use of io.vertigo.app.config.DefinitionResourceConfig in project vertigo by KleeGroup.
the class WebServiceDefinitionProvider method provideDefinitions.
/**
* {@inheritDoc}
*/
@Override
public List<Definition> provideDefinitions(final DefinitionSpace definitionSpace) {
Assertion.checkArgument(!definitionResourceConfigs.isEmpty(), "No definitionResource registered");
// -----
final List<Definition> webServiceDefinitions = new ArrayList<>();
for (final DefinitionResourceConfig definitionResourceConfig : definitionResourceConfigs) {
final String resourcePath = definitionResourceConfig.getPath();
if (resourcePath.endsWith(".*")) {
scanAndAddPackage(resourcePath.substring(0, resourcePath.length() - ".*".length()), webServiceDefinitions);
} else {
final Class<? extends WebServices> webServicesClass = ClassUtil.classForName(resourcePath, WebServices.class);
webServiceDefinitions.addAll(scanWebServices(webServicesClass));
}
}
Assertion.checkArgument(!webServiceDefinitions.isEmpty(), "No webService found by WebServiceDefinitionProvider");
// ----
return webServiceDefinitions;
}
use of io.vertigo.app.config.DefinitionResourceConfig in project vertigo by KleeGroup.
the class DynamoDefinitionProvider method parse.
/**
* @param definitionResourceConfigs List of resources (must be in a type managed by this loader)
*/
private List<DefinitionSupplier> parse(final DefinitionSpace definitionSpace) {
// Création du repositoy des instances le la grammaire (=> model)
final DynamicRegistry dynamoDynamicRegistry = new DynamoDynamicRegistry();
final DslDefinitionRepository dslDefinitionRepository = new DslDefinitionRepository(dynamoDynamicRegistry);
// --Enregistrement des types primitifs
for (final DslDefinition dslDefinition : dynamoDynamicRegistry.getGrammar().getRootDefinitions()) {
dslDefinitionRepository.addDefinition(dslDefinition);
}
for (final DefinitionResourceConfig definitionResourceConfig : definitionResourceConfigs) {
final Loader loaderPlugin = loadersByType.get(definitionResourceConfig.getType());
Assertion.checkNotNull(loaderPlugin, "This resource {0} can not be parse by these loaders : {1}", definitionResourceConfig, loadersByType.keySet());
loaderPlugin.load(definitionResourceConfig.getPath(), dslDefinitionRepository);
}
return dslDefinitionRepository.solve(definitionSpace);
}
Aggregations