{"action":"created","comment":{"url":"https://api.github.com/repos/apache/incubator-brooklyn/pulls/comments/45048101","id":45048101,"diff_hunk":"@@ -0,0 +1,115 @@\n+/*\n+ * Licensed to the Apache Software Foundation (ASF) under one\n+ * or more contributor license agreements.  See the NOTICE file\n+ * distributed with this work for additional information\n+ * regarding copyright ownership.  The ASF licenses this file\n+ * to you under the Apache License, Version 2.0 (the\n+ * \"License\"); you may not use this file except in compliance\n+ * with the License.  You may obtain a copy of the License at\n+ *\n+ *     http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing,\n+ * software distributed under the License is distributed on an\n+ * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n+ * KIND, either express or implied.  See the License for the\n+ * specific language governing permissions and limitations\n+ * under the License.\n+ */\n+package org.apache.brooklyn.core.catalog.internal;\n+\n+import java.util.List;\n+import java.util.Map;\n+import java.util.concurrent.ConcurrentHashMap;\n+\n+import org.apache.brooklyn.api.internal.AbstractBrooklynObjectSpec;\n+import org.apache.brooklyn.api.typereg.RegisteredType;\n+import org.apache.brooklyn.api.typereg.RegisteredTypeLoadingContext;\n+import org.apache.brooklyn.core.typereg.AbstractTypePlanTransformer;\n+import org.apache.brooklyn.core.typereg.JavaClassNameTypePlanTransformer;\n+import org.apache.brooklyn.core.typereg.TypePlanTransformers;\n+import org.apache.brooklyn.util.text.Identifiers;\n+\n+/**\n+ * Resolves previously registered specs by id.\n+ * First create a spec and register it, keeping the returned ID:\n+ * <pre> {@code\n+ * String specId = StaticTypePlanTransformer.registerSpec(EntitySpec.create(BasicEntity.class));\n+ * }</pre>\n+ *\n+ * Then build a plan to be resolved such as:\n+ * <pre> {@code\n+ *  brooklyn.catalog:\n+ *    id: test.inputs\n+ *    version: 0.0.1\n+ *    item: <specId>\n+ * } </pre>\n+ */\n+public class StaticTypePlanTransformer extends AbstractTypePlanTransformer {\n+    \n+    public StaticTypePlanTransformer() {\n+        super(\"static-types\", \"Static Type\", \"Static transformer for use in tests\");\n+    }\n+\n+    private static final Map<String, AbstractBrooklynObjectSpec<?, ?>> REGISTERED_SPECS = new ConcurrentHashMap<>();\n+\n+    public static void forceInstall() {\n+        TypePlanTransformers.forceAvailable(StaticTypePlanTransformer.class, JavaClassNameTypePlanTransformer.class);","path":"core/src/test/java/org/apache/brooklyn/core/catalog/internal/StaticTypePlanTransformer.java","position":57,"original_position":57,"commit_id":"c712ad5e6ed0b0cc6ea0a4e501091fc0dd77c9d9","original_commit_id":"c712ad5e6ed0b0cc6ea0a4e501091fc0dd77c9d9","user":{"login":"ahgittin","id":496540,"avatar_url":"https://avatars.githubusercontent.com/u/496540?v=3","gravatar_id":"","url":"https://api.github.com/users/ahgittin","html_url":"https://github.com/ahgittin","followers_url":"https://api.github.com/users/ahgittin/followers","following_url":"https://api.github.com/users/ahgittin/following{/other_user}","gists_url":"https://api.github.com/users/ahgittin/gists{/gist_id}","starred_url":"https://api.github.com/users/ahgittin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ahgittin/subscriptions","organizations_url":"https://api.github.com/users/ahgittin/orgs","repos_url":"https://api.github.com/users/ahgittin/repos","events_url":"https://api.github.com/users/ahgittin/events{/privacy}","received_events_url":"https://api.github.com/users/ahgittin/received_events","type":"User","site_admin":false},"body":"different.  this one requires the caller to provide the specs.  `JCNTPT` does a `Class.forName(typeName)` to create the spec.  added javadoc to this effect, plus a few other cleanups (clears the `REGISTERED_SPECS` map!)","created_at":"2015-11-17T11:18:21Z","updated_at":"2015-11-17T11:18:21Z","html_url":"https://github.com/apache/incubator-brooklyn/pull/1017#discussion_r45048101","pull_request_url":"https://api.github.com/repos/apache/incubator-brooklyn/pulls/1017","_links":{"self":{"href":"https://api.github.com/repos/apache/incubator-brooklyn/pulls/comments/45048101"},"html":{"href":"https://github.com/apache/incubator-brooklyn/pull/1017#discussion_r45048101"},"pull_request":{"href":"https://api.github.com/repos/apache/incubator-brooklyn/pulls/1017"}}},"pull_request":{"url":"https://api.github.com/repos/apache/incubator-brooklyn/pulls/1017","id":50261997,"html_url":"https://github.com/apache/incubator-brooklyn/pull/1017","diff_url":"https://github.com/apache/incubator-brooklyn/pull/1017.diff","patch_url":"https://github.com/apache/incubator-brooklyn/pull/1017.patch","issue_url":"https://api.github.com/repos/apache/incubator-brooklyn/issues/1017","number":1017,"state":"open","locked":false,"title":"Flesh out type creation using the new TypeRegistry","user":{"login":"ahgittin","id":496540,"avatar_url":"https://avatars.githubusercontent.com/u/496540?v=3","gravatar_id":"","url":"https://api.github.com/users/ahgittin","html_url":"https://github.com/ahgittin","followers_url":"https://api.github.com/users/ahgittin/followers","following_url":"https://api.github.com/users/ahgittin/following{/other_user}","gists_url":"https://api.github.com/users/ahgittin/gists{/gist_id}","starred_url":"https://api.github.com/users/ahgittin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ahgittin/subscriptions","organizations_url":"https://api.github.com/users/ahgittin/orgs","repos_url":"https://api.github.com/users/ahgittin/repos","events_url":"https://api.github.com/users/ahgittin/events{/privacy}","received_events_url":"https://api.github.com/users/ahgittin/received_events","type":"User","site_admin":false},"body":"Switch many uses of Catalog to RegisteredType and improve the API around the TypePlanTransformer.  See individual commits for detail.\r\n\r\nNext is:\r\n* enable CAMP to use bean creation and register some beans\r\n* swap CAMP to use a new simpler implementation for parsing, enabling reflection-based doc generation and code completion proposals\r\n* persist RegisteredType instances instead of CatalogItems\r\n\r\nNote that this builds on #1016 (which should be quick to review) so ignore commit  036ba79.","created_at":"2015-11-10T14:47:42Z","updated_at":"2015-11-17T11:18:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9fe0e8f867a07a3e5320e89bfd4406b4c11dbb50","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/apache/incubator-brooklyn/pulls/1017/commits","review_comments_url":"https://api.github.com/repos/apache/incubator-brooklyn/pulls/1017/comments","review_comment_url":"https://api.github.com/repos/apache/incubator-brooklyn/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/incubator-brooklyn/issues/1017/comments","statuses_url":"https://api.github.com/repos/apache/incubator-brooklyn/statuses/c712ad5e6ed0b0cc6ea0a4e501091fc0dd77c9d9","head":{"label":"ahgittin:type-registry","ref":"type-registry","sha":"c712ad5e6ed0b0cc6ea0a4e501091fc0dd77c9d9","user":{"login":"ahgittin","id":496540,"avatar_url":"https://avatars.githubusercontent.com/u/496540?v=3","gravatar_id":"","url":"https://api.github.com/users/ahgittin","html_url":"https://github.com/ahgittin","followers_url":"https://api.github.com/users/ahgittin/followers","following_url":"https://api.github.com/users/ahgittin/following{/other_user}","gists_url":"https://api.github.com/users/ahgittin/gists{/gist_id}","starred_url":"https://api.github.com/users/ahgittin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ahgittin/subscriptions","organizations_url":"https://api.github.com/users/ahgittin/orgs","repos_url":"https://api.github.com/users/ahgittin/repos","events_url":"https://api.github.com/users/ahgittin/events{/privacy}","received_events_url":"https://api.github.com/users/ahgittin/received_events","type":"User","site_admin":false},"repo":{"id":21164564,"name":"incubator-brooklyn","full_name":"ahgittin/incubator-brooklyn","owner":{"login":"ahgittin","id":496540,"avatar_url":"https://avatars.githubusercontent.com/u/496540?v=3","gravatar_id":"","url":"https://api.github.com/users/ahgittin","html_url":"https://github.com/ahgittin","followers_url":"https://api.github.com/users/ahgittin/followers","following_url":"https://api.github.com/users/ahgittin/following{/other_user}","gists_url":"https://api.github.com/users/ahgittin/gists{/gist_id}","starred_url":"https://api.github.com/users/ahgittin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ahgittin/subscriptions","organizations_url":"https://api.github.com/users/ahgittin/orgs","repos_url":"https://api.github.com/users/ahgittin/repos","events_url":"https://api.github.com/users/ahgittin/events{/privacy}","received_events_url":"https://api.github.com/users/ahgittin/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ahgittin/incubator-brooklyn","description":"Mirror of Apache Brooklyn","fork":true,"url":"https://api.github.com/repos/ahgittin/incubator-brooklyn","forks_url":"https://api.github.com/repos/ahgittin/incubator-brooklyn/forks","keys_url":"https://api.github.com/repos/ahgittin/incubator-brooklyn/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ahgittin/incubator-brooklyn/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ahgittin/incubator-brooklyn/teams","hooks_url":"https://api.github.com/repos/ahgittin/incubator-brooklyn/hooks","issue_events_url":"https://api.github.com/repos/ahgittin/incubator-brooklyn/issues/events{/number}","events_url":"https://api.github.com/repos/ahgittin/incubator-brooklyn/events","assignees_url":"https://api.github.com/repos/ahgittin/incubator-brooklyn/assignees{/user}","branches_url":"https://api.github.com/repos/ahgittin/incubator-brooklyn/branches{/branch}","tags_url":"https://api.github.com/repos/ahgittin/incubator-brooklyn/tags","blobs_url":"https://api.github.com/repos/ahgittin/incubator-brooklyn/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ahgittin/incubator-brooklyn/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ahgittin/incubator-brooklyn/git/refs{/sha}","trees_url":"https://api.github.com/repos/ahgittin/incubator-brooklyn/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ahgittin/incubator-brooklyn/statuses/{sha}","languages_url":"https://api.github.com/repos/ahgittin/incubator-brooklyn/languages","stargazers_url":"https://api.github.com/repos/ahgittin/incubator-brooklyn/stargazers","contributors_url":"https://api.github.com/repos/ahgittin/incubator-brooklyn/contributors","subscribers_url":"https://api.github.com/repos/ahgittin/incubator-brooklyn/subscribers","subscription_url":"https://api.github.com/repos/ahgittin/incubator-brooklyn/subscription","commits_url":"https://api.github.com/repos/ahgittin/incubator-brooklyn/commits{/sha}","git_commits_url":"https://api.github.com/repos/ahgittin/incubator-brooklyn/git/commits{/sha}","comments_url":"https://api.github.com/repos/ahgittin/incubator-brooklyn/comments{/number}","issue_comment_url":"https://api.github.com/repos/ahgittin/incubator-brooklyn/issues/comments{/number}","contents_url":"https://api.github.com/repos/ahgittin/incubator-brooklyn/contents/{+path}","compare_url":"https://api.github.com/repos/ahgittin/incubator-brooklyn/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ahgittin/incubator-brooklyn/merges","archive_url":"https://api.github.com/repos/ahgittin/incubator-brooklyn/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ahgittin/incubator-brooklyn/downloads","issues_url":"https://api.github.com/repos/ahgittin/incubator-brooklyn/issues{/number}","pulls_url":"https://api.github.com/repos/ahgittin/incubator-brooklyn/pulls{/number}","milestones_url":"https://api.github.com/repos/ahgittin/incubator-brooklyn/milestones{/number}","notifications_url":"https://api.github.com/repos/ahgittin/incubator-brooklyn/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ahgittin/incubator-brooklyn/labels{/name}","releases_url":"https://api.github.com/repos/ahgittin/incubator-brooklyn/releases{/id}","created_at":"2014-06-24T12:59:32Z","updated_at":"2015-02-06T14:02:59Z","pushed_at":"2015-11-10T17:13:08Z","git_url":"git://github.com/ahgittin/incubator-brooklyn.git","ssh_url":"git@github.com:ahgittin/incubator-brooklyn.git","clone_url":"https://github.com/ahgittin/incubator-brooklyn.git","svn_url":"https://github.com/ahgittin/incubator-brooklyn","homepage":null,"size":256407,"stargazers_count":1,"watchers_count":1,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"apache:master","ref":"master","sha":"2aa01c0f90c5acdf284f990cf7b7f1b4cae28dbb","user":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"repo":{"id":19368221,"name":"incubator-brooklyn","full_name":"apache/incubator-brooklyn","owner":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apache/incubator-brooklyn","description":"Mirror of Apache Brooklyn","fork":false,"url":"https://api.github.com/repos/apache/incubator-brooklyn","forks_url":"https://api.github.com/repos/apache/incubator-brooklyn/forks","keys_url":"https://api.github.com/repos/apache/incubator-brooklyn/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/incubator-brooklyn/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/incubator-brooklyn/teams","hooks_url":"https://api.github.com/repos/apache/incubator-brooklyn/hooks","issue_events_url":"https://api.github.com/repos/apache/incubator-brooklyn/issues/events{/number}","events_url":"https://api.github.com/repos/apache/incubator-brooklyn/events","assignees_url":"https://api.github.com/repos/apache/incubator-brooklyn/assignees{/user}","branches_url":"https://api.github.com/repos/apache/incubator-brooklyn/branches{/branch}","tags_url":"https://api.github.com/repos/apache/incubator-brooklyn/tags","blobs_url":"https://api.github.com/repos/apache/incubator-brooklyn/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/incubator-brooklyn/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/incubator-brooklyn/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/incubator-brooklyn/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/incubator-brooklyn/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/incubator-brooklyn/languages","stargazers_url":"https://api.github.com/repos/apache/incubator-brooklyn/stargazers","contributors_url":"https://api.github.com/repos/apache/incubator-brooklyn/contributors","subscribers_url":"https://api.github.com/repos/apache/incubator-brooklyn/subscribers","subscription_url":"https://api.github.com/repos/apache/incubator-brooklyn/subscription","commits_url":"https://api.github.com/repos/apache/incubator-brooklyn/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/incubator-brooklyn/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/incubator-brooklyn/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/incubator-brooklyn/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/incubator-brooklyn/contents/{+path}","compare_url":"https://api.github.com/repos/apache/incubator-brooklyn/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/incubator-brooklyn/merges","archive_url":"https://api.github.com/repos/apache/incubator-brooklyn/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/incubator-brooklyn/downloads","issues_url":"https://api.github.com/repos/apache/incubator-brooklyn/issues{/number}","pulls_url":"https://api.github.com/repos/apache/incubator-brooklyn/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/incubator-brooklyn/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/incubator-brooklyn/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/incubator-brooklyn/labels{/name}","releases_url":"https://api.github.com/repos/apache/incubator-brooklyn/releases{/id}","created_at":"2014-05-02T07:00:07Z","updated_at":"2015-11-12T17:59:23Z","pushed_at":"2015-11-17T10:42:04Z","git_url":"git://github.com/apache/incubator-brooklyn.git","ssh_url":"git@github.com:apache/incubator-brooklyn.git","clone_url":"https://github.com/apache/incubator-brooklyn.git","svn_url":"https://github.com/apache/incubator-brooklyn","homepage":null,"size":255777,"stargazers_count":124,"watchers_count":124,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":97,"mirror_url":"git://git.apache.org/incubator-brooklyn.git","open_issues_count":20,"forks":97,"open_issues":20,"watchers":124,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/incubator-brooklyn/pulls/1017"},"html":{"href":"https://github.com/apache/incubator-brooklyn/pull/1017"},"issue":{"href":"https://api.github.com/repos/apache/incubator-brooklyn/issues/1017"},"comments":{"href":"https://api.github.com/repos/apache/incubator-brooklyn/issues/1017/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/incubator-brooklyn/pulls/1017/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/incubator-brooklyn/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/incubator-brooklyn/pulls/1017/commits"},"statuses":{"href":"https://api.github.com/repos/apache/incubator-brooklyn/statuses/c712ad5e6ed0b0cc6ea0a4e501091fc0dd77c9d9"}}}}