示例#1
0
  /**
   * Creates a factory instance using the properties passed in.
   *
   * @param properties Properties to be used while creating the <code>FactoryInstance</code>.
   */
  private FactoryInstance createFactoryInstance(ConfigMap properties) {
    if (properties == null) properties = new ConfigMap();

    properties.put(FlexFactory.SOURCE, source);
    properties.put(FlexFactory.SCOPE, scope);
    FactoryInstance factoryInstance = getFactory().createFactoryInstance(getId(), properties);
    return factoryInstance;
  }
  /**
   * Initializes the <code>FactoryDestination</code> with the properties.
   *
   * @param id the factory id
   * @param properties Properties for the <code>FactoryDestination</code>.
   */
  public void initialize(String id, ConfigMap properties) {
    super.initialize(id, properties);

    if (properties == null || properties.size() == 0) return;

    // Need to cache this for later. TODO: We shouldn't need to do this.
    factoryProperties = properties;

    factoryId = properties.getPropertyAsString(FACTORY, factoryId);
    scope = properties.getPropertyAsString(FlexFactory.SCOPE, scope);
    source = properties.getPropertyAsString(FlexFactory.SOURCE, source);

    if (source == null) source = getId();

    if (factory != null) factory.initialize(getId(), factoryProperties);
  }
示例#3
0
  /** Initialize the adapter properties from the flex services-config.xml file */
  public void initialize(String id, ConfigMap properties) {
    super.initialize(id, properties);
    if (properties == null || properties.size() == 0) return;

    // properties.getProperty("hibernateFactory");
    ConfigMap adapterProps = properties.getPropertyAsMap("hibernate", new ConfigMap());
    ConfigMap adapterHibernateProps =
        adapterProps.getPropertyAsMap("sessionFactory", new ConfigMap());
    property_hibernateSessionFactoryClass =
        adapterHibernateProps.getPropertyAsString("class", property_hibernateSessionFactoryClass);
    property_getCurrentSessionMethod =
        adapterHibernateProps.getPropertyAsString(
            "getCurrentSessionMethod", property_getCurrentSessionMethod);

    ConfigMap destProps = properties.getPropertyAsMap("hibernate", new ConfigMap());
    property_loadMethod = destProps.getPropertyAsString("loadMethod", property_loadMethod);
  }