Search in sources :

Example 1 with InstanceSampleServiceImpl

use of eu.esdihumboldt.hale.ui.service.instance.sample.internal.InstanceSampleServiceImpl in project hale by halestudio.

the class HaleServiceFactory method create.

/**
 * @see AbstractServiceFactory#create(Class, IServiceLocator,
 *      IServiceLocator)
 */
@Override
public Object create(@SuppressWarnings("rawtypes") Class serviceInterface, IServiceLocator parentLocator, IServiceLocator locator) {
    if (AlignmentService.class.equals(serviceInterface)) {
        return new AlignmentServiceUndoSupport(new AlignmentServiceImpl(locator.getService(ProjectService.class)));
    }
    if (CompatibilityService.class.equals(serviceInterface)) {
        return new CompatibilityServiceImpl();
    }
    if (EntityDefinitionService.class.equals(serviceInterface)) {
        return new EntityDefinitionServiceUndoSupport(new EntityDefinitionServiceImpl(locator.getService(AlignmentService.class), locator.getService(ProjectService.class)));
    }
    if (EntityResolver.class.equals(serviceInterface)) {
        return new UserFallbackEntityResolver();
    }
    if (FunctionService.class.equals(serviceInterface)) {
        return new HaleFunctionService(locator.getService(AlignmentService.class));
    }
    if (GeometrySchemaService.class.equals(serviceInterface)) {
        return new ProjectGeometrySchemaService(locator.getService(ProjectService.class));
    }
    if (GroovyService.class.equals(serviceInterface)) {
        return new PreferencesGroovyService(locator.getService(ProjectService.class), locator.getService(AlignmentService.class));
    }
    if (InstanceSampleService.class.equals(serviceInterface)) {
        return new InstanceSampleServiceImpl();
    }
    if (InstanceService.class.equals(serviceInterface)) {
        final InstanceService is = OrientInstanceService.getInstance(locator.getService(SchemaService.class), locator.getService(ProjectService.class), locator.getService(AlignmentService.class), locator.getService(GroovyService.class));
        // Add a listener to close all InstanceProcessors when source data
        // is cleared
        // XXX There may a better place to add this listener
        is.addListener(new InstanceServiceAdapter() {

            @Override
            public void datasetChanged(DataSet type) {
                if (type != DataSet.SOURCE) {
                    return;
                }
                InstanceCollection instances = is.getInstances(type);
                if (instances.isEmpty()) {
                    // data was cleared, close instance
                    // processors
                    final InstanceProcessingExtension ext = new InstanceProcessingExtension(HaleUI.getServiceProvider());
                    for (InstanceProcessor processor : ext.getInstanceProcessors()) {
                        try {
                            processor.close();
                        } catch (IOException e) {
                        // Ignore
                        }
                    }
                }
            }
        });
        return is;
    }
    if (InstanceValidationService.class.equals(serviceInterface))
        return new InstanceValidationServiceImpl(locator.getService(InstanceService.class), locator.getService(ReportService.class));
    if (InstanceViewService.class.equals(serviceInterface)) {
        return new InstanceViewServiceImpl(locator.getService(ProjectService.class));
    }
    if (OccurringValuesService.class.equals(serviceInterface)) {
        return new OccurringValuesServiceImpl(locator.getService(InstanceService.class), locator.getService(ProjectService.class));
    }
    if (PopulationService.class.equals(serviceInterface)) {
        return new PopulationServiceImpl(locator.getService(InstanceService.class));
    }
    if (ProjectService.class.equals(serviceInterface)) {
        return new ProjectServiceImpl();
    }
    if (ProjectInfoService.class.equals(serviceInterface)) {
        return locator.getService(ProjectService.class);
    }
    if (RecentProjectsService.class.equals(serviceInterface)) {
        return new RecentProjectsServiceImpl();
    }
    if (RecentResources.class.equals(serviceInterface)) {
        return new RecentResourcesService(locator.getService(ProjectService.class));
    }
    if (ReportService.class.equals(serviceInterface)) {
        return new ReportServiceImpl();
    }
    if (SchemaService.class.equals(serviceInterface)) {
        return new SchemaServiceImpl(locator.getService(ProjectService.class));
    }
    if (TaskService.class.equals(serviceInterface)) {
        return new TaskServiceImpl();
    }
    if (TransformationFunctionService.class.equals(serviceInterface)) {
        return new HaleTransformationFunctionService(locator.getService(AlignmentService.class));
    }
    if (TransformationSchemas.class.equals(serviceInterface)) {
        return locator.getService(SchemaService.class);
    }
    return null;
}
Also used : UserFallbackEntityResolver(eu.esdihumboldt.hale.ui.service.align.resolver.UserFallbackEntityResolver) DataSet(eu.esdihumboldt.hale.common.instance.model.DataSet) TaskServiceImpl(eu.esdihumboldt.hale.ui.service.tasks.internal.TaskServiceImpl) CompatibilityServiceImpl(eu.esdihumboldt.hale.ui.compatibility.extension.impl.CompatibilityServiceImpl) EntityDefinitionServiceUndoSupport(eu.esdihumboldt.hale.ui.service.entity.internal.EntityDefinitionServiceUndoSupport) AlignmentServiceUndoSupport(eu.esdihumboldt.hale.ui.service.align.internal.AlignmentServiceUndoSupport) PreferencesGroovyService(eu.esdihumboldt.hale.ui.service.groovy.internal.PreferencesGroovyService) GroovyService(eu.esdihumboldt.util.groovy.sandbox.GroovyService) ProjectServiceImpl(eu.esdihumboldt.hale.ui.service.project.internal.ProjectServiceImpl) InstanceViewServiceImpl(eu.esdihumboldt.hale.ui.service.instance.sample.internal.InstanceViewServiceImpl) PopulationServiceImpl(eu.esdihumboldt.hale.ui.service.population.internal.PopulationServiceImpl) AlignmentService(eu.esdihumboldt.hale.ui.service.align.AlignmentService) InstanceSampleServiceImpl(eu.esdihumboldt.hale.ui.service.instance.sample.internal.InstanceSampleServiceImpl) SchemaServiceImpl(eu.esdihumboldt.hale.ui.service.schema.internal.SchemaServiceImpl) InstanceProcessor(eu.esdihumboldt.hale.common.instance.processing.InstanceProcessor) RecentResourcesService(eu.esdihumboldt.hale.ui.service.project.internal.resources.RecentResourcesService) InstanceServiceAdapter(eu.esdihumboldt.hale.ui.service.instance.InstanceServiceAdapter) PreferencesGroovyService(eu.esdihumboldt.hale.ui.service.groovy.internal.PreferencesGroovyService) InstanceCollection(eu.esdihumboldt.hale.common.instance.model.InstanceCollection) InstanceValidationServiceImpl(eu.esdihumboldt.hale.ui.service.instance.validation.internal.InstanceValidationServiceImpl) ProjectService(eu.esdihumboldt.hale.ui.service.project.ProjectService) IOException(java.io.IOException) ReportServiceImpl(eu.esdihumboldt.hale.ui.service.report.internal.ReportServiceImpl) RecentProjectsServiceImpl(eu.esdihumboldt.hale.ui.service.project.internal.RecentProjectsServiceImpl) EntityDefinitionServiceImpl(eu.esdihumboldt.hale.ui.service.entity.internal.EntityDefinitionServiceImpl) InstanceProcessingExtension(eu.esdihumboldt.hale.common.instance.processing.InstanceProcessingExtension) AlignmentServiceImpl(eu.esdihumboldt.hale.ui.service.align.internal.AlignmentServiceImpl) SchemaService(eu.esdihumboldt.hale.ui.service.schema.SchemaService) ProjectGeometrySchemaService(eu.esdihumboldt.hale.ui.service.geometry.ProjectGeometrySchemaService) GeometrySchemaService(eu.esdihumboldt.hale.ui.geometry.service.GeometrySchemaService) OrientInstanceService(eu.esdihumboldt.hale.ui.service.instance.internal.orient.OrientInstanceService) InstanceService(eu.esdihumboldt.hale.ui.service.instance.InstanceService) OccurringValuesServiceImpl(eu.esdihumboldt.hale.ui.service.values.internal.OccurringValuesServiceImpl) ProjectGeometrySchemaService(eu.esdihumboldt.hale.ui.service.geometry.ProjectGeometrySchemaService)

