Projects >> splunk-shuttl >>c22c9b4fdd2b79e3d294248f20220a0e54b7641d

Chunk
Conflicting content
 */
public class SplunkConfiguration {

<<<<<<< HEAD
    // hadoop job keys
=======
    public static final String SPLUNKHOST = "splunk.host";
    public static final String SPLUNKINDEX = "splunk.index";
    public static final String SPLUNKSOURCETYPE = "splunk.sourcetype";
>>>>>>> 6b5d03f9198af662f1ec7cd79ae2dd707fe5fd0a
    public static final String INDEXBYHOST = "INDEXBYHOST";
    public final static String SPLUNKPORT = "splunk.port";
    public final static String USERNAME = "username";
Solution content
 */
public class SplunkConfiguration {

    public static final String SPLUNKHOST = "splunk.host";
    public static final String SPLUNKINDEX = "splunk.index";
    public static final String SPLUNKSOURCETYPE = "splunk.sourcetype";
    public static final String INDEXBYHOST = "INDEXBYHOST";
    public final static String SPLUNKPORT = "splunk.port";
    public final static String USERNAME = "username";
File
SplunkConfiguration.java
Developer's decision
Version 2
Kind of conflict
Attribute
Comment
Chunk
Conflicting content
    public final static String TIMEFORMAT = "time_format";
    public final static String NUMSPLITS = "numsplits";
    public final static String SPLUNKEVENTREADER = "splunkeventreader";
<<<<<<< HEAD
=======
    public final static String SPLUNK_SEARCH_URL = "/servicesNS/admin/search/search/jobs/export";
>>>>>>> 6b5d03f9198af662f1ec7cd79ae2dd707fe5fd0a
    public final static String INDEXHOST = "indexhost";

    public final static String SPLUNKDEFAULTSOURCETYPE = "hadoop_event";
Solution content
    public final static String TIMEFORMAT = "time_format";
    public final static String NUMSPLITS = "numsplits";
    public final static String SPLUNKEVENTREADER = "splunkeventreader";
    public final static String SPLUNK_SEARCH_URL = "/servicesNS/admin/search/search/jobs/export";
    public final static String INDEXHOST = "indexhost";

    public final static String SPLUNKDEFAULTSOURCETYPE = "hadoop_event";
File
SplunkConfiguration.java
Developer's decision
Version 2
Kind of conflict
Attribute
Chunk
Conflicting content
	    String username, String password) {
	job.set(SPLUNKHOST, host);
	job.setInt(SPLUNKPORT, port);
<<<<<<< HEAD
=======
	job.set(USERNAME, username);
	job.set(PASSWORD, password);
	job.set(SPLUNKSOURCETYPE, SPLUNKDEFAULTSOURCETYPE);
	job.set(SPLUNKINDEX, SPLUNKDEFAULTINDEX);
    }

    public static void setConnInfo(JobConf job, String username, String password) {
	job.set(SPLUNKHOST, SPLUNKDEFAULTHOST);
	job.setInt(SPLUNKPORT, SPLUNKDEFAULTPORT);
	job.set(USERNAME, username);
	job.set(PASSWORD, password);
	job.set(SPLUNKSOURCETYPE, SPLUNKDEFAULTSOURCETYPE);
	job.set(SPLUNKINDEX, SPLUNKDEFAULTINDEX);
    }

    public static void setJobConf(JobConf job, String host, int port,
	    String sourcetype, String index, String username, String password) {
	job.set(SPLUNKHOST, host);
	job.setInt(SPLUNKPORT, port);
	job.set(USERNAME, username);
	job.set(PASSWORD, password);
	job.set(SPLUNKSOURCETYPE, sourcetype);
	job.set(SPLUNKINDEX, index);
    }

