code: public static String findApplicationName( final File templateDir, final File templateFile ) {
  
  		final File parentDir = templateFile.getParentFile();
  		final String appName;
  
  		// No intermediate directory, the template is global!
  		if( templateDir.equals( parentDir ))
  			appName = null;
  
  		// One intermediate directory: the template is specific to one application.
  		// The name of the application is the name of the intermediate directory.
  		else if( templateDir.equals( parentDir.getParentFile()))
  			appName = parentDir.getName();
  
  		// Too many levels!
  		else
  			throw new IllegalArgumentException( "Not a template file: " + templateFile );
  
  		return appName;
  	}
docs: Finds an application name from a template file.
  
  @param templateDir the templates root directory, the one being watched by the TemplateWatcher
  @param templateFile the template file
  @return name of the application targeted by the given template file, or {@code null} for a template global to all applications
  @throws IllegalStateException if the provided {@code templateFile} does not match