Aggregations

DataSet (eu.esdihumboldt.hale.common.instance.model.DataSet)1 InstanceCollection (eu.esdihumboldt.hale.common.instance.model.InstanceCollection)1 InstanceProcessingExtension (eu.esdihumboldt.hale.common.instance.processing.InstanceProcessingExtension)1 InstanceProcessor (eu.esdihumboldt.hale.common.instance.processing.InstanceProcessor)1 CompatibilityServiceImpl (eu.esdihumboldt.hale.ui.compatibility.extension.impl.CompatibilityServiceImpl)1 GeometrySchemaService (eu.esdihumboldt.hale.ui.geometry.service.GeometrySchemaService)1 AlignmentService (eu.esdihumboldt.hale.ui.service.align.AlignmentService)1 AlignmentServiceImpl (eu.esdihumboldt.hale.ui.service.align.internal.AlignmentServiceImpl)1 AlignmentServiceUndoSupport (eu.esdihumboldt.hale.ui.service.align.internal.AlignmentServiceUndoSupport)1 UserFallbackEntityResolver (eu.esdihumboldt.hale.ui.service.align.resolver.UserFallbackEntityResolver)1 EntityDefinitionServiceImpl (eu.esdihumboldt.hale.ui.service.entity.internal.EntityDefinitionServiceImpl)1 EntityDefinitionServiceUndoSupport (eu.esdihumboldt.hale.ui.service.entity.internal.EntityDefinitionServiceUndoSupport)1 ProjectGeometrySchemaService (eu.esdihumboldt.hale.ui.service.geometry.ProjectGeometrySchemaService)1 PreferencesGroovyService (eu.esdihumboldt.hale.ui.service.groovy.internal.PreferencesGroovyService)1 InstanceService (eu.esdihumboldt.hale.ui.service.instance.InstanceService)1 InstanceServiceAdapter (eu.esdihumboldt.hale.ui.service.instance.InstanceServiceAdapter)1 OrientInstanceService (eu.esdihumboldt.hale.ui.service.instance.internal.orient.OrientInstanceService)1 InstanceSampleServiceImpl (eu.esdihumboldt.hale.ui.service.instance.sample.internal.InstanceSampleServiceImpl)1 InstanceViewServiceImpl (eu.esdihumboldt.hale.ui.service.instance.sample.internal.InstanceViewServiceImpl)1 InstanceValidationServiceImpl (eu.esdihumboldt.hale.ui.service.instance.validation.internal.InstanceValidationServiceImpl)1