    public void setJobConf(JobConf job, String username, String password) {
	job.set(SPLUNKHOST, host);
	job.set(SPLUNKSOURCETYPE, sourceType);
	job.set(SPLUNKINDEX, splunkIndex);
	job.setInt(SPLUNKPORT, mgmtPort);
>>>>>>> 6b5d03f9198af662f1ec7cd79ae2dd707fe5fd0a
	job.set(USERNAME, username);
	job.set(PASSWORD, password);
    }
Solution content
	    String username, String password) {
	job.set(SPLUNKHOST, host);
	job.setInt(SPLUNKPORT, port);
	job.set(USERNAME, username);
	job.set(PASSWORD, password);
	job.set(SPLUNKSOURCETYPE, SPLUNKDEFAULTSOURCETYPE);
	job.set(SPLUNKINDEX, SPLUNKDEFAULTINDEX);
    }

    public static void setConnInfo(JobConf job, String username, String password) {
	job.set(SPLUNKHOST, SPLUNKDEFAULTHOST);
	job.setInt(SPLUNKPORT, SPLUNKDEFAULTPORT);
	job.set(USERNAME, username);
	job.set(PASSWORD, password);
	job.set(SPLUNKSOURCETYPE, SPLUNKDEFAULTSOURCETYPE);
	job.set(SPLUNKINDEX, SPLUNKDEFAULTINDEX);
    }

    public static void setJobConf(JobConf job, String host, int port,
	    String sourcetype, String index, String username, String password) {
	job.set(SPLUNKHOST, host);
	job.setInt(SPLUNKPORT, port);
	job.set(USERNAME, username);
	job.set(PASSWORD, password);
	job.set(SPLUNKSOURCETYPE, sourcetype);
	job.set(SPLUNKINDEX, index);
    }

    public void setJobConf(JobConf job, String username, String password) {
	job.set(SPLUNKHOST, host);
	job.set(SPLUNKSOURCETYPE, sourceType);
	job.set(SPLUNKINDEX, splunkIndex);
	job.setInt(SPLUNKPORT, mgmtPort);
	job.set(USERNAME, username);
	job.set(PASSWORD, password);
    }
File
SplunkConfiguration.java
Developer's decision
Version 2
Kind of conflict
Method declaration
Method invocation
Method signature
Chunk
Conflicting content
	    }
	}
    }
<<<<<<< HEAD
=======

    protected void parseConfig(String confpath) throws FileNotFoundException,
	    IOException {
	Properties prop = new Properties();
	prop.load(new FileInputStream(confpath));

	String hostname = prop.getProperty("host");
	String srctype = prop.getProperty("sourcetype");
	String index = prop.getProperty("index");
	String port = prop.getProperty("port");

	if (hostname != null) {
	    host = hostname;
	}

	if (srctype != null) {
	    sourceType = srctype;
	}

	if (index != null) {
	    splunkIndex = index;
	}

	if (port != null) {
	    mgmtPort = Integer.parseInt(port);
	}
    }

>>>>>>> 6b5d03f9198af662f1ec7cd79ae2dd707fe5fd0a
}
Solution content
	    }
	}
    }

    protected void parseConfig(String confpath) throws FileNotFoundException,
	    IOException {
	Properties prop = new Properties();
	prop.load(new FileInputStream(confpath));

	String hostname = prop.getProperty("host");
	String srctype = prop.getProperty("sourcetype");
	String index = prop.getProperty("index");
	String port = prop.getProperty("port");

	if (hostname != null) {
	    host = hostname;
	}

	if (srctype != null) {
	    sourceType = srctype;
	}

	if (index != null) {
	    splunkIndex = index;
	}

	if (port != null) {
	    mgmtPort = Integer.parseInt(port);
	}
    }

}
File
SplunkConfiguration.java
Developer's decision
Version 2
Kind of conflict
Method declaration
Chunk
Conflicting content
		    .setCredentials(
	}

	private void configureCredentials() {
<<<<<<< HEAD
	    Args args = new Args();
	    args.put("username", job.get(SplunkConfiguration.USERNAME));
	    args.put("password", job.get(SplunkConfiguration.PASSWORD));
	    args.put("host", job.get(SplunkConfiguration.SPLUNKHOST));
	    args.put("port", job.getInt(SplunkConfiguration.SPLUNKPORT, 8089));
	    service = Service.connect(args);
=======
	    ((AbstractHttpClient) httpclient).getCredentialsProvider()
			    new AuthScope(host, job.getInt(
				    SplunkConfiguration.SPLUNKPORT,
				    SplunkConfiguration.SPLUNKDEFAULTPORT)),
			    new UsernamePasswordCredentials(job
				    .get(SplunkConfiguration.USERNAME), job
				    .get(SplunkConfiguration.PASSWORD)));
