package com.emc.ecs.serviceBroker.model;

import java.util.List;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement(name = "base_url")
public class BaseUrlInfo {
	private String id;
	private Link link;
	private String name;
	private List<String> tags;
	private String baseurl;
	private Boolean namespaceInHost = false;

	public BaseUrlInfo() {
		super();
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public Link getLink() {
		return link;
	}

	public void setLink(Link link) {
		this.link = link;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public List<String> getTags() {
		return tags;
	}

	public void setTags(List<String> tags) {
		this.tags = tags;
	}

	public String getBaseurl() {
		return baseurl;
	}

	public void setBaseurl(String baseurl) {
		this.baseurl = baseurl;
	}

	@XmlElement(name = "get_namespace_in_host")
	public Boolean getNamespaceInHost() {
		return namespaceInHost;
	}

	public void setNamespaceInHost(Boolean namespaceInHost) {
		this.namespaceInHost = namespaceInHost;
	}
	
	public String getNamespaceUrl(String namespace, boolean ssl) {
		String scheme = ssl ? "https" : "http";
		if (namespaceInHost) {
			return scheme + "://" + namespace + "." + baseurl;
		} else {
			return scheme + "://" + baseurl;
		}
	}	

}

@@ -1283,16 +1283,56 @@
 %22http%22;%0A
+%09%09String port = ssl ? %229021%22 : %229020%22;%0A%0A
 %09%09if (na
@@ -1396,24 +1396,38 @@
 .%22 + baseurl
+ + %22:%22 + port 
 ;%0A%09%09%7D else %7B
@@ -1461,16 +1461,29 @@
  baseurl
+ + %22:%22 + port
 ;%0A%09%09%7D%0A%09%7D

Improve s3 endpoint location