use of org.apache.knox.gateway.deploy.impl.ApplicationDeploymentContributor in project knox by apache.
the class DeploymentFactory method selectContextApplications.
private static Map<String, ServiceDeploymentContributor> selectContextApplications(GatewayConfig config, Topology topology) {
Map<String, ServiceDeploymentContributor> contributors = new HashMap<>();
if (topology != null) {
for (Application application : topology.getApplications()) {
String name = application.getName();
if (name == null || name.isEmpty()) {
throw new DeploymentException("Topologies cannot contain an application without a name.");
}
ApplicationDeploymentContributor contributor = new ApplicationDeploymentContributor(config, application);
List<String> urls = application.getUrls();
if (urls == null || urls.isEmpty()) {
urls = new ArrayList<String>(1);
urls.add("/" + name);
}
for (String url : urls) {
if (url == null || url.isEmpty() || url.equals("/")) {
if (!topology.getServices().isEmpty()) {
throw new DeploymentException(String.format("Topologies with services cannot contain an application (%s) with a root url.", name));
}
}
contributors.put(url, contributor);
}
}
}
return contributors;
}
Aggregations