Package com.dbxml.db.core.transaction

Examples of com.dbxml.db.core.transaction.Transaction


    int idx = name.lastIndexOf('/');
    String colName = name.substring(0, idx);
    Collection col = db.getCollection(colName);
    String docName = name.substring(idx + 1);

    Transaction tx = new Transaction();
    try {
      Container c = col.getContainer(tx, docName);

      if ( c != null ) {
        ContentProxy dp = new ContentProxy(col, docName);
        return new ObjectInstance(dp);
      }
      else
        throw new DBException(FaultCodes.COL_CANNOT_RETRIEVE, "Container '"+docName+"' not found");
    }
    catch ( DBException e ) {
      tx.cancel();
      throw e;
    }
    finally {
      if ( tx.getStatus() == Transaction.ACTIVE )
        tx.commit();
    }
   }
View Full Code Here


            tx.commit();
      }
   }

   public String[] listKeys() throws dbXMLException {
      Transaction tx = new Transaction();
      try {
         Key[] keys = col.listKeys(tx);
         String[] result = new String[keys.length];
         for ( int i = 0; i < keys.length; i++ )
            result[i] = keys[i].toString();
         return result;
      }
      catch ( dbXMLException e ) {
         tx.cancel();
         throw e;
      }
      finally {
         if ( tx.getStatus() == Transaction.ACTIVE )
            tx.commit();
      }
   }
View Full Code Here

            tx.commit();
      }
   }

   public long getKeyCount() throws dbXMLException {
      Transaction tx = new Transaction();
      try {
         return col.getKeyCount(tx);
      }
      catch ( dbXMLException e ) {
         tx.cancel();
         throw e;
      }
      finally {
         if ( tx.getStatus() == Transaction.ACTIVE )
            tx.commit();
      }
   }
View Full Code Here

            tx.commit();
      }
   }

   public String insertValue(byte[] value) throws dbXMLException {
      Transaction tx = new Transaction();
      try {
         return col.insertRecord(tx, new Value(value)).toString();
      }
      catch ( dbXMLException e ) {
         tx.cancel();
         throw e;
      }
      finally {
         if ( tx.getStatus() == Transaction.ACTIVE )
            tx.commit();
      }
   }
View Full Code Here

            tx.commit();
      }
   }

   public void setValue(String key, byte[] value) throws dbXMLException {
      Transaction tx = new Transaction();
      try {
         col.setRecord(tx, key, new Value(value));
      }
      catch ( dbXMLException e ) {
         tx.cancel();
         throw e;
      }
      finally {
         if ( tx.getStatus() == Transaction.ACTIVE )
            tx.commit();
      }
   }
View Full Code Here

    * @param collection The Collection whose SymbolTable is required
    * @return The requested SymbolTable
    * @throws DBException If a Database Exception occurs
    */
   public SymbolTable loadSymbols(Collection collection) throws DBException {
      Transaction tx = new Transaction();
      try {
         userStack.pushCurrentUser(magicUser);

         XMLSerializableAdapter symCol = getSymbolsCollection();
         String colName = collection.getCanonicalName();
         SymbolTable symbols = (SymbolTable)symCol.getObject(tx, colName);
         if ( symbols == null ) {
            symbols = new SymbolTable();
            saveSymbols(collection, symbols);
         }

         return symbols;
      }
      catch ( DBException e ) {
         tx.cancel();
         e.printStackTrace(System.err);
         throw e;
      }
      finally {
         userStack.popCurrentUser();

         if ( tx.getStatus() == Transaction.ACTIVE )
            tx.commit();
      }
   }
View Full Code Here

            tx.commit();
      }
   }

   public byte[] getValue(String key) throws dbXMLException {
      Transaction tx = new Transaction();
      try {
         return col.getRecord(tx, key).getValue().getData();
      }
      catch ( dbXMLException e ) {
         tx.cancel();
         throw e;
      }
      finally {
         if ( tx.getStatus() == Transaction.ACTIVE )
            tx.commit();
      }
   }
View Full Code Here

    * @param collection The Collection that owns the SymbolTable
    * @param symbols The SymbolTable
    * @throws DBException If a Database Exception occurs
    */
   public void saveSymbols(Collection collection, SymbolTable symbols) throws DBException {
      Transaction tx = new Transaction();
      try {
         userStack.pushCurrentUser(magicUser);

         if ( symbols != null ) {
            XMLSerializableAdapter symCol = getSymbolsCollection();
            String colName = collection.getCanonicalName();
            symCol.setObject(tx, colName, symbols);
            symbols.setDirty(false);
         }
      }
      catch ( DBException e ) {
         tx.cancel();
         e.printStackTrace(System.err);
         throw e;
      }
      finally {
         userStack.popCurrentUser();

         if ( tx.getStatus() == Transaction.ACTIVE )
            tx.commit();
      }
   }
View Full Code Here

            tx.commit();
      }
   }

   public ResultSetClient queryCollection(String style, String query, Map nsMap) throws dbXMLException {
      Transaction tx = new Transaction();
      try {
         return new ResultSetClientImpl(this, col.queryCollection(tx, style, query, new NamespaceMap(nsMap)));
      }
      catch ( dbXMLException e ) {
         tx.cancel();
         throw e;
      }
      finally {
         if ( tx.getStatus() == Transaction.ACTIVE )
            tx.commit();
      }
   }
View Full Code Here

            tx.commit();
      }
   }

   public ResultSetClient queryDocument(String style, String query, Map nsMap, String key) throws dbXMLException {
      Transaction tx = new Transaction();
      try {
         return new ResultSetClientImpl(this, col.queryDocument(tx, style, query, new NamespaceMap(nsMap), key));
      }
      catch ( dbXMLException e ) {
         tx.cancel();
         throw e;
      }
      finally {
         if ( tx.getStatus() == Transaction.ACTIVE )
            tx.commit();
      }
   }
View Full Code Here

TOP

Related Classes of com.dbxml.db.core.transaction.Transaction

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.