下面列出了java.util.Vector#listIterator ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
public void add(AddInterceptorChain chain, Entry entry,
LDAPConstraints constraints) throws LDAPException {
DN dn = new DN(entry.getEntry().getDN());
Vector<RDN> rdns = dn.getRDNs();
ListIterator it = rdns.listIterator();
DN newDN = new DN();
while (it.hasNext()) {
RDN rdn = (RDN) it.next();
if (! this.attribsToRemove.contains(rdn.getType().toLowerCase())) {
newDN.addRDNToBack(rdn);
}
if (this.attribsToStore.contains(rdn.getType().toLowerCase())) {
entry.getEntry().getAttributeSet().add(new LDAPAttribute(rdn.getType(),rdn.getValue()));
}
}
entry.setDN(newDN);
chain.nextAdd(entry,constraints);
}
public void delete(DeleteInterceptorChain chain, DistinguishedName dn,
LDAPConstraints constraints) throws LDAPException {
Vector<RDN> rdns = dn.getDN().getRDNs();
ListIterator it = rdns.listIterator();
DN newDN = new DN();
while (it.hasNext()) {
RDN rdn = (RDN) it.next();
if (! this.attribsToRemove.contains(rdn.getType().toLowerCase())) {
newDN.addRDN(rdn);
}
}
chain.nextDelete(dn,constraints);
}
public void add(AddInterceptorChain chain, Entry entry,
LDAPConstraints constraints) throws LDAPException {
DN dn = new DN(entry.getEntry().getDN());
Vector<RDN> rdns = dn.getRDNs();
ListIterator it = rdns.listIterator();
DN newDN = new DN();
while (it.hasNext()) {
RDN rdn = (RDN) it.next();
if (! this.attribsToRemove.contains(rdn.getType().toLowerCase())) {
newDN.addRDNToBack(rdn);
}
if (this.attribsToStore.contains(rdn.getType().toLowerCase())) {
entry.getEntry().getAttributeSet().add(new LDAPAttribute(rdn.getType(),rdn.getValue()));
}
}
entry.setDN(newDN);
chain.nextAdd(entry,constraints);
}
public void delete(DeleteInterceptorChain chain, DistinguishedName dn,
LDAPConstraints constraints) throws LDAPException {
Vector<RDN> rdns = dn.getDN().getRDNs();
ListIterator it = rdns.listIterator();
DN newDN = new DN();
while (it.hasNext()) {
RDN rdn = (RDN) it.next();
if (! this.attribsToRemove.contains(rdn.getType().toLowerCase())) {
newDN.addRDN(rdn);
}
}
chain.nextDelete(dn,constraints);
}
/**
* This will produce a List of Hashtables, each hashtable contains the initialization info for a particular resource loader. This
* Hashtable will be passed in when initializing the the template loader.
*/
private void assembleResourceLoaderInitializers()
{
Vector resourceLoaderNames = rsvc.getConfiguration().getVector(RuntimeConstants.RESOURCE_LOADERS);
for (ListIterator<String> it = resourceLoaderNames.listIterator(); it.hasNext(); )
{
/*
* The loader id might look something like the following:
*
* resource.loader.file
*
* The loader id is the prefix used for all properties
* pertaining to a particular loader.
*/
String loaderName = StringUtils.trim(it.next());
it.set(loaderName);
StringBuilder loaderID = new StringBuilder();
loaderID.append(RuntimeConstants.RESOURCE_LOADER).append('.').append(loaderName);
ExtProperties loaderConfiguration =
rsvc.getConfiguration().subset(loaderID.toString());
/*
* we can't really count on ExtProperties to give us an empty set
*/
if (loaderConfiguration == null)
{
log.debug("ResourceManager : No configuration information found "+
"for resource loader named '{}' (id is {}). Skipping it...",
loaderName, loaderID);
continue;
}
/*
* add the loader name token to the initializer if we need it
* for reference later. We can't count on the user to fill
* in the 'name' field
*/
loaderConfiguration.setProperty(RuntimeConstants.RESOURCE_LOADER_IDENTIFIER, loaderName);
/*
* Add resources to the list of resource loader
* initializers.
*/
sourceInitializerList.add(loaderConfiguration);
}
}