1 package org.ozoneDB.xml.dom4j.o3impl; 9 10 import org.dom4j.DocumentFactory; 11 import org.dom4j.Node; 12 import org.dom4j.NodeFactory; 13 import org.dom4j.XPathFactory; 14 import org.ozoneDB.OzoneCompatible; 15 import org.ozoneDB.OzoneInterface; 16 import org.ozoneDB.OzoneRemoteException; 17 import org.ozoneDB.xml.dom4j.OzoneDocumentFactory; 18 import org.ozoneDB.xml.dom4j.OzoneDocumentType; 19 20 24 public class OzoneDocumentTypeImpl extends DefaultDocumentType implements OzoneDocumentType, OzoneCompatible { 25 26 final static long serialVersionUID = 1L; 27 28 private void init() { 29 } 30 31 public OzoneDocumentTypeImpl() { 32 init(); 33 } 34 35 public static OzoneDocumentType create(OzoneInterface db) { 36 return (OzoneDocumentType) db.createObject(OzoneDocumentTypeImpl.class); 37 } 38 39 45 public OzoneDocumentTypeImpl(String elementName, String systemID) { 46 super(elementName, systemID); 47 init(); 48 } 49 50 public static OzoneDocumentType create(OzoneInterface db, String elementName, String systemID) { 51 final Class [] signature = new Class [] {String .class, String .class}; 52 return (OzoneDocumentType) db.createObject(OzoneAttributeImpl.class, 53 signature, 54 new Object []{elementName, systemID}); 55 } 56 57 64 public OzoneDocumentTypeImpl(String elementName, String publicID, String systemID) { 65 super(elementName, publicID, systemID); 66 init(); 67 } 68 69 public static OzoneDocumentType create(OzoneInterface db, String elementName, String publicID, String systemID) { 70 final Class [] signature = new Class [] {String .class, String .class, String .class}; 71 return (OzoneDocumentType) db.createObject(OzoneAttributeImpl.class, 72 signature, 73 new Object []{elementName, publicID, systemID}); 74 } 75 76 public DocumentFactory getDocumentFactory() { 77 throw new OzoneRemoteException("getDocumentFactory will not work in Ozone"); 78 } 79 80 protected NodeFactory getNodeFactory() { 81 try { 82 return (NodeFactory) database().objectForName(OzoneDocumentFactory.OBJECT_NAME); 85 } catch (Exception e) { 86 throw new OzoneRemoteException("NodeFctory not registered" + e.toString()); 87 } 88 } 89 90 protected XPathFactory getXPathFactory() { 91 try { 92 return (XPathFactory) database().objectForName(OzoneDocumentFactory.OBJECT_NAME); 95 } catch (Exception e) { 96 throw new OzoneRemoteException("XPathFactory not registered" + e.toString()); 97 } 98 } 99 100 public Object clone() { 101 try { 102 Node answer = (Node) database().copyObject(self()); 103 answer.setDocument(null); 104 answer.setParent(null); 105 return answer; 106 } catch (Exception e) { 107 e.printStackTrace(); 108 return null; 109 } 110 } 111 112 public void onCreate() { 113 } 114 115 public void onActivate() { 116 } 117 118 public void onPassivate() { 119 } 120 121 public void onDelete() { 122 } 123 } 124 | Popular Tags |