当前位置: 首页>>代码示例>>Java>>正文


Java RepositoryConnection.rollback方法代码示例

本文整理汇总了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;
}
 
开发者ID:Ostrich-Emulators,项目名称:semtool,代码行数:17,代码来源:DbInfoMapper.java

示例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;
		}
	}
}
 
开发者ID:Ostrich-Emulators,项目名称:semtool,代码行数:18,代码来源:DbInfoMapper.java

示例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;
		}
	}
}
 
开发者ID:Ostrich-Emulators,项目名称:semtool,代码行数:18,代码来源:DbInfoMapper.java

示例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 );
		}
	}
}
 
开发者ID:Ostrich-Emulators,项目名称:semtool,代码行数:27,代码来源:UserMapper.java

示例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 );
		}
	}
}
 
开发者ID:Ostrich-Emulators,项目名称:semtool,代码行数:28,代码来源:UserMapper.java

示例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;
	}
}
 
开发者ID:Ostrich-Emulators,项目名称:semtool,代码行数:24,代码来源:AbstractSesameEngine.java

示例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);
	}
}
 
开发者ID:lszeremeta,项目名称:neo4j-sparql-extension-yars,代码行数:20,代码来源:AbstractStreamingOutput.java


注:本文中的org.openrdf.repository.RepositoryConnection.rollback方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。