// Path: c3po-api/src/main/java/com/petpet/c3po/api/adaptor/PreProcessingRule.java
// public interface PreProcessingRule extends ProcessingRule {
// 
//   /**
//    * Returns true if the property and value should be skipped for some reason.
//    * 
//    * The adaptors should invoke this method for each raw record and skip the
//    * meta data record if the method returns true.
//    * 
//    * @param property
//    *          the property of the record.
//    * @param value
//    *          the value for the given property.
//    * @param status
//    *          the status if it is known.
//    * @param tool
//    *          the tool that provides this record.
//    * @param version
//    *          the version of the tool that provides this record.
//    * @return true if the record should be skipped, false otherwise.
//    */
//   boolean shouldSkip( String property, String value, String status, String tool, String version );
// 
// }


import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashSet;
import java.util.Set;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.petpet.c3po.api.adaptor.PreProcessingRule;
/*******************************************************************************
 * Copyright 2013 Petar Petrov <me@petarpetrov.org>
 * 
 * Licensed 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 com.petpet.c3po.adaptor.rules;




/**
 * A {@link PreProcessingRule} that cleans up values provided by a special tool
 * bundled in FITS by TU Wien. Note that this rule is turned off by default and
 * can be enabled via the .c3poconfig file with the following key set to true:
 * 'c3po.rule.html_info_processing'.
 * 
 * @author Petar Petrov <me@petarpetrov.org>
 * 
 */
public class HtmlInfoProcessingRule implements PreProcessingRule {

  /**
   * A default logger.
   */
  private static final Logger LOG = LoggerFactory.getLogger( HtmlInfoProcessingRule.class );

  /**
   * A set of valid html tags.
   */
  private Set<String> tags;

  public HtmlInfoProcessingRule() {
    this.tags = new HashSet<String>();
    this.readTags();
  }

  /**
   * Reads the valid html tags into memory.
   */
  private void readTags() {
    try {
// Path: c3po-api/src/main/java/com/petpet/c3po/api/adaptor/PreProcessingRule.java
// public interface PreProcessingRule extends ProcessingRule {
// 
//   /**
//    * Returns true if the property and value should be skipped for some reason.
//    * 
//    * The adaptors should invoke this method for each raw record and skip the
//    * meta data record if the method returns true.
//    * 
//    * @param property
//    *          the property of the record.
//    * @param value
//    *          the value for the given property.
//    * @param status
//    *          the status if it is known.
//    * @param tool
//    *          the tool that provides this record.
//    * @param version
//    *          the version of the tool that provides this record.
//    * @return true if the record should be skipped, false otherwise.
//    */
//   boolean shouldSkip( String property, String value, String status, String tool, String version );
// 
// }


// Path: c3po-core/src/main/java/com/petpet/c3po/adaptor/rules/HtmlInfoProcessingRule.java
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashSet;
import java.util.Set;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.petpet.c3po.api.adaptor.PreProcessingRule;

/*******************************************************************************
 * Copyright 2013 Petar Petrov <me@petarpetrov.org>
 * 
 * Licensed 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 com.petpet.c3po.adaptor.rules;




/**
 * A {@link PreProcessingRule} that cleans up values provided by a special tool
 * bundled in FITS by TU Wien. Note that this rule is turned off by default and
 * can be enabled via the .c3poconfig file with the following key set to true:
 * 'c3po.rule.html_info_processing'.
 * 
 * @author Petar Petrov <me@petarpetrov.org>
 * 
 */
public class HtmlInfoProcessingRule implements PreProcessingRule {

  /**
   * A default logger.
   */
  private static final Logger LOG = LoggerFactory.getLogger( HtmlInfoProcessingRule.class );

  /**
   * A set of valid html tags.
   */
  private Set<String> tags;

  public HtmlInfoProcessingRule() {
    this.tags = new HashSet<String>();
    this.readTags();
  }

  /**
   * Reads the valid html tags into memory.
   */
  private void readTags() {
    try {
      BufferedReader reader = new BufferedReader( new InputStreamReader( HtmlInfoProcessingRule.class.getClassLoader()