2 * ============LICENSE_START=======================================================
\r
4 * ================================================================================
\r
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
\r
6 * ================================================================================
\r
7 * Copyright (C) 2017 Amdocs
\r
8 * =============================================================================
\r
9 * Licensed under the Apache License, Version 2.0 (the "License");
\r
10 * you may not use this file except in compliance with the License.
\r
11 * You may obtain a copy of the License at
\r
13 * http://www.apache.org/licenses/LICENSE-2.0
\r
15 * Unless required by applicable law or agreed to in writing, software
\r
16 * distributed under the License is distributed on an "AS IS" BASIS,
\r
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
18 * See the License for the specific language governing permissions and
\r
19 * limitations under the License.
\r
21 * ECOMP is a trademark and service mark of AT&T Intellectual Property.
\r
22 * ============LICENSE_END=========================================================
\r
25 package org.openecomp.appc.adapter.iaas.impl;
\r
27 import java.util.Properties;
\r
29 import com.att.eelf.configuration.EELFLogger;
\r
30 import com.att.eelf.configuration.EELFManager;
\r
32 public class ServiceCatalogFactory {
\r
34 private static EELFLogger logger= EELFManager.getInstance().getLogger(org.openecomp.appc.adapter.iaas.impl.ServiceCatalogFactory.class);
\r
37 * This method accepts a fully qualified identity service URL and uses that to determine which version of the
\r
38 * serviceCatalog to load.
\r
40 * @param url The parsed URL of the identity service
\r
41 * @param projectIdentifier The project or tenant to be used to connect to the service
\r
42 * @param principal The principal or user to be used to connect to the service
\r
43 * @param ceredential The credential or password to be used to connect to the service
\r
44 * @param properties Properties object for proxy information
\r
45 * @return The serviceCatalog for identity service version specified in the url, null if not supported.
\r
47 public static ServiceCatalog getServiceCatalog(String url, String projectIdentifier, String principal,
\r
48 String credential, String domain, Properties properties) {
\r
49 IdentityURL idUrl = IdentityURL.parseURL(url);
\r
51 logger.error("Url " + url + " could not be parsed.");
\r
54 String version = idUrl.getVersion();
\r
55 if(version == null){
\r
56 logger.error("Invalid Identity URL check configuration");
\r
59 String prefix = version.split("\\.")[0];
\r
60 if (prefix != null) {
\r
63 return new ServiceCatalogV2(url, projectIdentifier, principal, credential, properties);
\r
65 return new ServiceCatalogV3(url, projectIdentifier, principal, credential, domain, properties);
\r