Search in sources :

Example 1 with BasicPostProcessorDescriptorImpl

use of org.eclipse.emf.compare.postprocessor.BasicPostProcessorDescriptorImpl 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)

Aggregations

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 IPostProcessor (org.eclipse.emf.compare.postprocessor.IPostProcessor)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 DatabasePostProcessor (org.obeonetwork.dsl.database.compare.extensions.processor.DatabasePostProcessor)1