use of eu.esdihumboldt.hale.ui.service.values.internal.OccurringValuesServiceImpl 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;
}
Aggregations