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.OzoneProcessingInstruction; 16 17 import java.util.Map ; 18 19 23 public class OzoneProcessingInstructionImpl extends DefaultProcessingInstruction implements OzoneProcessingInstruction, OzoneCompatible { 24 25 final static long serialVersionUID = 1L; 26 27 private void init() { 28 } 29 30 public static OzoneProcessingInstruction create(OzoneInterface db, String target, Map data) { 31 final Class [] signature = new Class [] {String .class, Map .class}; 32 return (OzoneProcessingInstruction) db.createObject(OzoneProcessingInstructionImpl.class, 33 signature, 34 new Object []{target, data}); 35 } 36 37 42 public OzoneProcessingInstructionImpl(String target, Map values) { 43 super(target, values); 44 init(); 45 } 46 47 public static OzoneProcessingInstruction create(OzoneInterface db, String target, String text) { 48 final Class [] signature = new Class [] {String .class, String .class}; 49 return (OzoneProcessingInstruction) db.createObject(OzoneProcessingInstructionImpl.class, 50 signature, 51 new Object []{target, text}); 52 } 53 54 public OzoneProcessingInstructionImpl(String target, String text) { 55 super(target, text); 56 init(); 57 } 58 59 public static OzoneProcessingInstruction create(OzoneInterface db, Element parent, String target, String values) { 60 final Class [] signature = new Class [] {Element.class, String .class, String .class}; 61 return (OzoneProcessingInstruction) db.createObject(OzoneProcessingInstructionImpl.class, 62 signature, 63 new Object []{parent, target, values}); 64 } 65 66 72 public OzoneProcessingInstructionImpl(Element parent, String target, String values) { 73 super(parent, target, values); 74 init(); 75 } 76 77 public DocumentFactory getDocumentFactory() { 78 throw new OzoneRemoteException("getDocumentFactory will not work in Ozone"); 79 } 80 81 protected NodeFactory getNodeFactory() { 82 try { 83 return (NodeFactory) database().objectForName(OzoneDocumentFactory.OBJECT_NAME); 86 } catch (Exception e) { 87 throw new OzoneRemoteException("NodeFctory not registered" + e.toString()); 88 } 89 } 90 91 protected XPathFactory getXPathFactory() { 92 try { 93 return (XPathFactory) database().objectForName(OzoneDocumentFactory.OBJECT_NAME); 96 } catch (Exception e) { 97 throw new OzoneRemoteException("XPathFactory not registered" + e.toString()); 98 } 99 } 100 101 public Object clone() { 102 try { 103 Node answer = (Node) database().copyObject(self()); 104 answer.setDocument(null); 105 answer.setParent(null); 106 return answer; 107 } catch (Exception e) { 108 e.printStackTrace(); 109 return null; 110 } 111 } 112 113 public void onCreate() { 114 } 115 116 public void onActivate() { 117 } 118 119 public void onPassivate() { 120 } 121 122 public void onDelete() { 123 } 124 } 125 | Popular Tags |