Ejemplo n.º 1
0
  public StoreResource getStoreResource(final Type _type, final long _fileId)
      throws EFapsException {
    StoreResource storeRsrc = null;

    // TODO: dynamic class loading instead of hard coded store resource name
    String provider = _type.getProperty("StoreResource");
    if (provider.equals("org.efaps.db.transaction.JDBCStoreResource")) {
      storeRsrc = new JDBCStoreResource(this, _type, _fileId);
    } else {
      storeRsrc = new VFSStoreResource(this, _type, _fileId);
    }
    System.out.println("storeRsrc.getContext()=" + storeRsrc.getContext());
    storeRsrc.open();
    this.storeStore.add(storeRsrc);
    return storeRsrc;
  }
Ejemplo n.º 2
0
  /**
   * The method tests if all resources (JDBC connection and store resources) are closed, that means
   * that the resources are freeed and returned for reuse.
   *
   * @return <i>true</i> if all resources are closed, otherwise <i>false</i> is returned
   * @see #connectionStore
   * @see #storeStore
   */
  public boolean allConnectionClosed() {
    boolean closed = true;

    for (ConnectionResource con : this.connectionStore) {
      if (con.isOpened()) {
        closed = false;
        break;
      }
    }

    if (closed) {
      for (StoreResource store : this.storeStore) {
        if (store.isOpened()) {
          closed = false;
          break;
        }
      }
    }

    return closed;
  }