>>>>>>> 6b5d03f9198af662f1ec7cd79ae2dd707fe5fd0a
	}

	private void addQueryParameters() {
Solution content
	}

	private void configureCredentials() {
	    Args args = new Args();
	    args.put("username", job.get(SplunkConfiguration.USERNAME));
	    args.put("password", job.get(SplunkConfiguration.PASSWORD));
	    args.put("host", job.get(SplunkConfiguration.SPLUNKHOST));
	    args.put("port", job.getInt(SplunkConfiguration.SPLUNKPORT, 8089));
	    service = Service.connect(args);
	}

	private void addQueryParameters() {
File
SplunkInputFormat.java
Developer's decision
Version 1
Kind of conflict
Attribute
Method invocation
Variable
Chunk
Conflicting content
 */

public class SplunkOutputFormat implements OutputFormat {
<<<<<<< HEAD
    private static final String HADOOP_EVENT = "hadoop_event";
=======
    private static final String SPLUNK_SMPLRCVR_ENDPT = "/services/receivers/simple";
    private static final int SPLUNK_MGMTPORT_DEFAULT = SplunkConfiguration.SPLUNKDEFAULTPORT;
    private static final String HADOOP_EVENT = "hadoop_event"; // event can be
							       // configured on
							       // the Splunk
							       // side
>>>>>>> 6b5d03f9198af662f1ec7cd79ae2dd707fe5fd0a
    public final static String SPLUNKHOST = SplunkConfiguration.SPLUNKHOST;
    public final static String SPLUNKPORT = SplunkConfiguration.SPLUNKPORT;
    public final static String USERNAME = SplunkConfiguration.USERNAME;
Solution content
 */

public class SplunkOutputFormat implements OutputFormat {
    private static final String SPLUNK_SMPLRCVR_ENDPT = "/services/receivers/simple";
    private static final int SPLUNK_MGMTPORT_DEFAULT = SplunkConfiguration.SPLUNKDEFAULTPORT;
    private static final String HADOOP_EVENT = "hadoop_event"; // event can be
							       // configured on
							       // the Splunk
							       // side
    public final static String SPLUNKHOST = SplunkConfiguration.SPLUNKHOST;
    public final static String SPLUNKPORT = SplunkConfiguration.SPLUNKPORT;
    public final static String USERNAME = SplunkConfiguration.USERNAME;
File
SplunkOutputFormat.java
Developer's decision
Version 2
Kind of conflict
Attribute
Comment
Chunk
Conflicting content
     */
    public RecordWriter getRecordWriter(FileSystem ignored, JobConf job,
	    String name, Progressable progress) throws IOException {
<<<<<<< HEAD

	loginSplunk(job);

	return new SplunkRecordWriter();
=======
	try {
	    HttpClient httpclient = HttpClientUtils.getHttpClient();
	    ((AbstractHttpClient) httpclient).getCredentialsProvider()
		    .setCredentials(
			    new AuthScope(job.get(SPLUNKHOST), job.getInt(
				    SPLUNKPORT, SPLUNK_MGMTPORT_DEFAULT)),
			    new UsernamePasswordCredentials(job.get(USERNAME),
				    job.get(PASSWORD)));
	    String poststr = "https://"
		    + job.get(SPLUNKHOST)
		    + ":"
		    + new Integer(job.getInt(SPLUNKPORT,
			    SPLUNK_MGMTPORT_DEFAULT)) + SPLUNK_SMPLRCVR_ENDPT
		    + "?source=" + job.getJobName() + "&sourcetype="
		    + job.get(SplunkConfiguration.SPLUNKSOURCETYPE) + "&index="
		    + job.get(SplunkConfiguration.SPLUNKINDEX);
	    logger.trace("POSTSTR: " + poststr);
	    return new SplunkRecordWriter(httpclient, poststr);
	} catch (Exception e) {
	    logger.trace(e);
	    throw new IOException(e);
	}
>>>>>>> 6b5d03f9198af662f1ec7cd79ae2dd707fe5fd0a
    }

    /**
Solution content
     */
    public RecordWriter getRecordWriter(FileSystem ignored, JobConf job,
	    String name, Progressable progress) throws IOException {

	loginSplunk(job);

	return new SplunkRecordWriter();
    }

    /**
File
SplunkOutputFormat.java
Developer's decision
Version 1
Kind of conflict
Method invocation
Return statement
Try statement