예제 #1
0
  /**
   * This method return an implementation of EnvironmentFactoryIfc.
   *
   * @param classContext represents the class that desires a factory.
   * @return an implementation of EnvironmentFactoryIfc.
   */
  public EnvironmentFactoryIfc getFactory(final Class classContext) {
    final FactoryContextIfc factoryContext = FactoryContext.getSingleton();

    EnvironmentFactoryIfc retVal =
        (EnvironmentFactoryIfc) factoryContext.getFactoryForContext(this, classContext);

    if (retVal == null) {
      retVal = getDefaultFactory();
    }

    return retVal;
  }
예제 #2
0
  /** Default constructor not allowed. */
  private EnvironmentFactoryMgr() {
    final FactoryContextIfc factoryContext = FactoryContext.getSingleton();

    EnvironmentFactoryIfc defaultFactory =
        (EnvironmentFactoryIfc) factoryContext.getDefaultFactory(this);

    if (defaultFactory == null) {
      defaultFactory = DefaultEnvironmentFactory.getSingleton().getDefaultFactory();
    }

    _defaultFactory = defaultFactory;
  }