/** From a collection find the adapter for the specified modelObject. */
  protected SCAdapter findAdapterFor(Object modelObject, Iterator iterator) {

    for (Iterator i = iterator; i.hasNext(); ) {
      SCAdapter adapter = (SCAdapter) i.next();
      if (adapter.getModel() == modelObject) return adapter;
    }
    return null;
  }
  /**
   * Builds this child adapter for the given modelObject.
   *
   * @param modelObject
   */
  protected SCAdapter adapt(Object configObject) {

    if (configObject == null) return null;

    Constructor adapterConstructor = adapterConstructorFor(configObject);

    return SCAdapter.buildsAdapterWith(adapterConstructor, new Object[] {this, configObject});
  }
  /**
   * Subclasses should override this method to add their children to the specified collection.
   *
   * @see #children()
   */
  protected void addChildrenTo(List children) {
    super.addChildrenTo(children);

    synchronized (pools) {
      children.addAll(this.pools);
    }

    if (this.readConnectionPool != null) children.add(this.readConnectionPool);

    if (this.writeConnectionPool != null) children.add(this.writeConnectionPool);

    if (this.sequenceConnectionPool != null) children.add(this.sequenceConnectionPool);
  }
  /** Initializes this adapter from the specified config model. */
  protected void initializeFromModel(Object scConfig) {

    super.initializeFromModel(scConfig);

    if (!this.platformIsXml()) {
      // TOREVIEW
      //			if( this.getReadConnectionPoolConfig() == null || this.getWriteConnectionPoolConfig() ==
      // null)
      //				throw new NoSuchElementException( this.displayString() + " ReadConnectionPool or
      // WriteConnectionPool not found.");

      this.readConnectionPool =
          (ReadConnectionPoolAdapter) this.adapt(config().getReadConnectionPoolConfig());
      this.writeConnectionPool =
          (WriteConnectionPoolAdapter) this.adapt(config().getWriteConnectionPoolConfig());
      this.sequenceConnectionPool =
          (ConnectionPoolAdapter) this.adapt(config().getSequenceConnectionPoolConfig());
      this.pools.addAll(this.adaptAll(this.getConnectionPoolConfigs()));
    }
  }
 /**
  * Initializes this new model. ReadConnectionPool, WriteConnectionPool, and SequenceConnectionPool
  * are stored in their corresponding instance variable.
  */
 protected void initialize(Object newConfig) {
   super.initialize(newConfig);
 }
  /** Initializes this adapter. */
  protected void initialize() {
    super.initialize();

    this.setConfigRequired(true);
    this.pools = new Vector();
  }
  /** Initializes this adapter from the specified config model. */
  protected void initializeFromModel(Object scConfig) {

    super.initializeFromModel(scConfig);

    this.login = getLoginFromModel();
  }
  /** Initializes this adapter. */
  protected void initialize(Object newConfig) {
    super.initialize(newConfig);

    this.setLogin(buildLogin());
  }
  /**
   * Adds the children of this adapter to the given list.
   *
   * @param children The list of children
   */
  protected void addChildrenTo(List children) {
    super.addChildrenTo(children);

    if (this.getLogin() != NullLoginAdapter.instance()) children.add(getLogin());
  }
  protected void postInitializationFromModel() {
    super.postInitializationFromModel();

    if (this.getName() == null) this.setName("unamed");
    return;
  }