コード例 #1
0
  /**
   * Read a chunk of repository connections.
   *
   * @param rval is the place to put the read policies.
   * @param returnIndex is a map from the object id (resource id) and the rval index.
   * @param params is the set of parameters.
   */
  protected void getRepositoryConnectionsChunk(
      RepositoryConnection[] rval, Map returnIndex, ArrayList params) throws ManifoldCFException {
    ArrayList list = new ArrayList();
    String query =
        buildConjunctionClause(list, new ClauseDescription[] {new MultiClause(nameField, params)});
    IResultSet set =
        performQuery("SELECT * FROM " + getTableName() + " WHERE " + query, list, null, null);
    int i = 0;
    while (i < set.getRowCount()) {
      IResultRow row = set.getRow(i++);
      String name = row.getValue(nameField).toString();
      int index = ((Integer) returnIndex.get(name)).intValue();
      RepositoryConnection rc = new RepositoryConnection();
      rc.setIsNew(false);
      rc.setName(name);
      rc.setDescription((String) row.getValue(descriptionField));
      rc.setClassName((String) row.getValue(classNameField));
      rc.setACLAuthority((String) row.getValue(groupNameField));
      rc.setMaxConnections((int) ((Long) row.getValue(maxCountField)).longValue());
      String xml = (String) row.getValue(configField);
      if (xml != null && xml.length() > 0) rc.getConfigParams().fromXML(xml);
      rval[index] = rc;
    }

    // Do throttle part
    throttleSpecManager.getRows(rval, returnIndex, params);
  }
コード例 #2
0
    /**
     * Notify the implementing class of the existence of a cached version of the object. The object
     * is passed to this method so that the execute() method below will have it available to operate
     * on. This method is also called for all objects that are freshly created as well.
     *
     * @param objectDescription is the unique identifier of the object.
     * @param cachedObject is the cached object.
     */
    public void exists(ICacheDescription objectDescription, Object cachedObject)
        throws ManifoldCFException {
      // Cast what came in as what it really is
      RepositoryConnectionDescription objectDesc =
          (RepositoryConnectionDescription) objectDescription;
      RepositoryConnection ci = (RepositoryConnection) cachedObject;

      // Duplicate it!
      if (ci != null) ci = ci.duplicate();

      // In order to make the indexes line up, we need to use the hashtable built by
      // the constructor.
      returnValues[((Integer) returnMap.get(objectDesc.getConnectionName())).intValue()] = ci;
    }