Skip to content

Commit

Permalink
Code base clean up. #18
Browse files Browse the repository at this point in the history
The whole code base needed a clean up.
The eclipse settings used for cleaning
up was the following:
- Change non static accesses to static members using declaring type
- Change indirect accesses to static members to direct accesses (accesses through subtypes)
- Remove unnecessary blocks
- Remove unused imports
- Add missing '@OverRide' annotations
- Add missing '@OverRide' annotations to implementations of interface methods
- Add missing '@deprecated' annotations
- Remove unnecessary casts
- Remove unnecessary '-NLS$' tags
- Organize imports
- Format source code
- Remove trailing white spaces on all lines
- Correct indentation
  • Loading branch information
Petter Eriksson committed May 29, 2012
1 parent 692a0b3 commit 23462fd
Show file tree
Hide file tree
Showing 179 changed files with 10,759 additions and 11,080 deletions.
8 changes: 4 additions & 4 deletions .settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#Mon Feb 27 18:07:44 PST 2012
#Tue May 29 13:24:09 CEST 2012
eclipse.preferences.version=1
org.eclipse.jdt.core.codeComplete.argumentPrefixes=
org.eclipse.jdt.core.codeComplete.argumentSuffixes=
Expand Down Expand Up @@ -93,7 +93,7 @@ org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
org.eclipse.jdt.core.formatter.indentation.size=4
org.eclipse.jdt.core.formatter.indentation.size=8
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
Expand Down Expand Up @@ -286,8 +286,8 @@ org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
org.eclipse.jdt.core.formatter.tabulation.char=mixed
org.eclipse.jdt.core.formatter.tabulation.size=8
org.eclipse.jdt.core.formatter.tabulation.char=tab
org.eclipse.jdt.core.formatter.tabulation.size=2
org.eclipse.jdt.core.formatter.use_on_off_tags=false
org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
Expand Down
57 changes: 55 additions & 2 deletions .settings/org.eclipse.jdt.ui.prefs
Original file line number Diff line number Diff line change
@@ -1,7 +1,60 @@
#Tue Mar 13 15:07:41 PDT 2012
#Tue May 29 13:24:09 CEST 2012
cleanup.add_default_serial_version_id=true
cleanup.add_generated_serial_version_id=false
cleanup.add_missing_annotations=true
cleanup.add_missing_deprecated_annotations=true
cleanup.add_missing_methods=false
cleanup.add_missing_nls_tags=false
cleanup.add_missing_override_annotations=true
cleanup.add_missing_override_annotations_interface_methods=true
cleanup.add_serial_version_id=false
cleanup.always_use_blocks=false
cleanup.always_use_parentheses_in_expressions=false
cleanup.always_use_this_for_non_static_field_access=false
cleanup.always_use_this_for_non_static_method_access=false
cleanup.convert_to_enhanced_for_loop=false
cleanup.correct_indentation=true
cleanup.format_source_code=true
cleanup.format_source_code_changes_only=false
cleanup.make_local_variable_final=true
cleanup.make_parameters_final=false
cleanup.make_private_fields_final=true
cleanup.make_type_abstract_if_missing_method=false
cleanup.make_variable_declarations_final=false
cleanup.never_use_blocks=true
cleanup.never_use_parentheses_in_expressions=true
cleanup.organize_imports=true
cleanup.qualify_static_field_accesses_with_declaring_class=false
cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
cleanup.qualify_static_member_accesses_with_declaring_class=true
cleanup.qualify_static_method_accesses_with_declaring_class=false
cleanup.remove_private_constructors=true
cleanup.remove_trailing_whitespaces=true
cleanup.remove_trailing_whitespaces_all=true
cleanup.remove_trailing_whitespaces_ignore_empty=false
cleanup.remove_unnecessary_casts=true
cleanup.remove_unnecessary_nls_tags=true
cleanup.remove_unused_imports=true
cleanup.remove_unused_local_variables=false
cleanup.remove_unused_private_fields=true
cleanup.remove_unused_private_members=false
cleanup.remove_unused_private_methods=true
cleanup.remove_unused_private_types=true
cleanup.sort_members=false
cleanup.sort_members_all=false
cleanup.use_blocks=true
cleanup.use_blocks_only_for_return_and_throw=false
cleanup.use_parentheses_in_expressions=false
cleanup.use_this_for_non_static_field_access=false
cleanup.use_this_for_non_static_field_access_only_if_necessary=true
cleanup.use_this_for_non_static_method_access=false
cleanup.use_this_for_non_static_method_access_only_if_necessary=true
cleanup_profile=_Shuttl clean up
cleanup_settings_version=2
eclipse.preferences.version=1
editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
formatter_profile=org.eclipse.jdt.ui.default.sun_profile
formatter_profile=_Java Conventions With Tabs Size 2 Only
formatter_settings_version=12
org.eclipse.jdt.ui.exception.name=e
org.eclipse.jdt.ui.gettersetter.use.is=false
Expand Down
103 changes: 50 additions & 53 deletions src/java/com/splunk/shuttl/ShuttlConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,69 +18,66 @@

