• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java CommitException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.eclipse.emf.cdo.util.CommitException的典型用法代码示例。如果您正苦于以下问题:Java CommitException类的具体用法?Java CommitException怎么用?Java CommitException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



CommitException类属于org.eclipse.emf.cdo.util包,在下文中一共展示了CommitException类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: startCDOServer

import org.eclipse.emf.cdo.util.CommitException; //导入依赖的package包/类
@BeforeClass
public static void startCDOServer() throws IOException, CommitException {
    server = new CDOServer(false);
    server.start();
    IConnector connector = M2DocCDOUtils
            .getConnector(CDOServer.PROTOCOL + "://" + CDOServer.IP + ":" + CDOServer.PORT);
    CDOSession session = M2DocCDOUtils.openSession(connector, CDOServer.REPOSITORY_NAME, CDOServer.USER_NAME,
            CDOServer.PASSWORD);
    final CDOTransaction transaction = M2DocCDOUtils.openTransaction(session);
    final CDOResource resource = transaction.createResource("anydsl.ecore");
    final ResourceSet resourceSet = new ResourceSetImpl();
    resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("*", new XMIResourceFactoryImpl());
    final Resource anyDSLResource = resourceSet.getResource(URI.createFileURI("resources/anydsl.ecore"), true);
    resource.getContents().addAll(anyDSLResource.getContents());
    resource.save(null);
    transaction.commit();
    transaction.close();
    session.close();
    connector.close();

    if (!EMFPlugin.IS_ECLIPSE_RUNNING) {
        ConfigurationProviderService.getInstance().register(CONFIGURATION_PROVIDER);
        M2DocUtils.registerServicesConfigurator(SERVICES_CONFIGURATOR_DESCRIPTOR);
    }
}
 
开发者ID:ObeoNetwork,项目名称:M2Doc,代码行数:26,代码来源:ServerWithoutAuthentication.java


示例2: startCDOServer

import org.eclipse.emf.cdo.util.CommitException; //导入依赖的package包/类
@BeforeClass
public static void startCDOServer() throws IOException, CommitException {
    server = new CDOServer(true);
    server.start();
    IConnector connector = M2DocCDOUtils
            .getConnector(CDOServer.PROTOCOL + "://" + CDOServer.IP + ":" + CDOServer.PORT);
    CDOSession session = M2DocCDOUtils.openSession(connector, CDOServer.REPOSITORY_NAME, CDOServer.USER_NAME,
            CDOServer.PASSWORD);
    final CDOTransaction transaction = M2DocCDOUtils.openTransaction(session);
    final CDOResource resource = transaction.createResource("anydsl.ecore");
    final ResourceSet resourceSet = new ResourceSetImpl();
    resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("*", new XMIResourceFactoryImpl());
    final Resource anyDSLResource = resourceSet.getResource(URI.createFileURI("resources/anydsl.ecore"), true);
    resource.getContents().addAll(anyDSLResource.getContents());
    resource.save(null);
    transaction.commit();
    transaction.close();
    session.close();
    connector.close();

    if (!EMFPlugin.IS_ECLIPSE_RUNNING) {
        ConfigurationProviderService.getInstance().register(CONFIGURATION_PROVIDER);
        M2DocUtils.registerServicesConfigurator(SERVICES_CONFIGURATOR_DESCRIPTOR);
    }
}
 
开发者ID:ObeoNetwork,项目名称:M2Doc,代码行数:26,代码来源:ServerWithAuthentication.java


示例3: save

import org.eclipse.emf.cdo.util.CommitException; //导入依赖的package包/类
public void save(Map<?, ?> options) throws IOException {
    CDOViewSet cdoVS = CDOUtil.getViewSet(getResourceSet());
    CDOTransaction trans = Arrays.stream(cdoVS.getViews()).filter(CDOTransaction.class::isInstance)
            .map(CDOTransaction.class::cast).findFirst().orElse(null);
    if (trans == null) {
        throw new IOException("Could not gather a transaction to perform the save operation.");
    }
    String realCdoRepositoryPath = getRealCDORepositoryPath(trans);
    XMISerializer accessor = new XMISerializer(this, prepareOptions(options));
    doSave(accessor, trans, realCdoRepositoryPath);
    try {
        trans.commit();
    } catch (CommitException e) {
        throw new IOException(e);
    }
}
 
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:17,代码来源:VirtualCDOFileResource.java


示例4: delete

