{"action":"created","comment":{"url":"https://api.github.com/repos/yarkinsv/BookStoreManagment/pulls/comments/55668352","id":55668352,"diff_hunk":"@@ -0,0 +1,56 @@\n+package store;\n+\n+import com.google.inject.AbstractModule;\n+import com.google.inject.Provides;\n+import org.hibernate.SessionFactory;\n+import store.DAO.BookDAO;\n+import store.DAO.BookJdbcDAO;\n+import store.DAO.TaskDAO;\n+import store.DAO.TaskHibernateDAO;\n+import store.Services.BookService;\n+import store.Services.BookServiceImpl;\n+import utils.HibernateSessionFactory;\n+import utils.PropertiesFactory;\n+\n+import javax.sql.DataSource;\n+import java.io.IOException;\n+import java.util.Properties;\n+import java.util.logging.Logger;\n+\n+import static utils.DataSourceFactory.createPGSimpleDataSource;\n+\n+public class BookStoreModule extends AbstractModule {\n+    @Override\n+    protected void configure() {\n+        bind(BookDAO.class).to(BookJdbcDAO.class);\n+        bind(TaskDAO.class).to(TaskHibernateDAO.class);\n+        bind(BookService.class).to(BookServiceImpl.class);\n+    }\n+\n+    @Provides\n+    public DataSource provideDataSource() {\n+        final Properties properties;\n+        try {\n+            properties = PropertiesFactory.load();","path":"src/main/java/store/BookStoreModule.java","position":34,"original_position":34,"commit_id":"182d52e15301630399e7201cc09aec5cf36d1e23","original_commit_id":"182d52e15301630399e7201cc09aec5cf36d1e23","user":{"login":"AntonIvanov87","id":3289141,"avatar_url":"https://avatars.githubusercontent.com/u/3289141?v=3","gravatar_id":"","url":"https://api.github.com/users/AntonIvanov87","html_url":"https://github.com/AntonIvanov87","followers_url":"https://api.github.com/users/AntonIvanov87/followers","following_url":"https://api.github.com/users/AntonIvanov87/following{/other_user}","gists_url":"https://api.github.com/users/AntonIvanov87/gists{/gist_id}","starred_url":"https://api.github.com/users/AntonIvanov87/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AntonIvanov87/subscriptions","organizations_url":"https://api.github.com/users/AntonIvanov87/orgs","repos_url":"https://api.github.com/users/AntonIvanov87/repos","events_url":"https://api.github.com/users/AntonIvanov87/events{/privacy}","received_events_url":"https://api.github.com/users/AntonIvanov87/received_events","type":"User","site_admin":false},"body":"В реальной системе настройки все же хранятся в узле графа, так как доступ к настройкам требуется из разных мест, не только при создании датасорса.\r\nЗдесь можно и так.","created_at":"2016-03-10T11:49:35Z","updated_at":"2016-03-10T11:49:35Z","html_url":"https://github.com/yarkinsv/BookStoreManagment/pull/2#discussion_r55668352","pull_request_url":"https://api.github.com/repos/yarkinsv/BookStoreManagment/pulls/2","_links":{"self":{"href":"https://api.github.com/repos/yarkinsv/BookStoreManagment/pulls/comments/55668352"},"html":{"href":"https://github.com/yarkinsv/BookStoreManagment/pull/2#discussion_r55668352"},"pull_request":{"href":"https://api.github.com/repos/yarkinsv/BookStoreManagment/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/yarkinsv/BookStoreManagment/pulls/2","id":61810786,"html_url":"https://github.com/yarkinsv/BookStoreManagment/pull/2","diff_url":"https://github.com/yarkinsv/BookStoreManagment/pull/2.diff","patch_url":"https://github.com/yarkinsv/BookStoreManagment/pull/2.patch","issue_url":"https://api.github.com/repos/yarkinsv/BookStoreManagment/issues/2","number":2,"state":"open","locked":false,"title":"DAO Homework","user":{"login":"yarkinsv","id":7859184,"avatar_url":"https://avatars.githubusercontent.com/u/7859184?v=3","gravatar_id":"","url":"https://api.github.com/users/yarkinsv","html_url":"https://github.com/yarkinsv","followers_url":"https://api.github.com/users/yarkinsv/followers","following_url":"https://api.github.com/users/yarkinsv/following{/other_user}","gists_url":"https://api.github.com/users/yarkinsv/gists{/gist_id}","starred_url":"https://api.github.com/users/yarkinsv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yarkinsv/subscriptions","organizations_url":"https://api.github.com/users/yarkinsv/orgs","repos_url":"https://api.github.com/users/yarkinsv/repos","events_url":"https://api.github.com/users/yarkinsv/events{/privacy}","received_events_url":"https://api.github.com/users/yarkinsv/received_events","type":"User","site_admin":false},"body":"Добавил два объекта: \r\n[Book](https://github.com/yarkinsv/BookStoreManagment/blob/dao/src/main/java/store/Model/Book.java) - объект представляющий книгу \r\n[Task](https://github.com/yarkinsv/BookStoreManagment/blob/dao/src/main/java/store/Model/Task.java) - объект представляющий задачу для сотрудника \r\n\r\n[BookDAO](https://github.com/yarkinsv/BookStoreManagment/blob/dao/src/main/java/store/DAO/BookDAO.java) и [TaskDAO](https://github.com/yarkinsv/BookStoreManagment/blob/dao/src/main/java/store/DAO/TaskDAO.java) - соответствующие dao интерфейсы\r\n[BookJdbcDAO](https://github.com/yarkinsv/BookStoreManagment/blob/dao/src/main/java/store/DAO/BookJdbcDAO.java) - нативная jdbc реализация\r\n[TaskHibernateDAO](https://github.com/yarkinsv/BookStoreManagment/blob/dao/src/main/java/store/DAO/TaskHibernateDAO.java) - реализация dao с использованием hibernate\r\n\r\n[BookServiceImpl](https://github.com/yarkinsv/BookStoreManagment/blob/dao/src/main/java/store/Services/BookServiceImpl.java) - сервис, предоставляющий возможность зарегистрировать новую книгу в базе. Регистрация новой книги должна сопровождаться созданием простой задачи для сотрудников, в которой будет сказано, чтобы они обработали поступившую книгу. Данный функционал должен работать в рамках одной транзакции, так как после создания задачи создание самой книги может пройти не успешно. В этом случае задача будет, а информации по книге нет, что повлечет замешательство сотрудников и временные издержки.\r\n\r\nВ качестве IoC контейнера я выбрал Guice и добавил соответствующие модули конфигурации: [BookStoreModule](https://github.com/yarkinsv/BookStoreManagment/blob/dao/src/main/java/store/BookStoreModule.java) и [BookStoreTestModule](https://github.com/yarkinsv/BookStoreManagment/blob/dao/src/test/java/BookStoreTestModule.java)\r\n\r\nЛогирование также добавлено в простом варианте - я использовал slf4j и logback. Логируются ошибки создания книги в консоль. Конфигурация логирования - [logback.xml](https://github.com/yarkinsv/BookStoreManagment/blob/dao/src/main/resources/logback.xml)\r\n","created_at":"2016-03-05T12:26:27Z","updated_at":"2016-03-10T11:49:35Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d42e92b9651a01df5610ab4dcba1c381e4ab8f3d","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/yarkinsv/BookStoreManagment/pulls/2/commits","review_comments_url":"https://api.github.com/repos/yarkinsv/BookStoreManagment/pulls/2/comments","review_comment_url":"https://api.github.com/repos/yarkinsv/BookStoreManagment/pulls/comments{/number}","comments_url":"https://api.github.com/repos/yarkinsv/BookStoreManagment/issues/2/comments","statuses_url":"https://api.github.com/repos/yarkinsv/BookStoreManagment/statuses/182d52e15301630399e7201cc09aec5cf36d1e23","head":{"label":"yarkinsv:dao","ref":"dao","sha":"182d52e15301630399e7201cc09aec5cf36d1e23","user":{"login":"yarkinsv","id":7859184,"avatar_url":"https://avatars.githubusercontent.com/u/7859184?v=3","gravatar_id":"","url":"https://api.github.com/users/yarkinsv","html_url":"https://github.com/yarkinsv","followers_url":"https://api.github.com/users/yarkinsv/followers","following_url":"https://api.github.com/users/yarkinsv/following{/other_user}","gists_url":"https://api.github.com/users/yarkinsv/gists{/gist_id}","starred_url":"https://api.github.com/users/yarkinsv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yarkinsv/subscriptions","organizations_url":"https://api.github.com/users/yarkinsv/orgs","repos_url":"https://api.github.com/users/yarkinsv/repos","events_url":"https://api.github.com/users/yarkinsv/events{/privacy}","received_events_url":"https://api.github.com/users/yarkinsv/received_events","type":"User","site_admin":false},"repo":{"id":53163197,"name":"BookStoreManagment","full_name":"yarkinsv/BookStoreManagment","owner":{"login":"yarkinsv","id":7859184,"avatar_url":"https://avatars.githubusercontent.com/u/7859184?v=3","gravatar_id":"","url":"https://api.github.com/users/yarkinsv","html_url":"https://github.com/yarkinsv","followers_url":"https://api.github.com/users/yarkinsv/followers","following_url":"https://api.github.com/users/yarkinsv/following{/other_user}","gists_url":"https://api.github.com/users/yarkinsv/gists{/gist_id}","starred_url":"https://api.github.com/users/yarkinsv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yarkinsv/subscriptions","organizations_url":"https://api.github.com/users/yarkinsv/orgs","repos_url":"https://api.github.com/users/yarkinsv/repos","events_url":"https://api.github.com/users/yarkinsv/events{/privacy}","received_events_url":"https://api.github.com/users/yarkinsv/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/yarkinsv/BookStoreManagment","description":"","fork":false,"url":"https://api.github.com/repos/yarkinsv/BookStoreManagment","forks_url":"https://api.github.com/repos/yarkinsv/BookStoreManagment/forks","keys_url":"https://api.github.com/repos/yarkinsv/BookStoreManagment/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yarkinsv/BookStoreManagment/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yarkinsv/BookStoreManagment/teams","hooks_url":"https://api.github.com/repos/yarkinsv/BookStoreManagment/hooks","issue_events_url":"https://api.github.com/repos/yarkinsv/BookStoreManagment/issues/events{/number}","events_url":"https://api.github.com/repos/yarkinsv/BookStoreManagment/events","assignees_url":"https://api.github.com/repos/yarkinsv/BookStoreManagment/assignees{/user}","branches_url":"https://api.github.com/repos/yarkinsv/BookStoreManagment/branches{/branch}","tags_url":"https://api.github.com/repos/yarkinsv/BookStoreManagment/tags","blobs_url":"https://api.github.com/repos/yarkinsv/BookStoreManagment/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yarkinsv/BookStoreManagment/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yarkinsv/BookStoreManagment/git/refs{/sha}","trees_url":"https://api.github.com/repos/yarkinsv/BookStoreManagment/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yarkinsv/BookStoreManagment/statuses/{sha}","languages_url":"https://api.github.com/repos/yarkinsv/BookStoreManagment/languages","stargazers_url":"https://api.github.com/repos/yarkinsv/BookStoreManagment/stargazers","contributors_url":"https://api.github.com/repos/yarkinsv/BookStoreManagment/contributors","subscribers_url":"https://api.github.com/repos/yarkinsv/BookStoreManagment/subscribers","subscription_url":"https://api.github.com/repos/yarkinsv/BookStoreManagment/subscription","commits_url":"https://api.github.com/repos/yarkinsv/BookStoreManagment/commits{/sha}","git_commits_url":"https://api.github.com/repos/yarkinsv/BookStoreManagment/git/commits{/sha}","comments_url":"https://api.github.com/repos/yarkinsv/BookStoreManagment/comments{/number}","issue_comment_url":"https://api.github.com/repos/yarkinsv/BookStoreManagment/issues/comments{/number}","contents_url":"https://api.github.com/repos/yarkinsv/BookStoreManagment/contents/{+path}","compare_url":"https://api.github.com/repos/yarkinsv/BookStoreManagment/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yarkinsv/BookStoreManagment/merges","archive_url":"https://api.github.com/repos/yarkinsv/BookStoreManagment/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yarkinsv/BookStoreManagment/downloads","issues_url":"https://api.github.com/repos/yarkinsv/BookStoreManagment/issues{/number}","pulls_url":"https://api.github.com/repos/yarkinsv/BookStoreManagment/pulls{/number}","milestones_url":"https://api.github.com/repos/yarkinsv/BookStoreManagment/milestones{/number}","notifications_url":"https://api.github.com/repos/yarkinsv/BookStoreManagment/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yarkinsv/BookStoreManagment/labels{/name}","releases_url":"https://api.github.com/repos/yarkinsv/BookStoreManagment/releases{/id}","deployments_url":"https://api.github.com/repos/yarkinsv/BookStoreManagment/deployments","created_at":"2016-03-04T20:23:21Z","updated_at":"2016-03-04T20:23:21Z","pushed_at":"2016-03-05T12:26:27Z","git_url":"git://github.com/yarkinsv/BookStoreManagment.git","ssh_url":"git@github.com:yarkinsv/BookStoreManagment.git","clone_url":"https://github.com/yarkinsv/BookStoreManagment.git","svn_url":"https://github.com/yarkinsv/BookStoreManagment","homepage":null,"size":20,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"yarkinsv:master","ref":"master","sha":"abab7066fc47b5222e8b978d8e2320302c859901","user":{"login":"yarkinsv","id":7859184,"avatar_url":"https://avatars.githubusercontent.com/u/7859184?v=3","gravatar_id":"","url":"https://api.github.com/users/yarkinsv","html_url":"https://github.com/yarkinsv","followers_url":"https://api.github.com/users/yarkinsv/followers","following_url":"https://api.github.com/users/yarkinsv/following{/other_user}","gists_url":"https://api.github.com/users/yarkinsv/gists{/gist_id}","starred_url":"https://api.github.com/users/yarkinsv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yarkinsv/subscriptions","organizations_url":"https://api.github.com/users/yarkinsv/orgs","repos_url":"https://api.github.com/users/yarkinsv/repos","events_url":"https://api.github.com/users/yarkinsv/events{/privacy}","received_events_url":"https://api.github.com/users/yarkinsv/received_events","type":"User","site_admin":false},"repo":{"id":53163197,"name":"BookStoreManagment","full_name":"yarkinsv/BookStoreManagment","owner":{"login":"yarkinsv","id":7859184,"avatar_url":"https://avatars.githubusercontent.com/u/7859184?v=3","gravatar_id":"","url":"https://api.github.com/users/yarkinsv","html_url":"https://github.com/yarkinsv","followers_url":"https://api.github.com/users/yarkinsv/followers","following_url":"https://api.github.com/users/yarkinsv/following{/other_user}","gists_url":"https://api.github.com/users/yarkinsv/gists{/gist_id}","starred_url":"https://api.github.com/users/yarkinsv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yarkinsv/subscriptions","organizations_url":"https://api.github.com/users/yarkinsv/orgs","repos_url":"https://api.github.com/users/yarkinsv/repos","events_url":"https://api.github.com/users/yarkinsv/events{/privacy}","received_events_url":"https://api.github.com/users/yarkinsv/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/yarkinsv/BookStoreManagment","description":"","fork":false,"url":"https://api.github.com/repos/yarkinsv/BookStoreManagment","forks_url":"https://api.github.com/repos/yarkinsv/BookStoreManagment/forks","keys_url":"https://api.github.com/repos/yarkinsv/BookStoreManagment/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yarkinsv/BookStoreManagment/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yarkinsv/BookStoreManagment/teams","hooks_url":"https://api.github.com/repos/yarkinsv/BookStoreManagment/hooks","issue_events_url":"https://api.github.com/repos/yarkinsv/BookStoreManagment/issues/events{/number}","events_url":"https://api.github.com/repos/yarkinsv/BookStoreManagment/events","assignees_url":"https://api.github.com/repos/yarkinsv/BookStoreManagment/assignees{/user}","branches_url":"https://api.github.com/repos/yarkinsv/BookStoreManagment/branches{/branch}","tags_url":"https://api.github.com/repos/yarkinsv/BookStoreManagment/tags","blobs_url":"https://api.github.com/repos/yarkinsv/BookStoreManagment/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yarkinsv/BookStoreManagment/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yarkinsv/BookStoreManagment/git/refs{/sha}","trees_url":"https://api.github.com/repos/yarkinsv/BookStoreManagment/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yarkinsv/BookStoreManagment/statuses/{sha}","languages_url":"https://api.github.com/repos/yarkinsv/BookStoreManagment/languages","stargazers_url":"https://api.github.com/repos/yarkinsv/BookStoreManagment/stargazers","contributors_url":"https://api.github.com/repos/yarkinsv/BookStoreManagment/contributors","subscribers_url":"https://api.github.com/repos/yarkinsv/BookStoreManagment/subscribers","subscription_url":"https://api.github.com/repos/yarkinsv/BookStoreManagment/subscription","commits_url":"https://api.github.com/repos/yarkinsv/BookStoreManagment/commits{/sha}","git_commits_url":"https://api.github.com/repos/yarkinsv/BookStoreManagment/git/commits{/sha}","comments_url":"https://api.github.com/repos/yarkinsv/BookStoreManagment/comments{/number}","issue_comment_url":"https://api.github.com/repos/yarkinsv/BookStoreManagment/issues/comments{/number}","contents_url":"https://api.github.com/repos/yarkinsv/BookStoreManagment/contents/{+path}","compare_url":"https://api.github.com/repos/yarkinsv/BookStoreManagment/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yarkinsv/BookStoreManagment/merges","archive_url":"https://api.github.com/repos/yarkinsv/BookStoreManagment/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yarkinsv/BookStoreManagment/downloads","issues_url":"https://api.github.com/repos/yarkinsv/BookStoreManagment/issues{/number}","pulls_url":"https://api.github.com/repos/yarkinsv/BookStoreManagment/pulls{/number}","milestones_url":"https://api.github.com/repos/yarkinsv/BookStoreManagment/milestones{/number}","notifications_url":"https://api.github.com/repos/yarkinsv/BookStoreManagment/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yarkinsv/BookStoreManagment/labels{/name}","releases_url":"https://api.github.com/repos/yarkinsv/BookStoreManagment/releases{/id}","deployments_url":"https://api.github.com/repos/yarkinsv/BookStoreManagment/deployments","created_at":"2016-03-04T20:23:21Z","updated_at":"2016-03-04T20:23:21Z","pushed_at":"2016-03-05T12:26:27Z","git_url":"git://github.com/yarkinsv/BookStoreManagment.git","ssh_url":"git@github.com:yarkinsv/BookStoreManagment.git","clone_url":"https://github.com/yarkinsv/BookStoreManagment.git","svn_url":"https://github.com/yarkinsv/BookStoreManagment","homepage":null,"size":20,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/yarkinsv/BookStoreManagment/pulls/2"},"html":{"href":"https://github.com/yarkinsv/BookStoreManagment/pull/2"},"issue":{"href":"https://api.github.com/repos/yarkinsv/BookStoreManagment/issues/2"},"comments":{"href":"https://api.github.com/repos/yarkinsv/BookStoreManagment/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/yarkinsv/BookStoreManagment/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/yarkinsv/BookStoreManagment/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/yarkinsv/BookStoreManagment/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/yarkinsv/BookStoreManagment/statuses/182d52e15301630399e7201cc09aec5cf36d1e23"}}}}