use of org.eclipse.emf.cdo.transaction.CDOTransaction in project InformationSystem by ObeoNetwork.
the class CollaborativeBusinessProjectImporter method getTargetRemoteResource.
private CDOResource getTargetRemoteResource(String targetResourcePath) {
CDOResource targetResource = null;
CDOTransaction transaction = getTransactionOnSession(getTargetSession());
if (transaction != null && transaction.hasResource(targetResourcePath)) {
try {
targetResource = transaction.getResource(targetResourcePath);
} catch (Exception e) {
// unable to get resource, it probably doesn't exist
}
}
return targetResource;
}
use of org.eclipse.emf.cdo.transaction.CDOTransaction in project InformationSystem by ObeoNetwork.
the class EmbeddedCDOServer method getRemoteProjectsURIs.
/**
* Retrieve remote projects from CDO server
* @param parentMonitor
* @return
*/
public Collection<URI> getRemoteProjectsURIs(IProgressMonitor parentMonitor) {
SubMonitor monitor = SubMonitor.convert(parentMonitor, 1);
monitor.setTaskName("Retrieving remote projects list");
String productGroup = "org.eclipse.emf.cdo.sessions";
CDOSession session = (CDOSession) IPluginContainer.INSTANCE.getElement(productGroup, "cdo", getTcpUrl());
CDOTransaction transaction = session.openTransaction();
Collection<URI> remoteProjectsURIs = getRemoteProjectsURIs(transaction);
transaction.close();
session.close();
monitor.worked(1);
monitor.done();
return remoteProjectsURIs;
}
use of org.eclipse.emf.cdo.transaction.CDOTransaction in project InformationSystem by ObeoNetwork.
the class ScaffoldingOperation method createScaffoldResourceForSharedProject.
private Resource createScaffoldResourceForSharedProject(CDOView cdoView) {
CDOTransaction transaction = (CDOTransaction) cdoView;
String name = getScaffoldModelName();
int count = 0;
while (count < 10) {
String path = SCAFFOLD_FOLDER + "/" + getFilenameForScaffoldModel(name, count);
// Create resource
CDOResource resource = transaction.getOrCreateResource(path);
// Check if it is empty
if (resource.getContents().isEmpty()) {
resource.getContents().add(scaffoldInfo);
return resource;
} else {
// try with another name
count++;
}
}
return null;
}
use of org.eclipse.emf.cdo.transaction.CDOTransaction in project InformationSystem by ObeoNetwork.
the class CollaborativeBusinessProjectImporter method addToRemoteSemanticResource.
private void addToRemoteSemanticResource(final EObject copyObject, final String targetPath) {
CDOTransaction transaction = getTransactionOnSession(getTargetSession());
if (transaction != null) {
CDOResource targetResource = transaction.getOrCreateResource(targetPath);
targetResource.getContents().add(copyObject);
if (!existsTargetSemanticResource(targetResource.getURI())) {
addToSemanticResources(getTargetSession(), targetResource.getURI(), new NullProgressMonitor());
}
}
}
Aggregations