Github user cestella commented on a diff in the pull request:
https://github.com/apache/incubator-metron/pull/146#discussion_r66321208
--- Diff:
metron-platform/metron-data-management/src/main/java/org/apache/metron/dataloads/nonbulk/taxii/TaxiiHandler.java
---
@@ -61,346 +63,334 @@
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
-import java.io.*;
+import java.io.IOException;
+import java.io.StringWriter;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.text.SimpleDateFormat;
import java.util.*;
public class TaxiiHandler extends TimerTask {
-private static final Logger LOG = Logger.getLogger(TaxiiHandler.class);
+ private static final Logger LOG = Logger.getLogger(TaxiiHandler.class);
-private static ThreadLocal xmlFactory = new
ThreadLocal() {
-@Override
-protected TaxiiXmlFactory initialValue() {
-return new TaxiiXmlFactory();
-}
-};
-private static ThreadLocal messageFactory = new
ThreadLocal() {
-@Override
-protected ObjectFactory initialValue() {
-return new ObjectFactory();
-}
-};
-
-private HttpClient taxiiClient;
-private URL endpoint;
-private Extractor extractor;
-private String hbaseTable;
-private String columnFamily;
-private Map connectionCache = new HashMap<>();
-private HttpClientContext context;
-private String collection;
-private String subscriptionId;
-private EnrichmentConverter converter = new EnrichmentConverter();
-private Date beginTime;
-private Configuration config;
-private boolean inProgress = false;
-private Set allowedIndicatorTypes;
-public TaxiiHandler( TaxiiConnectionConfig connectionConfig
- , Extractor extractor
- , Configuration config
- ) throws Exception
-{
-LOG.info("Loading configuration: " + connectionConfig);
-this.allowedIndicatorTypes =
connectionConfig.getAllowedIndicatorTypes();
-this.extractor = extractor;
-this.collection = connectionConfig.getCollection();
-this.subscriptionId = connectionConfig.getSubscriptionId();
-hbaseTable = connectionConfig.getTable();
-columnFamily = connectionConfig.getColumnFamily();
-this.beginTime = connectionConfig.getBeginTime();
-this.config = config;
-initializeClient(connectionConfig);
-LOG.info("Configured, starting polling " + endpoint + " for " +
collection);
+ private static ThreadLocal xmlFactory = new
ThreadLocal() {
+@Override
+protected TaxiiXmlFactory initialValue() {
+ return new TaxiiXmlFactory();
}
+ };
+ private static ThreadLocal messageFactory = new
ThreadLocal() {
+@Override
+protected ObjectFactory initialValue() {
+ return new ObjectFactory();
+}
+ };
-protected synchronized HTableInterface getTable(String table) throws
IOException {
-HTableInterface ret = connectionCache.get(table);
-if(ret == null) {
-ret = createHTable(table);
-connectionCache.put(table, ret);
-}
-return ret;
+ private HttpClient taxiiClient;
+ private URL endpoint;
+ private Extractor extractor;
+ private String hbaseTable;
+ private String columnFamily;
+ private Map connectionCache = new HashMap<>();
+ private HttpClientContext context;
+ private String collection;
+ private String subscriptionId;
+ private EnrichmentConverter converter = new EnrichmentConverter();
+ private Date beginTime;
+ private Configuration config;
+ private boolean inProgress = false;
+ private Set allowedIndicatorTypes;
+ public TaxiiHandler( TaxiiConnectionConfig connectionConfig
+ , Extractor extractor
+ , Configuration config
+ ) throws Exception
+ {
+LOG.info("Loading configuration: " + connectionConfig);
+this.allowedIndicatorTypes =
connectionConfig.getAllowedIndicatorTypes();
+this.extractor = extractor;
+this.collection = connectionConfig.getCollection();
+this.subscriptionId = connectionConfig.getSubscriptionId();
+hbaseTable = connectionConfig.getTable();
+columnFamily = connectionConfig.getColumnFamily();
+this.beginTime = connectionConfig.getBeginTime();
+this.config = config;
+initializeClient(connectionConfig);