當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。