{"action":"created","comment":{"url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/pulls/comments/49729359","id":49729359,"diff_hunk":"@@ -1,20 +1,47 @@\n package io.cloudsoft.tosca.metadata;\n \n-import java.util.Map;\n-\n import com.google.common.base.Optional;\n import com.google.common.collect.ImmutableMap;\n+import org.apache.brooklyn.rest.client.BrooklynApi;\n+import org.apache.brooklyn.rest.domain.CatalogEntitySummary;\n \n-public class BrooklynToscaTypeProvider implements ToscaTypeProvider {\n+import java.util.List;\n+import java.util.Map;\n+\n+public class BrooklynToscaTypeProvider implements ToscaTypeProvider, RequiresBrooklynApi {\n \n     private Map<String, String> typeMapping = ImmutableMap.<String, String>builder()\n+            .put(\"org.apache.brooklyn.entity.proxy.LoadBalancer\", \"brooklyn.nodes.LoadBalancer\")\n+            .put(\"org.apache.brooklyn.entity.database.DatabaseNode\", \"brooklyn.nodes.Database\")\n             .put(\"org.apache.brooklyn.entity.database.mysql.MySqlNode\", \"brooklyn.nodes.Database\")\n-            .put(\"org.apache.brooklyn.entity.webapp.tomcat.TomcatServer\", \"brooklyn.nodes.WebServer\")\n-            .put(\"org.apache.brooklyn.entity.webapp.tomcat.Tomcat8Server\", \"brooklyn.nodes.WebServer\")\n+            .put(\"org.apache.brooklyn.entity.webapp.WebAppService\", \"brooklyn.nodes.WebServer\")\n             .build();\n \n+    private BrooklynApi brooklynApi;\n+\n     @Override\n-    public Optional<String> getToscaType(String type) {\n+    public void setBrooklynApi(BrooklynApi brooklynApi) {\n+        this.brooklynApi = brooklynApi;\n+    }\n+\n+    @Override\n+    public Optional<String> getToscaType(String type, String version) {\n+        try {\n+            CatalogEntitySummary catalogEntitySummary = brooklynApi.getCatalogApi().getEntity(type, version);\n+            for (Object o : catalogEntitySummary.getTags()) {","path":"brooklyn-tosca-common/src/main/java/io/cloudsoft/tosca/metadata/BrooklynToscaTypeProvider.java","position":37,"original_position":37,"commit_id":"34d238b41e61dff1c59697bd4e6b999d83d01550","original_commit_id":"34d238b41e61dff1c59697bd4e6b999d83d01550","user":{"login":"sjcorbett","id":837527,"avatar_url":"https://avatars.githubusercontent.com/u/837527?v=3","gravatar_id":"","url":"https://api.github.com/users/sjcorbett","html_url":"https://github.com/sjcorbett","followers_url":"https://api.github.com/users/sjcorbett/followers","following_url":"https://api.github.com/users/sjcorbett/following{/other_user}","gists_url":"https://api.github.com/users/sjcorbett/gists{/gist_id}","starred_url":"https://api.github.com/users/sjcorbett/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sjcorbett/subscriptions","organizations_url":"https://api.github.com/users/sjcorbett/orgs","repos_url":"https://api.github.com/users/sjcorbett/repos","events_url":"https://api.github.com/users/sjcorbett/events{/privacy}","received_events_url":"https://api.github.com/users/sjcorbett/received_events","type":"User","site_admin":false},"body":"Check tags is non-null.","created_at":"2016-01-14T14:11:45Z","updated_at":"2016-01-14T14:11:45Z","html_url":"https://github.com/cloudsoft/brooklyn-tosca/pull/54#discussion_r49729359","pull_request_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/pulls/54","_links":{"self":{"href":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/pulls/comments/49729359"},"html":{"href":"https://github.com/cloudsoft/brooklyn-tosca/pull/54#discussion_r49729359"},"pull_request":{"href":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/pulls/54"}}},"pull_request":{"url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/pulls/54","id":56036773,"html_url":"https://github.com/cloudsoft/brooklyn-tosca/pull/54","diff_url":"https://github.com/cloudsoft/brooklyn-tosca/pull/54.diff","patch_url":"https://github.com/cloudsoft/brooklyn-tosca/pull/54.patch","issue_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/issues/54","number":54,"state":"open","locked":false,"title":"makes BrooklynToscaTypeProvider look up traits to decide tosca type","user":{"login":"robertgmoss","id":1054185,"avatar_url":"https://avatars.githubusercontent.com/u/1054185?v=3","gravatar_id":"","url":"https://api.github.com/users/robertgmoss","html_url":"https://github.com/robertgmoss","followers_url":"https://api.github.com/users/robertgmoss/followers","following_url":"https://api.github.com/users/robertgmoss/following{/other_user}","gists_url":"https://api.github.com/users/robertgmoss/gists{/gist_id}","starred_url":"https://api.github.com/users/robertgmoss/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robertgmoss/subscriptions","organizations_url":"https://api.github.com/users/robertgmoss/orgs","repos_url":"https://api.github.com/users/robertgmoss/repos","events_url":"https://api.github.com/users/robertgmoss/events{/privacy}","received_events_url":"https://api.github.com/users/robertgmoss/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-01-14T13:48:42Z","updated_at":"2016-01-14T14:11:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a3c1f51c923ee11377a434ce428e8ef4a1a18de6","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/pulls/54/commits","review_comments_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/pulls/54/comments","review_comment_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/issues/54/comments","statuses_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/statuses/34d238b41e61dff1c59697bd4e6b999d83d01550","head":{"label":"robertgmoss:trait-mapping","ref":"trait-mapping","sha":"34d238b41e61dff1c59697bd4e6b999d83d01550","user":{"login":"robertgmoss","id":1054185,"avatar_url":"https://avatars.githubusercontent.com/u/1054185?v=3","gravatar_id":"","url":"https://api.github.com/users/robertgmoss","html_url":"https://github.com/robertgmoss","followers_url":"https://api.github.com/users/robertgmoss/followers","following_url":"https://api.github.com/users/robertgmoss/following{/other_user}","gists_url":"https://api.github.com/users/robertgmoss/gists{/gist_id}","starred_url":"https://api.github.com/users/robertgmoss/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robertgmoss/subscriptions","organizations_url":"https://api.github.com/users/robertgmoss/orgs","repos_url":"https://api.github.com/users/robertgmoss/repos","events_url":"https://api.github.com/users/robertgmoss/events{/privacy}","received_events_url":"https://api.github.com/users/robertgmoss/received_events","type":"User","site_admin":false},"repo":{"id":44966819,"name":"brooklyn-tosca","full_name":"robertgmoss/brooklyn-tosca","owner":{"login":"robertgmoss","id":1054185,"avatar_url":"https://avatars.githubusercontent.com/u/1054185?v=3","gravatar_id":"","url":"https://api.github.com/users/robertgmoss","html_url":"https://github.com/robertgmoss","followers_url":"https://api.github.com/users/robertgmoss/followers","following_url":"https://api.github.com/users/robertgmoss/following{/other_user}","gists_url":"https://api.github.com/users/robertgmoss/gists{/gist_id}","starred_url":"https://api.github.com/users/robertgmoss/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robertgmoss/subscriptions","organizations_url":"https://api.github.com/users/robertgmoss/orgs","repos_url":"https://api.github.com/users/robertgmoss/repos","events_url":"https://api.github.com/users/robertgmoss/events{/privacy}","received_events_url":"https://api.github.com/users/robertgmoss/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/robertgmoss/brooklyn-tosca","description":"","fork":true,"url":"https://api.github.com/repos/robertgmoss/brooklyn-tosca","forks_url":"https://api.github.com/repos/robertgmoss/brooklyn-tosca/forks","keys_url":"https://api.github.com/repos/robertgmoss/brooklyn-tosca/keys{/key_id}","collaborators_url":"https://api.github.com/repos/robertgmoss/brooklyn-tosca/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/robertgmoss/brooklyn-tosca/teams","hooks_url":"https://api.github.com/repos/robertgmoss/brooklyn-tosca/hooks","issue_events_url":"https://api.github.com/repos/robertgmoss/brooklyn-tosca/issues/events{/number}","events_url":"https://api.github.com/repos/robertgmoss/brooklyn-tosca/events","assignees_url":"https://api.github.com/repos/robertgmoss/brooklyn-tosca/assignees{/user}","branches_url":"https://api.github.com/repos/robertgmoss/brooklyn-tosca/branches{/branch}","tags_url":"https://api.github.com/repos/robertgmoss/brooklyn-tosca/tags","blobs_url":"https://api.github.com/repos/robertgmoss/brooklyn-tosca/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/robertgmoss/brooklyn-tosca/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/robertgmoss/brooklyn-tosca/git/refs{/sha}","trees_url":"https://api.github.com/repos/robertgmoss/brooklyn-tosca/git/trees{/sha}","statuses_url":"https://api.github.com/repos/robertgmoss/brooklyn-tosca/statuses/{sha}","languages_url":"https://api.github.com/repos/robertgmoss/brooklyn-tosca/languages","stargazers_url":"https://api.github.com/repos/robertgmoss/brooklyn-tosca/stargazers","contributors_url":"https://api.github.com/repos/robertgmoss/brooklyn-tosca/contributors","subscribers_url":"https://api.github.com/repos/robertgmoss/brooklyn-tosca/subscribers","subscription_url":"https://api.github.com/repos/robertgmoss/brooklyn-tosca/subscription","commits_url":"https://api.github.com/repos/robertgmoss/brooklyn-tosca/commits{/sha}","git_commits_url":"https://api.github.com/repos/robertgmoss/brooklyn-tosca/git/commits{/sha}","comments_url":"https://api.github.com/repos/robertgmoss/brooklyn-tosca/comments{/number}","issue_comment_url":"https://api.github.com/repos/robertgmoss/brooklyn-tosca/issues/comments{/number}","contents_url":"https://api.github.com/repos/robertgmoss/brooklyn-tosca/contents/{+path}","compare_url":"https://api.github.com/repos/robertgmoss/brooklyn-tosca/compare/{base}...{head}","merges_url":"https://api.github.com/repos/robertgmoss/brooklyn-tosca/merges","archive_url":"https://api.github.com/repos/robertgmoss/brooklyn-tosca/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/robertgmoss/brooklyn-tosca/downloads","issues_url":"https://api.github.com/repos/robertgmoss/brooklyn-tosca/issues{/number}","pulls_url":"https://api.github.com/repos/robertgmoss/brooklyn-tosca/pulls{/number}","milestones_url":"https://api.github.com/repos/robertgmoss/brooklyn-tosca/milestones{/number}","notifications_url":"https://api.github.com/repos/robertgmoss/brooklyn-tosca/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/robertgmoss/brooklyn-tosca/labels{/name}","releases_url":"https://api.github.com/repos/robertgmoss/brooklyn-tosca/releases{/id}","created_at":"2015-10-26T12:27:28Z","updated_at":"2015-10-26T12:27:29Z","pushed_at":"2016-01-14T13:48:31Z","git_url":"git://github.com/robertgmoss/brooklyn-tosca.git","ssh_url":"git@github.com:robertgmoss/brooklyn-tosca.git","clone_url":"https://github.com/robertgmoss/brooklyn-tosca.git","svn_url":"https://github.com/robertgmoss/brooklyn-tosca","homepage":null,"size":891,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"cloudsoft:master","ref":"master","sha":"0b623b498db9bd69ca92333bb7dd343fec70768c","user":{"login":"cloudsoft","id":831459,"avatar_url":"https://avatars.githubusercontent.com/u/831459?v=3","gravatar_id":"","url":"https://api.github.com/users/cloudsoft","html_url":"https://github.com/cloudsoft","followers_url":"https://api.github.com/users/cloudsoft/followers","following_url":"https://api.github.com/users/cloudsoft/following{/other_user}","gists_url":"https://api.github.com/users/cloudsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/cloudsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cloudsoft/subscriptions","organizations_url":"https://api.github.com/users/cloudsoft/orgs","repos_url":"https://api.github.com/users/cloudsoft/repos","events_url":"https://api.github.com/users/cloudsoft/events{/privacy}","received_events_url":"https://api.github.com/users/cloudsoft/received_events","type":"Organization","site_admin":false},"repo":{"id":42243454,"name":"brooklyn-tosca","full_name":"cloudsoft/brooklyn-tosca","owner":{"login":"cloudsoft","id":831459,"avatar_url":"https://avatars.githubusercontent.com/u/831459?v=3","gravatar_id":"","url":"https://api.github.com/users/cloudsoft","html_url":"https://github.com/cloudsoft","followers_url":"https://api.github.com/users/cloudsoft/followers","following_url":"https://api.github.com/users/cloudsoft/following{/other_user}","gists_url":"https://api.github.com/users/cloudsoft/gists{/gist_id}","starred_url":"https://api.github.com/users/cloudsoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cloudsoft/subscriptions","organizations_url":"https://api.github.com/users/cloudsoft/orgs","repos_url":"https://api.github.com/users/cloudsoft/repos","events_url":"https://api.github.com/users/cloudsoft/events{/privacy}","received_events_url":"https://api.github.com/users/cloudsoft/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cloudsoft/brooklyn-tosca","description":"","fork":false,"url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca","forks_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/forks","keys_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/teams","hooks_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/hooks","issue_events_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/issues/events{/number}","events_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/events","assignees_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/assignees{/user}","branches_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/branches{/branch}","tags_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/tags","blobs_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/git/refs{/sha}","trees_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/statuses/{sha}","languages_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/languages","stargazers_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/stargazers","contributors_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/contributors","subscribers_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/subscribers","subscription_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/subscription","commits_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/commits{/sha}","git_commits_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/git/commits{/sha}","comments_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/comments{/number}","issue_comment_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/issues/comments{/number}","contents_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/contents/{+path}","compare_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/merges","archive_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/downloads","issues_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/issues{/number}","pulls_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/pulls{/number}","milestones_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/milestones{/number}","notifications_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/labels{/name}","releases_url":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/releases{/id}","created_at":"2015-09-10T12:36:54Z","updated_at":"2016-01-11T11:40:35Z","pushed_at":"2016-01-14T13:48:44Z","git_url":"git://github.com/cloudsoft/brooklyn-tosca.git","ssh_url":"git@github.com:cloudsoft/brooklyn-tosca.git","clone_url":"https://github.com/cloudsoft/brooklyn-tosca.git","svn_url":"https://github.com/cloudsoft/brooklyn-tosca","homepage":null,"size":980,"stargazers_count":5,"watchers_count":5,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":12,"mirror_url":null,"open_issues_count":1,"forks":12,"open_issues":1,"watchers":5,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/pulls/54"},"html":{"href":"https://github.com/cloudsoft/brooklyn-tosca/pull/54"},"issue":{"href":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/issues/54"},"comments":{"href":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/issues/54/comments"},"review_comments":{"href":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/pulls/54/comments"},"review_comment":{"href":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/pulls/54/commits"},"statuses":{"href":"https://api.github.com/repos/cloudsoft/brooklyn-tosca/statuses/34d238b41e61dff1c59697bd4e6b999d83d01550"}}}}