import org.eclipse.emf.cdo.util.CommitException; //导入依赖的package包/类
private static boolean delete(IFile launcher) {
    CDOSession session = CDOConnectionManager.getInstance().acquireSession(launcher.getProject());
    try {
        CDOTransaction transaction = session.openTransaction();
        try {
            if (delete(launcher, transaction)) {
                transaction.commit();
                return true;
            }
            return false;
        } catch (CommitException e) {
            LOGGER.error("Could not commit changes.", e);
            return false;
        } finally {
            IOUtil.closeSilent(transaction);
        }
    } finally {
        CDOConnectionManager.getInstance().releaseSession(session);
    }
}
 
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:21,代码来源:DeleteDiagramFromRepositoryCommand.java


示例5: reset

import org.eclipse.emf.cdo.util.CommitException; //导入依赖的package包/类
public static boolean reset(CDOSession session, CDOCommitInfo commit, IResource resource) {
    CDOBranch mainBranch = session.getBranchManager().getMainBranch();
    CDOBranch branch = mainBranch.createBranch("revert_" + System.currentTimeMillis());
    boolean result = reset(session, commit, resource, branch);
    if (result) {
        CDOTransaction mergeTransaction = session.openTransaction(mainBranch);
        try {
            String changedObjectLabel = getLabelFor(resource);
            DateFormat df = new SimpleDateFormat("dd.MM.yy HH:mm:ss");
            String commitComment = String.format("Reset of %s to previous commit (%s) by %s.", changedObjectLabel,
                    df.format(new Date(commit.getTimeStamp())), System.getProperty("user.name"));
            mergeTransaction.setCommitComment(commitComment);
            mergeTransaction.merge(branch, new NilFixingCDOMerger());
            try {
                mergeTransaction.commit();
            } catch (CommitException e) {
                LOGGER.error("Merge commit of reverted changes failed.", e);
                return false;
            }
        } finally {
            IOUtil.closeSilent(mergeTransaction);
        }
    }
    return result;
}
 
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:26,代码来源:ResetToPreviousStateCommand.java


示例6: deleteProjectFromRepository

import org.eclipse.emf.cdo.util.CommitException; //导入依赖的package包/类
private static boolean deleteProjectFromRepository(IProject project) {
    CDOSession session = null;
    try {
        session = CDOConnectionManager.getInstance().acquireSession(project);
        CDOTransaction transaction = session.openTransaction();
        CDOResourceFolder resource = transaction.getResourceFolder(project.getName());
        if (resource == null) {
            LOGGER.error("Project {} doesn't exist in repository.", project);
            return false;
        }
        EcoreUtil.delete(resource);
        try {
            transaction.commit();
        } catch (CommitException e) {
            LOGGER.error("Could not delete project {} from repository.", project.getName(), e);
            return false;
        }
    } finally {
        CDOConnectionManager.getInstance().releaseSession(session);
    }
    return true;
}
 
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:23,代码来源:DeleteProjectFromRepositoryCommand.java


示例7: createCDOResource

import org.eclipse.emf.cdo.util.CommitException; //导入依赖的package包/类
private static CDOResourceFolder createCDOResource(IProject project, String cdoRepoPath,
		IListener listener) throws CommitException {
	CDOSession cdoSession = CDOConnectionManager.getInstance().acquireSession(project);
	CDOResourceFolder result = null;
	try {
		CDOView cdoView = cdoSession.openView();
		cdoView.addListener(listener);
		cdoView.options().addChangeSubscriptionPolicy(CDOAdapterPolicy.ALL);
		if (!cdoView.hasResource(cdoRepoPath)) {
			CDOTransaction transaction = cdoSession.openTransaction();
			transaction.createResourceFolder(cdoRepoPath);
			transaction.commit();
			transaction.close();
		}
		result = cdoView.getResourceFolder(cdoRepoPath);
		return result;
	} finally {
		if (result == null) {
			CDOConnectionManager.getInstance().releaseSession(cdoSession);
		}
	}
}
 
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:23,代码来源:CDOHandlingBackgroundTask.java


示例8: promptForCommitInsideDisplayThread

import org.eclipse.emf.cdo.util.CommitException; //导入依赖的package包/类
private static void promptForCommitInsideDisplayThread(Shell shell, Optional<String> name) {
    InputDialog dialog = new InputDialog(
            shell, "Commit Message", "Please enter a commit message"
                    + name.map(n -> " for the diagram: " + n).orElse(StringUtils.EMPTY) + ".",
            StringUtils.EMPTY, EditorLauncherBase::isValidCommitMessage);
    dialog.setBlockOnOpen(true);
    if (dialog.open() != InputDialog.OK) {
        return;
    }
    String commitMessage = dialog.getValue();
    try {
        transformationManager.handleEditorMerge(commitMessage);
    } catch (CommitException e) {
        LOGGER.error("Failed to merge branch into master.", e);
        ErrorDialog.openError(shell, "Commit failed",
                "The requested commit failed. "
                        + "The changes stay in the temporary branch but will not appear on the master branch.",
                new Status(Status.ERROR, null, "Merging of branches failed.", e));
    }
}
 
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:21,代码来源:EditorLauncherBase.java


