Пример #1
0
  /**
   * Creates a CNBindingEnumeration object.
   *
   * @param ctx Context to enumerate
   */
  CNBindingEnumeration(CNCtx ctx, boolean isLookedUpCtx, Hashtable env) {
    // Get batch size to use
    String batch = (env != null ? (String) env.get(javax.naming.Context.BATCHSIZE) : null);
    if (batch != null) {
      try {
        batchsize = Integer.parseInt(batch);
      } catch (NumberFormatException e) {
        throw new IllegalArgumentException("Batch size not numeric: " + batch);
      }
    }
    _ctx = ctx;
    _ctx.incEnumCount();
    this.isLookedUpCtx = isLookedUpCtx;
    _env = env;
    _bindingList = new BindingListHolder();
    BindingIteratorHolder _bindingIterH = new BindingIteratorHolder();

    // Perform listing and request that bindings be returned in _bindingIter
    // Upon return,_bindingList returns a zero length list
    _ctx._nc.list(0, _bindingList, _bindingIterH);

    _bindingIter = _bindingIterH.value;

    // Get first batch using _bindingIter
    if (_bindingIter != null) {
      more = _bindingIter.next_n(batchsize, _bindingList);
    } else {
      more = false;
    }
    counter = 0;
  }
Пример #2
0
 /** Get the next batch using _bindingIter. Update the 'more' field. */
 private boolean getMore() throws NamingException {
   try {
     more = _bindingIter.next_n(batchsize, _bindingList);
     counter = 0; // reset
   } catch (Exception e) {
     more = false;
     NamingException ne = new NamingException("Problem getting binding list");
     ne.setRootCause(e);
     throw ne;
   }
   return more;
 }