TargAttrFilterList.java revision 040cba63ba4af5bed76846f0edb63c853b009da9
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at legal-notices/CDDLv1_0.txt.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information:
* Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*
*
* Copyright 2008 Sun Microsystems, Inc.
* Portions Copyright 2013-2014 ForgeRock AS
*/
/**
* The TargAttrFilterList class represents an targattrfilters list. A
* targattrfilters list looks like:
*
* "Op=attr1:F1 [(&& attr2:F2)*]
*/
public class TargAttrFilterList {
/**
* The mask corresponding to the operation of this list (add or del).
*/
private int mask=0;
/**
* ListHashMap keyed by the attribute type and mapping to the corresponding
* search filter. LinkedHashMap is used so everything is in order.
*/
/**
* Regular expression group count.
*/
private static int expectedGroupCount=2;
/**
* Regular expression attribute group position.
*/
private static int attributePos=1;
/**
* Regular expression filter group position.
*/
private static int filterPos=2;
/**
* Regular expression used to match a filter list including the strange "and"
* token used to join the multiple attribute type filter pairs.
*/
private static final String filterListSeperator =
/**
* Regular expression used to match an attribute filter pair.
*/
private static final String attributeFilter=
ZERO_OR_MORE_WHITESPACE + "(\\({1}.*\\){1})";
/**
* Construct a class representing an targattrfilters filter list.
* @param mask The mask representing the operation.
* @param attrFilterList The list map containing the attribute type
* filter mappings.
*/
public TargAttrFilterList(int mask,
this.attrFilterList=attrFilterList;
}
/**
* Decode an TargAttrFilterList from the specified expression string.
* @param mask The mask representing the operation.
* @param expression The expression string to decode.
* @return A TargAttrFilterList class representing the targattrfilters
* filter list.
* @throws AciException If the expression string contains errors.
*/
throws AciException {
//Iterate over each sub-expression, parse and add them to the list
//if there are no errors.
//Match the attribute:filter pair part of the expression
throw new AciException(message);
}
//Strip off any options, so it will match the filter option
//handling.
if (semicolon != -1)
}
//Check if it is a valid filter and add it to the list map if ok.
try {
} catch (DirectoryException ex) {
throw new AciException(message);
}
//Verify the filter components. This check assures that each
//attribute type in the filter matches the provided attribute type.
}
}
/**
* Verify the filter component attribute types by assuring that each
* attribute type in the filter matches the specified attribute type.
* @param filter The filter to verify.
* @param type The attribute type to use in the verification.
* @throws AciException If the filter contains an attribute type not
* specified.
*/
throws AciException {
switch (filter.getFilterType()) {
case AND:
case OR: {
}
break;
}
case NOT: {
break;
}
default: {
throw new AciException(
}
}
}
}
/**
* Return the mask of this TargAttrFilterList.
* @return The mask value.
*/
public int getMask() {
return this.mask;
}
/**
* Check if the mask value of this TargAttrFilterList class contains the
* specified mask value.
* @param mask The mask to check for.
* @return True if the mask matches the specified value.
*/
}
/**
* Return the list map holding the attribute type to filter mappings.
* @return The list map.
*/
public
return attrFilterList;
}
}