示例9: saveNotation

import org.eclipse.emf.cdo.util.CommitException; //导入依赖的package包/类
@Override
public void saveNotation() {
	System.out.println("Saving notation");

	CDOResource resource = generalTransaction.getOrCreateResource(concreteSyntaxPath); //$NON-NLS-1$

	//		try {
	//			resource.getContents().clear();  
	//			resource.getContents().add(concreteSyntaxDefinition);
	//			resource.save(null);
	//		} catch (IOException e) {
	//		}

	try {
		generalTransaction.commit();
	} catch (CommitException e) {
		e.printStackTrace();
	}

	loadNotation();
}
 
开发者ID:SOM-Research,项目名称:collaboro,代码行数:22,代码来源:CDOModelManager.java


示例10: saveEcoreModel

import org.eclipse.emf.cdo.util.CommitException; //导入依赖的package包/类
@Override
public void saveEcoreModel() {
	System.out.println("Saving ecore model");

	CDOResource resource = generalTransaction.getOrCreateResource(abstractSyntaxPath); //$NON-NLS-1$

	//		try {
	//			resource.getContents().clear();  
	//			resource.getContents().add(ePackage);
	//			resource.save(null);
	//		} catch (IOException e) {
	//		}

	try {
		generalTransaction.commit();
	} catch (CommitException e) {
		e.printStackTrace();
	}

	loadEcoreModel();
}
 
开发者ID:SOM-Research,项目名称:collaboro,代码行数:22,代码来源:CDOModelManager.java


示例11: saveHistory

import org.eclipse.emf.cdo.util.CommitException; //导入依赖的package包/类
@Override
public void saveHistory() {
	System.out.println("Saving history");

	CDOResource resource = generalTransaction.getOrCreateResource(historyPath); //$NON-NLS-1$

	//		try {
	//			resource.getContents().clear();  
	//			resource.getContents().add(history);
	//			resource.save(null);
	//		} catch (IOException e) {
	//		}

	try {
		generalTransaction.commit();
	} catch (CommitException e) {
		e.printStackTrace();
	}

	loadHistory();
}
 
开发者ID:SOM-Research,项目名称:collaboro,代码行数:22,代码来源:CDOModelManager.java


示例12: nextJobID

import org.eclipse.emf.cdo.util.CommitException; //导入依赖的package包/类
@Override
protected synchronized int nextJobID() throws OperatingSystemException {
				
	int x = viewSystem.getLastJobNumber()+1;
	
	viewSystem.setLastJobNumber(x);
	transactionSystem.setLastJobNumber(x);

	try {
		transaction.commit();
	} catch (CommitException e) {
		throw new OperatingSystemException(e);
	}

	return x;
}
 
开发者ID:asupdev,项目名称:asup,代码行数:17,代码来源:CDOSystemManagerImpl.java


示例13: beforeClass

import org.eclipse.emf.cdo.util.CommitException; //导入依赖的package包/类
@BeforeClass
public static void beforeClass() throws ConcurrentAccessException, CommitException {
	AllTests.startCDOServer();
	IConnector connector = CDOUtils.getConnector(CDOServer.PROTOCOL + "://" + CDOServer.IP + ":"
			+ CDOServer.PORT);
	CDOSession session = CDOUtils.openSession(connector, CDOServer.REPOSITORY_NAME);
	transaction = CDOUtils.openTransaction(session);
	resource = transaction.createResource(CDOContainerProviderTests.class.getCanonicalName());
	eObject = MappingPackage.eINSTANCE.getMappingFactory().createBase();
	resource.getContents().add(eObject);
	transaction.commit();
}
 
开发者ID:ModelWriter,项目名称:Source,代码行数:13,代码来源:CDOContainerProviderTests.java


示例14: start

import org.eclipse.emf.cdo.util.CommitException; //导入依赖的package包/类
@Override
public void start() throws TaskException {
	try {
		repositoryFolder = createCDOProjectFolder();
	} catch (CommitException e) {
		throw new TaskException("Could not create folder in CDO.", e);
	}
	doStart();
}
 
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:10,代码来源:CDOHandlingBackgroundTask.java


示例15: handleEditorSave

import org.eclipse.emf.cdo.util.CommitException; //导入依赖的package包/类
@Override
public void handleEditorSave(IEditorInput editorInput) throws TransformationException {
    try {
        triggerTransformation(editorInput);
    } catch (IOException | CommitException e) {
        throw new TransformationException("Could not transform and merge model changes.", e);
    }
}
 
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:9,代码来源:TransformationManager.java


