/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* Given an enumeration of candidates, check whether each
* item in enumeration satifies the given filter.
* Each item is a Binding and the following is used to get its
* attributes for used by the filter:
*
* ((DirContext)item.getObject()).getAttributes("").
* If item.getObject() is not an DirContext, the item is skipped
*
* The items in the enumeration are obtained one at a time as
* items from the search enumeration are requested.
*
* @author Rosanna Lee
*/
private boolean useFactory = true;
this.candidates = candidates;
this.cons = new SearchControls();
} else {
}
}
this.candidates = candidates;
this.useFactory = useFactory;
this.cons = new SearchControls();
} else {
}
}
}
// find and do not remove from list
return findNextMatch(false) != null;
}
public boolean hasMoreElements() {
try {
return hasMore();
} catch (NamingException e) {
return false;
}
}
try {
return findNextMatch(true);
} catch (NamingException e) {
throw new NoSuchElementException(e.toString());
}
}
// find and remove from list
return (findNextMatch(true));
}
if (candidates != null) {
candidates.close();
}
}
if (remove) {
}
return answer;
} else {
// need to find next match
while (candidates.hasMore()) {
if (obj instanceof DirContext) {
if (!cons.getReturningObjFlag()) {
} else if (useFactory) {
try {
// Give name only if context non-null,
// otherewise, name will be interpreted relative
// to initial context (not what we want)
} catch (NamingException e) {
throw e;
} catch (Exception e) {
"problem generating object using object factory");
e2.setRootCause(e);
throw e2;
}
}
true);
if (!remove)
return answer;
}
}
}
return null;
}
}
}