Github user cestella commented on a diff in the pull request:

    https://github.com/apache/incubator-metron/pull/119#discussion_r63115005
  
    --- Diff: 
metron-platform/metron-pcap/src/main/java/org/apache/metron/pcap/filter/query/QueryPcapFilter.java
 ---
    @@ -0,0 +1,74 @@
    +/**
    + * 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.metron.pcap.filter.query;
    +
    +import org.apache.hadoop.conf.Configuration;
    +import org.apache.metron.common.Constants;
    +import org.apache.metron.common.query.PredicateProcessor;
    +import org.apache.metron.common.query.VariableResolver;
    +import org.apache.metron.pcap.PacketInfo;
    +import org.apache.metron.pcap.PcapHelper;
    +import org.apache.metron.pcap.filter.PcapFilter;
    +import org.apache.metron.pcap.filter.PcapFilterConfigurator;
    +import org.apache.metron.pcap.filter.PcapFilters;
    +
    +import java.util.EnumMap;
    +import java.util.Map;
    +
    +public class QueryPcapFilter implements PcapFilter {
    +  public static final String QUERY_STR_CONFIG = "mql";
    +
    +  public static class Configurator implements 
PcapFilterConfigurator<String> {
    +    @Override
    +    public void addToConfig(String query, Configuration conf) {
    +      conf.set(QUERY_STR_CONFIG, query);
    +      conf.set(PCAP_FILTER_NAME_CONF, PcapFilters.QUERY.name());
    +    }
    +
    +    @Override
    +    public String queryToString(String fields) {
    +      return fields.replaceAll("\\w", "_")
    --- End diff --
    
    Actually the safest thing here is to return "". There is already a UUID in
    the file name to ensure uniqueness.
    
    On Thu, May 12, 2016 at 19:28 Michael Miklavcic <[email protected]>
    wrote:
    
    > In
    > 
metron-platform/metron-pcap/src/main/java/org/apache/metron/pcap/filter/query/QueryPcapFilter.java
    > <https://github.com/apache/incubator-metron/pull/119#discussion_r63113925>
    > :
    >
    > > +import java.util.EnumMap;
    > > +import java.util.Map;
    > > +
    > > +public class QueryPcapFilter implements PcapFilter {
    > > +  public static final String QUERY_STR_CONFIG = "mql";
    > > +
    > > +  public static class Configurator implements 
PcapFilterConfigurator<String> {
    > > +    @Override
    > > +    public void addToConfig(String query, Configuration conf) {
    > > +      conf.set(QUERY_STR_CONFIG, query);
    > > +      conf.set(PCAP_FILTER_NAME_CONF, PcapFilters.QUERY.name());
    > > +    }
    > > +
    > > +    @Override
    > > +    public String queryToString(String fields) {
    > > +      return fields.replaceAll("\\w", "_")
    >
    > Will definitely want feedback on the formatting on this one since we're
    > using the string rep for filenames.
    >
    > —
    > You are receiving this because you were mentioned.
    > Reply to this email directly or view it on GitHub
    > 
<https://github.com/apache/incubator-metron/pull/119/files/b3af68484718a66393f4b0417bc525c462afed5d#r63113925>
    >



---
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 [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to