JDBC 介体串行化
可以将 JDBC DMS 生成的 Datagraph 序列化,并将 Datagraph 写到文件或者跨网络发送。
以下示例描述图的序列化和反序列化:
// This example assumes the creation of the Customer
// metadata and the JDBC DMS.
DataObject object = mediator.getGraph();
DataGraph origGraph = object.getDataGraph();
FileOutputStream out = new FileOutputStream("test.datagraph");
ObjectOutputStream oos = new ObjectOutputStream(out);
oos.writeObject(origGraph);
out.close();
FileInputStream in = new FileInputStream("test.datagraph");
ObjectInputStream oin = new ObjectInputStream(in);
DataGraph graph = (DataGraph) oin.readObject();
DataObject obj = (DataObject) graph.getRootObject();
// Now, the DataObject retrieved from the input stream
// obj is equal to the original variable object put
// through the output stream.