📄 dbxmlforobj.java
字号:
// You can redistribute this software and/or modify it under the terms of
// the Ozone Core 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: DbXMLForObj.java,v 1.5 2002/12/29 11:15:56 per_nyfelt Exp $
package org.ozoneDB.core.DbRemote;
import org.ozoneDB.OzoneCompatible;
import org.ozoneDB.OzoneProxy;
import org.ozoneDB.core.*;
import org.ozoneDB.core.xml.Object2XML;
import org.ozoneDB.xml.util.*;
import java.io.*;
/**
* @author <a href="http://www.softwarebuero.de/">SMB</a>
* @version $Revision: 1.5 $Date: 2002/12/29 11:15:56 $
*/
public final class DbXMLForObj extends DbCommand {
private OzoneProxy obj;
public DbXMLForObj() {
}
public DbXMLForObj( OzoneProxy _obj ) {
obj = _obj;
}
public void perform( Transaction ta ) throws Exception {
// env.logWriter.newEntry (this, "DbXMLForObj.perform()...", LogWriter.DEBUG);
ObjectContainer container = ta.acquireObject( obj.remoteID(), Lock.LEVEL_READ );
try {
// cache already converted XML in the container?
result = createChunk( container );
} finally {
container.unpin();
}
}
public byte[] createChunk( ObjectContainer container ) throws Exception {
// because of the global locks this statement is not stricktly needed
synchronized (container) {
OzoneCompatible target = container.target();
SAXChunkProducer chunkProducer = new SAXChunkProducer( (SAXChunkProducerDelegate)null );
chunkProducer.startDocument();
// check if target provides custom implementation...
boolean custom = target.toXML( chunkProducer );
// ...use default mapping otherwise
if (!custom) {
Object2XML o2x = new Object2XML( chunkProducer, true );
o2x.toXML( target );
}
chunkProducer.endDocument();
ChunkOutputStream cos = chunkProducer.chunkStream();
return cos.toByteArray();
}
}
public void writeExternal( ObjectOutput out ) throws IOException {
out.writeObject( obj );
}
public void readExternal( ObjectInput in ) throws IOException, ClassNotFoundException {
obj = (OzoneProxy)in.readObject();
}
public String toString() {
return super.toString();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -