diff options
Diffstat (limited to 'dcae-analytics-aai/src/main/java/org/openecomp/dcae/apod/analytics/aai/domain/config')
3 files changed, 253 insertions, 0 deletions
diff --git a/dcae-analytics-aai/src/main/java/org/openecomp/dcae/apod/analytics/aai/domain/config/AAIEnrichmentConfig.java b/dcae-analytics-aai/src/main/java/org/openecomp/dcae/apod/analytics/aai/domain/config/AAIEnrichmentConfig.java new file mode 100644 index 0000000..19c284f --- /dev/null +++ b/dcae-analytics-aai/src/main/java/org/openecomp/dcae/apod/analytics/aai/domain/config/AAIEnrichmentConfig.java @@ -0,0 +1,33 @@ +/* + * ===============================LICENSE_START====================================== + * dcae-analytics + * ================================================================================ + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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.openecomp.dcae.apod.analytics.aai.domain.config; + +import java.io.Serializable; + +/** + * <p> + * Marker interface for all A&AI API Enrichment Configs + * </p> + * + * @author Rajiv Singla . Creation Date: 9/14/2017. + */ +public interface AAIEnrichmentConfig extends Serializable { +} diff --git a/dcae-analytics-aai/src/main/java/org/openecomp/dcae/apod/analytics/aai/domain/config/AAIHttpClientConfig.java b/dcae-analytics-aai/src/main/java/org/openecomp/dcae/apod/analytics/aai/domain/config/AAIHttpClientConfig.java new file mode 100644 index 0000000..37190a0 --- /dev/null +++ b/dcae-analytics-aai/src/main/java/org/openecomp/dcae/apod/analytics/aai/domain/config/AAIHttpClientConfig.java @@ -0,0 +1,131 @@ +/* + * ===============================LICENSE_START====================================== + * dcae-analytics + * ================================================================================ + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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.openecomp.dcae.apod.analytics.aai.domain.config; + +import com.google.common.base.Objects; + +import java.net.URL; + +/** + * Contains parameters required to create an instance of A&AI Http Client + * + * @author Rajiv Singla . Creation Date: 9/21/2017. + */ +public class AAIHttpClientConfig implements AAIEnrichmentConfig { + + private static final long serialVersionUID = 1L; + + private final String aaiHost; + private final Integer aaiHostPortNumber; + private final String aaiProtocol; + private final String aaiUserName; + private final String aaiUserPassword; + private final URL aaiProxyURL; + private final boolean aaiIgnoreSSLCertificateErrors; + + AAIHttpClientConfig(final String aaiHost, final Integer aaiHostPortNumber, final String aaiProtocol, + final String aaiUserName, final String aaiUserPassword, final URL aaiProxyURL, + final boolean aaiIgnoreSSLCertificateErrors) { + this.aaiHost = aaiHost; + this.aaiHostPortNumber = aaiHostPortNumber; + this.aaiProtocol = aaiProtocol; + this.aaiUserName = aaiUserName; + this.aaiUserPassword = aaiUserPassword; + this.aaiProxyURL = aaiProxyURL; + this.aaiIgnoreSSLCertificateErrors = aaiIgnoreSSLCertificateErrors; + } + + /** + * Provides A&AI Http Client Host + * + * @return A&AI Http Client Host + */ + public String getAaiHost() { + return aaiHost; + } + + /** + * Provides A&AI Http Client Host Port Number + * + * @return A&AI Http Client Host Port Number + */ + public Integer getAaiHostPortNumber() { + return aaiHostPortNumber; + } + + /** + * Provides A&AI Http Client Protocol + * + * @return A&AI Http Client Protocol + */ + public String getAaiProtocol() { + return aaiProtocol; + } + + /** + * Provides A&AI Http Client UserName + * + * @return A&AI Http Client UserName + */ + public String getAaiUserName() { + return aaiUserName; + } + + /** + * Provides A&AI Http Client UserPassword + * + * @return A&AI Http Client UserPassword + */ + public String getAaiUserPassword() { + return aaiUserPassword; + } + + /** + * Returns A&AI Proxy url + * + * @return A&AI Proxy url + */ + public URL getAaiProxyURL() { + return aaiProxyURL; + } + + /** + * Returns true if SSL Certificate errors can be ignored for A&AI Http client + * + * @return true if SSL Certificate errors can be ignored for A&AI Http client + */ + public boolean isAaiIgnoreSSLCertificateErrors() { + return aaiIgnoreSSLCertificateErrors; + } + + + @Override + public String toString() { + return Objects.toStringHelper(this) + .add("aaiHost", aaiHost) + .add("aaiHostPortNumber", aaiHostPortNumber) + .add("aaiProtocol", aaiProtocol) + .add("aaiUserName", aaiUserName) + .add("aaiProxyHost", aaiProxyURL == null ? null : aaiProxyURL.getHost()) + .add("aaiIgnoreSSLCertificateErrors", aaiIgnoreSSLCertificateErrors) + .toString(); + } +} diff --git a/dcae-analytics-aai/src/main/java/org/openecomp/dcae/apod/analytics/aai/domain/config/AAIHttpClientConfigBuilder.java b/dcae-analytics-aai/src/main/java/org/openecomp/dcae/apod/analytics/aai/domain/config/AAIHttpClientConfigBuilder.java new file mode 100644 index 0000000..3df0050 --- /dev/null +++ b/dcae-analytics-aai/src/main/java/org/openecomp/dcae/apod/analytics/aai/domain/config/AAIHttpClientConfigBuilder.java @@ -0,0 +1,89 @@ +/* + * ===============================LICENSE_START====================================== + * dcae-analytics + * ================================================================================ + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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.openecomp.dcae.apod.analytics.aai.domain.config; + +import org.openecomp.dcae.apod.analytics.common.AnalyticsConstants; + +import java.io.Serializable; +import java.net.URL; + +/** + * A&AI Http Client Config Builder used to create immutable instance of {@link AAIHttpClientConfig} + * + * @author Rajiv Singla . Creation Date: 9/21/2017. + */ +public class AAIHttpClientConfigBuilder implements Serializable { + + private static final long serialVersionUID = 1L; + + private String aaiHost; + private Integer aaiHostPortNumber; + private String aaiProtocol; + private String aaiUserName; + private String aaiUserPassword; + private URL aaiProxyURL; + private boolean aaiIgnoreSSLCertificateErrors; + + public AAIHttpClientConfigBuilder(final String aaiHost) { + this.aaiHost = aaiHost; + this.aaiHostPortNumber = AnalyticsConstants.DEFAULT_PORT_NUMBER; + this.aaiProtocol = AnalyticsConstants.DEFAULT_PROTOCOL; + this.aaiUserName = AnalyticsConstants.DEFAULT_USER_NAME; + this.aaiUserPassword = AnalyticsConstants.DEFAULT_USER_PASSWORD; + this.aaiIgnoreSSLCertificateErrors = AnalyticsConstants + .TCA_DEFAULT_AAI_ENRICHMENT_IGNORE_SSL_CERTIFICATE_ERRORS; + } + + public AAIHttpClientConfigBuilder setAaiHostPortNumber(final Integer aaiHostPortNumber) { + this.aaiHostPortNumber = aaiHostPortNumber; + return this; + } + + public AAIHttpClientConfigBuilder setAaiProtocol(final String aaiProtocol) { + this.aaiProtocol = aaiProtocol; + return this; + } + + public AAIHttpClientConfigBuilder setAaiUserName(final String aaiUserName) { + this.aaiUserName = aaiUserName; + return this; + } + + public AAIHttpClientConfigBuilder setAaiUserPassword(final String aaiUserPassword) { + this.aaiUserPassword = aaiUserPassword; + return this; + } + + public AAIHttpClientConfigBuilder setAaiProxyURL(final URL aaiProxyURL) { + this.aaiProxyURL = aaiProxyURL; + return this; + } + + public AAIHttpClientConfigBuilder setAaiIgnoreSSLCertificateErrors(final boolean aaiIgnoreSSLCertificateErrors) { + this.aaiIgnoreSSLCertificateErrors = aaiIgnoreSSLCertificateErrors; + return this; + } + + public AAIHttpClientConfig build() { + return new AAIHttpClientConfig(aaiHost, aaiHostPortNumber, aaiProtocol, aaiUserName, aaiUserPassword, + aaiProxyURL, aaiIgnoreSSLCertificateErrors); + } +} |