本文整理汇总了Java中org.openrdf.repository.RepositoryConnection.rollback方法的典型用法代码示例。如果您正苦于以下问题:Java RepositoryConnection.rollback方法的具体用法?Java RepositoryConnection.rollback怎么用?Java RepositoryConnection.rollback使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openrdf.repository.RepositoryConnection
的用法示例。
在下文中一共展示了RepositoryConnection.rollback方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: create
import org.openrdf.repository.RepositoryConnection; //导入方法依赖的package包/类
@Override
public DbInfo create( DbInfo t ) throws Exception {
RepositoryConnection rc = store.getConnection();
UriBuilder urib = UriBuilder.getBuilder( WEBDS.NAMESPACE + "dbinfo" );
URI uri = urib.uniqueUri();
rc.begin();
try{
rc.add( getCreateStatements( uri, t, rc.getValueFactory() ) );
rc.commit();
}
catch( RepositoryException re ){
rc.rollback();
throw re;
}
return t;
}
示例2: remove
import org.openrdf.repository.RepositoryConnection; //导入方法依赖的package包/类
@Override
public void remove( DbInfo t ) throws Exception {
RepositoryConnection rc = store.getConnection();
Resource idToRemove = getId( t, rc );
if ( null != idToRemove ) {
try{
rc.begin();
rc.remove( idToRemove, null, null );
rc.commit();
}
catch( RepositoryException re ){
rc.rollback();
throw re;
}
}
}
示例3: update
import org.openrdf.repository.RepositoryConnection; //导入方法依赖的package包/类
@Override
public void update( DbInfo data ) throws Exception {
RepositoryConnection rc = store.getConnection();
Resource id = getId( data, rc );
if ( null != id ) {
try{
rc.begin();
rc.remove( id, null, null );
rc.add( getCreateStatements( id, data, rc.getValueFactory() ) );
rc.commit();
}
catch( RepositoryException re ){
rc.rollback();
throw re;
}
}
}
示例4: update
import org.openrdf.repository.RepositoryConnection; //导入方法依赖的package包/类
@Override
public void update( User user ) throws Exception {
RepositoryConnection rc = store.getConnection();
try {
Map<URI, DbAccess> accesses = getAccesses( user );
Resource id = getId( user, rc );
if ( null != id ) {
rc.begin();
rc.remove( id, null, null );
rc.add( getCreateStatements( id, user, rc.getValueFactory() ) );
addAccesses( id, accesses, rc );
rc.commit();
}
}
catch ( RepositoryException e ) {
log.error( e, e );
try {
rc.rollback();
}
catch ( Exception x ) {
log.warn( x, x );
}
}
}
示例5: setAccesses
import org.openrdf.repository.RepositoryConnection; //导入方法依赖的package包/类
/**
* Sets the access level from the given map. To remove access from a DB, user
* {@link DbAccess#NONE}.
*
* @param user
* @param access a mapping of URIs (either {@link DbInfo#getDataUrl()} or
* {@link DbInfo#getInsightsUrl()}) and the access given
*/
public void setAccesses( User user, Map<URI, DbAccess> access ) {
RepositoryConnection rc = store.getConnection();
try {
rc.begin();
Resource id = getId( user, rc );
addAccesses( id, access, rc );
rc.commit();
}
catch ( RepositoryException e ) {
log.error( e, e );
try {
rc.rollback();
}
catch ( Exception x ) {
log.warn( x, x );
}
}
}
示例6: execute
import org.openrdf.repository.RepositoryConnection; //导入方法依赖的package包/类
@Override
public void execute( ModificationExecutor exe ) throws RepositoryException {
RepositoryConnection rc = getRawConnection();
try {
if ( exe.execInTransaction() ) {
rc.begin();
}
exe.exec( rc );
if ( exe.execInTransaction() ) {
rc.commit();
}
}
catch ( RepositoryException e ) {
if ( exe.execInTransaction() ) {
rc.rollback();
}
throw e;
}
}
示例7: rollback
import org.openrdf.repository.RepositoryConnection; //导入方法依赖的package包/类
/**
* Rolls back a transaction, if there is a active transaction
* using a connection.
*
* This method is intended to roll back a transaction after an exception
* occured. Any occuring exceptions while rolling back will be added as
* suppressed exceptions to the given exception.
* @param conn the connection on which the transaction should be rolled back
* @param ex an exception that caused the rollback
*/
protected void rollback(RepositoryConnection conn, Exception ex) {
try {
if (conn.isActive()) {
conn.rollback();
}
} catch (RepositoryException ex2) {
ex.addSuppressed(ex2);
}
}