KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ozoneDB > xml > dom4j > o3impl > O3QName


1 // You can redistribute this software and/or modify it under the terms of
2
// the Ozone Library License version 1 published by ozone-db.org.
3
//
4
// The original code and portions created by SMB are
5
// Copyright (C) 1997-@year@ by SMB GmbH. All rights reserved.
6
//
7
// $Id: O3QName.java,v 1.1 2003/11/02 18:10:03 per_nyfelt Exp $
8
package org.ozoneDB.xml.dom4j.o3impl;
9
10 import org.dom4j.*;
11 import org.ozoneDB.OzoneInterface;
12 import org.ozoneDB.OzoneRemoteException;
13 import org.ozoneDB.xml.dom4j.OzoneDocumentFactory;
14
15 import java.io.Serializable JavaDoc;
16
17 /**
18  *
19  * @author Per Nyfelt
20  */

21 public class O3QName extends DefaultQName implements Serializable JavaDoc {
22
23     final static long serialVersionUID = 1L;
24     //private static final String SEP = OPP.SIGNATURE_DELIMITER;
25

26     private transient OzoneInterface db;
27     //private OzoneObject ozoneObject;
28

29     private void init() {
30         //ozoneObject = new OzoneObject();
31
}
32
33     public static QName create(OzoneInterface db, String JavaDoc name) {
34 // return (OzoneQName) db.createObject(O3QName.class,
35
// String.class.getName(),
36
// new Object[]{name});
37
NodeFactory nodeFactory = OzoneDocumentFactoryImpl.getInstance(db);
38         O3QName obj = new O3QName(name, nodeFactory);
39         obj.db = db;
40         return obj;
41     }
42
43     public O3QName(String JavaDoc name, NodeFactory nodeFactory) {
44         super(name, nodeFactory);
45         init();
46     }
47
48     public static QName create(OzoneInterface db, String JavaDoc name, Namespace namespace) {
49 // final String signature = String.class.getName() + SEP + AbstractNamespace.class.getName();
50
// return (OzoneQName) db.createObject(O3QName.class,
51
// signature,
52
// new Object[]{name, namespace});
53
NodeFactory nodeFactory = OzoneDocumentFactoryImpl.getInstance(db);
54         O3QName obj = new O3QName(name, namespace, nodeFactory);
55         obj.db = db;
56         return obj;
57     }
58
59     public O3QName(String JavaDoc name, Namespace namespace, NodeFactory nodeFactory) {
60         super(name, namespace, nodeFactory);
61         init();
62     }
63
64     public static QName create(OzoneInterface db, String JavaDoc name, Namespace namespace, String JavaDoc qualifiedName) {
65 // final String signature = String.class.getName()
66
// + SEP + AbstractNamespace.class.getName()
67
// + SEP + String.class.getName();
68
// return (OzoneQName) db.createObject(O3QName.class,
69
// signature,
70
// new Object[]{name, namespace, qualifiedName});
71
NodeFactory nodeFactory = OzoneDocumentFactoryImpl.getInstance(db);
72         O3QName obj = new O3QName(name, namespace, qualifiedName, nodeFactory);
73         obj.db = db;
74         return obj;
75     }
76
77     public O3QName(String JavaDoc name, Namespace namespace, String JavaDoc qualifiedName, NodeFactory nodeFactory) {
78         super(name, namespace, qualifiedName, nodeFactory);
79         init();
80     }
81
82     public DocumentFactory getDocumentFactory() {
83         throw new OzoneRemoteException("getDocumentFactory will not work in Ozone");
84     }
85
86     public NodeFactory getNodeFactory() {
87         try {
88             // todo: might be faster to return super.getNodeFactory() if it is instanceof OzoneCompatible first
89
// before falling back to object for name look-up
90
return (NodeFactory) db.objectForName(OzoneDocumentFactory.OBJECT_NAME);
91         } catch (Exception JavaDoc e) {
92             throw new OzoneRemoteException("NodeFctory not registered" + e.toString());
93         }
94     }
95
96     protected XPathFactory getXPathFactory() {
97         try {
98             // todo: might be faster to return super.getXPathFactory() if it is instanceof OzoneCompatible first
99
// before falling back to object for name look-up
100
return (XPathFactory) db.objectForName(OzoneDocumentFactory.OBJECT_NAME);
101         } catch (Exception JavaDoc e) {
102             throw new OzoneRemoteException("XPathFactory not registered" + e.toString());
103         }
104     }
105
106 /* public ObjectID getObjectID() {
107         return ozoneObject.getObjectID();
108     }
109
110     public void setContainer(ObjectContainer _container) {
111         ozoneObject.setContainer(_container);
112     }
113
114     public ObjectContainer container() {
115         return ozoneObject.container();
116     }
117
118     public OzoneProxy self() {
119         return ozoneObject.self();
120     }
121
122     public OzoneInterface database() {
123         return ozoneObject.database();
124     }
125
126     public boolean toXML(ContentHandler ch) throws SAXException {
127         return ozoneObject.toXML(ch);
128     }
129
130     public void onCreate() {
131     }
132
133     public void onActivate() {
134     }
135
136     public void onPassivate() {
137     }
138
139     public void onDelete() {
140     }*/

141 }
142
Popular Tags