Merge "Reorder modifiers"
[so.git] / adapters / mso-adapter-utils / src / main / java / org / openecomp / mso / cloud / CloudIdentity.java
index 0f15dea..07f0546 100644 (file)
 
 package org.openecomp.mso.cloud;
 
-import java.io.IOException;
-import java.net.URISyntaxException;
 import java.security.GeneralSecurityException;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.codehaus.jackson.annotate.JsonProperty;
-import org.codehaus.jackson.map.JsonSerializer;
-import org.codehaus.jackson.JsonGenerator;
-import org.codehaus.jackson.map.SerializerProvider;
-import org.codehaus.jackson.map.annotate.JsonDeserialize;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-import org.codehaus.jackson.JsonProcessingException;
-
-import org.openecomp.mso.openstack.exceptions.MsoAdapterException;
-import org.openecomp.mso.openstack.exceptions.MsoException;
-import org.openecomp.mso.openstack.utils.MsoCommonUtils;
-import org.openecomp.mso.openstack.utils.MsoKeystoneUtils;
-import org.openecomp.mso.openstack.utils.MsoTenantUtils;
-import org.openecomp.mso.openstack.utils.MsoTenantUtilsFactory;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.woorea.openstack.keystone.model.Authentication;
+import com.woorea.openstack.keystone.model.authentication.UsernamePassword;
 import org.openecomp.mso.cloud.authentication.AuthenticationMethodFactory;
 import org.openecomp.mso.cloud.authentication.AuthenticationWrapper;
-import org.openecomp.mso.cloud.authentication.models.RackspaceAuthentication;
 import org.openecomp.mso.cloud.authentication.wrappers.RackspaceAPIKeyWrapper;
 import org.openecomp.mso.cloud.authentication.wrappers.UsernamePasswordWrapper;
 import org.openecomp.mso.logger.MessageEnum;
 import org.openecomp.mso.logger.MsoLogger;
-
-import com.woorea.openstack.keystone.model.authentication.UsernamePassword;
+import org.openecomp.mso.openstack.exceptions.MsoException;
+import org.openecomp.mso.openstack.utils.MsoKeystoneUtils;
+import org.openecomp.mso.openstack.utils.MsoTenantUtils;
+import org.openecomp.mso.openstack.utils.MsoTenantUtilsFactory;
 import org.openecomp.mso.utils.CryptoUtils;
-import com.woorea.openstack.keystone.model.Authentication;
 
 /**
  * JavaBean JSON class for a CloudIdentity. This bean represents a cloud identity
@@ -137,14 +123,6 @@ public class CloudIdentity {
         this.id = id;
     }
 
-    //DEPRECATED
-    public String getKeystoneUrl () throws MsoException {
-       if (this.identityServerType.equals(IdentityServerType.KEYSTONE))
-               return this.identityUrl;
-       else
-               return null;
-    }
-    
     public String getKeystoneUrl (String regionId, String msoPropID) throws MsoException {
        if (IdentityServerType.KEYSTONE.equals(this.identityServerType)) {
                return this.identityUrl;
@@ -160,15 +138,11 @@ public class CloudIdentity {
                }
        }
     }
-    
-    public Authentication getAuthentication () throws MsoException {
+
+       public Authentication getAuthentication() {
        if (this.getIdentityAuthenticationType() != null) {
-                       try {
                        return AuthenticationMethodFactory.getAuthenticationFor(this);
-                       } catch (IllegalAccessException | InstantiationException | ClassNotFoundException | IOException | URISyntaxException e) {
-                               throw new MsoAdapterException("Could not retrieve authentication for " + this.identityAuthenticationType, e);
-                       }
-       } else { // Fallback
+       } else {
                return new UsernamePassword(this.getMsoId(), this.getMsoPass());
        }
     }
@@ -253,29 +227,18 @@ public class CloudIdentity {
        public void setIdentityAuthenticationType(IdentityAuthenticationType identityAuthenticationType) {
                this.identityAuthenticationType = identityAuthenticationType;
        }
-       
+
        @Override
     public String toString () {
-        StringBuilder stringBuilder = new StringBuilder ();
-        stringBuilder.append ("Cloud Identity Service: id=")
-                     .append (id)
-                     .append (", identityUrl=")
-                     .append (this.identityUrl)
-                     .append (", msoId=")
-                     .append (msoId)
-                     .append (", adminTenant=")
-                     .append (adminTenant)
-                     .append (", memberRole=")
-                     .append (memberRole)
-                     .append (", tenantMetadata=")
-                     .append (tenantMetadata)
-                     .append (", identityServerType=")
-                     .append (identityServerType == null ? "null" : identityServerType.toString())
-                     .append (", identityAuthenticationType=")
-                     .append (identityAuthenticationType == null ? "null" : identityAuthenticationType.toString());
-        
-        return stringBuilder.toString ();
-    }
+               return "Cloud Identity Service: id=" + id +
+                       ", identityUrl=" + this.identityUrl +
+                       ", msoId=" + msoId +
+                       ", adminTenant=" + adminTenant +
+                       ", memberRole=" + memberRole +
+                       ", tenantMetadata=" + tenantMetadata +
+                       ", identityServerType=" + (identityServerType == null ? "null" : identityServerType.toString()) +
+                       ", identityAuthenticationType=" + (identityAuthenticationType == null ? "null" : identityAuthenticationType.toString());
+       }
 
     public static String encryptPassword (String msoPass) {
         try {