Search in sources :

Example 6 with ACL

use of org.apache.zookeeper_voltpatches.data.ACL in project voltdb by VoltDB.

the class DataTree method serializeList.

private synchronized void serializeList(Map<Long, List<ACL>> longKeyMap, OutputArchive oa) throws IOException {
    oa.writeInt(longKeyMap.size(), "map");
    Set<Map.Entry<Long, List<ACL>>> set = longKeyMap.entrySet();
    for (Map.Entry<Long, List<ACL>> val : set) {
        oa.writeLong(val.getKey(), "long");
        List<ACL> aclList = val.getValue();
        oa.startVector(aclList, "acls");
        for (ACL acl : aclList) {
            acl.serialize(oa, "acl");
        }
        oa.endVector(aclList, "acls");
    }
}
Also used : ACL(org.apache.zookeeper_voltpatches.data.ACL) ArrayList(java.util.ArrayList) List(java.util.List) HashMap(java.util.HashMap) Map(java.util.Map) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap)

Example 7 with ACL

use of org.apache.zookeeper_voltpatches.data.ACL in project voltdb by VoltDB.

the class DataTree method deserializeList.

private void deserializeList(Map<Long, List<ACL>> longKeyMap, InputArchive ia) throws IOException {
    int i = ia.readInt("map");
    while (i > 0) {
        Long val = ia.readLong("long");
        if (aclIndex < val) {
            aclIndex = val;
        }
        List<ACL> aclList = new ArrayList<ACL>();
        Index j = ia.startVector("acls");
        while (!j.done()) {
            ACL acl = new ACL();
            acl.deserialize(ia, "acl");
            aclList.add(acl);
            j.incr();
        }
        longKeyMap.put(val, aclList);
        aclKeyMap.put(aclList, val);
        i--;
    }
}
Also used : ArrayList(java.util.ArrayList) ACL(org.apache.zookeeper_voltpatches.data.ACL) Index(org.apache.jute_voltpatches.Index)

Example 8 with ACL

use of org.apache.zookeeper_voltpatches.data.ACL in project voltdb by VoltDB.

the class DataTree method listACLEquals.

/**
     * compare two list of acls. if there elements are in the same order and the
     * same size then return true else return false
     *
     * @param lista
     *            the list to be compared
     * @param listb
     *            the list to be compared
     * @return true if and only if the lists are of the same size and the
     *         elements are in the same order in lista and listb
     */
private boolean listACLEquals(List<ACL> lista, List<ACL> listb) {
    if (lista.size() != listb.size()) {
        return false;
    }
    for (int i = 0; i < lista.size(); i++) {
        ACL a = lista.get(i);
        ACL b = listb.get(i);
        if (!a.equals(b)) {
            return false;
        }
    }
    return true;
}
Also used : ACL(org.apache.zookeeper_voltpatches.data.ACL)

Aggregations

ACL (org.apache.zookeeper_voltpatches.data.ACL)8 ArrayList (java.util.ArrayList)3 LinkedList (java.util.LinkedList)2 List (java.util.List)2 Id (org.apache.zookeeper_voltpatches.data.Id)2 HashMap (java.util.HashMap)1 Map (java.util.Map)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 Index (org.apache.jute_voltpatches.Index)1 Stat (org.apache.zookeeper_voltpatches.data.Stat)1 AuthenticationProvider (org.apache.zookeeper_voltpatches.server.auth.AuthenticationProvider)1