<commit_before>package org.ow2.chameleon.rose.pubsubhubbub.hub;

import static org.osgi.framework.FrameworkUtil.createFilter;

import java.io.IOException;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Dictionary;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Map;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.felix.ipojo.ConfigurationException;
import org.apache.felix.ipojo.Factory;
import org.apache.felix.ipojo.MissingHandlerException;
import org.apache.felix.ipojo.UnacceptableConfiguration;
import org.apache.felix.ipojo.annotations.Component;
import org.apache.felix.ipojo.annotations.Property;
import org.apache.felix.ipojo.annotations.Requires;
import org.apache.felix.ipojo.annotations.Validate;
import org.apache.http.HttpStatus;
import org.apache.http.client.HttpClient;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager;
import org.osgi.framework.BundleContext;
import org.osgi.framework.Constants;
import org.osgi.framework.InvalidSyntaxException;
import org.osgi.framework.ServiceReference;
import org.osgi.service.http.HttpService;
import org.osgi.service.http.NamespaceException;
import org.osgi.service.log.LogService;
import org.osgi.service.remoteserviceadmin.EndpointDescription;
import org.osgi.service.remoteserviceadmin.RemoteConstants;
import org.osgi.util.tracker.ServiceTracker;
import org.osgi.util.tracker.ServiceTrackerCustomizer;
import org.ow2.chameleon.json.JSONService;
import org.ow2.chameleon.syndication.FeedEntry;
import org.ow2.chameleon.syndication.FeedReader;

/**
 * Component class to work as Hub in Pubsubhubbub technology, specially modified
 * to work with Rose
 * 
 * @author Bartek
 * 
 */
@Component(name = "Rose_Pubsubhubbub.hub")
public class Hub extends HttpServlet {

	/**
	 * 
	 */
	private static final long serialVersionUID = -1526708334275691196L;

	private static final String FEED_READER_FACTORY_FILTER = "(&("
			+ Constants.OBJECTCLASS
			+ "=org.apache.felix.ipojo.Factory)(factory.name=org.ow2.chameleon.syndication.rome.reader))";
	private static final String READER_SERVICE_CLASS = "org.ow2.chameleon.syndication.FeedReader";
	private static final String READER_FILTER_PROPERTY = "org.ow2.chameleon.syndication.feed.url";
	private static final String ENDPOINT_ADD = "endpoint.add";
	private static final String ENDPOINT_REMOVE = "endpoint.remove";
	private static final String TOPIC_DELETE = "topic.delete";

	
	@Requires
	private HttpService httpService;

	@Requires
	private JSONService json;

	@Requires(optional = true)
	private LogService logger;

	@Property(name = "hub.url")
	private String hubServlet;

	
	
	// HTTP response status code<commit_msg>fix the hub.url property to required<commit_after>package org.ow2.chameleon.rose.pubsubhubbub.hub;

import static org.osgi.framework.FrameworkUtil.createFilter;

import java.io.IOException;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Dictionary;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Map;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.felix.ipojo.ConfigurationException;
import org.apache.felix.ipojo.Factory;
import org.apache.felix.ipojo.MissingHandlerException;
import org.apache.felix.ipojo.UnacceptableConfiguration;
import org.apache.felix.ipojo.annotations.Component;
import org.apache.felix.ipojo.annotations.Property;
import org.apache.felix.ipojo.annotations.Requires;
import org.apache.felix.ipojo.annotations.Validate;
import org.apache.http.HttpStatus;
import org.apache.http.client.HttpClient;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager;
import org.osgi.framework.BundleContext;
import org.osgi.framework.Constants;
import org.osgi.framework.InvalidSyntaxException;
import org.osgi.framework.ServiceReference;
import org.osgi.service.http.HttpService;
import org.osgi.service.http.NamespaceException;
import org.osgi.service.log.LogService;
import org.osgi.service.remoteserviceadmin.EndpointDescription;
import org.osgi.service.remoteserviceadmin.RemoteConstants;
import org.osgi.util.tracker.ServiceTracker;
import org.osgi.util.tracker.ServiceTrackerCustomizer;
import org.ow2.chameleon.json.JSONService;
import org.ow2.chameleon.syndication.FeedEntry;
import org.ow2.chameleon.syndication.FeedReader;

/**
 * Component class to work as Hub in Pubsubhubbub technology, specially modified
 * to work with Rose
 * 
 * @author Bartek
 * 
 */
@Component(name = "Rose_Pubsubhubbub.hub")
public class Hub extends HttpServlet {

	/**
	 * 
	 */
	private static final long serialVersionUID = -1526708334275691196L;

	private static final String FEED_READER_FACTORY_FILTER = "(&("
			+ Constants.OBJECTCLASS
			+ "=org.apache.felix.ipojo.Factory)(factory.name=org.ow2.chameleon.syndication.rome.reader))";
	private static final String READER_SERVICE_CLASS = "org.ow2.chameleon.syndication.FeedReader";
	private static final String READER_FILTER_PROPERTY = "org.ow2.chameleon.syndication.feed.url";
	private static final String ENDPOINT_ADD = "endpoint.add";
	private static final String ENDPOINT_REMOVE = "endpoint.remove";
	private static final String TOPIC_DELETE = "topic.delete";

	
	@Requires
	private HttpService httpService;

	@Requires
	private JSONService json;

	@Requires(optional = true)
	private LogService logger;

	@Property(name = "hub.url", mandatory=true)
	private String hubServlet;

	
	
	// HTTP response status code
{'fraction_non_alphanumeric': 0.1000514844688519, 'fraction_numerical': 0.008923974600995366, 'mean_word_length': 5.9052132701421804, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '536787', 'n_tokens_mistral': 1882, 'n_tokens_neox': 1825, 'n_words': 341}