From adbd17d6aae976a94fca2bef9328df45f25bf224 Mon Sep 17 00:00:00 2001 From: hns Date: Wed, 5 May 2004 14:31:17 +0000 Subject: [PATCH] Added exportNode() method that takes a DbMapping as second argument. --- src/helma/objectmodel/db/NodeManager.java | 32 ++++++++++++++++++----- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/src/helma/objectmodel/db/NodeManager.java b/src/helma/objectmodel/db/NodeManager.java index 010facb2..eab69e81 100644 --- a/src/helma/objectmodel/db/NodeManager.java +++ b/src/helma/objectmodel/db/NodeManager.java @@ -463,20 +463,38 @@ public final class NodeManager { /** * Insert a node into a different (relational) database than its default one. */ - public void exportNode(Node node, DbSource dbs) + public void exportNode(Node node, DbSource dbs) + throws IOException, SQLException, ClassNotFoundException { + if (node == null) { + throw new IllegalArgumentException("Node can't be null in exportNode"); + } + + DbMapping dbm = node.getDbMapping(); + + if (dbs == null) { + throw new IllegalArgumentException("DbSource can't be null in exportNode"); + } else if ((dbm == null) || !dbm.isRelational()) { + throw new IllegalArgumentException("Can't export into non-relational database"); + } else { + insertRelationalNode(node, dbm, dbs.getConnection()); + } + } + + /** + * Insert a node into a different (relational) database than its default one. + */ + public void exportNode(Node node, DbMapping dbm) throws IOException, SQLException, ClassNotFoundException { if (node == null) { throw new IllegalArgumentException("Node can't be null in exportNode"); } - DbMapping dbm = node.getDbMapping(); - - if (dbs == null) { - throw new IllegalArgumentException("DbSource can't be null in exportNode"); + if (dbm == null) { + throw new IllegalArgumentException("DbMapping can't be null in exportNode"); } else if ((dbm == null) || !dbm.isRelational()) { - throw new SQLException("Can't export into non-relational database"); + throw new IllegalArgumentException("Can't export into non-relational database"); } else { - insertRelationalNode(node, dbm, dbs.getConnection()); + insertRelationalNode(node, dbm, dbm.getConnection()); } }