public String buildEmrClusterName(String namespaceCd,String emrDefinitionName,String clusterName){
  String tokenDelimiter=configurationHelper.getProperty(ConfigurationValue.TEMPLATE_TOKEN_DELIMITER);
  String namespaceToken=tokenDelimiter + "namespace" + tokenDelimiter;
  String emrDefinitionToken=tokenDelimiter + "emrDefinitionName" + tokenDelimiter;
  String clusterNameToken=tokenDelimiter + "clusterName" + tokenDelimiter;
  Map<String,String> pathToTokenValueMap=new HashMap<>();
  pathToTokenValueMap.put(namespaceToken,namespaceCd);
  pathToTokenValueMap.put(emrDefinitionToken,emrDefinitionName);
  pathToTokenValueMap.put(clusterNameToken,clusterName);
  String defaultClusterNameTemplate=namespaceToken + "." + emrDefinitionToken+ "."+ clusterNameToken;
  String emrClusterName=configurationHelper.getProperty(ConfigurationValue.EMR_CLUSTER_NAME_TEMPLATE);
  if (emrClusterName == null) {
    emrClusterName=defaultClusterNameTemplate;
  }
  for (  Map.Entry<String,String> mapEntry : pathToTokenValueMap.entrySet()) {
    emrClusterName=emrClusterName.replaceAll(mapEntry.getKey(),mapEntry.getValue());
  }
  return emrClusterName;
}

public String buildEmrClusterName ( String namespaceCd , String emrDefinitionName , String clusterName ) { String tokenDelimiter = configurationHelper . getProperty ( ConfigurationValue . TEMPLATE_TOKEN_DELIMITER ) ; String namespaceToken = tokenDelimiter + "namespace" + tokenDelimiter ; String emrDefinitionToken = tokenDelimiter + "emrDefinitionName" + tokenDelimiter ; String clusterNameToken = tokenDelimiter + "clusterName" + tokenDelimiter ; Map < String , String > pathToTokenValueMap = new HashMap < > ( ) ; pathToTokenValueMap . put ( namespaceToken , namespaceCd ) ; pathToTokenValueMap . put ( emrDefinitionToken , emrDefinitionName ) ; pathToTokenValueMap . put ( clusterNameToken , clusterName ) ; String defaultClusterNameTemplate = namespaceToken + "." + emrDefinitionToken + "." + clusterNameToken ; String emrClusterName = configurationHelper . getProperty ( ConfigurationValue . EMR_CLUSTER_NAME_TEMPLATE ) ; if ( emrClusterName == null ) { emrClusterName = defaultClusterNameTemplate ; } for ( Map . Entry < String , String > mapEntry : pathToTokenValueMap . entrySet ( ) ) { emrClusterName = emrClusterName . replaceAll ( mapEntry . getKey ( ) , mapEntry . getValue ( ) ) ; } return emrClusterName ; }
returns emr cluster name constructed according to the template defined .
