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.OzoneDocumentFactory; 15 import org.ozoneDB.xml.dom4j.OzoneText; 16 17 21 public class OzoneTextImpl extends DefaultText implements OzoneText, OzoneCompatible { 22 23 final static long serialVersionUID = 1L; 24 25 private void init() { 26 } 27 28 public static OzoneText create(OzoneInterface db, String text) { 29 return (OzoneText) db.createObject(OzoneTextImpl.class, 30 new Class [] {String .class}, 31 new Object []{text}); 32 } 33 34 36 public OzoneTextImpl(String text) { 37 super(text); 38 init(); 39 } 40 41 public static OzoneText create(OzoneInterface db, Element parent, String text) { 42 final Class [] signature = new Class [] {Element.class, String .class}; 43 return (OzoneText) db.createObject(OzoneTextImpl.class, 44 signature, 45 new Object []{parent, text}); 46 } 47 48 51 public OzoneTextImpl(Element parent, String text) { 52 super(parent, text); 53 init(); 54 } 55 56 public DocumentFactory getDocumentFactory() { 57 throw new OzoneRemoteException("getDocumentFactory will not work in Ozone"); 58 } 59 60 protected NodeFactory getNodeFactory() { 61 try { 62 return (NodeFactory) database().objectForName(OzoneDocumentFactory.OBJECT_NAME); 65 } catch (Exception e) { 66 throw new OzoneRemoteException("NodeFctory not registered" + e.toString()); 67 } 68 } 69 70 protected XPathFactory getXPathFactory() { 71 try { 72 return (XPathFactory) database().objectForName(OzoneDocumentFactory.OBJECT_NAME); 75 } catch (Exception e) { 76 throw new OzoneRemoteException("XPathFactory not registered" + e.toString()); 77 } 78 } 79 80 public Object clone() { 81 try { 82 Node answer = (Node) database().copyObject(self()); 83 answer.setDocument(null); 84 answer.setParent(null); 85 return answer; 86 } catch (Exception e) { 87 e.printStackTrace(); 88 return null; 89 } 90 } 91 92 public void onCreate() { 93 } 94 95 public void onActivate() { 96 } 97 98 public void onPassivate() { 99 } 100 101 public void onDelete() { 102 } 103 } 104 | Popular Tags |