Author: kwright
Date: Wed Sep 17 01:05:36 2014
New Revision: 1625445
URL: http://svn.apache.org/r1625445
Log:
Pull up changes for CONNECTORS-1015 from dev_1x branch
Modified:
manifoldcf/branches/release-1.7-branch/ (props changed)
manifoldcf/branches/release-1.7-branch/CHANGES.txt
manifoldcf/branches/release-1.7-branch/connectors/documentfilter/connector/src/main/java/org/apache/manifoldcf/agents/transformation/documentfilter/DocumentFilter.java
manifoldcf/branches/release-1.7-branch/connectors/documentfilter/connector/src/main/java/org/apache/manifoldcf/agents/transformation/documentfilter/DocumentFilterConfig.java
manifoldcf/branches/release-1.7-branch/connectors/documentfilter/connector/src/main/native2ascii/org/apache/manifoldcf/agents/transformation/documentfilter/common_en_US.properties
manifoldcf/branches/release-1.7-branch/connectors/documentfilter/connector/src/main/native2ascii/org/apache/manifoldcf/agents/transformation/documentfilter/common_ja_JP.properties
manifoldcf/branches/release-1.7-branch/connectors/documentfilter/connector/src/main/native2ascii/org/apache/manifoldcf/agents/transformation/documentfilter/common_zh_CH.properties
manifoldcf/branches/release-1.7-branch/connectors/documentfilter/connector/src/main/resources/org/apache/manifoldcf/agents/transformation/documentfilter/editSpecification_Contents.html
manifoldcf/branches/release-1.7-branch/connectors/documentfilter/connector/src/main/resources/org/apache/manifoldcf/agents/transformation/documentfilter/viewSpecification.html
Propchange: manifoldcf/branches/release-1.7-branch/
------------------------------------------------------------------------------
Merged /manifoldcf/branches/dev_1x:r1620749
Merged /manifoldcf/trunk:r1620748
Modified: manifoldcf/branches/release-1.7-branch/CHANGES.txt
URL:
http://svn.apache.org/viewvc/manifoldcf/branches/release-1.7-branch/CHANGES.txt?rev=1625445&r1=1625444&r2=1625445&view=diff
==============================================================================
--- manifoldcf/branches/release-1.7-branch/CHANGES.txt (original)
+++ manifoldcf/branches/release-1.7-branch/CHANGES.txt Wed Sep 17 01:05:36 2014
@@ -8,6 +8,10 @@ CONNECTORS-1031: Fix Zookeeper synchroni
against short tick time settings.
(Karl Wright)
+CONNECTORS-1015: Add minimum file size to Allowed Documents
+transformation filter.
+(David Morana, Karl Wright)
+
CONNECTORS-1016: Recognize non-existent user.
(David Morana, Karl Wright)
Modified:
manifoldcf/branches/release-1.7-branch/connectors/documentfilter/connector/src/main/java/org/apache/manifoldcf/agents/transformation/documentfilter/DocumentFilter.java
URL:
http://svn.apache.org/viewvc/manifoldcf/branches/release-1.7-branch/connectors/documentfilter/connector/src/main/java/org/apache/manifoldcf/agents/transformation/documentfilter/DocumentFilter.java?rev=1625445&r1=1625444&r2=1625445&view=diff
==============================================================================
---
manifoldcf/branches/release-1.7-branch/connectors/documentfilter/connector/src/main/java/org/apache/manifoldcf/agents/transformation/documentfilter/DocumentFilter.java
(original)
+++
manifoldcf/branches/release-1.7-branch/connectors/documentfilter/connector/src/main/java/org/apache/manifoldcf/agents/transformation/documentfilter/DocumentFilter.java
Wed Sep 17 01:05:36 2014
@@ -122,6 +122,7 @@ public class DocumentFilter extends org.
protected static void fillInContentsSpecificationMap(Map<String,Object>
paramMap, Specification os)
{
+ String minFileSize = DocumentFilterConfig.MINLENGTH_DEFAULT;
String maxFileSize = DocumentFilterConfig.MAXLENGTH_DEFAULT;
String allowedMimeTypes = DocumentFilterConfig.MIMETYPES_DEFAULT;
String allowedFileExtensions = DocumentFilterConfig.EXTENSIONS_DEFAULT;
@@ -130,11 +131,14 @@ public class DocumentFilter extends org.
SpecificationNode sn = os.getChild(i);
if (sn.getType().equals(DocumentFilterConfig.NODE_MAXLENGTH))
maxFileSize =
sn.getAttributeValue(DocumentFilterConfig.ATTRIBUTE_VALUE);
+ else if (sn.getType().equals(DocumentFilterConfig.NODE_MINLENGTH))
+ minFileSize =
sn.getAttributeValue(DocumentFilterConfig.ATTRIBUTE_VALUE);
else if (sn.getType().equals(DocumentFilterConfig.NODE_MIMETYPES))
allowedMimeTypes = sn.getValue();
else if (sn.getType().equals(DocumentFilterConfig.NODE_EXTENSIONS))
allowedFileExtensions = sn.getValue();
}
+ paramMap.put("MINFILESIZE",minFileSize);
paramMap.put("MAXFILESIZE",maxFileSize);
paramMap.put("MIMETYPES",allowedMimeTypes);
paramMap.put("EXTENSIONS",allowedFileExtensions);
@@ -230,7 +234,24 @@ public class DocumentFilter extends org.
String seqPrefix = "s"+connectionSequenceNumber+"_";
String x;
-
+
+ x = variableContext.getParameter(seqPrefix+"minfilesize");
+ if (x != null)
+ {
+ int i = 0;
+ while (i < os.getChildCount())
+ {
+ SpecificationNode node = os.getChild(i);
+ if (node.getType().equals(DocumentFilterConfig.NODE_MINLENGTH))
+ os.removeChild(i);
+ else
+ i++;
+ }
+ SpecificationNode sn = new
SpecificationNode(DocumentFilterConfig.NODE_MINLENGTH);
+ sn.setAttribute(DocumentFilterConfig.ATTRIBUTE_VALUE,x);
+ os.addChild(os.getChildCount(),sn);
+ }
+
x = variableContext.getParameter(seqPrefix+"maxfilesize");
if (x != null)
{
@@ -333,9 +354,11 @@ public class DocumentFilter extends org.
private final Set<String> extensions = new HashSet<String>();
private final Set<String> mimeTypes = new HashSet<String>();
+ private final Long minLength;
private final Long lengthCutoff;
public SpecPacker(Specification os) {
+ Long minLength = null;
Long lengthCutoff = null;
String extensions = null;
String mimeTypes = null;
@@ -349,8 +372,12 @@ public class DocumentFilter extends org.
} else if (sn.getType().equals(DocumentFilterConfig.NODE_MAXLENGTH)) {
String value =
sn.getAttributeValue(DocumentFilterConfig.ATTRIBUTE_VALUE);
lengthCutoff = new Long(value);
+ } else if (sn.getType().equals(DocumentFilterConfig.NODE_MINLENGTH)) {
+ String value =
sn.getAttributeValue(DocumentFilterConfig.ATTRIBUTE_VALUE);
+ minLength = new Long(value);
}
}
+ this.minLength = minLength;
this.lengthCutoff = lengthCutoff;
fillSet(this.extensions, extensions);
fillSet(this.mimeTypes, mimeTypes);
@@ -361,9 +388,9 @@ public class DocumentFilter extends org.
int index = 0;
// Max length
- final StringBuilder sb = new StringBuilder();
if (packedString.length() > index) {
if (packedString.charAt(index++) == '+') {
+ final StringBuilder sb = new StringBuilder();
index = unpack(sb,packedString,index,'+');
this.lengthCutoff = new Long(sb.toString());
} else
@@ -384,6 +411,18 @@ public class DocumentFilter extends org.
for (String extension : extensionsBuffer) {
this.extensions.add(extension);
}
+
+ // Min length
+ if (packedString.length() > index) {
+ if (packedString.charAt(index++) == '+') {
+ final StringBuilder sb = new StringBuilder();
+ index = unpack(sb,packedString,index,'+');
+ this.minLength = new Long(sb.toString());
+ } else
+ this.minLength = null;
+ } else
+ this.minLength = null;
+
}
public String toPackedString() {
@@ -415,14 +454,24 @@ public class DocumentFilter extends org.
}
java.util.Arrays.sort(extensions);
packList(sb,extensions,'+');
+
+ // Min length
+ if (minLength == null)
+ sb.append('-');
+ else {
+ sb.append('+');
+ pack(sb,minLength.toString(),'+');
+ }
return sb.toString();
}
public boolean checkLengthIndexable(long length) {
- if (lengthCutoff == null)
- return true;
- return (length <= lengthCutoff.longValue());
+ if (minLength != null && length < minLength.longValue())
+ return false;
+ if (lengthCutoff != null && length > lengthCutoff.longValue())
+ return false;
+ return true;
}
public boolean checkMimeType(String mimeType) {
Modified:
manifoldcf/branches/release-1.7-branch/connectors/documentfilter/connector/src/main/java/org/apache/manifoldcf/agents/transformation/documentfilter/DocumentFilterConfig.java
URL:
http://svn.apache.org/viewvc/manifoldcf/branches/release-1.7-branch/connectors/documentfilter/connector/src/main/java/org/apache/manifoldcf/agents/transformation/documentfilter/DocumentFilterConfig.java?rev=1625445&r1=1625444&r2=1625445&view=diff
==============================================================================
---
manifoldcf/branches/release-1.7-branch/connectors/documentfilter/connector/src/main/java/org/apache/manifoldcf/agents/transformation/documentfilter/DocumentFilterConfig.java
(original)
+++
manifoldcf/branches/release-1.7-branch/connectors/documentfilter/connector/src/main/java/org/apache/manifoldcf/agents/transformation/documentfilter/DocumentFilterConfig.java
Wed Sep 17 01:05:36 2014
@@ -26,6 +26,8 @@ public class DocumentFilterConfig {
// Configuration parameters
// Specification nodes and values
+ public static final String NODE_MINLENGTH = "minlength";
+ public static final String MINLENGTH_DEFAULT = "0";
public static final String NODE_MAXLENGTH = "maxlength";
public static final String MAXLENGTH_DEFAULT = "16777216";
public static final String NODE_MIMETYPES = "mimetypes";
Modified:
manifoldcf/branches/release-1.7-branch/connectors/documentfilter/connector/src/main/native2ascii/org/apache/manifoldcf/agents/transformation/documentfilter/common_en_US.properties
URL:
http://svn.apache.org/viewvc/manifoldcf/branches/release-1.7-branch/connectors/documentfilter/connector/src/main/native2ascii/org/apache/manifoldcf/agents/transformation/documentfilter/common_en_US.properties?rev=1625445&r1=1625444&r2=1625445&view=diff
==============================================================================
---
manifoldcf/branches/release-1.7-branch/connectors/documentfilter/connector/src/main/native2ascii/org/apache/manifoldcf/agents/transformation/documentfilter/common_en_US.properties
(original)
+++
manifoldcf/branches/release-1.7-branch/connectors/documentfilter/connector/src/main/native2ascii/org/apache/manifoldcf/agents/transformation/documentfilter/common_en_US.properties
Wed Sep 17 01:05:36 2014
@@ -14,6 +14,7 @@
# limitations under the License.
DocumentFilter.ContentsTabName=Allowed contents
+DocumentFilter.MinFileSizeBytesColon=Min file size (bytes):
DocumentFilter.MaxFileSizeBytesColon=Max file size (bytes):
DocumentFilter.AllowedMIMETypesColon=Allowed MIME types:
DocumentFilter.AllowedFileExtensionsColon=Allowed file extensions:
Modified:
manifoldcf/branches/release-1.7-branch/connectors/documentfilter/connector/src/main/native2ascii/org/apache/manifoldcf/agents/transformation/documentfilter/common_ja_JP.properties
URL:
http://svn.apache.org/viewvc/manifoldcf/branches/release-1.7-branch/connectors/documentfilter/connector/src/main/native2ascii/org/apache/manifoldcf/agents/transformation/documentfilter/common_ja_JP.properties?rev=1625445&r1=1625444&r2=1625445&view=diff
==============================================================================
---
manifoldcf/branches/release-1.7-branch/connectors/documentfilter/connector/src/main/native2ascii/org/apache/manifoldcf/agents/transformation/documentfilter/common_ja_JP.properties
(original)
+++
manifoldcf/branches/release-1.7-branch/connectors/documentfilter/connector/src/main/native2ascii/org/apache/manifoldcf/agents/transformation/documentfilter/common_ja_JP.properties
Wed Sep 17 01:05:36 2014
@@ -14,6 +14,7 @@
# limitations under the License.
DocumentFilter.ContentsTabName=ã³ã³ãã³ã
+DocumentFilter.MinFileSizeBytesColon=Min file size (ãã¤ã):
DocumentFilter.MaxFileSizeBytesColon=æå¤§ãã¡ã¤ã«ãµã¤ãº (ãã¤ã):
DocumentFilter.AllowedMIMETypesColon=å©ç¨å¯è½ãªMIMEã¿ã¤ãï¼
DocumentFilter.AllowedFileExtensionsColon=å©ç¨å¯è½ãªãã¡ã¤ã«æ¡å¼µåï¼
Modified:
manifoldcf/branches/release-1.7-branch/connectors/documentfilter/connector/src/main/native2ascii/org/apache/manifoldcf/agents/transformation/documentfilter/common_zh_CH.properties
URL:
http://svn.apache.org/viewvc/manifoldcf/branches/release-1.7-branch/connectors/documentfilter/connector/src/main/native2ascii/org/apache/manifoldcf/agents/transformation/documentfilter/common_zh_CH.properties?rev=1625445&r1=1625444&r2=1625445&view=diff
==============================================================================
---
manifoldcf/branches/release-1.7-branch/connectors/documentfilter/connector/src/main/native2ascii/org/apache/manifoldcf/agents/transformation/documentfilter/common_zh_CH.properties
(original)
+++
manifoldcf/branches/release-1.7-branch/connectors/documentfilter/connector/src/main/native2ascii/org/apache/manifoldcf/agents/transformation/documentfilter/common_zh_CH.properties
Wed Sep 17 01:05:36 2014
@@ -14,6 +14,7 @@
# limitations under the License.
DocumentFilter.ContentsTabName=Allowed contents
+DocumentFilter.MinFileSizeBytesColon=Min file size (bytes):
DocumentFilter.MaxFileSizeBytesColon=Max file size (bytes):
DocumentFilter.AllowedMIMETypesColon=Allowed MIME types:
DocumentFilter.AllowedFileExtensionsColon=Allowed file extensions:
Modified:
manifoldcf/branches/release-1.7-branch/connectors/documentfilter/connector/src/main/resources/org/apache/manifoldcf/agents/transformation/documentfilter/editSpecification_Contents.html
URL:
http://svn.apache.org/viewvc/manifoldcf/branches/release-1.7-branch/connectors/documentfilter/connector/src/main/resources/org/apache/manifoldcf/agents/transformation/documentfilter/editSpecification_Contents.html?rev=1625445&r1=1625444&r2=1625445&view=diff
==============================================================================
---
manifoldcf/branches/release-1.7-branch/connectors/documentfilter/connector/src/main/resources/org/apache/manifoldcf/agents/transformation/documentfilter/editSpecification_Contents.html
(original)
+++
manifoldcf/branches/release-1.7-branch/connectors/documentfilter/connector/src/main/resources/org/apache/manifoldcf/agents/transformation/documentfilter/editSpecification_Contents.html
Wed Sep 17 01:05:36 2014
@@ -20,6 +20,13 @@
<table class="displaytable">
<tr>
<td class="description">
+
<nobr>$Encoder.bodyEscape($ResourceBundle.getString('DocumentFilter.MinFileSizeBytesColon'))</nobr>
+ </td>
+ <td class="value"><input name="s${SEQNUM}_minfilesize" type="text"
+ value="$Encoder.attributeEscape($MINFILESIZE)" size="24" /></td>
+ </tr>
+ <tr>
+ <td class="description">
<nobr>$Encoder.bodyEscape($ResourceBundle.getString('DocumentFilter.MaxFileSizeBytesColon'))</nobr>
</td>
<td class="value"><input name="s${SEQNUM}_maxfilesize" type="text"
@@ -43,6 +50,7 @@
#else
+<input type="hidden" name="s${SEQNUM}_minfilesize"
value="$Encoder.attributeEscape($MINFILESIZE)" />
<input type="hidden" name="s${SEQNUM}_maxfilesize"
value="$Encoder.attributeEscape($MAXFILESIZE)" />
<input type="hidden" name="s${SEQNUM}_mimetypes"
value="$Encoder.attributeEscape($MIMETYPES)" />
<input type="hidden" name="s${SEQNUM}_extensions"
value="$Encoder.attributeEscape($EXTENSIONS)" />
Modified:
manifoldcf/branches/release-1.7-branch/connectors/documentfilter/connector/src/main/resources/org/apache/manifoldcf/agents/transformation/documentfilter/viewSpecification.html
URL:
http://svn.apache.org/viewvc/manifoldcf/branches/release-1.7-branch/connectors/documentfilter/connector/src/main/resources/org/apache/manifoldcf/agents/transformation/documentfilter/viewSpecification.html?rev=1625445&r1=1625444&r2=1625445&view=diff
==============================================================================
---
manifoldcf/branches/release-1.7-branch/connectors/documentfilter/connector/src/main/resources/org/apache/manifoldcf/agents/transformation/documentfilter/viewSpecification.html
(original)
+++
manifoldcf/branches/release-1.7-branch/connectors/documentfilter/connector/src/main/resources/org/apache/manifoldcf/agents/transformation/documentfilter/viewSpecification.html
Wed Sep 17 01:05:36 2014
@@ -17,6 +17,10 @@
<table class="displaytable">
<tr>
+ <td
class="description"><nobr>$Encoder.bodyEscape($ResourceBundle.getString('DocumentFilter.MinFileSizeBytesColon'))</nobr></td>
+ <td class="value">$Encoder.bodyEscape($MINFILESIZE)</td>
+ </tr>
+ <tr>
<td
class="description"><nobr>$Encoder.bodyEscape($ResourceBundle.getString('DocumentFilter.MaxFileSizeBytesColon'))</nobr></td>
<td class="value">$Encoder.bodyEscape($MAXFILESIZE)</td>
</tr>