Search in sources :

Example 1 with BeanFactory

use of com.devonfw.cobigen.impl.aop.BeanFactory in project cobigen by devonfw.

the class CobiGenFactory method create.

/**
 * Creates a new {@link CobiGen} while searching a valid configuration at the given path
 *
 * @param configFileOrFolder the root folder containing the context.xml and all templates, configurations etc.
 * @return a new instance of {@link CobiGen}
 * @throws InvalidConfigurationException if the context configuration could not be read properly.
 */
public static CobiGen create(URI configFileOrFolder) throws InvalidConfigurationException {
    Objects.requireNonNull(configFileOrFolder, "The URI pointing to the configuration could not be null.");
    ConfigurationHolder configurationHolder = new ConfigurationHolder(configFileOrFolder);
    BeanFactory beanFactory = new BeanFactory();
    beanFactory.addManuallyInitializedBean(configurationHolder);
    CobiGen createBean = beanFactory.createBean(CobiGen.class);
    // Notifies all plugins of new template root path
    PluginRegistry.notifyPlugins(configurationHolder.getConfigurationPath());
    return createBean;
}
Also used : BeanFactory(com.devonfw.cobigen.impl.aop.BeanFactory) ConfigurationHolder(com.devonfw.cobigen.impl.config.ConfigurationHolder) CobiGen(com.devonfw.cobigen.api.CobiGen)

Aggregations

CobiGen (com.devonfw.cobigen.api.CobiGen)1 BeanFactory (com.devonfw.cobigen.impl.aop.BeanFactory)1 ConfigurationHolder (com.devonfw.cobigen.impl.config.ConfigurationHolder)1