Search in sources :

Example 1 with ELService

use of org.apache.oozie.service.ELService in project oozie by apache.

the class ELUtils method resolveAppName.

/**
 * Resolves the application name using the configuration properties to resolve any EL variable.
 *
 * @param name name to EL resolve.
 * @param conf configuration to use for resolving any EL variable in the name.
 *
 * @return the resolved application name.
 *
 * @throws Exception thrown if the name could not be EL resolved.
 */
public static String resolveAppName(String name, Configuration conf) throws Exception {
    ELService elService = Services.get().get(ELService.class);
    ELEvaluator elEvaluator = elService.createEvaluator("job-submit");
    Map<String, Object> map = new HashMap<String, Object>();
    for (Map.Entry<String, String> entry : conf) {
        map.put(entry.getKey(), entry.getValue());
    }
    elEvaluator.getContext().setVariables(map);
    return elEvaluator.evaluate(name, String.class);
}
Also used : HashMap(java.util.HashMap) ELService(org.apache.oozie.service.ELService) Map(java.util.Map) HashMap(java.util.HashMap)

Aggregations

HashMap (java.util.HashMap)1 Map (java.util.Map)1 ELService (org.apache.oozie.service.ELService)1