/
IServicesConfigurator.java
113 lines (101 loc) · 4.15 KB
/
IServicesConfigurator.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/*******************************************************************************
* Copyright (c) 2017 Obeo.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Obeo - initial API and implementation
*
*******************************************************************************/
package org.obeonetwork.m2doc.services.configurator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
import org.eclipse.acceleo.query.runtime.IReadOnlyQueryEnvironment;
import org.eclipse.acceleo.query.runtime.IService;
import org.eclipse.emf.common.util.Diagnostic;
import org.eclipse.emf.ecore.resource.ResourceSet;
/**
* Configure for {@link IReadOnlyQueryEnvironment}.
*
* @author <a href="mailto:yvan.lussaud@obeo.fr">Yvan Lussaud</a>
*/
public interface IServicesConfigurator {
/**
* Gets the {@link List} of options managed by this configurator.
*
* @return the {@link List} of options managed by this configurator
*/
List<String> getOptions();
/**
* Gets the {@link Map} of initialized options.
*
* @param options
* the {@link Map} of existing options.
* @return the {@link Map} of initialized options
*/
Map<String, String> getInitializedOptions(Map<String, String> options);
/**
* Validates the given options.
*
* @param queryEnvironment
* the {@link IReadOnlyQueryEnvironment}
* @param options
* the {@link Map} of options
* @return the {@link Map} of option name to its {@link Diagnostic}
*/
Map<String, List<Diagnostic>> validate(IReadOnlyQueryEnvironment queryEnvironment, Map<String, String> options);
/**
* Gets the {@link Set} of {@link IService} for the given {@link IReadOnlyQueryEnvironment} and options.
*
* @param queryEnvironment
* the {@link IReadOnlyQueryEnvironment}
* @param resourceSetForModels
* the {@link ResourceSet} for model elements
* @param options
* the {@link Map} of options
* @return the {@link Set} of {@link IService} for the given {@link IReadOnlyQueryEnvironment}
*/
Set<IService> getServices(IReadOnlyQueryEnvironment queryEnvironment, ResourceSet resourceSetForModels,
Map<String, String> options);
/**
* Starts the generation for the given {@link IReadOnlyQueryEnvironment} and destination {@link XWPFDocument}.
*
* @param queryEnvironment
* the {@link IReadOnlyQueryEnvironment}
* @param destinationDocument
* the {@link XWPFDocument}
*/
void startGeneration(IReadOnlyQueryEnvironment queryEnvironment, XWPFDocument destinationDocument);
/**
* Clears the services for the given {@link IReadOnlyQueryEnvironment}.
*
* @param queryEnvironment
* the {@link IReadOnlyQueryEnvironment}
* @param resourceSetForModels
* the {@link ResourceSet} for model elements
*/
void cleanServices(IReadOnlyQueryEnvironment queryEnvironment, ResourceSet resourceSetForModels);
/**
* Create a new resourceSet which would need specific initialization for loading the models according to the given options.
*
* @param context
* the {@link Object} context used in {@link #cleanResourceSetForModels(Object)}
* @param options
* the {@link Map} of options
* @return the created {@link ResourceSet} if any, <code>null</code> otherwise
* @see #cleanResourceSetForModels(Object)
*/
ResourceSet createResourceSetForModels(Object context, Map<String, String> options);
/**
* Cleans the {@link #createResourceSetForModels(Object, Map) created} {@link ResourceSet} for the given
* {@link IReadOnlyQueryEnvironment}.
*
* @param context
* the {@link Object} context
*/
void cleanResourceSetForModels(Object context);
}