Beispiel #1
0
  /**
   * Lists the contents of a context or subcontext. The operation is delegated to the serial
   * context.
   *
   * @return an enumeration of the contents of the context.
   * @throws NamingException if there is a naming exception.
   */
  @Override
  public NamingEnumeration<NameClassPair> list(String name) throws NamingException {
    if (name.equals("")) {
      // listing this context
      if (namingManager == null) throw new NamingException();
      return namingManager.list(myName);
    }

    // Check if 'name' names a context
    Object target = lookup(name);
    if (target instanceof Context) {
      return ((Context) target).list("");
    }
    throw new NotContextException(name + " cannot be listed");
  }