示例#1
0
 @Override
 public synchronized void rollback() throws SailException {
   trx = null;
   metadata.clear();
   revised.clear();
   modified.clear();
   arch.clear();
   super.rollback();
 }
示例#2
0
 private void addMetadata(Resource subj, URI pred, Value obj, Resource context)
     throws SailException {
   if (trx == null) {
     synchronized (metadata) {
       metadata.add(vf.createStatement(subj, pred, obj, context));
     }
   } else {
     storeStatement(subj, pred, obj, context);
   }
 }
示例#3
0
 private URI getTrx() throws SailException {
   if (trx == null) {
     trx = sail.nextTransaction();
     synchronized (metadata) {
       for (Statement st : metadata) {
         storeStatement(st.getSubject(), st.getPredicate(), st.getObject(), st.getContext());
       }
       metadata.clear();
     }
   }
   return trx;
 }
示例#4
0
 @Override
 public synchronized void commit() throws SailException {
   flushArchive();
   if (trx != null) {
     for (Statement st : arch) {
       Resource ctx = st.getContext();
       if (ctx instanceof URI) {
         modified.add(ctx);
       }
     }
     for (Resource ctx : modified) {
       if (isObsolete(ctx)) {
         super.addStatement(ctx, RDF.TYPE, Audit.OBSOLETE, trx);
       }
     }
     GregorianCalendar cal = new GregorianCalendar();
     XMLGregorianCalendar xgc = factory.newXMLGregorianCalendar(cal);
     Literal now = vf.createLiteral(xgc);
     super.addStatement(trx, RDF.TYPE, TRANSACTION, trx);
     super.addStatement(trx, COMMITTED_ON, now, trx);
     for (Resource predecessor : predecessors) {
       super.addStatement(trx, PREDECESSOR, predecessor, trx);
     }
     sail.recent(trx, getWrappedConnection());
   }
   super.commit();
   metadata.clear();
   revised.clear();
   modified.clear();
   arch.clear();
   if (trx != null) {
     sail.committed(trx, predecessors);
     predecessors = Collections.singleton(trx);
     trx = null;
   }
 }