From 2cfbe194ef913b3ca55ffc02f31692b1cff7f02a Mon Sep 17 00:00:00 2001 From: bcopy <brice.copy@cern.ch> Date: Thu, 18 Jan 2018 10:54:26 +0100 Subject: [PATCH] update to dynconfig v0.2 --- pom.xml | 4 ++-- .../C2MonAtmosphereApplication.java | 17 +++++++++++++++ src/main/resources/application.properties | 2 -- src/main/resources/application.yaml | 21 +++++++++++++++++++ 4 files changed, 40 insertions(+), 4 deletions(-) delete mode 100644 src/main/resources/application.properties create mode 100644 src/main/resources/application.yaml diff --git a/pom.xml b/pom.xml index c6c75d9..cf8967c 100644 --- a/pom.xml +++ b/pom.xml @@ -14,7 +14,7 @@ <parent> <groupId>cern.c2mon.client</groupId> <artifactId>c2mon-client</artifactId> - <version>1.8.29</version> + <version>1.8.30-SNAPSHOT</version> </parent> <scm> @@ -73,7 +73,7 @@ <dependency> <groupId>cern.c2mon.client</groupId> <artifactId>c2mon-client-ext-dynconfig</artifactId> - <version>[0.1.0-SNAPSHOT,)</version> + <version>[0.2.0-SNAPSHOT,)</version> </dependency> <dependency> diff --git a/src/main/java/cern/c2mon/client/atmosphere/C2MonAtmosphereApplication.java b/src/main/java/cern/c2mon/client/atmosphere/C2MonAtmosphereApplication.java index ab8e0e8..20c9fb8 100644 --- a/src/main/java/cern/c2mon/client/atmosphere/C2MonAtmosphereApplication.java +++ b/src/main/java/cern/c2mon/client/atmosphere/C2MonAtmosphereApplication.java @@ -1,5 +1,7 @@ package cern.c2mon.client.atmosphere; +import java.util.Arrays; +import java.util.Collection; import java.util.Collections; import javax.servlet.ServletContext; @@ -10,6 +12,7 @@ import org.atmosphere.cpr.ContainerInitializer; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.builder.SpringApplicationBuilder; +import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.web.servlet.ServletContextInitializer; import org.springframework.boot.web.servlet.ServletRegistrationBean; import org.springframework.boot.web.support.SpringBootServletInitializer; @@ -22,7 +25,11 @@ import org.springframework.web.servlet.config.annotation.CorsRegistry; import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; +import cern.c2mon.client.ext.dynconfig.strategy.DipConfigStrategy; +import cern.c2mon.client.ext.dynconfig.strategy.ITagConfigurationStrategy; + @SpringBootApplication +@EnableConfigurationProperties @ComponentScan("cern.c2mon.client.ext.dynconfig") public class C2MonAtmosphereApplication extends SpringBootServletInitializer { @Override @@ -44,6 +51,7 @@ public class C2MonAtmosphereApplication extends SpringBootServletInitializer { .allowedMethods("PUT", "DELETE","GET", "POST", "HEAD", "OPTIONS"); } } + @Bean public EmbeddedAtmosphereInitializer atmosphereInitializer() { @@ -77,4 +85,13 @@ public class C2MonAtmosphereApplication extends SpringBootServletInitializer { public static void main(String[] args) { SpringApplication.run(C2MonAtmosphereApplication.class, args); } + + + /** + * Dynconfig configuration strategies setup + */ + @Bean + Collection<ITagConfigurationStrategy> getDynConfigTagConfigurationStrategies(){ + return Arrays.asList(new ITagConfigurationStrategy[]{new DipConfigStrategy()}); + } } diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties deleted file mode 100644 index 1ebcbca..0000000 --- a/src/main/resources/application.properties +++ /dev/null @@ -1,2 +0,0 @@ -server.servlet-path=/* -server.contextPath=/c2mon-atmo \ No newline at end of file diff --git a/src/main/resources/application.yaml b/src/main/resources/application.yaml new file mode 100644 index 0000000..632c223 --- /dev/null +++ b/src/main/resources/application.yaml @@ -0,0 +1,21 @@ +server: + servlet-path: "/*" + contextPath: "/c2mon-atmo" + +c2mon.dynconfig: + mappings: + - processName: "DYNDIP" + processId: 1001 + equipmentName: "DYNDIP.defaultEquipment" + processDescription: "DIP DAQ Process" + uriPattern: "dip://.*" + metadata: + domain: "GPN" + - processName: "DYNOPCUA" + equipmentName: "DYNOPCUA.defaultEquipment" + processDescription: "OPCUA DAQ Process" + uriPattern: "opcua://.*" + metadata: + server: "my-opc-ua-server.cern.ch" + namespace: 1 + \ No newline at end of file -- GitLab