Java Code Examples for java.util.Vector#listIterator()

The following examples show how to use java.util.Vector#listIterator() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FlattenNamespace.java    From MyVirtualDirectory with Apache License 2.0 6 votes vote down vote up
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);

}
 
Example 2
Source File: FlattenNamespace.java    From MyVirtualDirectory with Apache License 2.0 6 votes vote down vote up
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);
}
 
Example 3
Source File: FlattenNamespace.java    From MyVirtualDirectory with Apache License 2.0 6 votes vote down vote up
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);

}
 
Example 4
Source File: FlattenNamespace.java    From MyVirtualDirectory with Apache License 2.0 6 votes vote down vote up
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);
}
 
Example 5
Source File: ResourceManagerImpl.java    From velocity-engine with Apache License 2.0 4 votes vote down vote up
/**
 * 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);
    }
}