/**
* @author hyan
*
*
*/
public final class ShuttlConstants {
public static enum SystemType {
local, hdfs, splunk;
};
public static enum SystemType {
local, hdfs, splunk;
};

public static enum OutputMode {
xml, json, csv, raw;
}
public static enum OutputMode {
xml, json, csv, raw;
}

// REST endpoints
public static final String ENDPOINT_CONTEXT = "shuttl/rest";
public static final String ENDPOINT_DEFAULT_HOST = "/defaulthost";
public static final String ENDPOINT_DEFAULT_PORT = "/defaultport";
public static final String ENDPOINT_SERVER = "/server";
public static final String ENDPOINT_FORWARDER = "/forwarder";
public static final String ENDPOINT_SINK_PREFIX = "/sinkprefix";
public static final String ENDPOINT_BUCKET_ARCHIVER = "/bucket/archive";
public static final String ENDPOINT_BUCKET_THAW = "/bucket/thaw";
public static final String ENDPOINT_LIST_BUCKETS = "/bucket/list";
public static final String ENDPOINT_LIST_INDEXES = "/index/list";
public static final String ENDPOINT_ARCHIVER = "/archiver";
public static final String ENDPOINT_SHUTDOWN = "/shutdown";
public static final String ENDPOINT_EXPORT_SRVC_STATUS = "/exportservicestatus";
public static final String ATT_DEF_HADOOP_CLUSTER_HOST = "DefHadoopClusterHost";
public static final String ATT_DEF_HADOOP_CLUSTER_PORT = "DefHadoopClusterPort";
// REST endpoints
public static final String ENDPOINT_CONTEXT = "shuttl/rest";
public static final String ENDPOINT_DEFAULT_HOST = "/defaulthost";
public static final String ENDPOINT_DEFAULT_PORT = "/defaultport";
public static final String ENDPOINT_SERVER = "/server";
public static final String ENDPOINT_FORWARDER = "/forwarder";
public static final String ENDPOINT_SINK_PREFIX = "/sinkprefix";
public static final String ENDPOINT_BUCKET_ARCHIVER = "/bucket/archive";
public static final String ENDPOINT_BUCKET_THAW = "/bucket/thaw";
public static final String ENDPOINT_LIST_BUCKETS = "/bucket/list";
public static final String ENDPOINT_LIST_INDEXES = "/index/list";
public static final String ENDPOINT_ARCHIVER = "/archiver";
public static final String ENDPOINT_SHUTDOWN = "/shutdown";
public static final String ENDPOINT_EXPORT_SRVC_STATUS = "/exportservicestatus";
public static final String ATT_DEF_HADOOP_CLUSTER_HOST = "DefHadoopClusterHost";
public static final String ATT_DEF_HADOOP_CLUSTER_PORT = "DefHadoopClusterPort";

// Splunk field names
public static final String SPLUNK_EVENT_FIELD_RAW = "_raw";
public static final String SPLUNK_EVENT_FIELD_SOURCE = "source";
public static final String SPLUNK_EVENT_FIELD_SOURCETYPE = "_sourcetype";
public static final String SPLUNK_EVENT_FIELD_TIME = "_time";
// Splunk field names
public static final String SPLUNK_EVENT_FIELD_RAW = "_raw";
public static final String SPLUNK_EVENT_FIELD_SOURCE = "source";
public static final String SPLUNK_EVENT_FIELD_SOURCETYPE = "_sourcetype";
public static final String SPLUNK_EVENT_FIELD_TIME = "_time";

// properties
public static final String SPLUNK_HOME_PROPERTY = "splunk.home";
public static final String SPLUNK_USER_NAME = "splunk.username";
public static final String SPLUNK_PASSWORD = "splunk.password";
public static final String SPLUNK_HOST = "splunk.host";
public static final String SPLUNK_MGMT_PORT = "splunk.mgmtport";
// properties
public static final String SPLUNK_HOME_PROPERTY = "splunk.home";
public static final String SPLUNK_USER_NAME = "splunk.username";
public static final String SPLUNK_PASSWORD = "splunk.password";
public static final String SPLUNK_HOST = "splunk.host";
public static final String SPLUNK_MGMT_PORT = "splunk.mgmtport";

// file names
public static final String SHUTTL_DEFAULT_PROPERTIES_FILE_NAME = "default.properties";
public static final String TRANSLOG_NAME = "translog";
// file names
public static final String SHUTTL_DEFAULT_PROPERTIES_FILE_NAME = "default.properties";
public static final String TRANSLOG_NAME = "translog";

public static final String SPLUNK_HOME = System
.getProperty(SPLUNK_HOME_PROPERTY);
public static final String SPLUNK_HOME = System
.getProperty(SPLUNK_HOME_PROPERTY);

// check prerequisites before start the app
static {
if (SPLUNK_HOME == null) {
throw new IllegalStateException(SPLUNK_HOME_PROPERTY
+ " is not set");
// check prerequisites before start the app
static {
if (SPLUNK_HOME == null)
throw new IllegalStateException(SPLUNK_HOME_PROPERTY + " is not set");
}
}

public static final String SHUTTL_HOME = FileUtils.getFile(SPLUNK_HOME,
"etc", "apps", "shuttl").getAbsolutePath();
public static final String TRANSLOG_DIR_PATH = FileUtils.getFile(
SHUTTL_HOME,
TRANSLOG_NAME).getAbsolutePath();
public static final String TRANSLOG_FILE_PATH = FileUtils.getFile(
TRANSLOG_DIR_PATH, TRANSLOG_NAME).getAbsolutePath();
public static final String TRANSLOG_ENDTIME_KEY = "endtime";
public static final String SHUTTL_HOME = FileUtils.getFile(SPLUNK_HOME,
"etc", "apps", "shuttl").getAbsolutePath();
public static final String TRANSLOG_DIR_PATH = FileUtils.getFile(SHUTTL_HOME,
TRANSLOG_NAME).getAbsolutePath();
public static final String TRANSLOG_FILE_PATH = FileUtils.getFile(
TRANSLOG_DIR_PATH, TRANSLOG_NAME).getAbsolutePath();
public static final String TRANSLOG_ENDTIME_KEY = "endtime";

}
92 changes: 46 additions & 46 deletions src/java/com/splunk/shuttl/archiver/LocalFileSystemConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,61 +24,61 @@
*/
public class LocalFileSystemConstants {

static final String ARCHIVER_DIRECTORY_PATH = FileUtils
.getUserDirectoryPath() + File.separator + "SplunkArchiverFiles";
static final String ARCHIVER_DIRECTORY_PATH = FileUtils
.getUserDirectoryPath() + File.separator + "SplunkArchiverFiles";

static final String SAFE_PATH = ARCHIVER_DIRECTORY_PATH
+ File.separator + "safe-buckets";
static final String SAFE_PATH = ARCHIVER_DIRECTORY_PATH + File.separator
+ "safe-buckets";

static final String FAIL_PATH = ARCHIVER_DIRECTORY_PATH
+ File.separator + "failed-buckets";
static final String FAIL_PATH = ARCHIVER_DIRECTORY_PATH + File.separator
+ "failed-buckets";

static final String LOCKS_PATH = ARCHIVER_DIRECTORY_PATH
+ File.separator + "locks-dir";
static final String LOCKS_PATH = ARCHIVER_DIRECTORY_PATH + File.separator
+ "locks-dir";

static final String CSV_PATH = ARCHIVER_DIRECTORY_PATH
+ File.separator + "csv-dir";
static final String CSV_PATH = ARCHIVER_DIRECTORY_PATH + File.separator
+ "csv-dir";

/**
* Directory which contains all files created by the archiver.
*/
public static File getArchiverDirectory() {
return createDirectory(ARCHIVER_DIRECTORY_PATH);
}
/**
* Directory which contains all files created by the archiver.
*/
public static File getArchiverDirectory() {
return createDirectory(ARCHIVER_DIRECTORY_PATH);
}

private static File createDirectory(String path) {
File dir = new File(path);
dir.mkdirs();
return dir;
}
private static File createDirectory(String path) {
File dir = new File(path);
dir.mkdirs();
return dir;
}

/**
* Safe location for the buckets, away from where Splunk cannot delete the
* buckets.
*/
public static File getSafeDirectory() {
return createDirectory(SAFE_PATH);
}
/**
* Safe location for the buckets, away from where Splunk cannot delete the
* buckets.
*/
public static File getSafeDirectory() {
return createDirectory(SAFE_PATH);
}

/**
* Contains the failed bucket transfers
*/
public static File getFailDirectory() {
return createDirectory(FAIL_PATH);
}
/**
* Contains the failed bucket transfers
*/
public static File getFailDirectory() {
return createDirectory(FAIL_PATH);
}

/**
* Contains locks for the buckets.
*/
public static File getLocksDirectory() {
return createDirectory(LOCKS_PATH);
}
/**
* Contains locks for the buckets.
*/
public static File getLocksDirectory() {
return createDirectory(LOCKS_PATH);
}

/**
* Contains CSV files when exporting buckets.
*/
public static File getCsvDirectory() {
return createDirectory(CSV_PATH);
}
/**
* Contains CSV files when exporting buckets.
*/
public static File getCsvDirectory() {
return createDirectory(CSV_PATH);
}

}
Loading

0 comments on commit 23462fd

Please sign in to comment.