Search in sources :

Example 1 with IPostProcessor

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);
}
Also used : PostProcessorDescriptorRegistryImpl(org.eclipse.emf.compare.postprocessor.PostProcessorDescriptorRegistryImpl) DefaultComparisonScope(org.eclipse.emf.compare.scope.DefaultComparisonScope) IPostProcessor(org.eclipse.emf.compare.postprocessor.IPostProcessor) DatabaseMatchEngineFactory(org.obeonetwork.dsl.database.compare.extensions.match.DatabaseMatchEngineFactory) MatchEngineFactoryRegistryImpl(org.eclipse.emf.compare.match.impl.MatchEngineFactoryRegistryImpl) IComparisonScope(org.eclipse.emf.compare.scope.IComparisonScope) DatabasePostProcessor(org.obeonetwork.dsl.database.compare.extensions.processor.DatabasePostProcessor) DependenciesLoadOnDemandPolicy(org.obeonetwork.dsl.database.compare.extensions.policy.DependenciesLoadOnDemandPolicy) DatabaseMatchEngineFactory(org.obeonetwork.dsl.database.compare.extensions.match.DatabaseMatchEngineFactory) EMFCompare(org.eclipse.emf.compare.EMFCompare) BasicPostProcessorDescriptorImpl(org.eclipse.emf.compare.postprocessor.BasicPostProcessorDescriptorImpl) IMatchEngine(org.eclipse.emf.compare.match.IMatchEngine)

Example 2 with IPostProcessor

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;
}
Also used : IPostProcessor(org.eclipse.emf.compare.postprocessor.IPostProcessor) Comparison(org.eclipse.emf.compare.Comparison) DatabasePostProcessor(org.obeonetwork.dsl.database.compare.extensions.processor.DatabasePostProcessor)

Aggregations

IPostProcessor (org.eclipse.emf.compare.postprocessor.IPostProcessor)2 DatabasePostProcessor (org.obeonetwork.dsl.database.compare.extensions.processor.DatabasePostProcessor)2 Comparison (org.eclipse.emf.compare.Comparison)1 EMFCompare (org.eclipse.emf.compare.EMFCompare)1 IMatchEngine (org.eclipse.emf.compare.match.IMatchEngine)1 MatchEngineFactoryRegistryImpl (org.eclipse.emf.compare.match.impl.MatchEngineFactoryRegistryImpl)1 BasicPostProcessorDescriptorImpl (org.eclipse.emf.compare.postprocessor.BasicPostProcessorDescriptorImpl)1 PostProcessorDescriptorRegistryImpl (org.eclipse.emf.compare.postprocessor.PostProcessorDescriptorRegistryImpl)1 DefaultComparisonScope (org.eclipse.emf.compare.scope.DefaultComparisonScope)1 IComparisonScope (org.eclipse.emf.compare.scope.IComparisonScope)1 DatabaseMatchEngineFactory (org.obeonetwork.dsl.database.compare.extensions.match.DatabaseMatchEngineFactory)1 DependenciesLoadOnDemandPolicy (org.obeonetwork.dsl.database.compare.extensions.policy.DependenciesLoadOnDemandPolicy)1