Search in sources :

Example 1 with DefinitionResourceConfig

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;
}
Also used : DefinitionResourceConfig(io.vertigo.app.config.DefinitionResourceConfig) Definition(io.vertigo.core.definition.Definition) WebServiceDefinition(io.vertigo.vega.webservice.metamodel.WebServiceDefinition) ArrayList(java.util.ArrayList)

Example 2 with DefinitionResourceConfig

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);
}
Also used : DslDefinition(io.vertigo.dynamo.plugins.environment.dsl.dynamic.DslDefinition) DynamoDynamicRegistry(io.vertigo.dynamo.plugins.environment.registries.DynamoDynamicRegistry) DefinitionResourceConfig(io.vertigo.app.config.DefinitionResourceConfig) DynamoDynamicRegistry(io.vertigo.dynamo.plugins.environment.registries.DynamoDynamicRegistry) DynamicRegistry(io.vertigo.dynamo.plugins.environment.dsl.dynamic.DynamicRegistry) AnnotationLoader(io.vertigo.dynamo.plugins.environment.loaders.java.AnnotationLoader) Loader(io.vertigo.dynamo.plugins.environment.loaders.Loader) EAXmiLoader(io.vertigo.dynamo.plugins.environment.loaders.eaxmi.core.EAXmiLoader) OOMLoader(io.vertigo.dynamo.plugins.environment.loaders.poweramc.core.OOMLoader) KprLoader(io.vertigo.dynamo.plugins.environment.loaders.kpr.KprLoader) DslDefinitionRepository(io.vertigo.dynamo.plugins.environment.dsl.dynamic.DslDefinitionRepository)

Aggregations

DefinitionResourceConfig (io.vertigo.app.config.DefinitionResourceConfig)2 Definition (io.vertigo.core.definition.Definition)1 DslDefinition (io.vertigo.dynamo.plugins.environment.dsl.dynamic.DslDefinition)1 DslDefinitionRepository (io.vertigo.dynamo.plugins.environment.dsl.dynamic.DslDefinitionRepository)1 DynamicRegistry (io.vertigo.dynamo.plugins.environment.dsl.dynamic.DynamicRegistry)1 Loader (io.vertigo.dynamo.plugins.environment.loaders.Loader)1 EAXmiLoader (io.vertigo.dynamo.plugins.environment.loaders.eaxmi.core.EAXmiLoader)1 AnnotationLoader (io.vertigo.dynamo.plugins.environment.loaders.java.AnnotationLoader)1 KprLoader (io.vertigo.dynamo.plugins.environment.loaders.kpr.KprLoader)1 OOMLoader (io.vertigo.dynamo.plugins.environment.loaders.poweramc.core.OOMLoader)1 DynamoDynamicRegistry (io.vertigo.dynamo.plugins.environment.registries.DynamoDynamicRegistry)1 WebServiceDefinition (io.vertigo.vega.webservice.metamodel.WebServiceDefinition)1 ArrayList (java.util.ArrayList)1