/** * <B>IMPORTANT</B> Since Sesame 2.7.0. this method no longer automatically starts a transaction, but * instead verifies if a transaction is active and if not throws an exception. The method is left in for * transitional purposes only. Sail implementors are advised that by contract, any update operation on the * Sail should check if a transaction has been started via {@link SailConnection#isActive} and throw a * SailException if not. Implementors can use {@link AbstractSailConnection#verifyIsActive()} as a * convenience method for this check. * * @deprecated since 2.7.0. Use {@link #verifyIsActive()} instead. We should not automatically start a * transaction at the sail level. Instead, an exception should be thrown when an update is * executed without first starting a transaction. * @throws SailException * if no transaction is active. */ @Deprecated protected void autoStartTransaction() throws SailException { verifyIsActive(); }
/** * <B>IMPORTANT</B> Since Sesame 2.7.0. this method no longer automatically starts a transaction, but * instead verifies if a transaction is active and if not throws an exception. The method is left in for * transitional purposes only. Sail implementors are advised that by contract, any update operation on the * Sail should check if a transaction has been started via {@link SailConnection#isActive} and throw a * SailException if not. Implementors can use {@link AbstractSailConnection#verifyIsActive()} as a * convenience method for this check. * * @deprecated since 2.7.0. Use {@link #verifyIsActive()} instead. We should not automatically start a * transaction at the sail level. Instead, an exception should be thrown when an update is * executed without first starting a transaction. * @throws SailException * if no transaction is active. */ @Deprecated protected void autoStartTransaction() throws SailException { verifyIsActive(); }
@Override public final void clearNamespaces() throws SailException { connectionLock.readLock().lock(); try { verifyIsOpen(); updateLock.lock(); try { verifyIsActive(); clearNamespacesInternal(); } finally { updateLock.unlock(); } } finally { connectionLock.readLock().unlock(); } }
@Override public final void clearNamespaces() throws SailException { connectionLock.readLock().lock(); try { verifyIsOpen(); updateLock.lock(); try { verifyIsActive(); clearNamespacesInternal(); } finally { updateLock.unlock(); } } finally { connectionLock.readLock().unlock(); } }
@Override public final void setNamespace(String prefix, String name) throws SailException { if (prefix == null) { throw new NullPointerException("prefix must not be null"); } if (name == null) { throw new NullPointerException("name must not be null"); } connectionLock.readLock().lock(); try { verifyIsOpen(); updateLock.lock(); try { verifyIsActive(); setNamespaceInternal(prefix, name); } finally { updateLock.unlock(); } } finally { connectionLock.readLock().unlock(); } }
@Override public final void removeNamespace(String prefix) throws SailException { if (prefix == null) { throw new NullPointerException("prefix must not be null"); } connectionLock.readLock().lock(); try { verifyIsOpen(); updateLock.lock(); try { verifyIsActive(); removeNamespaceInternal(prefix); } finally { updateLock.unlock(); } } finally { connectionLock.readLock().unlock(); } }
@Override public final void removeNamespace(String prefix) throws SailException { if (prefix == null) { throw new NullPointerException("prefix must not be null"); } connectionLock.readLock().lock(); try { verifyIsOpen(); updateLock.lock(); try { verifyIsActive(); removeNamespaceInternal(prefix); } finally { updateLock.unlock(); } } finally { connectionLock.readLock().unlock(); } }
@Override public final void setNamespace(String prefix, String name) throws SailException { if (prefix == null) { throw new NullPointerException("prefix must not be null"); } if (name == null) { throw new NullPointerException("name must not be null"); } connectionLock.readLock().lock(); try { verifyIsOpen(); updateLock.lock(); try { verifyIsActive(); setNamespaceInternal(prefix, name); } finally { updateLock.unlock(); } } finally { connectionLock.readLock().unlock(); } }
@Override public final void endUpdate(UpdateContext op) throws SailException { connectionLock.readLock().lock(); try { verifyIsOpen(); updateLock.lock(); try { verifyIsActive(); endUpdateInternal(op); } finally { updateLock.unlock(); } } finally { connectionLock.readLock().unlock(); if (op != null) { flush(); } } }
@Override public final void clear(Resource... contexts) throws SailException { flushPendingUpdates(); connectionLock.readLock().lock(); try { verifyIsOpen(); updateLock.lock(); try { verifyIsActive(); clearInternal(contexts); } finally { updateLock.unlock(); } } finally { connectionLock.readLock().unlock(); } }
@Override public final void clear(Resource... contexts) throws SailException { flushPendingUpdates(); connectionLock.readLock().lock(); try { verifyIsOpen(); updateLock.lock(); try { verifyIsActive(); clearInternal(contexts); } finally { updateLock.unlock(); } } finally { connectionLock.readLock().unlock(); } }
@Override public final void endUpdate(UpdateContext op) throws SailException { connectionLock.readLock().lock(); try { verifyIsOpen(); updateLock.lock(); try { verifyIsActive(); endUpdateInternal(op); } finally { updateLock.unlock(); } } finally { connectionLock.readLock().unlock(); if (op != null) { flush(); } } }
/** * The default implementation buffers removed statements until the update operation is complete. */ @Override public void removeStatement(UpdateContext op, Resource subj, IRI pred, Value obj, Resource... contexts) throws SailException { verifyIsOpen(); verifyIsActive(); synchronized (removed) { assert removed.containsKey(op); Collection<Statement> pending = removed.get(op); if (contexts == null) { pending.add(new WildStatement(subj, pred, obj)); } else if (contexts.length == 0) { pending.add(new WildStatement(subj, pred, obj, wildContext)); } else { for (Resource ctx : contexts) { pending.add(new WildStatement(subj, pred, obj, ctx)); } } if (pending.size() % BLOCK_SIZE == 0 && !isActiveOperation()) { endUpdate(op); startUpdate(op); } } }
/** * The default implementation buffers removed statements until the update operation is complete. */ @Override public void removeStatement(UpdateContext op, Resource subj, IRI pred, Value obj, Resource... contexts) throws SailException { verifyIsOpen(); verifyIsActive(); synchronized (removed) { assert removed.containsKey(op); Collection<Statement> pending = removed.get(op); if (contexts == null) { pending.add(new WildStatement(subj, pred, obj)); } else if (contexts.length == 0) { pending.add(new WildStatement(subj, pred, obj, wildContext)); } else { for (Resource ctx : contexts) { pending.add(new WildStatement(subj, pred, obj, ctx)); } } if (pending.size() % BLOCK_SIZE == 0 && !isActiveOperation()) { endUpdate(op); startUpdate(op); } } }
/** * The default implementation buffers added statements until the update operation is complete. */ @Override public void addStatement(UpdateContext op, Resource subj, IRI pred, Value obj, Resource... contexts) throws SailException { verifyIsOpen(); verifyIsActive(); synchronized (added) { assert added.containsKey(op); Collection<Statement> pending = added.get(op); if (contexts == null || contexts.length == 0) { pending.add(sailBase.getValueFactory().createStatement(subj, pred, obj)); } else { for (Resource ctx : contexts) { pending.add(sailBase.getValueFactory().createStatement(subj, pred, obj, ctx)); } } if (pending.size() % BLOCK_SIZE == 0 && !isActiveOperation()) { endUpdate(op); startUpdate(op); } } }
/** * The default implementation buffers added statements until the update operation is complete. */ @Override public void addStatement(UpdateContext op, Resource subj, IRI pred, Value obj, Resource... contexts) throws SailException { verifyIsOpen(); verifyIsActive(); synchronized (added) { assert added.containsKey(op); Collection<Statement> pending = added.get(op); if (contexts == null || contexts.length == 0) { pending.add(sailBase.getValueFactory().createStatement(subj, pred, obj)); } else { for (Resource ctx : contexts) { pending.add(sailBase.getValueFactory().createStatement(subj, pred, obj, ctx)); } } if (pending.size() % BLOCK_SIZE == 0 && !isActiveOperation()) { endUpdate(op); startUpdate(op); } } }