Example usage for java.util Collections enumeration

List of usage examples for java.util Collections enumeration

Introduction

In this page you can find the example usage for java.util Collections enumeration.

Prototype

public static <T> Enumeration<T> enumeration(final Collection<T> c) 

Source Link

Document

Returns an enumeration over the specified collection.

Usage

From source file:bijian.util.upload.MyMultiPartRequest.java

public Enumeration<String> getParameterNames() {
    return Collections.enumeration(params.keySet());
}

From source file:gov.nih.nci.caarray.web.fileupload.MonitoredMultiPartRequest.java

/**
 * {@inheritDoc}
 */
public Enumeration<String> getParameterNames() {
    return Collections.enumeration(params.keySet());
}

From source file:org.opennms.netmgt.config.datacollection.SnmpCollection.java

/**
 * Method enumerateResourceType./*from  ww w.j  a  va  2 s  .c  o m*/
 * 
 * @return an Enumeration over all possible elements of this
 * collection
 */
public Enumeration<ResourceType> enumerateResourceType() {
    return Collections.enumeration(m_resourceTypes);
}

From source file:de.micromata.genome.tpsb.httpmockup.MockServletContext.java

/** Deprecated method always returns an empty enumeration. */
@Override//from   ww  w .j  ava  2  s  . c  o m
public Enumeration getServletNames() {
    return Collections.enumeration(Collections.emptySet());
}

From source file:de.micromata.genome.test.web.SimServletContext.java

@Override
@SuppressWarnings("rawtypes")
public Enumeration getServlets() {
    return Collections.enumeration(Collections.emptySet());
}

From source file:com.silverwrist.dynamo.security.AclObject.java

public Enumeration getPermissions(Principal user) {
    PrincipalID prid = new PrincipalID(user);
    Collection rc = null;//from www . j  a  v a  2  s .  c  om
    try { // is this for a user or a group?
        if (prid.isGroup()) { // compute permissions only for the group itself
            // (everything that appears in positive set but not in negative set)
            Set positive = m_ops.getGroupPermissionSetForGroup(m_aclid, prid.getID(), false);
            Set negative = m_ops.getGroupPermissionSetForGroup(m_aclid, prid.getID(), true);
            rc = CollectionUtils.subtract(positive, negative);

        } // end if
        else { // compute permissions for the user and for all groups of which the user is a member
            Set pos_group = m_ops.getGroupPermissionSetForUser(m_aclid, prid.getID(), false);
            Set neg_group = m_ops.getGroupPermissionSetForUser(m_aclid, prid.getID(), true);
            Set pos_user = m_ops.getUserPermissionSet(m_aclid, prid.getID(), false);
            Set neg_user = m_ops.getUserPermissionSet(m_aclid, prid.getID(), true);
            // "Real" groups have been normalized by removing all elements present in the corresponding
            // "other" group as well
            Collection real_pos_group = CollectionUtils.subtract(pos_group, neg_group);
            Collection real_neg_group = CollectionUtils.subtract(neg_group, pos_group);
            Collection real_pos_user = CollectionUtils.subtract(pos_user, neg_user);
            Collection real_neg_user = CollectionUtils.subtract(neg_user, pos_user);
            // "grant_group" = all permissions granted by the groups and not explicitly denied by user
            Collection grant_group = CollectionUtils.subtract(real_pos_group, real_neg_user);
            // "deny_group" = all permissions denied by the groups and not explicitly granted by user
            Collection deny_group = CollectionUtils.subtract(real_neg_group, real_pos_user);
            // "grant" - all grants from user plus all surviving grants from groups
            Collection grant = CollectionUtils.union(real_pos_user, grant_group);
            // "deny" - all denies from user plus all surviving denies from groups
            Collection deny = CollectionUtils.union(real_neg_user, deny_group);
            rc = CollectionUtils.subtract(grant, deny);

        } // end else

    } // end try
    catch (DatabaseException e) { // translate this into a SecurityRuntimeException
        throw new SecurityRuntimeException(e);

    } // end catch

    // Compute the proper return value.
    if (rc.isEmpty())
        return Collections.enumeration(Collections.EMPTY_LIST);
    ArrayList real_rc = new ArrayList(rc.size());
    Iterator it = rc.iterator();
    while (it.hasNext()) { // transform PropertyKey values into PermObjects
        PropertyKey pk = (PropertyKey) (it.next());
        real_rc.add(new PermObject(pk, m_ns_cache));

    } // end while

    return Collections.enumeration(real_rc);

}

From source file:web.MockServletContext.java

@Override
public Enumeration getServlets() {
    return Collections.enumeration(Collections.EMPTY_SET);
}

From source file:web.MockServletContext.java

@Override
public Enumeration getServletNames() {
    return Collections.enumeration(Collections.EMPTY_SET);
}

From source file:jp.terasoluna.fw.util.PropertyUtil.java

/**
 * ???????//from  www . j  a v a 2s .c om
 * @param keyPrefix ?
 * @return ?????
 */
public static Enumeration<String> getPropertyNames(String keyPrefix) {
    Map<String, String> map = props.tailMap(keyPrefix);
    Iterator<String> iter = map.keySet().iterator();
    while (iter.hasNext()) {
        String name = iter.next();
        if (!name.startsWith(keyPrefix)) {
            return Collections.enumeration(props.subMap(keyPrefix, name).keySet());
        }
    }
    return Collections.enumeration(map.keySet());
}

From source file:com.silverwrist.dynamo.security.AclObject.java

public Enumeration entries() {
    try { // get the IDs of all the ACEs
        int[] ids = m_ops.getAceIDs(m_aclid);

        // now get the ACEs themselves
        ArrayList rc = new ArrayList(ids.length);
        for (int i = 0; i < ids.length; i++)
            rc.add(m_ace_cache.getAce(ids[i]));
        return Collections.enumeration(rc);

    } // end try// w  w w  .  ja  va  2 s  .  c  o  m
    catch (DatabaseException e) { // translate this into a SecurityRuntimeException
        throw new SecurityRuntimeException(e);

    } // end catch

}