From c509e3a0309e57008582903440cb5d40d73b96a7 Mon Sep 17 00:00:00 2001 From: hns Date: Fri, 18 Mar 2005 03:11:13 +0000 Subject: [PATCH] Moved/merged to XmlIDGenerator in the same package. --- src/helma/objectmodel/dom/IDGenParser.java | 82 ---------------------- 1 file changed, 82 deletions(-) delete mode 100644 src/helma/objectmodel/dom/IDGenParser.java diff --git a/src/helma/objectmodel/dom/IDGenParser.java b/src/helma/objectmodel/dom/IDGenParser.java deleted file mode 100644 index 72cbf586..00000000 --- a/src/helma/objectmodel/dom/IDGenParser.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Helma License Notice - * - * The contents of this file are subject to the Helma License - * Version 2.0 (the "License"). You may not use this file except in - * compliance with the License. A copy of the License is available at - * http://adele.helma.org/download/helma/license.txt - * - * Copyright 1998-2003 Helma Software. All Rights Reserved. - * - * $RCSfile$ - * $Author$ - * $Revision$ - * $Date$ - */ - -package helma.objectmodel.dom; - -import helma.objectmodel.ObjectNotFoundException; -import helma.objectmodel.db.IDGenerator; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -import java.io.*; -import java.util.Date; - -/** - * - */ -public class IDGenParser { - /** - * - * - * @param file ... - * - * @return ... - * - * @throws ObjectNotFoundException ... - */ - public static IDGenerator getIDGenerator(File file) - throws ObjectNotFoundException { - if (!file.exists()) { - throw new ObjectNotFoundException("IDGenerator not found in idgen.xml"); - } - - try { - Document document = XmlUtil.parse(new FileInputStream(file)); - org.w3c.dom.Element tmp = (Element) document.getDocumentElement() - .getElementsByTagName("counter") - .item(0); - - return new IDGenerator(Long.parseLong(XmlUtil.getTextContent(tmp))); - } catch (Exception e) { - throw new ObjectNotFoundException(e.toString()); - } - } - - /** - * - * - * @param idgen ... - * @param file ... - * - * @return ... - * - * @throws Exception ... - */ - public static IDGenerator saveIDGenerator(IDGenerator idgen, File file) - throws IOException { - OutputStreamWriter out = new OutputStreamWriter(new FileOutputStream(file)); - - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write(" " + idgen.getValue() + "\n"); - out.write("\n"); - out.close(); - - return idgen; - } -}