1 package org.ozoneDB.xml.dom4j.o3impl; 9 10 import org.dom4j.*; 11 import org.ozoneDB.OzoneCompatible; 12 import org.ozoneDB.OzoneInterface; 13 import org.ozoneDB.OzoneRemoteException; 14 import org.ozoneDB.xml.dom4j.OzoneComment; 15 import org.ozoneDB.xml.dom4j.OzoneDocumentFactory; 16 17 21 public class OzoneCommentImpl extends DefaultComment implements OzoneComment, OzoneCompatible { 22 23 final static long serialVersionUID = 1L; 24 25 private void init() { 26 } 27 28 public static OzoneComment create(OzoneInterface db, String text) { 29 return (OzoneComment) db 30 .createObject(OzoneCommentImpl.class, 31 new Class [] {String .class}, 32 new Object []{text}); 33 } 34 35 37 public OzoneCommentImpl(String text) { 38 super(text); 39 init(); 40 } 41 42 public static OzoneComment create(OzoneInterface db, Element parent, String text) { 43 Class [] signature = new Class [] {Element.class, String .class}; 44 return (OzoneComment) db 45 .createObject(OzoneCommentImpl.class, 46 signature, 47 new Object []{parent, text}); 48 } 49 50 53 public OzoneCommentImpl(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 void onCreate() { 95 } 96 97 public void onActivate() { 98 } 99 100 public void onPassivate() { 101 } 102 103 public void onDelete() { 104 } 105 106 } 107 | Popular Tags |