示例16: mergeChangesToMaster

import org.eclipse.emf.cdo.util.CommitException; //导入依赖的package包/类
private void mergeChangesToMaster(String commitMessage) throws CommitException {
    CDOBranch editorBranch = branchView.getBranch();
    CDOBranch mainBranch = editorBranch.getBranchManager().getMainBranch();

    CDOBranchPoint sourceFromRevision = editorBranch.getPoint(lastMergeTimeBranch);
    CDOBranchPoint sourceToRevision = editorBranch.getHead();
    CDOBranchPoint targetFromRevision = mainBranch.getPoint(lastMergeTimeMain);
    maintTransaction.merge(sourceToRevision, sourceFromRevision, targetFromRevision, new NilFixingCDOMerger());
    maintTransaction.setCommitComment(commitMessage);
    CDOCommitInfo mergeCommitInfo = maintTransaction.commit();
    postMergeListener.handlePostMerge(maintTransaction);
    mergeCommitInfo.getTimeStamp();
    lastMergeTimeBranch = getTimestampOfBranch(branchView, editorBranch);
    lastMergeTimeMain = getTimestampOfBranch(maintTransaction, mainBranch);
}
 
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:16,代码来源:TransformationManager.java


示例17: triggerTransformation

import org.eclipse.emf.cdo.util.CommitException; //导入依赖的package包/类
private void triggerTransformation(IEditorInput editorInput) throws IOException, CommitException {
    URI changedResourceURI = new EditorInputSwitch().doSwitch(editorInput);
    URI baseURI = branchView.getRootResource().getURI();
    baseURI = URI.createHierarchicalURI(baseURI.scheme(), baseURI.authority(), null, null, null);
    URI normalizedURI = normalizeURI(changedResourceURI, baseURI);
    triggerTransformation(normalizedURI);
}
 
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:8,代码来源:TransformationManager.java


示例18: triggerTransformationCDO

import org.eclipse.emf.cdo.util.CommitException; //导入依赖的package包/类
private void triggerTransformationCDO(URI uri) throws IOException, CommitException {
    ResourceSet rs = branchView.getResourceSet();
    rs.setResourceFactoryRegistry(CDOResourceHandler.createFactoryWrapper(rs.getResourceFactoryRegistry()));
    fixStaleReferences(branchView);
    triggerTransformation(uri, rs);
    branchView.commit();
}
 
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:8,代码来源:TransformationManager.java


示例19: propertyChanged

import org.eclipse.emf.cdo.util.CommitException; //导入依赖的package包/类
@Override
public void propertyChanged(Object source, int propId) {
	//		synchronized (this) {
	if (((CDOEditor)(source)).getSite().getId().equals(CDOEditorUtil.EDITOR_ID)) {
		if (propId == IEditorPart.PROP_DIRTY) {
			String newValue = Controller.INSTANCE.getLoggedUser().getId()+((CDOEditor)(source)).getEditorInput().getName()+((CDOEditor) source).isDirty();
			if (!oldValue.equals(newValue)) {
				oldValue = newValue;
				Event ev = SynchronizationFactory.eINSTANCE.createEvent();
				ev.setTimeStamp(System.currentTimeMillis());
				ev.setModifiedElement(((CDOEditor)(source)).getSelection().toString());
				ev.setModifiedModel( ((CDOEditor)(source)).getEditorInput().getName());
				ev.setUser(Controller.INSTANCE.getLoggedUser().getId());

				CDOEditor ed = (CDOEditor) source;
				if (ed.isDirty()) {
					ev.setStatus("DIRTY");
				} else {
					ev.setStatus("CLEAN");
				}
				eventFromThisUser.add(ev);
				synchronization.getEvents().add(ev);
				try {
					synchronizationTransaction.commit();
				} catch (CommitException e) {
					e.printStackTrace();
				}
			}
		}
		//		}
	}




}
 
开发者ID:SOM-Research,项目名称:collaboro,代码行数:37,代码来源:CDOModelManager.java


示例20: closeSync

import org.eclipse.emf.cdo.util.CommitException; //导入依赖的package包/类
protected void closeSync() {
	synchronization.getEvents().removeAll(eventFromThisUser);
	try {
		synchronizationTransaction.commit();
	} catch (CommitException e) {
		e.printStackTrace();
	}
	eventFromThisUser.clear();
	synchronizationTransaction.close();
}
 
开发者ID:SOM-Research,项目名称:collaboro,代码行数:11,代码来源:CDOModelManager.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java AggregationKind类代码示例发布时间:2022-05-22
下一篇:
Java ValidationComplete类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap