use of org.eclipse.emf.compare.postprocessor.IPostProcessor in project InformationSystem by ObeoNetwork.
the class DatabaseCompareService method compare.
public static Comparison compare(TableContainer source, TableContainer target) throws Exception {
// Prepare using specific match engine
IMatchEngine.Factory matchEngineFactory = new DatabaseMatchEngineFactory();
matchEngineFactory.setRanking(20);
IMatchEngine.Factory.Registry matchEngineRegistry = new MatchEngineFactoryRegistryImpl();
matchEngineRegistry.add(matchEngineFactory);
// Prepare using post processor
IPostProcessor customPostProcessor = new DatabasePostProcessor();
IPostProcessor.Descriptor descriptor = new BasicPostProcessorDescriptorImpl(customPostProcessor, NS_URI_PATTERN_FOR_POST_PROCESSOR, null);
IPostProcessor.Descriptor.Registry<Object> postProcessorRegistry = new PostProcessorDescriptorRegistryImpl<Object>();
postProcessorRegistry.put(DatabasePostProcessor.class.getName(), descriptor);
EMFCompare comparator = EMFCompare.builder().setPostProcessorRegistry(postProcessorRegistry).setMatchEngineFactoryRegistry(matchEngineRegistry).build();
// Set the "load on demand policy" registry to resolve dependencies to external libraries.
EMFCompareRCPPlugin.getDefault().getLoadOnDemandPolicyRegistry().addPolicy(new DependenciesLoadOnDemandPolicy());
// Compare the two models
IComparisonScope scope = new DefaultComparisonScope(source, target, null);
return comparator.compare(scope);
}
use of org.eclipse.emf.compare.postprocessor.IPostProcessor in project InformationSystem by ObeoNetwork.
the class DatabaseTransformationTestSuite method transform.
private Comparison transform(Comparison originalComparison) {
IPostProcessor transformer = new DatabasePostProcessor();
Comparison comparison = EcoreUtil.copy(originalComparison);
transformer.postComparison(comparison, null);
return comparison;
}
Aggregations