rzo1 commented on code in PR #1728:
URL: https://github.com/apache/stormcrawler/pull/1728#discussion_r2537152036


##########
core/src/main/java/org/apache/stormcrawler/pii/PiiBolt.java:
##########
@@ -0,0 +1,194 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.stormcrawler.pii;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.storm.task.OutputCollector;
+import org.apache.storm.task.TopologyContext;
+import org.apache.storm.topology.OutputFieldsDeclarer;
+import org.apache.storm.topology.base.BaseRichBolt;
+import org.apache.storm.tuple.Fields;
+import org.apache.storm.tuple.Tuple;
+import org.apache.storm.tuple.Values;
+import org.apache.stormcrawler.Metadata;
+import org.apache.stormcrawler.util.ConfUtils;
+import org.apache.stormcrawler.util.InitialisationUtil;
+import org.slf4j.LoggerFactory;
+
+import java.nio.charset.StandardCharsets;
+import java.util.Map;
+
+/**
+ * StormCrawler bolt that performs PII redaction on the content of web pages
+ * before they are passed to the indexing or persistence bolt.<br>
+ * If enabled, the HTML content will be overwritten with a dummy HTML page 
(containing just "REDACTED")<br><br>
+ * <b>pii.redacter.class</b> is the name of the class implementing the 
PiiInterface interface (e.g. org.apache.stormcrawler.pii.PresidioRedacter)<br>
+ * <b>pii.language.field</b>, if set, allows to set the name of a Metadata 
field that contains the language to be passed to the PII redacter instance
+ * 
+ */
+@SuppressWarnings("serial")
+public class PiiBolt extends BaseRichBolt {
+
+       private static final org.slf4j.Logger LOG = 
LoggerFactory.getLogger(PiiBolt.class);
+
+       /*
+        *  Name of config field defining the PII Redacter class
+        * (This class must implement the PiiRedacter interface
+        */
+       public static final String PII_REDACTER_CLASS_PARAM = 
"pii.redacter.class";
+
+       /*
+        * Name of the field for configurating language detection
+        */
+       public static final String PII_DETECT_LANGUAGE_PARAM = 
"pii.detect.language";
+
+       /*
+        * Name of the field for defining Metadata field containing language
+        */
+       public static final String PII_LANGUAGE_FIELD = "pii.language.field";
+
+       /*
+        * Name of the field for disabling PII removal
+        */
+       public static final String PII_ENABLE_FIELD = "pii.removal.enable";
+
+       private static final String FIELD_URL = "url";
+       private static final String FIELD_CONTENT = "content";
+       private static final String FIELD_METADATA = "metadata";
+       private static final String FIELD_TEXT = "text";
+
+
+       // Default value for language metadata field
+       private String languageFieldName = "parse.lang";
+
+       OutputCollector _collector;

Review Comment:
   I was looking at `OutputCollector _collector;` :)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to