return false;
long maxFileLength = Long.MAX_VALUE;
i = 0;
while (i < documentSpecification.getChildCount())
{
SpecificationNode sn = documentSpecification.getChild(i++);
if (sn.getType().equals(NODE_MAXLENGTH))
{
try
{
String value = sn.getAttributeValue(ATTRIBUTE_VALUE);
if (value != null && value.length() > 0)
maxFileLength = new Long(value).longValue();
}
catch (NumberFormatException e)
{
throw new ManifoldCFException("Bad number: "+e.getMessage(),e);
}
}
}
if (fileLength > maxFileLength)
return false;
}
// Scan until we match a startpoint
i = 0;
while (i < documentSpecification.getChildCount())
{
SpecificationNode sn = documentSpecification.getChild(i++);
if (sn.getType().equals(NODE_STARTPOINT))
{
// Prepend the server URL to the path, since that's what pathpart will have.
String path = mapToIdentifier(sn.getAttributeValue(ATTRIBUTE_PATH));
// Compare with filename
if (Logging.connectors.isDebugEnabled())
Logging.connectors.debug("JCIFS: Matching startpoint '"+path+"' against actual '"+pathPart+"'");
int matchEnd = matchSubPath(path,pathPart);
if (matchEnd == -1)
{
Logging.connectors.debug("JCIFS: No match");
continue;
}
Logging.connectors.debug("JCIFS: Startpoint found!");
// If this is the root, it's always included.
if (matchEnd == fileName.length())
{
Logging.connectors.debug("JCIFS: Startpoint: always included");
return true;
}
// matchEnd is the start of the rest of the path (after the match) in fileName.
// We need to walk through the rules and see whether it's in or out.
int j = 0;
while (j < sn.getChildCount())
{
SpecificationNode node = sn.getChild(j++);
String flavor = node.getType();
if (flavor.equals(NODE_INCLUDE) || flavor.equals(NODE_EXCLUDE))
{
String type = node.getAttributeValue(ATTRIBUTE_TYPE);
if (type == null)
type = "";
String indexable = node.getAttributeValue(ATTRIBUTE_INDEXABLE);
if (indexable == null)
indexable = "";
String match = node.getAttributeValue(ATTRIBUTE_FILESPEC);
// Check if there's a match against the filespec
if (Logging.connectors.isDebugEnabled())
Logging.connectors.debug("JCIFS: Checking '"+match+"' against '"+fileName.substring(matchEnd-1)+"'");
boolean isMatch = checkMatch(fileName,matchEnd-1,match);