}
}
public static GerMessageDestinationType getMessageDestination(String messageDestinationLink, Map<String, Map<String, GerMessageDestinationType>> messageDestinations) throws DeploymentException {
GerMessageDestinationType destination = null;
int pos = messageDestinationLink.indexOf('#');
if (pos > -1) {
String targetModule = messageDestinationLink.substring(0, pos);
Map<String, GerMessageDestinationType> destinations = messageDestinations.get(targetModule);
// Hmmm...if we don't find the module then something is wrong in the deployment.
if (destinations == null) {
StringBuffer sb = new StringBuffer();
for (Object o : messageDestinations.keySet()) {
sb.append(o).append("\n");
}
throw new DeploymentException("Unknown module " + targetModule + " when processing message destination " + messageDestinationLink +
"\nKnown modules in deployable unit are:\n" + sb.toString());
}
messageDestinationLink = messageDestinationLink.substring(pos + 1);
destination = destinations.get(messageDestinationLink);
} else {
for (Map<String, GerMessageDestinationType> destinations : messageDestinations.values()) {
GerMessageDestinationType destinationTest = destinations.get(messageDestinationLink);
if (destinationTest != null) {
if (destination != null) {
throw new DeploymentException("Duplicate message destination " + messageDestinationLink + " accessed from a message-destination-link without a module");
}
destination = destinationTest;