{"action":"created","comment":{"url":"https://api.github.com/repos/hazelcast/hazelcast/pulls/comments/41962552","id":41962552,"diff_hunk":"@@ -0,0 +1,80 @@\n+/*\n+ * Copyright (c) 2008-2015, Hazelcast, Inc. All Rights Reserved.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * 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, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+\n+package com.hazelcast.spring;\n+\n+import com.hazelcast.spring.cache.SpringHazelcastCachingProvider;\n+import org.springframework.beans.factory.support.AbstractBeanDefinition;\n+import org.springframework.beans.factory.support.BeanDefinitionBuilder;\n+import org.springframework.beans.factory.xml.ParserContext;\n+import org.w3c.dom.Element;\n+import org.w3c.dom.NamedNodeMap;\n+import org.w3c.dom.Node;\n+\n+/**\n+ * Bean definition parser for JCache {@link javax.cache.CacheManager}\n+ * <p/>\n+ * <b>Sample bean</b>\n+ * <pre>\n+ * &lt;hz:cache-manager id=\"cacheManager\" instance-ref=\"instance\" name=\"cacheManager\" /&gt;\n+ * </pre>\n+ */\n+public class CacheManagerBeanDefinitionParser\n+        extends AbstractHazelcastBeanDefinitionParser {\n+\n+    @Override\n+    protected AbstractBeanDefinition parseInternal(Element element, ParserContext parserContext) {\n+        final SpringXmlBuilder springXmlBuilder = new SpringXmlBuilder(SpringHazelcastCachingProvider.class, parserContext);\n+        springXmlBuilder.handle(element);\n+        final BeanDefinitionBuilder builder = springXmlBuilder.getBuilder();\n+        return builder.getBeanDefinition();\n+    }\n+\n+    private class SpringXmlBuilder extends AbstractHazelcastBeanDefinitionParser.SpringXmlBuilderHelper {\n+\n+        private final ParserContext parserContext;\n+\n+        private BeanDefinitionBuilder builder;\n+\n+        public SpringXmlBuilder(Class providerClass, ParserContext parserContext) {\n+            this.parserContext = parserContext;\n+            this.builder = BeanDefinitionBuilder.rootBeanDefinition(providerClass);\n+        }\n+\n+        public BeanDefinitionBuilder getBuilder() {\n+            return this.builder;\n+        }\n+\n+        public void handle(Element element) {\n+            handleCommonBeanAttributes(element, builder, parserContext);\n+            final NamedNodeMap attrs = element.getAttributes();\n+            if (attrs != null) {\n+                Node instanceRefNode = attrs.getNamedItem(\"instance-ref\");","path":"hazelcast-spring/src/main/java/com/hazelcast/spring/CacheManagerBeanDefinitionParser.java","position":65,"original_position":65,"commit_id":"f82e72e67f44b3e03c02d88386de525226ba0169","original_commit_id":"f82e72e67f44b3e03c02d88386de525226ba0169","user":{"login":"jerrinot","id":158619,"avatar_url":"https://avatars.githubusercontent.com/u/158619?v=3","gravatar_id":"","url":"https://api.github.com/users/jerrinot","html_url":"https://github.com/jerrinot","followers_url":"https://api.github.com/users/jerrinot/followers","following_url":"https://api.github.com/users/jerrinot/following{/other_user}","gists_url":"https://api.github.com/users/jerrinot/gists{/gist_id}","starred_url":"https://api.github.com/users/jerrinot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jerrinot/subscriptions","organizations_url":"https://api.github.com/users/jerrinot/orgs","repos_url":"https://api.github.com/users/jerrinot/repos","events_url":"https://api.github.com/users/jerrinot/events{/privacy}","received_events_url":"https://api.github.com/users/jerrinot/received_events","type":"User","site_admin":false},"body":"is this the only way to pass the instance? Is there any other way to pass the instance? I do not know spring that well, I'm just asking.","created_at":"2015-10-14T07:30:10Z","updated_at":"2015-10-14T07:30:10Z","html_url":"https://github.com/hazelcast/hazelcast/pull/6450#discussion_r41962552","pull_request_url":"https://api.github.com/repos/hazelcast/hazelcast/pulls/6450","_links":{"self":{"href":"https://api.github.com/repos/hazelcast/hazelcast/pulls/comments/41962552"},"html":{"href":"https://github.com/hazelcast/hazelcast/pull/6450#discussion_r41962552"},"pull_request":{"href":"https://api.github.com/repos/hazelcast/hazelcast/pulls/6450"}}},"pull_request":{"url":"https://api.github.com/repos/hazelcast/hazelcast/pulls/6450","id":47576045,"html_url":"https://github.com/hazelcast/hazelcast/pull/6450","diff_url":"https://github.com/hazelcast/hazelcast/pull/6450.diff","patch_url":"https://github.com/hazelcast/hazelcast/pull/6450.patch","issue_url":"https://api.github.com/repos/hazelcast/hazelcast/issues/6450","number":6450,"state":"open","locked":false,"title":"[DO NOT MERGE] jcache support for spring cache manager","user":{"login":"mustafaiman","id":6582349,"avatar_url":"https://avatars.githubusercontent.com/u/6582349?v=3","gravatar_id":"","url":"https://api.github.com/users/mustafaiman","html_url":"https://github.com/mustafaiman","followers_url":"https://api.github.com/users/mustafaiman/followers","following_url":"https://api.github.com/users/mustafaiman/following{/other_user}","gists_url":"https://api.github.com/users/mustafaiman/gists{/gist_id}","starred_url":"https://api.github.com/users/mustafaiman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mustafaiman/subscriptions","organizations_url":"https://api.github.com/users/mustafaiman/orgs","repos_url":"https://api.github.com/users/mustafaiman/repos","events_url":"https://api.github.com/users/mustafaiman/events{/privacy}","received_events_url":"https://api.github.com/users/mustafaiman/received_events","type":"User","site_admin":false},"body":"Spring applications can use Hazelcast's JCache support for caching. With this PR one can create a `javax.cache.CacheManager` bean backed by Hazelcast in their Spring xml configuration and link it with `SpringJCacheCacheManager`. This way Spring internally uses Hazelcast's JCache implementations for caching.\r\n\r\nRelated issue: https://github.com/hazelcast/hazelcast/issues/6036\r\n\r\nSample application-context.xml:\r\n```xml\r\n    <cache:annotation-driven cache-manager=\"cacheManager\" />\r\n\r\n    <hz:hazelcast id=\"instance\">\r\n        <hz:config>\r\n            <hz:group name=\"dev\" password=\"dev-pass\"/>\r\n            <hz:network port=\"5701\" port-auto-increment=\"false\">\r\n                <hz:join>\r\n                    <hz:multicast enabled=\"true\"/>\r\n                    <hz:tcp-ip enabled=\"false\">\r\n                        <hz:interface>127.0.0.1:5701</hz:interface>\r\n                    </hz:tcp-ip>\r\n                </hz:join>\r\n                <hz:interfaces enabled=\"true\">\r\n                    <hz:interface>127.0.0.1</hz:interface>\r\n                </hz:interfaces>\r\n            </hz:network>\r\n            <hz:cache name=\"name\" />\r\n            <hz:cache name=\"city\" />\r\n        </hz:config>\r\n    </hz:hazelcast>\r\n\r\n    <hz:cache-manager id=\"hazelcastJCacheCacheManager\" instance-ref=\"instance\" name=\"hazelcastJCacheCacheManager\"/>\r\n\r\n    <bean id=\"cacheManager\" class=\"org.springframework.cache.jcache.JCacheCacheManager\">\r\n        <constructor-arg ref=\"hazelcastJCacheCacheManager\" />\r\n    </bean>\r\n\r\n    <bean id=\"dummy\" class=\"com.hazelcast.spring.cache.TestJCacheCacheManager.DummyBean\" />\r\n</beans>\r\n```\r\n\r\n\r\n","created_at":"2015-10-13T19:18:01Z","updated_at":"2015-10-14T07:30:10Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c572076905955749c6ddc71c256dddae3e7962bc","assignee":null,"milestone":{"url":"https://api.github.com/repos/hazelcast/hazelcast/milestones/61","html_url":"https://github.com/hazelcast/hazelcast/milestones/3.6","labels_url":"https://api.github.com/repos/hazelcast/hazelcast/milestones/61/labels","id":982584,"number":61,"title":"3.6","description":"","creator":{"login":"enesakar","id":234086,"avatar_url":"https://avatars.githubusercontent.com/u/234086?v=3","gravatar_id":"","url":"https://api.github.com/users/enesakar","html_url":"https://github.com/enesakar","followers_url":"https://api.github.com/users/enesakar/followers","following_url":"https://api.github.com/users/enesakar/following{/other_user}","gists_url":"https://api.github.com/users/enesakar/gists{/gist_id}","starred_url":"https://api.github.com/users/enesakar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/enesakar/subscriptions","organizations_url":"https://api.github.com/users/enesakar/orgs","repos_url":"https://api.github.com/users/enesakar/repos","events_url":"https://api.github.com/users/enesakar/events{/privacy}","received_events_url":"https://api.github.com/users/enesakar/received_events","type":"User","site_admin":false},"open_issues":159,"closed_issues":559,"state":"open","created_at":"2015-02-17T09:27:09Z","updated_at":"2015-10-14T07:02:52Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/hazelcast/hazelcast/pulls/6450/commits","review_comments_url":"https://api.github.com/repos/hazelcast/hazelcast/pulls/6450/comments","review_comment_url":"https://api.github.com/repos/hazelcast/hazelcast/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hazelcast/hazelcast/issues/6450/comments","statuses_url":"https://api.github.com/repos/hazelcast/hazelcast/statuses/f82e72e67f44b3e03c02d88386de525226ba0169","head":{"label":"mustafaiman:enhancement/spring/cachemanager","ref":"enhancement/spring/cachemanager","sha":"f82e72e67f44b3e03c02d88386de525226ba0169","user":{"login":"mustafaiman","id":6582349,"avatar_url":"https://avatars.githubusercontent.com/u/6582349?v=3","gravatar_id":"","url":"https://api.github.com/users/mustafaiman","html_url":"https://github.com/mustafaiman","followers_url":"https://api.github.com/users/mustafaiman/followers","following_url":"https://api.github.com/users/mustafaiman/following{/other_user}","gists_url":"https://api.github.com/users/mustafaiman/gists{/gist_id}","starred_url":"https://api.github.com/users/mustafaiman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mustafaiman/subscriptions","organizations_url":"https://api.github.com/users/mustafaiman/orgs","repos_url":"https://api.github.com/users/mustafaiman/repos","events_url":"https://api.github.com/users/mustafaiman/events{/privacy}","received_events_url":"https://api.github.com/users/mustafaiman/received_events","type":"User","site_admin":false},"repo":{"id":37841658,"name":"hazelcast","full_name":"mustafaiman/hazelcast","owner":{"login":"mustafaiman","id":6582349,"avatar_url":"https://avatars.githubusercontent.com/u/6582349?v=3","gravatar_id":"","url":"https://api.github.com/users/mustafaiman","html_url":"https://github.com/mustafaiman","followers_url":"https://api.github.com/users/mustafaiman/followers","following_url":"https://api.github.com/users/mustafaiman/following{/other_user}","gists_url":"https://api.github.com/users/mustafaiman/gists{/gist_id}","starred_url":"https://api.github.com/users/mustafaiman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mustafaiman/subscriptions","organizations_url":"https://api.github.com/users/mustafaiman/orgs","repos_url":"https://api.github.com/users/mustafaiman/repos","events_url":"https://api.github.com/users/mustafaiman/events{/privacy}","received_events_url":"https://api.github.com/users/mustafaiman/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mustafaiman/hazelcast","description":"Open Source In-Memory Data Grid","fork":true,"url":"https://api.github.com/repos/mustafaiman/hazelcast","forks_url":"https://api.github.com/repos/mustafaiman/hazelcast/forks","keys_url":"https://api.github.com/repos/mustafaiman/hazelcast/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mustafaiman/hazelcast/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mustafaiman/hazelcast/teams","hooks_url":"https://api.github.com/repos/mustafaiman/hazelcast/hooks","issue_events_url":"https://api.github.com/repos/mustafaiman/hazelcast/issues/events{/number}","events_url":"https://api.github.com/repos/mustafaiman/hazelcast/events","assignees_url":"https://api.github.com/repos/mustafaiman/hazelcast/assignees{/user}","branches_url":"https://api.github.com/repos/mustafaiman/hazelcast/branches{/branch}","tags_url":"https://api.github.com/repos/mustafaiman/hazelcast/tags","blobs_url":"https://api.github.com/repos/mustafaiman/hazelcast/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mustafaiman/hazelcast/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mustafaiman/hazelcast/git/refs{/sha}","trees_url":"https://api.github.com/repos/mustafaiman/hazelcast/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mustafaiman/hazelcast/statuses/{sha}","languages_url":"https://api.github.com/repos/mustafaiman/hazelcast/languages","stargazers_url":"https://api.github.com/repos/mustafaiman/hazelcast/stargazers","contributors_url":"https://api.github.com/repos/mustafaiman/hazelcast/contributors","subscribers_url":"https://api.github.com/repos/mustafaiman/hazelcast/subscribers","subscription_url":"https://api.github.com/repos/mustafaiman/hazelcast/subscription","commits_url":"https://api.github.com/repos/mustafaiman/hazelcast/commits{/sha}","git_commits_url":"https://api.github.com/repos/mustafaiman/hazelcast/git/commits{/sha}","comments_url":"https://api.github.com/repos/mustafaiman/hazelcast/comments{/number}","issue_comment_url":"https://api.github.com/repos/mustafaiman/hazelcast/issues/comments{/number}","contents_url":"https://api.github.com/repos/mustafaiman/hazelcast/contents/{+path}","compare_url":"https://api.github.com/repos/mustafaiman/hazelcast/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mustafaiman/hazelcast/merges","archive_url":"https://api.github.com/repos/mustafaiman/hazelcast/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mustafaiman/hazelcast/downloads","issues_url":"https://api.github.com/repos/mustafaiman/hazelcast/issues{/number}","pulls_url":"https://api.github.com/repos/mustafaiman/hazelcast/pulls{/number}","milestones_url":"https://api.github.com/repos/mustafaiman/hazelcast/milestones{/number}","notifications_url":"https://api.github.com/repos/mustafaiman/hazelcast/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mustafaiman/hazelcast/labels{/name}","releases_url":"https://api.github.com/repos/mustafaiman/hazelcast/releases{/id}","created_at":"2015-06-22T07:02:33Z","updated_at":"2015-06-22T07:02:44Z","pushed_at":"2015-10-13T19:08:45Z","git_url":"git://github.com/mustafaiman/hazelcast.git","ssh_url":"git@github.com:mustafaiman/hazelcast.git","clone_url":"https://github.com/mustafaiman/hazelcast.git","svn_url":"https://github.com/mustafaiman/hazelcast","homepage":"www.hazelcast.com","size":77823,"stargazers_count":0,"watchers_count":0,"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":0,"default_branch":"master"}},"base":{"label":"hazelcast:master","ref":"master","sha":"22e51b3ce2c2363399180552632fe7cebc9932e4","user":{"login":"hazelcast","id":1453152,"avatar_url":"https://avatars.githubusercontent.com/u/1453152?v=3","gravatar_id":"","url":"https://api.github.com/users/hazelcast","html_url":"https://github.com/hazelcast","followers_url":"https://api.github.com/users/hazelcast/followers","following_url":"https://api.github.com/users/hazelcast/following{/other_user}","gists_url":"https://api.github.com/users/hazelcast/gists{/gist_id}","starred_url":"https://api.github.com/users/hazelcast/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hazelcast/subscriptions","organizations_url":"https://api.github.com/users/hazelcast/orgs","repos_url":"https://api.github.com/users/hazelcast/repos","events_url":"https://api.github.com/users/hazelcast/events{/privacy}","received_events_url":"https://api.github.com/users/hazelcast/received_events","type":"Organization","site_admin":false},"repo":{"id":3786237,"name":"hazelcast","full_name":"hazelcast/hazelcast","owner":{"login":"hazelcast","id":1453152,"avatar_url":"https://avatars.githubusercontent.com/u/1453152?v=3","gravatar_id":"","url":"https://api.github.com/users/hazelcast","html_url":"https://github.com/hazelcast","followers_url":"https://api.github.com/users/hazelcast/followers","following_url":"https://api.github.com/users/hazelcast/following{/other_user}","gists_url":"https://api.github.com/users/hazelcast/gists{/gist_id}","starred_url":"https://api.github.com/users/hazelcast/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hazelcast/subscriptions","organizations_url":"https://api.github.com/users/hazelcast/orgs","repos_url":"https://api.github.com/users/hazelcast/repos","events_url":"https://api.github.com/users/hazelcast/events{/privacy}","received_events_url":"https://api.github.com/users/hazelcast/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hazelcast/hazelcast","description":"Open Source In-Memory Data Grid","fork":false,"url":"https://api.github.com/repos/hazelcast/hazelcast","forks_url":"https://api.github.com/repos/hazelcast/hazelcast/forks","keys_url":"https://api.github.com/repos/hazelcast/hazelcast/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hazelcast/hazelcast/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hazelcast/hazelcast/teams","hooks_url":"https://api.github.com/repos/hazelcast/hazelcast/hooks","issue_events_url":"https://api.github.com/repos/hazelcast/hazelcast/issues/events{/number}","events_url":"https://api.github.com/repos/hazelcast/hazelcast/events","assignees_url":"https://api.github.com/repos/hazelcast/hazelcast/assignees{/user}","branches_url":"https://api.github.com/repos/hazelcast/hazelcast/branches{/branch}","tags_url":"https://api.github.com/repos/hazelcast/hazelcast/tags","blobs_url":"https://api.github.com/repos/hazelcast/hazelcast/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hazelcast/hazelcast/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hazelcast/hazelcast/git/refs{/sha}","trees_url":"https://api.github.com/repos/hazelcast/hazelcast/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hazelcast/hazelcast/statuses/{sha}","languages_url":"https://api.github.com/repos/hazelcast/hazelcast/languages","stargazers_url":"https://api.github.com/repos/hazelcast/hazelcast/stargazers","contributors_url":"https://api.github.com/repos/hazelcast/hazelcast/contributors","subscribers_url":"https://api.github.com/repos/hazelcast/hazelcast/subscribers","subscription_url":"https://api.github.com/repos/hazelcast/hazelcast/subscription","commits_url":"https://api.github.com/repos/hazelcast/hazelcast/commits{/sha}","git_commits_url":"https://api.github.com/repos/hazelcast/hazelcast/git/commits{/sha}","comments_url":"https://api.github.com/repos/hazelcast/hazelcast/comments{/number}","issue_comment_url":"https://api.github.com/repos/hazelcast/hazelcast/issues/comments{/number}","contents_url":"https://api.github.com/repos/hazelcast/hazelcast/contents/{+path}","compare_url":"https://api.github.com/repos/hazelcast/hazelcast/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hazelcast/hazelcast/merges","archive_url":"https://api.github.com/repos/hazelcast/hazelcast/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hazelcast/hazelcast/downloads","issues_url":"https://api.github.com/repos/hazelcast/hazelcast/issues{/number}","pulls_url":"https://api.github.com/repos/hazelcast/hazelcast/pulls{/number}","milestones_url":"https://api.github.com/repos/hazelcast/hazelcast/milestones{/number}","notifications_url":"https://api.github.com/repos/hazelcast/hazelcast/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hazelcast/hazelcast/labels{/name}","releases_url":"https://api.github.com/repos/hazelcast/hazelcast/releases{/id}","created_at":"2012-03-21T12:25:18Z","updated_at":"2015-10-14T05:42:05Z","pushed_at":"2015-10-14T05:28:02Z","git_url":"git://github.com/hazelcast/hazelcast.git","ssh_url":"git@github.com:hazelcast/hazelcast.git","clone_url":"https://github.com/hazelcast/hazelcast.git","svn_url":"https://github.com/hazelcast/hazelcast","homepage":"www.hazelcast.com","size":159536,"stargazers_count":1264,"watchers_count":1264,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":617,"mirror_url":null,"open_issues_count":531,"forks":617,"open_issues":531,"watchers":1264,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hazelcast/hazelcast/pulls/6450"},"html":{"href":"https://github.com/hazelcast/hazelcast/pull/6450"},"issue":{"href":"https://api.github.com/repos/hazelcast/hazelcast/issues/6450"},"comments":{"href":"https://api.github.com/repos/hazelcast/hazelcast/issues/6450/comments"},"review_comments":{"href":"https://api.github.com/repos/hazelcast/hazelcast/pulls/6450/comments"},"review_comment":{"href":"https://api.github.com/repos/hazelcast/hazelcast/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hazelcast/hazelcast/pulls/6450/commits"},"statuses":{"href":"https://api.github.com/repos/hazelcast/hazelcast/statuses/f82e72e67f44b3e03c02d88386de525226ba0169"}}}}