{"action":"created","comment":{"url":"https://api.github.com/repos/commercehub-oss/watershed/pulls/comments/45632679","id":45632679,"diff_hunk":"@@ -0,0 +1,175 @@\n+package com.commercehub.watershed.pump.application;\n+\n+import com.amazonaws.auth.AWSCredentialsProviderChain;\n+import com.amazonaws.auth.BasicAWSCredentials;\n+import com.amazonaws.auth.DefaultAWSCredentialsProviderChain;\n+import com.amazonaws.internal.StaticCredentialsProvider;\n+import com.amazonaws.regions.Regions;\n+import com.amazonaws.services.kinesis.producer.KinesisProducerConfiguration;\n+import com.commercehub.watershed.pump.model.Job;\n+import com.commercehub.watershed.pump.processing.IsolatedConnectionProvider;\n+import com.commercehub.watershed.pump.processing.JobRunnable;\n+import com.commercehub.watershed.pump.processing.Pump;\n+import com.commercehub.watershed.pump.respositories.DrillRepository;\n+import com.commercehub.watershed.pump.respositories.QueryableRepository;\n+import com.commercehub.watershed.pump.service.JobService;\n+import com.commercehub.watershed.pump.service.JobServiceImpl;\n+import com.commercehub.watershed.pump.service.TransformerService;\n+import com.commercehub.watershed.pump.service.TransformerServiceImpl;\n+import com.fasterxml.jackson.core.JsonGenerator;\n+import com.fasterxml.jackson.databind.DeserializationFeature;\n+import com.fasterxml.jackson.databind.ObjectMapper;\n+import com.fasterxml.jackson.databind.SerializationFeature;\n+import com.fasterxml.jackson.datatype.joda.JodaModule;\n+import com.github.davidmoten.rx.jdbc.ConnectionProvider;\n+import com.github.davidmoten.rx.jdbc.Database;\n+import com.google.inject.AbstractModule;\n+import com.google.inject.Provider;\n+import com.google.inject.Provides;\n+import com.google.inject.Singleton;\n+import com.google.inject.name.Names;\n+import org.slf4j.Logger;\n+import org.slf4j.LoggerFactory;\n+\n+import javax.inject.Named;\n+import java.io.InputStream;\n+import java.util.HashMap;\n+import java.util.Map;\n+import java.util.Properties;\n+import java.util.concurrent.ExecutorService;\n+import java.util.concurrent.Executors;\n+\n+public class PumpGuiceModule extends AbstractModule {\n+    private static final String DEFAULT_PROPERTIES_FILE = \"pump.properties\";\n+    private static final Logger log = LoggerFactory.getLogger(PumpGuiceModule.class);\n+\n+    private Properties defaultProperties;\n+    private ObjectMapper objectMapper;\n+\n+    private Map<String, Job> jobMap = new HashMap<>();\n+\n+    @Override\n+    protected void configure() {\n+        defaultProperties = getDefaultPropertiesFromFile();\n+        objectMapper = configureObjectMapper();\n+        bind(JobService.class).to(JobServiceImpl.class);\n+        bind(QueryableRepository.class).to(DrillRepository.class);\n+        bind(TransformerService.class).to(TransformerServiceImpl.class);\n+    }\n+\n+    @Provides\n+    @Singleton\n+    @Named(\"applicationProperties\")\n+    private Properties getProperties(){\n+        return defaultProperties;\n+    }\n+\n+    @Provides\n+    @Singleton\n+    private Map<String, Job> getJobMap(){\n+        return jobMap;\n+    }\n+\n+    @Provides\n+    @Singleton\n+    private ObjectMapper getObjectMapper(){\n+        return objectMapper;\n+    }\n+\n+    private ObjectMapper configureObjectMapper(){\n+        ObjectMapper objectMapper = new ObjectMapper();\n+        objectMapper.registerModule(new JodaModule());\n+        objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);\n+        objectMapper.configure(DeserializationFeature.USE_BIG_DECIMAL_FOR_FLOATS, true);\n+        objectMapper.configure(DeserializationFeature.ADJUST_DATES_TO_CONTEXT_TIME_ZONE, false);\n+        objectMapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);\n+        objectMapper.configure(JsonGenerator.Feature.WRITE_BIGDECIMAL_AS_PLAIN, true);\n+\n+        return objectMapper;\n+    }\n+\n+    private Properties getDefaultPropertiesFromFile() {\n+        Properties properties = new Properties();\n+        String propertyFileName = DEFAULT_PROPERTIES_FILE;\n+        try {\n+            InputStream configStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(propertyFileName);\n+            properties.load(configStream);\n+            Names.bindProperties(binder(), properties);\n+        } catch (Exception ex) {\n+            log.error(\"Had a problem loading in application properties: \" + propertyFileName, ex);\n+        }\n+\n+        return properties;\n+    }\n+\n+\n+    @Provides\n+    private JobRunnable jobRunnableProvider(TransformerService transformerService, Provider<Pump> pumpProvider){\n+        return new JobRunnable(transformerService, pumpProvider);\n+    }\n+\n+    @Provides\n+    private Pump pumpProvider(Database database, KinesisProducerConfiguration kinesisProducerConfiguration){\n+        return new Pump(database, kinesisProducerConfiguration);\n+    }\n+\n+\n+    @Provides\n+    @Singleton\n+    private KinesisProducerConfiguration configureKinesis() {\n+        KinesisProducerConfiguration kinesisConfig = new KinesisProducerConfiguration();\n+","path":"pump/src/main/java/com/commercehub/watershed/pump/application/PumpGuiceModule.java","position":121,"original_position":121,"commit_id":"4adba0c859c6ea720fcd1f62c7a9b13fa054ba0e","original_commit_id":"4adba0c859c6ea720fcd1f62c7a9b13fa054ba0e","user":{"login":"pmogren","id":4183054,"avatar_url":"https://avatars.githubusercontent.com/u/4183054?v=3","gravatar_id":"","url":"https://api.github.com/users/pmogren","html_url":"https://github.com/pmogren","followers_url":"https://api.github.com/users/pmogren/followers","following_url":"https://api.github.com/users/pmogren/following{/other_user}","gists_url":"https://api.github.com/users/pmogren/gists{/gist_id}","starred_url":"https://api.github.com/users/pmogren/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pmogren/subscriptions","organizations_url":"https://api.github.com/users/pmogren/orgs","repos_url":"https://api.github.com/users/pmogren/repos","events_url":"https://api.github.com/users/pmogren/events{/privacy}","received_events_url":"https://api.github.com/users/pmogren/received_events","type":"User","site_admin":false},"body":"All of these options should come from config file","created_at":"2015-11-23T17:28:14Z","updated_at":"2015-11-23T17:28:14Z","html_url":"https://github.com/commercehub-oss/watershed/pull/55#discussion_r45632679","pull_request_url":"https://api.github.com/repos/commercehub-oss/watershed/pulls/55","_links":{"self":{"href":"https://api.github.com/repos/commercehub-oss/watershed/pulls/comments/45632679"},"html":{"href":"https://github.com/commercehub-oss/watershed/pull/55#discussion_r45632679"},"pull_request":{"href":"https://api.github.com/repos/commercehub-oss/watershed/pulls/55"}}},"pull_request":{"url":"https://api.github.com/repos/commercehub-oss/watershed/pulls/55","id":51531055,"html_url":"https://github.com/commercehub-oss/watershed/pull/55","diff_url":"https://github.com/commercehub-oss/watershed/pull/55.diff","patch_url":"https://github.com/commercehub-oss/watershed/pull/55.patch","issue_url":"https://api.github.com/repos/commercehub-oss/watershed/issues/55","number":55,"state":"open","locked":false,"title":"Rest endpoints + processing","user":{"login":"CrossfireCurt","id":17998,"avatar_url":"https://avatars.githubusercontent.com/u/17998?v=3","gravatar_id":"","url":"https://api.github.com/users/CrossfireCurt","html_url":"https://github.com/CrossfireCurt","followers_url":"https://api.github.com/users/CrossfireCurt/followers","following_url":"https://api.github.com/users/CrossfireCurt/following{/other_user}","gists_url":"https://api.github.com/users/CrossfireCurt/gists{/gist_id}","starred_url":"https://api.github.com/users/CrossfireCurt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CrossfireCurt/subscriptions","organizations_url":"https://api.github.com/users/CrossfireCurt/orgs","repos_url":"https://api.github.com/users/CrossfireCurt/repos","events_url":"https://api.github.com/users/CrossfireCurt/events{/privacy}","received_events_url":"https://api.github.com/users/CrossfireCurt/received_events","type":"User","site_admin":false},"body":"- Introduces concept of a \"Job\". Jobs are what hold Pump configuration and information about Pump's progress. Users submit a Job via REST endpoints. \r\n- Jobs are queued in an ExecutorService. Once executed, a new Pump instance is created and run with setting defined in the Job.\r\n- REST endpoints for interacting with Jobs; submitting, checking progress, etc. Uses Dropwizard 0.8.3 and Google Guice.\r\n- Broke record transformation out into a Service. \r\n- Implemented tests for service and controller layers (more to come soon).","created_at":"2015-11-23T14:42:33Z","updated_at":"2015-11-23T17:28:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"34921589dce8a120b82f96ce9a6c77a9868b2275","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/commercehub-oss/watershed/pulls/55/commits","review_comments_url":"https://api.github.com/repos/commercehub-oss/watershed/pulls/55/comments","review_comment_url":"https://api.github.com/repos/commercehub-oss/watershed/pulls/comments{/number}","comments_url":"https://api.github.com/repos/commercehub-oss/watershed/issues/55/comments","statuses_url":"https://api.github.com/repos/commercehub-oss/watershed/statuses/4adba0c859c6ea720fcd1f62c7a9b13fa054ba0e","head":{"label":"commercehub-oss:rest_endpoints","ref":"rest_endpoints","sha":"4adba0c859c6ea720fcd1f62c7a9b13fa054ba0e","user":{"login":"commercehub-oss","id":3227514,"avatar_url":"https://avatars.githubusercontent.com/u/3227514?v=3","gravatar_id":"","url":"https://api.github.com/users/commercehub-oss","html_url":"https://github.com/commercehub-oss","followers_url":"https://api.github.com/users/commercehub-oss/followers","following_url":"https://api.github.com/users/commercehub-oss/following{/other_user}","gists_url":"https://api.github.com/users/commercehub-oss/gists{/gist_id}","starred_url":"https://api.github.com/users/commercehub-oss/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/commercehub-oss/subscriptions","organizations_url":"https://api.github.com/users/commercehub-oss/orgs","repos_url":"https://api.github.com/users/commercehub-oss/repos","events_url":"https://api.github.com/users/commercehub-oss/events{/privacy}","received_events_url":"https://api.github.com/users/commercehub-oss/received_events","type":"Organization","site_admin":false},"repo":{"id":38642282,"name":"watershed","full_name":"commercehub-oss/watershed","owner":{"login":"commercehub-oss","id":3227514,"avatar_url":"https://avatars.githubusercontent.com/u/3227514?v=3","gravatar_id":"","url":"https://api.github.com/users/commercehub-oss","html_url":"https://github.com/commercehub-oss","followers_url":"https://api.github.com/users/commercehub-oss/followers","following_url":"https://api.github.com/users/commercehub-oss/following{/other_user}","gists_url":"https://api.github.com/users/commercehub-oss/gists{/gist_id}","starred_url":"https://api.github.com/users/commercehub-oss/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/commercehub-oss/subscriptions","organizations_url":"https://api.github.com/users/commercehub-oss/orgs","repos_url":"https://api.github.com/users/commercehub-oss/repos","events_url":"https://api.github.com/users/commercehub-oss/events{/privacy}","received_events_url":"https://api.github.com/users/commercehub-oss/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/commercehub-oss/watershed","description":"Archival, search, and replay of Amazon Kinesis streams","fork":false,"url":"https://api.github.com/repos/commercehub-oss/watershed","forks_url":"https://api.github.com/repos/commercehub-oss/watershed/forks","keys_url":"https://api.github.com/repos/commercehub-oss/watershed/keys{/key_id}","collaborators_url":"https://api.github.com/repos/commercehub-oss/watershed/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/commercehub-oss/watershed/teams","hooks_url":"https://api.github.com/repos/commercehub-oss/watershed/hooks","issue_events_url":"https://api.github.com/repos/commercehub-oss/watershed/issues/events{/number}","events_url":"https://api.github.com/repos/commercehub-oss/watershed/events","assignees_url":"https://api.github.com/repos/commercehub-oss/watershed/assignees{/user}","branches_url":"https://api.github.com/repos/commercehub-oss/watershed/branches{/branch}","tags_url":"https://api.github.com/repos/commercehub-oss/watershed/tags","blobs_url":"https://api.github.com/repos/commercehub-oss/watershed/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/commercehub-oss/watershed/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/commercehub-oss/watershed/git/refs{/sha}","trees_url":"https://api.github.com/repos/commercehub-oss/watershed/git/trees{/sha}","statuses_url":"https://api.github.com/repos/commercehub-oss/watershed/statuses/{sha}","languages_url":"https://api.github.com/repos/commercehub-oss/watershed/languages","stargazers_url":"https://api.github.com/repos/commercehub-oss/watershed/stargazers","contributors_url":"https://api.github.com/repos/commercehub-oss/watershed/contributors","subscribers_url":"https://api.github.com/repos/commercehub-oss/watershed/subscribers","subscription_url":"https://api.github.com/repos/commercehub-oss/watershed/subscription","commits_url":"https://api.github.com/repos/commercehub-oss/watershed/commits{/sha}","git_commits_url":"https://api.github.com/repos/commercehub-oss/watershed/git/commits{/sha}","comments_url":"https://api.github.com/repos/commercehub-oss/watershed/comments{/number}","issue_comment_url":"https://api.github.com/repos/commercehub-oss/watershed/issues/comments{/number}","contents_url":"https://api.github.com/repos/commercehub-oss/watershed/contents/{+path}","compare_url":"https://api.github.com/repos/commercehub-oss/watershed/compare/{base}...{head}","merges_url":"https://api.github.com/repos/commercehub-oss/watershed/merges","archive_url":"https://api.github.com/repos/commercehub-oss/watershed/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/commercehub-oss/watershed/downloads","issues_url":"https://api.github.com/repos/commercehub-oss/watershed/issues{/number}","pulls_url":"https://api.github.com/repos/commercehub-oss/watershed/pulls{/number}","milestones_url":"https://api.github.com/repos/commercehub-oss/watershed/milestones{/number}","notifications_url":"https://api.github.com/repos/commercehub-oss/watershed/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/commercehub-oss/watershed/labels{/name}","releases_url":"https://api.github.com/repos/commercehub-oss/watershed/releases{/id}","created_at":"2015-07-06T19:51:54Z","updated_at":"2015-11-13T17:21:21Z","pushed_at":"2015-11-23T17:26:20Z","git_url":"git://github.com/commercehub-oss/watershed.git","ssh_url":"git@github.com:commercehub-oss/watershed.git","clone_url":"https://github.com/commercehub-oss/watershed.git","svn_url":"https://github.com/commercehub-oss/watershed","homepage":"","size":14588,"stargazers_count":6,"watchers_count":6,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":19,"forks":3,"open_issues":19,"watchers":6,"default_branch":"master"}},"base":{"label":"commercehub-oss:master","ref":"master","sha":"0631dad495be997a7d4807ed0d2769a9b18fbe79","user":{"login":"commercehub-oss","id":3227514,"avatar_url":"https://avatars.githubusercontent.com/u/3227514?v=3","gravatar_id":"","url":"https://api.github.com/users/commercehub-oss","html_url":"https://github.com/commercehub-oss","followers_url":"https://api.github.com/users/commercehub-oss/followers","following_url":"https://api.github.com/users/commercehub-oss/following{/other_user}","gists_url":"https://api.github.com/users/commercehub-oss/gists{/gist_id}","starred_url":"https://api.github.com/users/commercehub-oss/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/commercehub-oss/subscriptions","organizations_url":"https://api.github.com/users/commercehub-oss/orgs","repos_url":"https://api.github.com/users/commercehub-oss/repos","events_url":"https://api.github.com/users/commercehub-oss/events{/privacy}","received_events_url":"https://api.github.com/users/commercehub-oss/received_events","type":"Organization","site_admin":false},"repo":{"id":38642282,"name":"watershed","full_name":"commercehub-oss/watershed","owner":{"login":"commercehub-oss","id":3227514,"avatar_url":"https://avatars.githubusercontent.com/u/3227514?v=3","gravatar_id":"","url":"https://api.github.com/users/commercehub-oss","html_url":"https://github.com/commercehub-oss","followers_url":"https://api.github.com/users/commercehub-oss/followers","following_url":"https://api.github.com/users/commercehub-oss/following{/other_user}","gists_url":"https://api.github.com/users/commercehub-oss/gists{/gist_id}","starred_url":"https://api.github.com/users/commercehub-oss/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/commercehub-oss/subscriptions","organizations_url":"https://api.github.com/users/commercehub-oss/orgs","repos_url":"https://api.github.com/users/commercehub-oss/repos","events_url":"https://api.github.com/users/commercehub-oss/events{/privacy}","received_events_url":"https://api.github.com/users/commercehub-oss/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/commercehub-oss/watershed","description":"Archival, search, and replay of Amazon Kinesis streams","fork":false,"url":"https://api.github.com/repos/commercehub-oss/watershed","forks_url":"https://api.github.com/repos/commercehub-oss/watershed/forks","keys_url":"https://api.github.com/repos/commercehub-oss/watershed/keys{/key_id}","collaborators_url":"https://api.github.com/repos/commercehub-oss/watershed/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/commercehub-oss/watershed/teams","hooks_url":"https://api.github.com/repos/commercehub-oss/watershed/hooks","issue_events_url":"https://api.github.com/repos/commercehub-oss/watershed/issues/events{/number}","events_url":"https://api.github.com/repos/commercehub-oss/watershed/events","assignees_url":"https://api.github.com/repos/commercehub-oss/watershed/assignees{/user}","branches_url":"https://api.github.com/repos/commercehub-oss/watershed/branches{/branch}","tags_url":"https://api.github.com/repos/commercehub-oss/watershed/tags","blobs_url":"https://api.github.com/repos/commercehub-oss/watershed/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/commercehub-oss/watershed/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/commercehub-oss/watershed/git/refs{/sha}","trees_url":"https://api.github.com/repos/commercehub-oss/watershed/git/trees{/sha}","statuses_url":"https://api.github.com/repos/commercehub-oss/watershed/statuses/{sha}","languages_url":"https://api.github.com/repos/commercehub-oss/watershed/languages","stargazers_url":"https://api.github.com/repos/commercehub-oss/watershed/stargazers","contributors_url":"https://api.github.com/repos/commercehub-oss/watershed/contributors","subscribers_url":"https://api.github.com/repos/commercehub-oss/watershed/subscribers","subscription_url":"https://api.github.com/repos/commercehub-oss/watershed/subscription","commits_url":"https://api.github.com/repos/commercehub-oss/watershed/commits{/sha}","git_commits_url":"https://api.github.com/repos/commercehub-oss/watershed/git/commits{/sha}","comments_url":"https://api.github.com/repos/commercehub-oss/watershed/comments{/number}","issue_comment_url":"https://api.github.com/repos/commercehub-oss/watershed/issues/comments{/number}","contents_url":"https://api.github.com/repos/commercehub-oss/watershed/contents/{+path}","compare_url":"https://api.github.com/repos/commercehub-oss/watershed/compare/{base}...{head}","merges_url":"https://api.github.com/repos/commercehub-oss/watershed/merges","archive_url":"https://api.github.com/repos/commercehub-oss/watershed/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/commercehub-oss/watershed/downloads","issues_url":"https://api.github.com/repos/commercehub-oss/watershed/issues{/number}","pulls_url":"https://api.github.com/repos/commercehub-oss/watershed/pulls{/number}","milestones_url":"https://api.github.com/repos/commercehub-oss/watershed/milestones{/number}","notifications_url":"https://api.github.com/repos/commercehub-oss/watershed/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/commercehub-oss/watershed/labels{/name}","releases_url":"https://api.github.com/repos/commercehub-oss/watershed/releases{/id}","created_at":"2015-07-06T19:51:54Z","updated_at":"2015-11-13T17:21:21Z","pushed_at":"2015-11-23T17:26:20Z","git_url":"git://github.com/commercehub-oss/watershed.git","ssh_url":"git@github.com:commercehub-oss/watershed.git","clone_url":"https://github.com/commercehub-oss/watershed.git","svn_url":"https://github.com/commercehub-oss/watershed","homepage":"","size":14588,"stargazers_count":6,"watchers_count":6,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":19,"forks":3,"open_issues":19,"watchers":6,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/commercehub-oss/watershed/pulls/55"},"html":{"href":"https://github.com/commercehub-oss/watershed/pull/55"},"issue":{"href":"https://api.github.com/repos/commercehub-oss/watershed/issues/55"},"comments":{"href":"https://api.github.com/repos/commercehub-oss/watershed/issues/55/comments"},"review_comments":{"href":"https://api.github.com/repos/commercehub-oss/watershed/pulls/55/comments"},"review_comment":{"href":"https://api.github.com/repos/commercehub-oss/watershed/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/commercehub-oss/watershed/pulls/55/commits"},"statuses":{"href":"https://api.github.com/repos/commercehub-oss/watershed/statuses/4adba0c859c6ea720fcd1f62c7a9b13fa054ba0e"}}}}