diff options
author | jjia <Jennie.Jia@amdocs.com> | 2018-12-31 12:18:59 -0500 |
---|---|---|
committer | jjia <Jennie.Jia@amdocs.com> | 2019-01-02 14:36:04 -0500 |
commit | ab1a2ed3d961919008bad949e62fcf3ba722c2ce (patch) | |
tree | 6e796cd107c4bc6dd07892461d602a2ea9ff1844 /src/main/java/org/onap | |
parent | 4ab14055e6131ff5c513b24192e84b952340ced9 (diff) |
Update Data Router with new schema ingest lib
Issue-ID: AAI-2044
Change-Id: I905ee7ce7716538a8336ff30a4a0286cb7685f2f
Signed-off-by: jjia <Jennie.Jia@amdocs.com>
Diffstat (limited to 'src/main/java/org/onap')
-rw-r--r-- | src/main/java/org/onap/aai/datarouter/Application.java | 25 | ||||
-rw-r--r-- | src/main/java/org/onap/aai/datarouter/config/SchemaConfiguration.java | 43 |
2 files changed, 64 insertions, 4 deletions
diff --git a/src/main/java/org/onap/aai/datarouter/Application.java b/src/main/java/org/onap/aai/datarouter/Application.java index 245797c..42b459d 100644 --- a/src/main/java/org/onap/aai/datarouter/Application.java +++ b/src/main/java/org/onap/aai/datarouter/Application.java @@ -24,20 +24,29 @@ import java.util.HashMap; import javax.annotation.PostConstruct; import org.apache.camel.component.servlet.CamelHttpTransportServlet; import org.eclipse.jetty.util.security.Password; +import org.onap.aai.config.EdgesConfiguration; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.web.servlet.ServletRegistrationBean; import org.springframework.boot.web.support.SpringBootServletInitializer; import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.PropertySource; import org.springframework.core.env.Environment; +import org.springframework.context.annotation.FilterType; @SpringBootApplication +@ComponentScan(basePackages = {"org.onap.aai.config", "org.onap.aai.setup", "org.onap.aai.datarouter"}, excludeFilters = { +@ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, +value = EdgesConfiguration.class)}) +@PropertySource(value = "file:${CONFIG_HOME}/schemaIngest.properties") public class Application extends SpringBootServletInitializer{ private static final String CAMEL_URL_MAPPING = "/*"; private static final String CAMEL_SERVLET_NAME = "CamelServlet"; + private static final String JETTY_OBFUSCATION_PATTERN = "OBF:"; @Autowired private Environment env; @@ -50,8 +59,6 @@ public class Application extends SpringBootServletInitializer{ HashMap<String, Object> props = new HashMap<>(); props.put("server.ssl.key-store-password", Password.deobfuscate(keyStorePassword)); new Application().configure(new SpringApplicationBuilder(Application.class).properties(props)).run(args); - - } @Bean @@ -62,7 +69,7 @@ public class Application extends SpringBootServletInitializer{ } /** - * Set required trust store system properties using values from application.properties + * Set required system properties using values from application.properties and schemaIngest.properties */ @PostConstruct public void setSystemProperties() { @@ -77,8 +84,18 @@ public class Application extends SpringBootServletInitializer{ throw new IllegalArgumentException("Env property server.ssl.key-store-password not set"); } } - } + String schemaServiceKeyStorePassword = env.getProperty("schema.service.ssl.key-store-password"); + if( (schemaServiceKeyStorePassword != null) && (schemaServiceKeyStorePassword.startsWith(JETTY_OBFUSCATION_PATTERN))){ + System.setProperty("schema.service.ssl.key-store-password", Password.deobfuscate(schemaServiceKeyStorePassword)); + } + + String schemaServiceTrustStorePassword = env.getProperty("schema.service.ssl.trust-store-password"); + if ( (schemaServiceTrustStorePassword != null) && (schemaServiceTrustStorePassword.startsWith(JETTY_OBFUSCATION_PATTERN)) ){ + System.setProperty("schema.service.ssl.trust-store-password", Password.deobfuscate(schemaServiceTrustStorePassword)); + } + + } }
\ No newline at end of file diff --git a/src/main/java/org/onap/aai/datarouter/config/SchemaConfiguration.java b/src/main/java/org/onap/aai/datarouter/config/SchemaConfiguration.java new file mode 100644 index 0000000..afcfba0 --- /dev/null +++ b/src/main/java/org/onap/aai/datarouter/config/SchemaConfiguration.java @@ -0,0 +1,43 @@ +/** + * ============LICENSE_START======================================================= + * org.onap.aai + * ================================================================================ + * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved. + * Copyright © 2017-2018 Amdocs + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.aai.datarouter.config; + +import org.onap.aai.setup.AAIConfigTranslator; +import org.onap.aai.setup.ConfigTranslator; +import org.onap.aai.setup.SchemaLocationsBean; +import org.onap.aai.setup.SchemaVersions; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.PropertySource; + +@Configuration +@PropertySource(value = "classpath:schema-ingest.properties", ignoreResourceNotFound = true) +@PropertySource(value = "file:${schema.ingest.file}", ignoreResourceNotFound = true) +public class SchemaConfiguration { + + @Bean(name = "configTranslator") + @ConditionalOnProperty(name = "schema.translator.list", havingValue = "config", matchIfMissing = true) + public ConfigTranslator configTranslator(SchemaLocationsBean schemaLocationsBean, SchemaVersions schemaVersions) { + return new AAIConfigTranslator(schemaLocationsBean, schemaVersions); + } +} |