code: public String getEnvironmentNameForExtension(String extension) {
        Preconditions.checkArgument(StringUtils.isNotNullOrBlank(extension), "Extension name cannot be null or empty");
        ScriptEngine engine = engineManager.getEngineByExtension(extension);
        Preconditions.checkArgument(engine != null, extension + " is not a recognized scripting extension.");
        return engine.getFactory().getLanguageName();
     }
docs: Gets the scripting environment name given the script extension.
  
  @param extension the scripting environment extension
  @return the scripting environment name