1 package org.ozoneDB.xml.dom4j.o3impl; 9 10 import org.dom4j.*; 11 import org.ozoneDB.*; 12 import org.ozoneDB.core.ObjectContainer; 13 import org.ozoneDB.core.ObjectID; 14 import org.ozoneDB.xml.dom4j.OzoneCDATA; 15 import org.ozoneDB.xml.dom4j.OzoneDocumentFactory; 16 import org.xml.sax.ContentHandler ; 17 import org.xml.sax.SAXException ; 18 19 23 public class OzoneCDATAImpl extends DefaultCDATA implements OzoneCDATA, OzoneCompatible { 24 25 final static long serialVersionUID = 1L; 26 27 private OzoneObject ozoneObject; 28 29 private void init() { 30 ozoneObject = new OzoneObject(); 31 } 32 33 public static OzoneCDATA create(OzoneInterface db, String text) { 34 return (OzoneCDATA) db.createObject(OzoneCDATAImpl.class, 35 new Class [] {String .class}, 36 new Object []{text}); 37 } 38 39 41 public OzoneCDATAImpl(String text) { 42 super(text); 43 init(); 44 } 45 46 public static OzoneCDATA create(OzoneInterface db, Element parent, String text) { 47 final Class [] signature = new Class [] {Element.class, String .class}; 48 return (OzoneCDATA) db.createObject(OzoneCDATAImpl.class, 49 signature, 50 new Object []{parent, text}); 51 } 52 53 public OzoneCDATAImpl(Element parent, String text) { 54 super(parent, text); 55 init(); 56 } 57 58 public DocumentFactory getDocumentFactory() { 59 throw new OzoneRemoteException("getDocumentFactory will not work in Ozone"); 60 } 61 62 protected NodeFactory getNodeFactory() { 63 try { 64 return (NodeFactory) database().objectForName(OzoneDocumentFactory.OBJECT_NAME); 67 } catch (Exception e) { 68 throw new OzoneRemoteException("NodeFctory not registered" + e.toString()); 69 } 70 } 71 72 protected XPathFactory getXPathFactory() { 73 try { 74 return (XPathFactory) database().objectForName(OzoneDocumentFactory.OBJECT_NAME); 77 } catch (Exception e) { 78 throw new OzoneRemoteException("XPathFactory not registered" + e.toString()); 79 } 80 } 81 82 public Object clone() { 83 try { 84 Node answer = (Node) database().copyObject(self()); 85 answer.setDocument(null); 86 answer.setParent(null); 87 return answer; 88 } catch (Exception e) { 89 e.printStackTrace(); 90 return null; 91 } 92 } 93 94 public ObjectID getObjectID() { 95 return ozoneObject.getObjectID(); 96 } 97 98 public void setContainer(ObjectContainer _container) { 99 ozoneObject.setContainer(_container); 100 } 101 102 public ObjectContainer container() { 103 return ozoneObject.container(); 104 } 105 106 public OzoneProxy self() { 107 return ozoneObject.self(); 108 } 109 110 public OzoneInterface database() { 111 return ozoneObject.database(); 112 } 113 114 public boolean toXML(ContentHandler ch) throws SAXException { 115 return ozoneObject.toXML(ch); 116 } 117 118 public void onCreate() { 119 } 120 121 public void onActivate() { 122 } 123 124 public void onPassivate() { 125 } 126 127 public void onDelete() { 128 } 129 } 130 | Popular Tags |