Search in sources :

Example 1 with Configuration

use of com.enonic.xp.config.Configuration in project xp by enonic.

the class ConfigLoader method load.

Map<String, String> load(final File file) throws Exception {
    final Properties props = new Properties();
    try (FileReader reader = new FileReader(file, StandardCharsets.UTF_8)) {
        props.load(reader);
    }
    final ConfigBuilder builder = ConfigBuilder.create();
    builder.addAll(props);
    final Configuration config = this.interpolator.interpolate(builder.build());
    return config.asMap();
}
Also used : Configuration(com.enonic.xp.config.Configuration) ConfigBuilder(com.enonic.xp.config.ConfigBuilder) FileReader(java.io.FileReader) Properties(java.util.Properties)

Example 2 with Configuration

use of com.enonic.xp.config.Configuration in project xp by enonic.

the class SchedulerConfigImpl method jobs.

@Override
public Set<CreateScheduledJobParams> jobs() {
    final Configuration jobConfig = this.config.subConfig(JOB_PROPERTY_PREFIX);
    final Set<ScheduledJobName> jobNames = parseNames(jobConfig);
    return jobNames.stream().map(name -> parseProperties(name, jobConfig.subConfig(name.getValue() + "."))).collect(Collectors.toSet());
}
Also used : TimeZone(java.util.TimeZone) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Set(java.util.Set) HashMap(java.util.HashMap) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException) ConfigInterpolator(com.enonic.xp.config.ConfigInterpolator) Collectors(java.util.stream.Collectors) PropertyTreeMarshallerService(com.enonic.xp.form.PropertyTreeMarshallerService) CalendarService(com.enonic.xp.scheduler.CalendarService) Configuration(com.enonic.xp.config.Configuration) Component(org.osgi.service.component.annotations.Component) Matcher(java.util.regex.Matcher) PrincipalKey(com.enonic.xp.security.PrincipalKey) DescriptorKey(com.enonic.xp.page.DescriptorKey) Map(java.util.Map) ScheduledJobName(com.enonic.xp.scheduler.ScheduledJobName) Activate(org.osgi.service.component.annotations.Activate) ConfigBuilder(com.enonic.xp.config.ConfigBuilder) Pattern(java.util.regex.Pattern) CreateScheduledJobParams(com.enonic.xp.scheduler.CreateScheduledJobParams) Reference(org.osgi.service.component.annotations.Reference) ScheduleCalendar(com.enonic.xp.scheduler.ScheduleCalendar) Configuration(com.enonic.xp.config.Configuration) ScheduledJobName(com.enonic.xp.scheduler.ScheduledJobName)

Example 3 with Configuration

use of com.enonic.xp.config.Configuration in project xp by enonic.

the class ApplicationInfoBuilder method buildConfig.

private ScriptObjectMirror buildConfig() {
    final ScriptObjectMirror result = this.javascriptHelper.newJsObject();
    final Configuration config = this.application.getConfig();
    if (config != null) {
        result.putAll(config.asMap());
    }
    return result;
}
Also used : ScriptObjectMirror(jdk.nashorn.api.scripting.ScriptObjectMirror) Configuration(com.enonic.xp.config.Configuration)

Aggregations

Configuration (com.enonic.xp.config.Configuration)3 ConfigBuilder (com.enonic.xp.config.ConfigBuilder)2 ConfigInterpolator (com.enonic.xp.config.ConfigInterpolator)1 PropertyTreeMarshallerService (com.enonic.xp.form.PropertyTreeMarshallerService)1 DescriptorKey (com.enonic.xp.page.DescriptorKey)1 CalendarService (com.enonic.xp.scheduler.CalendarService)1 CreateScheduledJobParams (com.enonic.xp.scheduler.CreateScheduledJobParams)1 ScheduleCalendar (com.enonic.xp.scheduler.ScheduleCalendar)1 ScheduledJobName (com.enonic.xp.scheduler.ScheduledJobName)1 PrincipalKey (com.enonic.xp.security.PrincipalKey)1 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 FileReader (java.io.FileReader)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 Properties (java.util.Properties)1 Set (java.util.Set)1 TimeZone (java.util.TimeZone)1 Matcher (java.util.regex.Matcher)1 Pattern (java.util.regex.Pattern)1