{"action":"created","comment":{"url":"https://api.github.com/repos/codice/ddf/pulls/comments/70290573","id":70290573,"diff_hunk":"@@ -0,0 +1,143 @@\n+/**\n+ * Copyright (c) Codice Foundation\n+ * <p>\n+ * This is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser\n+ * General Public License as published by the Free Software Foundation, either version 3 of the\n+ * License, or any later version.\n+ * <p>\n+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without\n+ * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n+ * Lesser General Public License for more details. A copy of the GNU Lesser General Public License\n+ * is distributed along with this program and can be found at\n+ * <http://www.gnu.org/licenses/lgpl.html>.\n+ */\n+package ddf.catalog.data.inject;\n+\n+import static org.apache.commons.lang.Validate.notNull;\n+\n+import java.util.Collections;\n+import java.util.HashSet;\n+import java.util.Map;\n+import java.util.Optional;\n+import java.util.Set;\n+import java.util.concurrent.ConcurrentHashMap;\n+import java.util.concurrent.CopyOnWriteArraySet;\n+import java.util.stream.Collectors;\n+\n+import org.osgi.framework.BundleContext;\n+import org.osgi.framework.FrameworkUtil;\n+import org.osgi.framework.ServiceReference;\n+import org.slf4j.Logger;\n+import org.slf4j.LoggerFactory;\n+\n+import ddf.catalog.data.AttributeDescriptor;\n+import ddf.catalog.data.AttributeInjector;\n+import ddf.catalog.data.AttributeRegistry;\n+import ddf.catalog.data.InjectableAttribute;\n+import ddf.catalog.data.Metacard;\n+import ddf.catalog.data.MetacardType;\n+import ddf.catalog.data.impl.MetacardImpl;\n+import ddf.catalog.data.impl.MetacardTypeImpl;\n+\n+public class AttributeInjectorImpl implements AttributeInjector {\n+    private static final Logger LOGGER = LoggerFactory.getLogger(AttributeInjectorImpl.class);\n+\n+    private final AttributeRegistry attributeRegistry;\n+\n+    private final Set<String> globalInjections = new CopyOnWriteArraySet<>();\n+\n+    private final Map<String, Set<String>> metacardTypeInjections = new ConcurrentHashMap<>();\n+\n+    public AttributeInjectorImpl(AttributeRegistry attributeRegistry) {\n+        this.attributeRegistry = attributeRegistry;\n+    }\n+\n+    private BundleContext getBundleContext() {\n+        return FrameworkUtil.getBundle(getClass())\n+                .getBundleContext();\n+    }\n+\n+    public void bind(ServiceReference<InjectableAttribute> reference) {\n+        LOGGER.debug(\"New service registered [{}]\", reference);\n+\n+        InjectableAttribute injectableAttribute = getBundleContext().getService(reference);\n+        String attributeName = injectableAttribute.attribute();\n+        Set<String> metacardTypeNames = injectableAttribute.metacardTypes();\n+\n+        if (metacardTypeNames.isEmpty()) {\n+            globalInjections.add(attributeName);","path":"catalog/core/catalog-core-injectattribute/src/main/java/ddf/catalog/data/inject/AttributeInjectorImpl.java","position":null,"original_position":68,"commit_id":"ac4628701f8992c8689a4fa335274d65401ba7a4","original_commit_id":"915ea2260f455410e1549b1f0cbbf49ae093a857","user":{"login":"jrnorth","id":4495447,"avatar_url":"https://avatars.githubusercontent.com/u/4495447?v=3","gravatar_id":"","url":"https://api.github.com/users/jrnorth","html_url":"https://github.com/jrnorth","followers_url":"https://api.github.com/users/jrnorth/followers","following_url":"https://api.github.com/users/jrnorth/following{/other_user}","gists_url":"https://api.github.com/users/jrnorth/gists{/gist_id}","starred_url":"https://api.github.com/users/jrnorth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jrnorth/subscriptions","organizations_url":"https://api.github.com/users/jrnorth/orgs","repos_url":"https://api.github.com/users/jrnorth/repos","events_url":"https://api.github.com/users/jrnorth/events{/privacy}","received_events_url":"https://api.github.com/users/jrnorth/received_events","type":"User","site_admin":false},"body":"Fixed.","created_at":"2016-07-11T16:27:08Z","updated_at":"2016-07-11T16:27:08Z","html_url":"https://github.com/codice/ddf/pull/889#discussion_r70290573","pull_request_url":"https://api.github.com/repos/codice/ddf/pulls/889","_links":{"self":{"href":"https://api.github.com/repos/codice/ddf/pulls/comments/70290573"},"html":{"href":"https://github.com/codice/ddf/pull/889#discussion_r70290573"},"pull_request":{"href":"https://api.github.com/repos/codice/ddf/pulls/889"}}},"pull_request":{"url":"https://api.github.com/repos/codice/ddf/pulls/889","id":74838966,"html_url":"https://github.com/codice/ddf/pull/889","diff_url":"https://github.com/codice/ddf/pull/889.diff","patch_url":"https://github.com/codice/ddf/pull/889.patch","issue_url":"https://api.github.com/repos/codice/ddf/issues/889","number":889,"state":"open","locked":false,"title":"DDF-2162 Add the ability to inject attributes into metacard types","user":{"login":"jrnorth","id":4495447,"avatar_url":"https://avatars.githubusercontent.com/u/4495447?v=3","gravatar_id":"","url":"https://api.github.com/users/jrnorth","html_url":"https://github.com/jrnorth","followers_url":"https://api.github.com/users/jrnorth/followers","following_url":"https://api.github.com/users/jrnorth/following{/other_user}","gists_url":"https://api.github.com/users/jrnorth/gists{/gist_id}","starred_url":"https://api.github.com/users/jrnorth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jrnorth/subscriptions","organizations_url":"https://api.github.com/users/jrnorth/orgs","repos_url":"https://api.github.com/users/jrnorth/repos","events_url":"https://api.github.com/users/jrnorth/events{/privacy}","received_events_url":"https://api.github.com/users/jrnorth/received_events","type":"User","site_admin":false},"body":"#### What does this PR do?\r\n- Adds an API for registering 'injectable' attributes that should be injected into all metacard types or into specific metacard types\r\n- Augments the JSON metacard type definition functionality by allowing attribute injections to be defined in JSON files\r\n- Updates the GeoJSON input transformer to add all parsed attributes to the metacard so injected attributes can be discovered after the catalog framework injects the attribute descriptors into the metacard type\r\n- Updates the standard catalog framework implementation to inject the proper attributes on creates, updates, and queries\r\n\r\n#### Who is reviewing it (please choose AT LEAST two reviewers that need to approve the PR before it can get merged; if a component team is listed, at least one of its members needs to approve)?\r\n@rzwiefel \r\n@bdeining\r\n@pklinef  \r\n\r\n#### Choose 2 committers to review/merge the PR (please choose ONLY two committers from below, delete the rest).\r\n@jlcsmith\r\n@kcwire \r\n\r\n#### How should this be tested?\r\nDefine some new attributes and metacard types using the JSON definition feature and make your new attributes injectable (following the JSON definition file documentation). Ingest some GeoJSON or XML metacards of various metacard types with values for the new attributes you defined. Verify that these attributes are present on each ingested metacard.\r\n\r\n#### What are the relevant tickets?\r\n[DDF-2162](https://codice.atlassian.net/browse/DDF-2162)\r\n\r\n#### Checklist:\r\n- [x] Documentation Updated\r\n- [x] Update / Add Unit Tests\r\n- [x] Update / Add Integration Tests","created_at":"2016-06-22T19:04:38Z","updated_at":"2016-07-11T16:27:09Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3f8582904e07dc47657262dfadbf9cbdcbebc309","assignee":{"login":"jlcsmith","id":4503545,"avatar_url":"https://avatars.githubusercontent.com/u/4503545?v=3","gravatar_id":"","url":"https://api.github.com/users/jlcsmith","html_url":"https://github.com/jlcsmith","followers_url":"https://api.github.com/users/jlcsmith/followers","following_url":"https://api.github.com/users/jlcsmith/following{/other_user}","gists_url":"https://api.github.com/users/jlcsmith/gists{/gist_id}","starred_url":"https://api.github.com/users/jlcsmith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jlcsmith/subscriptions","organizations_url":"https://api.github.com/users/jlcsmith/orgs","repos_url":"https://api.github.com/users/jlcsmith/repos","events_url":"https://api.github.com/users/jlcsmith/events{/privacy}","received_events_url":"https://api.github.com/users/jlcsmith/received_events","type":"User","site_admin":false},"assignees":[{"login":"jlcsmith","id":4503545,"avatar_url":"https://avatars.githubusercontent.com/u/4503545?v=3","gravatar_id":"","url":"https://api.github.com/users/jlcsmith","html_url":"https://github.com/jlcsmith","followers_url":"https://api.github.com/users/jlcsmith/followers","following_url":"https://api.github.com/users/jlcsmith/following{/other_user}","gists_url":"https://api.github.com/users/jlcsmith/gists{/gist_id}","starred_url":"https://api.github.com/users/jlcsmith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jlcsmith/subscriptions","organizations_url":"https://api.github.com/users/jlcsmith/orgs","repos_url":"https://api.github.com/users/jlcsmith/repos","events_url":"https://api.github.com/users/jlcsmith/events{/privacy}","received_events_url":"https://api.github.com/users/jlcsmith/received_events","type":"User","site_admin":false},{"login":"kcwire","id":4631300,"avatar_url":"https://avatars.githubusercontent.com/u/4631300?v=3","gravatar_id":"","url":"https://api.github.com/users/kcwire","html_url":"https://github.com/kcwire","followers_url":"https://api.github.com/users/kcwire/followers","following_url":"https://api.github.com/users/kcwire/following{/other_user}","gists_url":"https://api.github.com/users/kcwire/gists{/gist_id}","starred_url":"https://api.github.com/users/kcwire/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kcwire/subscriptions","organizations_url":"https://api.github.com/users/kcwire/orgs","repos_url":"https://api.github.com/users/kcwire/repos","events_url":"https://api.github.com/users/kcwire/events{/privacy}","received_events_url":"https://api.github.com/users/kcwire/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/codice/ddf/pulls/889/commits","review_comments_url":"https://api.github.com/repos/codice/ddf/pulls/889/comments","review_comment_url":"https://api.github.com/repos/codice/ddf/pulls/comments{/number}","comments_url":"https://api.github.com/repos/codice/ddf/issues/889/comments","statuses_url":"https://api.github.com/repos/codice/ddf/statuses/ac4628701f8992c8689a4fa335274d65401ba7a4","head":{"label":"jrnorth:mixins-v2","ref":"mixins-v2","sha":"ac4628701f8992c8689a4fa335274d65401ba7a4","user":{"login":"jrnorth","id":4495447,"avatar_url":"https://avatars.githubusercontent.com/u/4495447?v=3","gravatar_id":"","url":"https://api.github.com/users/jrnorth","html_url":"https://github.com/jrnorth","followers_url":"https://api.github.com/users/jrnorth/followers","following_url":"https://api.github.com/users/jrnorth/following{/other_user}","gists_url":"https://api.github.com/users/jrnorth/gists{/gist_id}","starred_url":"https://api.github.com/users/jrnorth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jrnorth/subscriptions","organizations_url":"https://api.github.com/users/jrnorth/orgs","repos_url":"https://api.github.com/users/jrnorth/repos","events_url":"https://api.github.com/users/jrnorth/events{/privacy}","received_events_url":"https://api.github.com/users/jrnorth/received_events","type":"User","site_admin":false},"repo":{"id":40272076,"name":"ddf","full_name":"jrnorth/ddf","owner":{"login":"jrnorth","id":4495447,"avatar_url":"https://avatars.githubusercontent.com/u/4495447?v=3","gravatar_id":"","url":"https://api.github.com/users/jrnorth","html_url":"https://github.com/jrnorth","followers_url":"https://api.github.com/users/jrnorth/followers","following_url":"https://api.github.com/users/jrnorth/following{/other_user}","gists_url":"https://api.github.com/users/jrnorth/gists{/gist_id}","starred_url":"https://api.github.com/users/jrnorth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jrnorth/subscriptions","organizations_url":"https://api.github.com/users/jrnorth/orgs","repos_url":"https://api.github.com/users/jrnorth/repos","events_url":"https://api.github.com/users/jrnorth/events{/privacy}","received_events_url":"https://api.github.com/users/jrnorth/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jrnorth/ddf","description":"The Distributed Data Framework - Distribution, SDK, and Test","fork":true,"url":"https://api.github.com/repos/jrnorth/ddf","forks_url":"https://api.github.com/repos/jrnorth/ddf/forks","keys_url":"https://api.github.com/repos/jrnorth/ddf/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jrnorth/ddf/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jrnorth/ddf/teams","hooks_url":"https://api.github.com/repos/jrnorth/ddf/hooks","issue_events_url":"https://api.github.com/repos/jrnorth/ddf/issues/events{/number}","events_url":"https://api.github.com/repos/jrnorth/ddf/events","assignees_url":"https://api.github.com/repos/jrnorth/ddf/assignees{/user}","branches_url":"https://api.github.com/repos/jrnorth/ddf/branches{/branch}","tags_url":"https://api.github.com/repos/jrnorth/ddf/tags","blobs_url":"https://api.github.com/repos/jrnorth/ddf/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jrnorth/ddf/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jrnorth/ddf/git/refs{/sha}","trees_url":"https://api.github.com/repos/jrnorth/ddf/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jrnorth/ddf/statuses/{sha}","languages_url":"https://api.github.com/repos/jrnorth/ddf/languages","stargazers_url":"https://api.github.com/repos/jrnorth/ddf/stargazers","contributors_url":"https://api.github.com/repos/jrnorth/ddf/contributors","subscribers_url":"https://api.github.com/repos/jrnorth/ddf/subscribers","subscription_url":"https://api.github.com/repos/jrnorth/ddf/subscription","commits_url":"https://api.github.com/repos/jrnorth/ddf/commits{/sha}","git_commits_url":"https://api.github.com/repos/jrnorth/ddf/git/commits{/sha}","comments_url":"https://api.github.com/repos/jrnorth/ddf/comments{/number}","issue_comment_url":"https://api.github.com/repos/jrnorth/ddf/issues/comments{/number}","contents_url":"https://api.github.com/repos/jrnorth/ddf/contents/{+path}","compare_url":"https://api.github.com/repos/jrnorth/ddf/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jrnorth/ddf/merges","archive_url":"https://api.github.com/repos/jrnorth/ddf/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jrnorth/ddf/downloads","issues_url":"https://api.github.com/repos/jrnorth/ddf/issues{/number}","pulls_url":"https://api.github.com/repos/jrnorth/ddf/pulls{/number}","milestones_url":"https://api.github.com/repos/jrnorth/ddf/milestones{/number}","notifications_url":"https://api.github.com/repos/jrnorth/ddf/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jrnorth/ddf/labels{/name}","releases_url":"https://api.github.com/repos/jrnorth/ddf/releases{/id}","deployments_url":"https://api.github.com/repos/jrnorth/ddf/deployments","created_at":"2015-08-05T22:33:54Z","updated_at":"2016-01-11T16:11:49Z","pushed_at":"2016-07-09T01:06:24Z","git_url":"git://github.com/jrnorth/ddf.git","ssh_url":"git@github.com:jrnorth/ddf.git","clone_url":"https://github.com/jrnorth/ddf.git","svn_url":"https://github.com/jrnorth/ddf","homepage":"","size":143841,"stargazers_count":1,"watchers_count":1,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"codice:master","ref":"master","sha":"61596d72800892423045422f8f1c3512edd45fc3","user":{"login":"codice","id":2386734,"avatar_url":"https://avatars.githubusercontent.com/u/2386734?v=3","gravatar_id":"","url":"https://api.github.com/users/codice","html_url":"https://github.com/codice","followers_url":"https://api.github.com/users/codice/followers","following_url":"https://api.github.com/users/codice/following{/other_user}","gists_url":"https://api.github.com/users/codice/gists{/gist_id}","starred_url":"https://api.github.com/users/codice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codice/subscriptions","organizations_url":"https://api.github.com/users/codice/orgs","repos_url":"https://api.github.com/users/codice/repos","events_url":"https://api.github.com/users/codice/events{/privacy}","received_events_url":"https://api.github.com/users/codice/received_events","type":"Organization","site_admin":false},"repo":{"id":15173563,"name":"ddf","full_name":"codice/ddf","owner":{"login":"codice","id":2386734,"avatar_url":"https://avatars.githubusercontent.com/u/2386734?v=3","gravatar_id":"","url":"https://api.github.com/users/codice","html_url":"https://github.com/codice","followers_url":"https://api.github.com/users/codice/followers","following_url":"https://api.github.com/users/codice/following{/other_user}","gists_url":"https://api.github.com/users/codice/gists{/gist_id}","starred_url":"https://api.github.com/users/codice/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codice/subscriptions","organizations_url":"https://api.github.com/users/codice/orgs","repos_url":"https://api.github.com/users/codice/repos","events_url":"https://api.github.com/users/codice/events{/privacy}","received_events_url":"https://api.github.com/users/codice/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/codice/ddf","description":"Distributed Data Framework - an open source, modular integration framework.","fork":false,"url":"https://api.github.com/repos/codice/ddf","forks_url":"https://api.github.com/repos/codice/ddf/forks","keys_url":"https://api.github.com/repos/codice/ddf/keys{/key_id}","collaborators_url":"https://api.github.com/repos/codice/ddf/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/codice/ddf/teams","hooks_url":"https://api.github.com/repos/codice/ddf/hooks","issue_events_url":"https://api.github.com/repos/codice/ddf/issues/events{/number}","events_url":"https://api.github.com/repos/codice/ddf/events","assignees_url":"https://api.github.com/repos/codice/ddf/assignees{/user}","branches_url":"https://api.github.com/repos/codice/ddf/branches{/branch}","tags_url":"https://api.github.com/repos/codice/ddf/tags","blobs_url":"https://api.github.com/repos/codice/ddf/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/codice/ddf/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/codice/ddf/git/refs{/sha}","trees_url":"https://api.github.com/repos/codice/ddf/git/trees{/sha}","statuses_url":"https://api.github.com/repos/codice/ddf/statuses/{sha}","languages_url":"https://api.github.com/repos/codice/ddf/languages","stargazers_url":"https://api.github.com/repos/codice/ddf/stargazers","contributors_url":"https://api.github.com/repos/codice/ddf/contributors","subscribers_url":"https://api.github.com/repos/codice/ddf/subscribers","subscription_url":"https://api.github.com/repos/codice/ddf/subscription","commits_url":"https://api.github.com/repos/codice/ddf/commits{/sha}","git_commits_url":"https://api.github.com/repos/codice/ddf/git/commits{/sha}","comments_url":"https://api.github.com/repos/codice/ddf/comments{/number}","issue_comment_url":"https://api.github.com/repos/codice/ddf/issues/comments{/number}","contents_url":"https://api.github.com/repos/codice/ddf/contents/{+path}","compare_url":"https://api.github.com/repos/codice/ddf/compare/{base}...{head}","merges_url":"https://api.github.com/repos/codice/ddf/merges","archive_url":"https://api.github.com/repos/codice/ddf/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/codice/ddf/downloads","issues_url":"https://api.github.com/repos/codice/ddf/issues{/number}","pulls_url":"https://api.github.com/repos/codice/ddf/pulls{/number}","milestones_url":"https://api.github.com/repos/codice/ddf/milestones{/number}","notifications_url":"https://api.github.com/repos/codice/ddf/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/codice/ddf/labels{/name}","releases_url":"https://api.github.com/repos/codice/ddf/releases{/id}","deployments_url":"https://api.github.com/repos/codice/ddf/deployments","created_at":"2013-12-13T20:38:28Z","updated_at":"2016-06-30T23:25:30Z","pushed_at":"2016-07-11T15:37:10Z","git_url":"git://github.com/codice/ddf.git","ssh_url":"git@github.com:codice/ddf.git","clone_url":"https://github.com/codice/ddf.git","svn_url":"https://github.com/codice/ddf","homepage":"http://ddf.codice.org","size":278049,"stargazers_count":39,"watchers_count":39,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":81,"mirror_url":null,"open_issues_count":25,"forks":81,"open_issues":25,"watchers":39,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/codice/ddf/pulls/889"},"html":{"href":"https://github.com/codice/ddf/pull/889"},"issue":{"href":"https://api.github.com/repos/codice/ddf/issues/889"},"comments":{"href":"https://api.github.com/repos/codice/ddf/issues/889/comments"},"review_comments":{"href":"https://api.github.com/repos/codice/ddf/pulls/889/comments"},"review_comment":{"href":"https://api.github.com/repos/codice/ddf/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/codice/ddf/pulls/889/commits"},"statuses":{"href":"https://api.github.com/repos/codice/ddf/statuses/ac4628701f8992c8689a4fa335274d65401ba7a4"}}}}
{"actor":{"display_login":"jrnorth"}}