📄 ozoneentityimpl.java
字号:
// You can redistribute this software and/or modify it under the terms of// the Ozone Library License version 1 published by ozone-db.org.//// The original code and portions created by SMB are// Copyright (C) 1997-@year@ by SMB GmbH. All rights reserved.//// $Id: OzoneEntityImpl.java,v 1.1 2003/11/02 18:10:03 per_nyfelt Exp $package org.ozoneDB.xml.dom4j.o3impl;import org.dom4j.*;import org.ozoneDB.OzoneCompatible;import org.ozoneDB.OzoneInterface;import org.ozoneDB.OzoneRemoteException;import org.ozoneDB.xml.dom4j.OzoneDocumentFactory;import org.ozoneDB.xml.dom4j.OzoneEntity;/** * * @author Per Nyfelt */public class OzoneEntityImpl extends DefaultEntity implements OzoneEntity, OzoneCompatible { final static long serialVersionUID = 1L; private void init() { } public static OzoneEntity create(OzoneInterface db, String name) { return (OzoneEntity) db.createObject(OzoneEntityImpl.class, new Class[] {String.class}, new Object[]{name}); } /** Creates the <code>Entity</code> with the specified name * * @param name is the name of the entity */ public OzoneEntityImpl(String name) { super(name); init(); } public static OzoneEntity create(OzoneInterface db, String name, String text) { final Class[] signature = new Class[] {String.class, String.class}; return (OzoneEntity) db.createObject(OzoneEntityImpl.class, signature, new Object[]{name, text}); } /** Creates the <code>Entity</code> with the specified name * and text. * * @param name is the name of the entity * @param text is the text of the entity */ public OzoneEntityImpl(String name, String text) { super(name, text); init(); } public static OzoneEntity create(OzoneInterface db, Element parent, String name, String text) { final Class[] signature = new Class[] {Element.class, String.class, String.class}; return (OzoneEntity) db.createObject(OzoneEntityImpl.class, signature, new Object[]{parent, name, text}); } /** Creates the <code>Entity</code> with the specified name * and text. * * @param parent is the parent element * @param name is the name of the entity * @param text is the text of the entity */ public OzoneEntityImpl(Element parent, String name, String text) { super(parent, name, text); init(); } public DocumentFactory getDocumentFactory() { throw new OzoneRemoteException("getDocumentFactory will not work in Ozone"); } protected NodeFactory getNodeFactory() { try { // todo: might be faster to return super.getNodeFactory() if it is instanceof OzoneCompatible first // before falling back to object for name look-up return (NodeFactory) database().objectForName(OzoneDocumentFactory.OBJECT_NAME); } catch (Exception e) { throw new OzoneRemoteException("NodeFctory not registered" + e.toString()); } } protected XPathFactory getXPathFactory() { try { // todo: might be faster to return super.getXPathFactory() if it is instanceof OzoneCompatible first // before falling back to object for name look-up return (XPathFactory) database().objectForName(OzoneDocumentFactory.OBJECT_NAME); } catch (Exception e) { throw new OzoneRemoteException("XPathFactory not registered" + e.toString()); } } public Object clone() { try { Node answer = (Node) database().copyObject(self()); answer.setDocument(null); answer.setParent(null); return answer; } catch (Exception e) { e.printStackTrace(); return null; } } public void onCreate() { } public void onActivate() { } public void onPassivate() { } public void onDelete() { }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -