Example #1
0
  /**
   * This method will store the argument <code>factoryName/implName</code> mapping in such a way
   * that {@link #getFactory} will find this mapping when searching for a match.
   *
   * <p>
   *
   * <p>This method has no effect if <code>getFactory()</code> has already been called looking for a
   * factory for this <code>factoryName</code>.
   *
   * <p>
   *
   * <p>This method can be used by implementations to store a factory mapping while parsing the
   * Faces configuration file
   *
   * @throws IllegalArgumentException if <code>factoryName</code> does not identify a standard
   *     JavaServer Faces factory name
   * @throws NullPointerException if <code>factoryname</code> is null
   */
  public static void setFactory(String factoryName, String implName) {

    validateFactoryName(factoryName);

    // Identify the web application class loader
    ClassLoader classLoader = getClassLoader();

    FactoryManager manager = FACTORIES_CACHE.getApplicationFactoryManager(classLoader);
    manager.addFactory(factoryName, implName);
  }