[GitHub] incubator-metron pull request #146: METRON-203 General best practice and bug...

2016-06-13 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/incubator-metron/pull/146


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-metron pull request #146: METRON-203 General best practice and bug...

2016-06-08 Thread cestella
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);