View Javadoc
1 package org.smartcomps.twister.common.persistence; 2 3 import org.smartcomps.twister.common.transaction.TransactionalResource; 4 import org.smartcomps.twister.common.transaction.TransactionException; 5 6 import org.xmldb.api.base.Database; 7 import org.xmldb.api.base.XMLDBException; 8 import org.xmldb.api.base.Collection; 9 import org.xmldb.api.DatabaseManager; 10 import org.xmldb.api.modules.XMLResource; 11 12 import org.apache.xindice.client.xmldb.services.CollectionManager; 13 import org.apache.xindice.xml.dom.DOMParser; 14 import org.apache.xindice.util.XindiceException; 15 16 import org.dom4j.io.DOMWriter; 17 import org.dom4j.Document; 18 import org.dom4j.DocumentException; 19 20 import java.text.MessageFormat; 21 22 /*** 23 * Please put some JavaDoc here. 24 */ 25 public class XMLSessionManager implements TransactionalResource { 26 27 public void initialize() throws TransactionException { 28 Database db = null; 29 try { 30 Class c = Class.forName("org.apache.xindice.client.xmldb.DatabaseImpl"); 31 db = (Database) c.newInstance(); 32 } catch (ClassNotFoundException e) { 33 throw new TransactionException(e); 34 } catch (InstantiationException e) { 35 throw new TransactionException(e); 36 } catch (IllegalAccessException e) { 37 throw new TransactionException(e); 38 } 39 try { 40 DatabaseManager.registerDatabase(db); 41 } catch (XMLDBException e) { 42 throw new TransactionException(e); 43 } 44 } 45 46 public void beginTransaction() throws TransactionException { 47 // XIndice is not transactional, we're just simulating a transaction by enlisting all 48 // modifications and executing them only at commit time. 49 } 50 51 public void commitTransaction() throws TransactionException { 52 } 53 54 public void rollbackTransaction() throws TransactionException { 55 } 56 57 }

This page was automatically generated by Maven