{"action":"created","comment":{"url":"https://api.github.com/repos/v5analytics/vertexium/pulls/comments/41628690","id":41628690,"diff_hunk":"@@ -0,0 +1,102 @@\n+package org.vertexium.sql;\n+\n+import com.google.common.base.Preconditions;\n+import org.apache.commons.dbcp2.BasicDataSource;\n+import org.vertexium.VertexiumSerializer;\n+import org.vertexium.inmemory.InMemoryEdge;\n+import org.vertexium.inmemory.InMemoryGraphConfiguration;\n+import org.vertexium.inmemory.InMemoryTableElement;\n+import org.vertexium.inmemory.InMemoryVertex;\n+import org.vertexium.sql.collections.SqlMap;\n+\n+import javax.sql.DataSource;\n+import java.util.HashMap;\n+import java.util.Map;\n+\n+public class SqlGraphConfiguration extends InMemoryGraphConfiguration {\n+    protected static final String CONFIG_JDBC_DRIVER_CLASS = \"sql.jdbc.driverClass\";\n+    protected static final String CONFIG_JDBC_URL = \"sql.jdbc.url\";\n+    protected static final String CONFIG_JDBC_USERNAME = \"sql.jdbc.username\";\n+    protected static final String CONFIG_JDBC_PASSWORD = \"sql.jdbc.password\";\n+    protected static final String KEY_COLUMN_NAME = \"id\";\n+    protected static final String VALUE_COLUMN_NAME = \"object\";\n+    protected static final String VERTEX_TABLE_NAME = \"vertex\";\n+    protected static final String EDGE_TABLE_NAME = \"edge\";\n+    protected static final String METADATA_TABLE_NAME = \"metadata\";\n+    protected static final String IN_VERTEX_ID_COLUMN = \"in_vertex_id\";\n+    protected static final String OUT_VERTEX_ID_COLUMN = \"out_vertex_id\";\n+\n+    private final BasicDataSource dataSource;\n+    private final SqlMap<InMemoryTableElement<InMemoryVertex>> vertexMap;\n+    private final SqlMap<InMemoryTableElement<InMemoryEdge>> edgeMap;\n+    private final SqlMap<Object> metadataMap;\n+    private final VertexiumSerializer serializer;\n+\n+    public SqlGraphConfiguration(Map<String, Object> config) {\n+        super(config);\n+        String driverClass = getConfigString(config, CONFIG_JDBC_DRIVER_CLASS);\n+        String url = getConfigString(config, CONFIG_JDBC_URL);\n+        String username = getConfigString(config, CONFIG_JDBC_USERNAME);\n+        String password = getConfigString(config, CONFIG_JDBC_PASSWORD);\n+        dataSource = new BasicDataSource();\n+        dataSource.setDriverClassName(driverClass);\n+        dataSource.setUrl(url);\n+        dataSource.setUsername(username);\n+        dataSource.setPassword(password);\n+        serializer = createSerializer();\n+        vertexMap = newVertexMap();\n+        edgeMap = newEdgeMap();\n+        metadataMap = newMetadataMap();\n+    }\n+\n+    protected DataSource getDataSource() {\n+        return dataSource;\n+    }\n+\n+    protected SqlMap<InMemoryTableElement<InMemoryVertex>> vertexMap() {\n+        return vertexMap;\n+    }\n+\n+    protected SqlMap<InMemoryTableElement<InMemoryEdge>> edgeMap() {\n+        return edgeMap;\n+    }\n+\n+    protected SqlMap<Object> metadataMap() {\n+        return metadataMap;\n+    }\n+\n+    protected String tableNameWithPrefix(String tableName) {\n+        return getTableNamePrefix() + \"_\" + tableName;\n+    }\n+\n+    private SqlMap<InMemoryTableElement<InMemoryEdge>> newEdgeMap() {","path":"sql/src/main/java/org/vertexium/sql/SqlGraphConfiguration.java","position":72,"original_position":72,"commit_id":"76fbea6da0fa12ef077c85ec0812342d5c0a6e84","original_commit_id":"46a34a10b0c39e2fd5f348900ad3ea3f1a882c24","user":{"login":"joeferner","id":808857,"avatar_url":"https://avatars.githubusercontent.com/u/808857?v=3","gravatar_id":"","url":"https://api.github.com/users/joeferner","html_url":"https://github.com/joeferner","followers_url":"https://api.github.com/users/joeferner/followers","following_url":"https://api.github.com/users/joeferner/following{/other_user}","gists_url":"https://api.github.com/users/joeferner/gists{/gist_id}","starred_url":"https://api.github.com/users/joeferner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joeferner/subscriptions","organizations_url":"https://api.github.com/users/joeferner/orgs","repos_url":"https://api.github.com/users/joeferner/repos","events_url":"https://api.github.com/users/joeferner/events{/privacy}","received_events_url":"https://api.github.com/users/joeferner/received_events","type":"User","site_admin":false},"body":"This still seems like an odd place for these methods. Shouldn't these be in SqlGraph?","created_at":"2015-10-09T13:22:32Z","updated_at":"2015-10-09T13:22:32Z","html_url":"https://github.com/v5analytics/vertexium/pull/46#discussion_r41628690","pull_request_url":"https://api.github.com/repos/v5analytics/vertexium/pulls/46","_links":{"self":{"href":"https://api.github.com/repos/v5analytics/vertexium/pulls/comments/41628690"},"html":{"href":"https://github.com/v5analytics/vertexium/pull/46#discussion_r41628690"},"pull_request":{"href":"https://api.github.com/repos/v5analytics/vertexium/pulls/46"}}},"pull_request":{"url":"https://api.github.com/repos/v5analytics/vertexium/pulls/46","id":46967446,"html_url":"https://github.com/v5analytics/vertexium/pull/46","diff_url":"https://github.com/v5analytics/vertexium/pull/46.diff","patch_url":"https://github.com/v5analytics/vertexium/pull/46.patch","issue_url":"https://api.github.com/repos/v5analytics/vertexium/issues/46","number":46,"state":"open","locked":false,"title":"SQL/JDBC implementation","user":{"login":"srfarley","id":528468,"avatar_url":"https://avatars.githubusercontent.com/u/528468?v=3","gravatar_id":"","url":"https://api.github.com/users/srfarley","html_url":"https://github.com/srfarley","followers_url":"https://api.github.com/users/srfarley/followers","following_url":"https://api.github.com/users/srfarley/following{/other_user}","gists_url":"https://api.github.com/users/srfarley/gists{/gist_id}","starred_url":"https://api.github.com/users/srfarley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/srfarley/subscriptions","organizations_url":"https://api.github.com/users/srfarley/orgs","repos_url":"https://api.github.com/users/srfarley/repos","events_url":"https://api.github.com/users/srfarley/events{/privacy}","received_events_url":"https://api.github.com/users/srfarley/received_events","type":"User","site_admin":false},"body":"@joeferner: I intend to squash the commits before merge.\r\n","created_at":"2015-10-06T22:39:17Z","updated_at":"2015-10-09T13:22:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"083edca9d2eae6ecb1f0ef480a001a981d5b4c37","assignee":{"login":"joeferner","id":808857,"avatar_url":"https://avatars.githubusercontent.com/u/808857?v=3","gravatar_id":"","url":"https://api.github.com/users/joeferner","html_url":"https://github.com/joeferner","followers_url":"https://api.github.com/users/joeferner/followers","following_url":"https://api.github.com/users/joeferner/following{/other_user}","gists_url":"https://api.github.com/users/joeferner/gists{/gist_id}","starred_url":"https://api.github.com/users/joeferner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joeferner/subscriptions","organizations_url":"https://api.github.com/users/joeferner/orgs","repos_url":"https://api.github.com/users/joeferner/repos","events_url":"https://api.github.com/users/joeferner/events{/privacy}","received_events_url":"https://api.github.com/users/joeferner/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/v5analytics/vertexium/pulls/46/commits","review_comments_url":"https://api.github.com/repos/v5analytics/vertexium/pulls/46/comments","review_comment_url":"https://api.github.com/repos/v5analytics/vertexium/pulls/comments{/number}","comments_url":"https://api.github.com/repos/v5analytics/vertexium/issues/46/comments","statuses_url":"https://api.github.com/repos/v5analytics/vertexium/statuses/76fbea6da0fa12ef077c85ec0812342d5c0a6e84","head":{"label":"v5analytics:jdbc-graph","ref":"jdbc-graph","sha":"76fbea6da0fa12ef077c85ec0812342d5c0a6e84","user":{"login":"v5analytics","id":9688123,"avatar_url":"https://avatars.githubusercontent.com/u/9688123?v=3","gravatar_id":"","url":"https://api.github.com/users/v5analytics","html_url":"https://github.com/v5analytics","followers_url":"https://api.github.com/users/v5analytics/followers","following_url":"https://api.github.com/users/v5analytics/following{/other_user}","gists_url":"https://api.github.com/users/v5analytics/gists{/gist_id}","starred_url":"https://api.github.com/users/v5analytics/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/v5analytics/subscriptions","organizations_url":"https://api.github.com/users/v5analytics/orgs","repos_url":"https://api.github.com/users/v5analytics/repos","events_url":"https://api.github.com/users/v5analytics/events{/privacy}","received_events_url":"https://api.github.com/users/v5analytics/received_events","type":"Organization","site_admin":false},"repo":{"id":31785239,"name":"vertexium","full_name":"v5analytics/vertexium","owner":{"login":"v5analytics","id":9688123,"avatar_url":"https://avatars.githubusercontent.com/u/9688123?v=3","gravatar_id":"","url":"https://api.github.com/users/v5analytics","html_url":"https://github.com/v5analytics","followers_url":"https://api.github.com/users/v5analytics/followers","following_url":"https://api.github.com/users/v5analytics/following{/other_user}","gists_url":"https://api.github.com/users/v5analytics/gists{/gist_id}","starred_url":"https://api.github.com/users/v5analytics/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/v5analytics/subscriptions","organizations_url":"https://api.github.com/users/v5analytics/orgs","repos_url":"https://api.github.com/users/v5analytics/repos","events_url":"https://api.github.com/users/v5analytics/events{/privacy}","received_events_url":"https://api.github.com/users/v5analytics/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/v5analytics/vertexium","description":"Vertexium, similar to Blueprints but secure.","fork":false,"url":"https://api.github.com/repos/v5analytics/vertexium","forks_url":"https://api.github.com/repos/v5analytics/vertexium/forks","keys_url":"https://api.github.com/repos/v5analytics/vertexium/keys{/key_id}","collaborators_url":"https://api.github.com/repos/v5analytics/vertexium/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/v5analytics/vertexium/teams","hooks_url":"https://api.github.com/repos/v5analytics/vertexium/hooks","issue_events_url":"https://api.github.com/repos/v5analytics/vertexium/issues/events{/number}","events_url":"https://api.github.com/repos/v5analytics/vertexium/events","assignees_url":"https://api.github.com/repos/v5analytics/vertexium/assignees{/user}","branches_url":"https://api.github.com/repos/v5analytics/vertexium/branches{/branch}","tags_url":"https://api.github.com/repos/v5analytics/vertexium/tags","blobs_url":"https://api.github.com/repos/v5analytics/vertexium/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/v5analytics/vertexium/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/v5analytics/vertexium/git/refs{/sha}","trees_url":"https://api.github.com/repos/v5analytics/vertexium/git/trees{/sha}","statuses_url":"https://api.github.com/repos/v5analytics/vertexium/statuses/{sha}","languages_url":"https://api.github.com/repos/v5analytics/vertexium/languages","stargazers_url":"https://api.github.com/repos/v5analytics/vertexium/stargazers","contributors_url":"https://api.github.com/repos/v5analytics/vertexium/contributors","subscribers_url":"https://api.github.com/repos/v5analytics/vertexium/subscribers","subscription_url":"https://api.github.com/repos/v5analytics/vertexium/subscription","commits_url":"https://api.github.com/repos/v5analytics/vertexium/commits{/sha}","git_commits_url":"https://api.github.com/repos/v5analytics/vertexium/git/commits{/sha}","comments_url":"https://api.github.com/repos/v5analytics/vertexium/comments{/number}","issue_comment_url":"https://api.github.com/repos/v5analytics/vertexium/issues/comments{/number}","contents_url":"https://api.github.com/repos/v5analytics/vertexium/contents/{+path}","compare_url":"https://api.github.com/repos/v5analytics/vertexium/compare/{base}...{head}","merges_url":"https://api.github.com/repos/v5analytics/vertexium/merges","archive_url":"https://api.github.com/repos/v5analytics/vertexium/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/v5analytics/vertexium/downloads","issues_url":"https://api.github.com/repos/v5analytics/vertexium/issues{/number}","pulls_url":"https://api.github.com/repos/v5analytics/vertexium/pulls{/number}","milestones_url":"https://api.github.com/repos/v5analytics/vertexium/milestones{/number}","notifications_url":"https://api.github.com/repos/v5analytics/vertexium/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/v5analytics/vertexium/labels{/name}","releases_url":"https://api.github.com/repos/v5analytics/vertexium/releases{/id}","created_at":"2015-03-06T19:27:47Z","updated_at":"2015-09-20T16:16:18Z","pushed_at":"2015-10-09T13:18:07Z","git_url":"git://github.com/v5analytics/vertexium.git","ssh_url":"git@github.com:v5analytics/vertexium.git","clone_url":"https://github.com/v5analytics/vertexium.git","svn_url":"https://github.com/v5analytics/vertexium","homepage":"http://vertexium.org/","size":12630,"stargazers_count":7,"watchers_count":7,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":2,"mirror_url":null,"open_issues_count":7,"forks":2,"open_issues":7,"watchers":7,"default_branch":"master"}},"base":{"label":"v5analytics:master","ref":"master","sha":"eb8c7af409af924ecd65045a268e308dcc0efbc0","user":{"login":"v5analytics","id":9688123,"avatar_url":"https://avatars.githubusercontent.com/u/9688123?v=3","gravatar_id":"","url":"https://api.github.com/users/v5analytics","html_url":"https://github.com/v5analytics","followers_url":"https://api.github.com/users/v5analytics/followers","following_url":"https://api.github.com/users/v5analytics/following{/other_user}","gists_url":"https://api.github.com/users/v5analytics/gists{/gist_id}","starred_url":"https://api.github.com/users/v5analytics/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/v5analytics/subscriptions","organizations_url":"https://api.github.com/users/v5analytics/orgs","repos_url":"https://api.github.com/users/v5analytics/repos","events_url":"https://api.github.com/users/v5analytics/events{/privacy}","received_events_url":"https://api.github.com/users/v5analytics/received_events","type":"Organization","site_admin":false},"repo":{"id":31785239,"name":"vertexium","full_name":"v5analytics/vertexium","owner":{"login":"v5analytics","id":9688123,"avatar_url":"https://avatars.githubusercontent.com/u/9688123?v=3","gravatar_id":"","url":"https://api.github.com/users/v5analytics","html_url":"https://github.com/v5analytics","followers_url":"https://api.github.com/users/v5analytics/followers","following_url":"https://api.github.com/users/v5analytics/following{/other_user}","gists_url":"https://api.github.com/users/v5analytics/gists{/gist_id}","starred_url":"https://api.github.com/users/v5analytics/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/v5analytics/subscriptions","organizations_url":"https://api.github.com/users/v5analytics/orgs","repos_url":"https://api.github.com/users/v5analytics/repos","events_url":"https://api.github.com/users/v5analytics/events{/privacy}","received_events_url":"https://api.github.com/users/v5analytics/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/v5analytics/vertexium","description":"Vertexium, similar to Blueprints but secure.","fork":false,"url":"https://api.github.com/repos/v5analytics/vertexium","forks_url":"https://api.github.com/repos/v5analytics/vertexium/forks","keys_url":"https://api.github.com/repos/v5analytics/vertexium/keys{/key_id}","collaborators_url":"https://api.github.com/repos/v5analytics/vertexium/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/v5analytics/vertexium/teams","hooks_url":"https://api.github.com/repos/v5analytics/vertexium/hooks","issue_events_url":"https://api.github.com/repos/v5analytics/vertexium/issues/events{/number}","events_url":"https://api.github.com/repos/v5analytics/vertexium/events","assignees_url":"https://api.github.com/repos/v5analytics/vertexium/assignees{/user}","branches_url":"https://api.github.com/repos/v5analytics/vertexium/branches{/branch}","tags_url":"https://api.github.com/repos/v5analytics/vertexium/tags","blobs_url":"https://api.github.com/repos/v5analytics/vertexium/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/v5analytics/vertexium/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/v5analytics/vertexium/git/refs{/sha}","trees_url":"https://api.github.com/repos/v5analytics/vertexium/git/trees{/sha}","statuses_url":"https://api.github.com/repos/v5analytics/vertexium/statuses/{sha}","languages_url":"https://api.github.com/repos/v5analytics/vertexium/languages","stargazers_url":"https://api.github.com/repos/v5analytics/vertexium/stargazers","contributors_url":"https://api.github.com/repos/v5analytics/vertexium/contributors","subscribers_url":"https://api.github.com/repos/v5analytics/vertexium/subscribers","subscription_url":"https://api.github.com/repos/v5analytics/vertexium/subscription","commits_url":"https://api.github.com/repos/v5analytics/vertexium/commits{/sha}","git_commits_url":"https://api.github.com/repos/v5analytics/vertexium/git/commits{/sha}","comments_url":"https://api.github.com/repos/v5analytics/vertexium/comments{/number}","issue_comment_url":"https://api.github.com/repos/v5analytics/vertexium/issues/comments{/number}","contents_url":"https://api.github.com/repos/v5analytics/vertexium/contents/{+path}","compare_url":"https://api.github.com/repos/v5analytics/vertexium/compare/{base}...{head}","merges_url":"https://api.github.com/repos/v5analytics/vertexium/merges","archive_url":"https://api.github.com/repos/v5analytics/vertexium/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/v5analytics/vertexium/downloads","issues_url":"https://api.github.com/repos/v5analytics/vertexium/issues{/number}","pulls_url":"https://api.github.com/repos/v5analytics/vertexium/pulls{/number}","milestones_url":"https://api.github.com/repos/v5analytics/vertexium/milestones{/number}","notifications_url":"https://api.github.com/repos/v5analytics/vertexium/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/v5analytics/vertexium/labels{/name}","releases_url":"https://api.github.com/repos/v5analytics/vertexium/releases{/id}","created_at":"2015-03-06T19:27:47Z","updated_at":"2015-09-20T16:16:18Z","pushed_at":"2015-10-09T13:18:07Z","git_url":"git://github.com/v5analytics/vertexium.git","ssh_url":"git@github.com:v5analytics/vertexium.git","clone_url":"https://github.com/v5analytics/vertexium.git","svn_url":"https://github.com/v5analytics/vertexium","homepage":"http://vertexium.org/","size":12630,"stargazers_count":7,"watchers_count":7,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":2,"mirror_url":null,"open_issues_count":7,"forks":2,"open_issues":7,"watchers":7,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/v5analytics/vertexium/pulls/46"},"html":{"href":"https://github.com/v5analytics/vertexium/pull/46"},"issue":{"href":"https://api.github.com/repos/v5analytics/vertexium/issues/46"},"comments":{"href":"https://api.github.com/repos/v5analytics/vertexium/issues/46/comments"},"review_comments":{"href":"https://api.github.com/repos/v5analytics/vertexium/pulls/46/comments"},"review_comment":{"href":"https://api.github.com/repos/v5analytics/vertexium/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/v5analytics/vertexium/pulls/46/commits"},"statuses":{"href":"https://api.github.com/repos/v5analytics/vertexium/statuses/76fbea6da0fa12ef077c85ec0812342d5c0a6e84"}}}}