-
Notifications
You must be signed in to change notification settings - Fork 3
/
IQualifiedNameResolver.java
236 lines (209 loc) · 7.02 KB
/
IQualifiedNameResolver.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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
/*******************************************************************************
* Copyright (c) 2020, 2023 Obeo.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v20.html
*
* Contributors:
* Obeo - initial API and implementation
*******************************************************************************/
package org.eclipse.acceleo.query.runtime.namespace;
import java.io.InputStream;
import java.net.URI;
import java.util.List;
import java.util.Set;
import org.eclipse.acceleo.query.runtime.IService;
/**
* Resolves qualified names.
*
* @author <a href="mailto:yvan.lussaud@obeo.fr">Yvan Lussaud</a>
*/
public interface IQualifiedNameResolver {
/**
* Gets the qualified name from the given {@link URI}.
*
* @param uri
* the {@link URI}
* @return the qualified name from the given {@link URI} if any, <code>null</code> otherwise
*/
String getQualifiedName(URI uri);
/**
* Gets the {@link URI} from the given qualified name.
*
* @param qualifiedName
* the qualified name
* @return the {@link URI} from the given qualified name if any, <code>null</code> otherwise
*/
URI getURI(String qualifiedName);
/**
* Gets the source {@link URI} from the given qualified name.
*
* @param qualifiedName
* the qualified name
* @return the source {@link URI} from the given qualified name if any, <code>null</code> otherwise
*/
URI getSourceURI(String qualifiedName);
/**
* Gets the binary {@link URI} for the given source {@link URI}.
*
* @param sourceURI
* the source {@link URI}
* @return the binary {@link URI} for the given source {@link URI}
*/
URI getBinaryURI(URI sourceURI);
/**
* Gets the {@link ISourceLocation} for the given {@link IService}.
*
* @param service
* the {@link IService}
* @return the {@link ISourceLocation} for the given {@link IService} if any, <code>null</code> otherwise
*/
ISourceLocation getSourceLocation(IService<?> service);
/**
* Gets the {@link ISourceLocation} for the given qualified name.
*
* @param qualifiedName
* the qualified name
* @return the {@link ISourceLocation} for the given qualified name if any, <code>null</code> otherwise
*/
ISourceLocation getSourceLocation(String qualifiedName);
/**
* Clears the cache for the given {@link Set} of qualified names.
*
* @param qualifiedNames
* the {@link Set} of qualified names
*/
void clear(Set<String> qualifiedNames);
/**
* Gets the {@link Object} corresponding to the given qualified name.
*
* @param qualifiedName
* the qualified name
* @return the {@link Object} corresponding to the given qualified name if any, <code>null</code>
* otherwise
*/
Object resolve(String qualifiedName);
/**
* Register the given {@link Object} to the given qualified name.
*
* @param qualifiedName
* the qualified name
* @param object
* the {@link Object}
*/
void register(String qualifiedName, Object object);
/**
* Gets the qualified name from the given {@link Object} that have been {@link #resolve(String) resolved}.
*
* @param object
* the {@link Object}
* @return the qualified name from the given {@link Object} that have been {@link #resolve(String)
* resolved} if any, <code>null</code> otherwise
*/
String getQualifiedName(Object object);
/**
* Gets the {@link URI} from the given {@link Object} that have been {@link #resolve(String) resolved}.
*
* @param object
* the {@link Object}
* @return the {@link URI} from the given {@link Object} that have been {@link #resolve(String) resolved}
* if any, <code>null</code> otherwise
*/
URI getURI(Object object);
/**
* Gets the {@link List} of {@link IService} from the given {@link Object}.
*
* @param lookupEngine
* the {@link IQualifiedNameLookupEngine}
* @param object
* the {@link Object}
* @param contextQualifiedName
* the context qualified name
* @return the {@link List} of {@link IService} from the given {@link Object}
*/
Set<IService<?>> getServices(IQualifiedNameLookupEngine lookupEngine, Object object,
String contextQualifiedName);
/**
* Gets the context qualified name for the given {@link IService}.
*
* @param service
* the {@link IService}
* @return the context qualified name for the given {@link IService} if nay, <code>null</code> otherwise
*/
String getContextQualifiedName(IService<?> service);
/**
* Gets the super qualified name of the given qualified name.
*
* @param qualifiedName
* the qualified name
* @return the super qualified name of the given qualified name if any, <code>null</code> otherwise
*/
String getExtend(String qualifiedName);
/**
* Gets the {@link List} of imported qualified name for the given qualified name.
*
* @param qualifiedName
* the qualified name
* @return the {@link List} of imported qualified name for the given qualified name
*/
List<String> getImports(String qualifiedName);
/**
* Gets the {@link Set} of qualified name depending on the given qualified name. Opposite relation of
* {@link #getExtend(String)} closure and opposite relation of {@link #getImports(String)} for this
* closure.
*
* @param qualifiedName
* the qualified name
* @return the {@link Set} of qualified name depending on the given qualified name. Opposite relation of
* {@link #getExtend(String)} closure and opposite relation of {@link #getImports(String)} for
* this closure
*/
Set<String> getDependOn(String qualifiedName);
/**
* Gets the {@link Set} of available qualified names.
*
* @return the {@link Set} of available qualified names
*/
Set<String> getAvailableQualifiedNames();
/**
* Gets the {@link Set} of resolved qualified names.
*
* @return the {@link Set} of resolved qualified names
*/
Set<String> getResolvedQualifiedNames();
/**
* Gets the {@link InputStream} from the given resource name.
*
* @param resourceName
* the resource name
* @return the {@link InputStream} from the given resource name if any, <code>null</code> otherwise
*/
InputStream getInputStream(String resourceName);
/**
* Gets the {@link Class} from the given qualified name.
*
* @param qualifiedName
* the qualified name
* @return the {@link Class} from the given qualified name if any, <code>null</code> otherwise
*/
Class<?> getClass(String qualifiedName);
/**
* Adds the given {@link ILoader}.
*
* @param loader
* the {@link ILoader} to add
*/
void addLoader(ILoader loader);
/**
* Removes the given {@link ILoader}.
*
* @param loader
* the {@link ILoader} to remove
*/
void removeLoader(ILoader loader);
/**
* Clears all {@link ILoader}.
*/
void clearLoaders();
}