{"action":"created","comment":{"url":"https://api.github.com/repos/mulesoft/mule/pulls/comments/59285084","id":59285084,"diff_hunk":"@@ -0,0 +1,84 @@\n+/*\n+ * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com\n+ * The software in this package is published under the terms of the CPAL v1.0\n+ * license, a copy of which has been included with this distribution in the\n+ * LICENSE.txt file.\n+ */\n+package org.mule.module.launcher.application;\n+\n+import static org.mule.api.lifecycle.LifecycleUtils.initialiseIfNeeded;\n+import org.mule.DefaultMuleContext;\n+import org.mule.api.MuleContext;\n+import org.mule.config.builders.AbstractConfigurationBuilder;\n+import org.mule.extension.api.ExtensionManager;\n+import org.mule.extension.api.introspection.RuntimeExtensionModel;\n+import org.mule.extension.api.introspection.declaration.fluent.ExtensionDeclarer;\n+import org.mule.extension.api.introspection.declaration.spi.Describer;\n+import org.mule.module.extension.internal.DefaultDescribingContext;\n+import org.mule.module.extension.internal.introspection.DefaultExtensionFactory;\n+import org.mule.module.extension.internal.manager.DefaultExtensionManager;\n+import org.mule.registry.SpiServiceRegistry;\n+\n+import java.io.IOException;\n+import java.net.URL;\n+import java.util.Enumeration;\n+import java.util.List;\n+import java.util.ServiceLoader;\n+\n+/**\n+ * Implementation of {@link org.mule.api.config.ConfigurationBuilder}\n+ * that register a {@link ExtensionManager} if it's present in the classpath\n+ *\n+ * @since 3.7.0\n+ */\n+public class ApplicationExtensionsManagerConfigurationBuilder extends AbstractConfigurationBuilder\n+{\n+\n+    private final List<ApplicationPlugin> applicationPlugins;\n+\n+    public ApplicationExtensionsManagerConfigurationBuilder(List<ApplicationPlugin> applicationPlugins)\n+    {\n+        this.applicationPlugins = applicationPlugins;\n+    }\n+\n+    @Override\n+    protected void doConfigure(MuleContext muleContext) throws Exception\n+    {\n+        ExtensionManager extensionManager = new DefaultExtensionManager();\n+        ((DefaultMuleContext) muleContext).setExtensionManager(extensionManager);\n+        initialiseIfNeeded(extensionManager, muleContext);\n+\n+        for (ApplicationPlugin applicationPlugin : applicationPlugins)\n+        {\n+            final ServiceLoader<Describer> describers = ServiceLoader.load(Describer.class, new ClassLoader(null)\n+            {\n+                @Override\n+                public Class<?> loadClass(String name) throws ClassNotFoundException\n+                {\n+                    return applicationPlugin.getArtifactClassLoader().getClassLoader().loadClass(name);\n+                }\n+\n+                @Override\n+                protected URL findResource(String name)\n+                {\n+                    return super.findResource(name);\n+                }\n+\n+                @Override\n+                protected Enumeration<URL> findResources(String name) throws IOException\n+                {\n+                    return applicationPlugin.getArtifactClassLoader().findResources(name);\n+                }\n+            });\n+\n+            for (Describer describer : describers)\n+            {\n+                System.out.println(\"Describer: \" + describer.getClass().getName());","path":"modules/launcher/src/main/java/org/mule/module/launcher/application/ApplicationExtensionsManagerConfigurationBuilder.java","position":76,"original_position":76,"commit_id":"0bc7027b0407a1c107088ea51912b3a0266cc63b","original_commit_id":"0bc7027b0407a1c107088ea51912b3a0266cc63b","user":{"login":"marianogonzalez","id":1272771,"avatar_url":"https://avatars.githubusercontent.com/u/1272771?v=3","gravatar_id":"","url":"https://api.github.com/users/marianogonzalez","html_url":"https://github.com/marianogonzalez","followers_url":"https://api.github.com/users/marianogonzalez/followers","following_url":"https://api.github.com/users/marianogonzalez/following{/other_user}","gists_url":"https://api.github.com/users/marianogonzalez/gists{/gist_id}","starred_url":"https://api.github.com/users/marianogonzalez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marianogonzalez/subscriptions","organizations_url":"https://api.github.com/users/marianogonzalez/orgs","repos_url":"https://api.github.com/users/marianogonzalez/repos","events_url":"https://api.github.com/users/marianogonzalez/events{/privacy}","received_events_url":"https://api.github.com/users/marianogonzalez/received_events","type":"User","site_admin":false},"body":"remove system.out","created_at":"2016-04-11T21:29:46Z","updated_at":"2016-04-11T21:29:46Z","html_url":"https://github.com/mulesoft/mule/pull/2555#discussion_r59285084","pull_request_url":"https://api.github.com/repos/mulesoft/mule/pulls/2555","_links":{"self":{"href":"https://api.github.com/repos/mulesoft/mule/pulls/comments/59285084"},"html":{"href":"https://github.com/mulesoft/mule/pull/2555#discussion_r59285084"},"pull_request":{"href":"https://api.github.com/repos/mulesoft/mule/pulls/2555"}}},"pull_request":{"url":"https://api.github.com/repos/mulesoft/mule/pulls/2555","id":66014373,"html_url":"https://github.com/mulesoft/mule/pull/2555","diff_url":"https://github.com/mulesoft/mule/pull/2555.diff","patch_url":"https://github.com/mulesoft/mule/pull/2555.patch","issue_url":"https://api.github.com/repos/mulesoft/mule/issues/2555","number":2555,"state":"open","locked":false,"title":"MULE-9436:  Define deployment model for extensions","user":{"login":"pablokraan","id":561399,"avatar_url":"https://avatars.githubusercontent.com/u/561399?v=3","gravatar_id":"","url":"https://api.github.com/users/pablokraan","html_url":"https://github.com/pablokraan","followers_url":"https://api.github.com/users/pablokraan/followers","following_url":"https://api.github.com/users/pablokraan/following{/other_user}","gists_url":"https://api.github.com/users/pablokraan/gists{/gist_id}","starred_url":"https://api.github.com/users/pablokraan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pablokraan/subscriptions","organizations_url":"https://api.github.com/users/pablokraan/orgs","repos_url":"https://api.github.com/users/pablokraan/repos","events_url":"https://api.github.com/users/pablokraan/events{/privacy}","received_events_url":"https://api.github.com/users/pablokraan/received_events","type":"User","site_admin":false},"body":"_ Extending ArtifactClassLoader to findResources defined on the artifact classlaoder\r\n_ Adding parent artifact classaloader to ArtifactClassLoaderFactory#create method\r\n_ Implemetngin ArtifactClassLoader on FilteringArtifactClassLoader\r\n_ Splitting Artifact interface on Artifact and DeployableArtifact\r\n_ Using the right classloader when processing extensions\r\n_ Adding ApplicationPlugin as another artifact\r\n_ Refactoring DefaultApplicationFactory and MuleApplicationClassLoaderFactory to manage plugins as artifacts\r\n_ Splitting DomainClassLoaderRespository into DomainClassLoaderFactory and DomainManager/DomainRepository\r\n_ Adding deployment test using a extension plugin","created_at":"2016-04-11T15:35:06Z","updated_at":"2016-04-11T21:29:46Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e950ded419dfb10170a84cf55323debdb3901252","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mulesoft/mule/pulls/2555/commits","review_comments_url":"https://api.github.com/repos/mulesoft/mule/pulls/2555/comments","review_comment_url":"https://api.github.com/repos/mulesoft/mule/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mulesoft/mule/issues/2555/comments","statuses_url":"https://api.github.com/repos/mulesoft/mule/statuses/0bc7027b0407a1c107088ea51912b3a0266cc63b","head":{"label":"mulesoft:MULE-9436","ref":"MULE-9436","sha":"0bc7027b0407a1c107088ea51912b3a0266cc63b","user":{"login":"mulesoft","id":185740,"avatar_url":"https://avatars.githubusercontent.com/u/185740?v=3","gravatar_id":"","url":"https://api.github.com/users/mulesoft","html_url":"https://github.com/mulesoft","followers_url":"https://api.github.com/users/mulesoft/followers","following_url":"https://api.github.com/users/mulesoft/following{/other_user}","gists_url":"https://api.github.com/users/mulesoft/gists{/gist_id}","starred_url":"https://api.github.com/users/mulesoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mulesoft/subscriptions","organizations_url":"https://api.github.com/users/mulesoft/orgs","repos_url":"https://api.github.com/users/mulesoft/repos","events_url":"https://api.github.com/users/mulesoft/events{/privacy}","received_events_url":"https://api.github.com/users/mulesoft/received_events","type":"Organization","site_admin":false},"repo":{"id":7058562,"name":"mule","full_name":"mulesoft/mule","owner":{"login":"mulesoft","id":185740,"avatar_url":"https://avatars.githubusercontent.com/u/185740?v=3","gravatar_id":"","url":"https://api.github.com/users/mulesoft","html_url":"https://github.com/mulesoft","followers_url":"https://api.github.com/users/mulesoft/followers","following_url":"https://api.github.com/users/mulesoft/following{/other_user}","gists_url":"https://api.github.com/users/mulesoft/gists{/gist_id}","starred_url":"https://api.github.com/users/mulesoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mulesoft/subscriptions","organizations_url":"https://api.github.com/users/mulesoft/orgs","repos_url":"https://api.github.com/users/mulesoft/repos","events_url":"https://api.github.com/users/mulesoft/events{/privacy}","received_events_url":"https://api.github.com/users/mulesoft/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mulesoft/mule","description":"Mule Community Edition","fork":false,"url":"https://api.github.com/repos/mulesoft/mule","forks_url":"https://api.github.com/repos/mulesoft/mule/forks","keys_url":"https://api.github.com/repos/mulesoft/mule/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mulesoft/mule/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mulesoft/mule/teams","hooks_url":"https://api.github.com/repos/mulesoft/mule/hooks","issue_events_url":"https://api.github.com/repos/mulesoft/mule/issues/events{/number}","events_url":"https://api.github.com/repos/mulesoft/mule/events","assignees_url":"https://api.github.com/repos/mulesoft/mule/assignees{/user}","branches_url":"https://api.github.com/repos/mulesoft/mule/branches{/branch}","tags_url":"https://api.github.com/repos/mulesoft/mule/tags","blobs_url":"https://api.github.com/repos/mulesoft/mule/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mulesoft/mule/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mulesoft/mule/git/refs{/sha}","trees_url":"https://api.github.com/repos/mulesoft/mule/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mulesoft/mule/statuses/{sha}","languages_url":"https://api.github.com/repos/mulesoft/mule/languages","stargazers_url":"https://api.github.com/repos/mulesoft/mule/stargazers","contributors_url":"https://api.github.com/repos/mulesoft/mule/contributors","subscribers_url":"https://api.github.com/repos/mulesoft/mule/subscribers","subscription_url":"https://api.github.com/repos/mulesoft/mule/subscription","commits_url":"https://api.github.com/repos/mulesoft/mule/commits{/sha}","git_commits_url":"https://api.github.com/repos/mulesoft/mule/git/commits{/sha}","comments_url":"https://api.github.com/repos/mulesoft/mule/comments{/number}","issue_comment_url":"https://api.github.com/repos/mulesoft/mule/issues/comments{/number}","contents_url":"https://api.github.com/repos/mulesoft/mule/contents/{+path}","compare_url":"https://api.github.com/repos/mulesoft/mule/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mulesoft/mule/merges","archive_url":"https://api.github.com/repos/mulesoft/mule/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mulesoft/mule/downloads","issues_url":"https://api.github.com/repos/mulesoft/mule/issues{/number}","pulls_url":"https://api.github.com/repos/mulesoft/mule/pulls{/number}","milestones_url":"https://api.github.com/repos/mulesoft/mule/milestones{/number}","notifications_url":"https://api.github.com/repos/mulesoft/mule/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mulesoft/mule/labels{/name}","releases_url":"https://api.github.com/repos/mulesoft/mule/releases{/id}","deployments_url":"https://api.github.com/repos/mulesoft/mule/deployments","created_at":"2012-12-07T19:23:06Z","updated_at":"2016-04-11T08:05:28Z","pushed_at":"2016-04-11T20:34:17Z","git_url":"git://github.com/mulesoft/mule.git","ssh_url":"git@github.com:mulesoft/mule.git","clone_url":"https://github.com/mulesoft/mule.git","svn_url":"https://github.com/mulesoft/mule","homepage":null,"size":224039,"stargazers_count":307,"watchers_count":307,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":335,"mirror_url":null,"open_issues_count":22,"forks":335,"open_issues":22,"watchers":307,"default_branch":"mule-3.x"}},"base":{"label":"mulesoft:mule-4.x","ref":"mule-4.x","sha":"a09ecce8c1259311611e97b34a5e7679e2bb22dd","user":{"login":"mulesoft","id":185740,"avatar_url":"https://avatars.githubusercontent.com/u/185740?v=3","gravatar_id":"","url":"https://api.github.com/users/mulesoft","html_url":"https://github.com/mulesoft","followers_url":"https://api.github.com/users/mulesoft/followers","following_url":"https://api.github.com/users/mulesoft/following{/other_user}","gists_url":"https://api.github.com/users/mulesoft/gists{/gist_id}","starred_url":"https://api.github.com/users/mulesoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mulesoft/subscriptions","organizations_url":"https://api.github.com/users/mulesoft/orgs","repos_url":"https://api.github.com/users/mulesoft/repos","events_url":"https://api.github.com/users/mulesoft/events{/privacy}","received_events_url":"https://api.github.com/users/mulesoft/received_events","type":"Organization","site_admin":false},"repo":{"id":7058562,"name":"mule","full_name":"mulesoft/mule","owner":{"login":"mulesoft","id":185740,"avatar_url":"https://avatars.githubusercontent.com/u/185740?v=3","gravatar_id":"","url":"https://api.github.com/users/mulesoft","html_url":"https://github.com/mulesoft","followers_url":"https://api.github.com/users/mulesoft/followers","following_url":"https://api.github.com/users/mulesoft/following{/other_user}","gists_url":"https://api.github.com/users/mulesoft/gists{/gist_id}","starred_url":"https://api.github.com/users/mulesoft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mulesoft/subscriptions","organizations_url":"https://api.github.com/users/mulesoft/orgs","repos_url":"https://api.github.com/users/mulesoft/repos","events_url":"https://api.github.com/users/mulesoft/events{/privacy}","received_events_url":"https://api.github.com/users/mulesoft/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mulesoft/mule","description":"Mule Community Edition","fork":false,"url":"https://api.github.com/repos/mulesoft/mule","forks_url":"https://api.github.com/repos/mulesoft/mule/forks","keys_url":"https://api.github.com/repos/mulesoft/mule/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mulesoft/mule/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mulesoft/mule/teams","hooks_url":"https://api.github.com/repos/mulesoft/mule/hooks","issue_events_url":"https://api.github.com/repos/mulesoft/mule/issues/events{/number}","events_url":"https://api.github.com/repos/mulesoft/mule/events","assignees_url":"https://api.github.com/repos/mulesoft/mule/assignees{/user}","branches_url":"https://api.github.com/repos/mulesoft/mule/branches{/branch}","tags_url":"https://api.github.com/repos/mulesoft/mule/tags","blobs_url":"https://api.github.com/repos/mulesoft/mule/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mulesoft/mule/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mulesoft/mule/git/refs{/sha}","trees_url":"https://api.github.com/repos/mulesoft/mule/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mulesoft/mule/statuses/{sha}","languages_url":"https://api.github.com/repos/mulesoft/mule/languages","stargazers_url":"https://api.github.com/repos/mulesoft/mule/stargazers","contributors_url":"https://api.github.com/repos/mulesoft/mule/contributors","subscribers_url":"https://api.github.com/repos/mulesoft/mule/subscribers","subscription_url":"https://api.github.com/repos/mulesoft/mule/subscription","commits_url":"https://api.github.com/repos/mulesoft/mule/commits{/sha}","git_commits_url":"https://api.github.com/repos/mulesoft/mule/git/commits{/sha}","comments_url":"https://api.github.com/repos/mulesoft/mule/comments{/number}","issue_comment_url":"https://api.github.com/repos/mulesoft/mule/issues/comments{/number}","contents_url":"https://api.github.com/repos/mulesoft/mule/contents/{+path}","compare_url":"https://api.github.com/repos/mulesoft/mule/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mulesoft/mule/merges","archive_url":"https://api.github.com/repos/mulesoft/mule/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mulesoft/mule/downloads","issues_url":"https://api.github.com/repos/mulesoft/mule/issues{/number}","pulls_url":"https://api.github.com/repos/mulesoft/mule/pulls{/number}","milestones_url":"https://api.github.com/repos/mulesoft/mule/milestones{/number}","notifications_url":"https://api.github.com/repos/mulesoft/mule/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mulesoft/mule/labels{/name}","releases_url":"https://api.github.com/repos/mulesoft/mule/releases{/id}","deployments_url":"https://api.github.com/repos/mulesoft/mule/deployments","created_at":"2012-12-07T19:23:06Z","updated_at":"2016-04-11T08:05:28Z","pushed_at":"2016-04-11T20:34:17Z","git_url":"git://github.com/mulesoft/mule.git","ssh_url":"git@github.com:mulesoft/mule.git","clone_url":"https://github.com/mulesoft/mule.git","svn_url":"https://github.com/mulesoft/mule","homepage":null,"size":224039,"stargazers_count":307,"watchers_count":307,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":335,"mirror_url":null,"open_issues_count":22,"forks":335,"open_issues":22,"watchers":307,"default_branch":"mule-3.x"}},"_links":{"self":{"href":"https://api.github.com/repos/mulesoft/mule/pulls/2555"},"html":{"href":"https://github.com/mulesoft/mule/pull/2555"},"issue":{"href":"https://api.github.com/repos/mulesoft/mule/issues/2555"},"comments":{"href":"https://api.github.com/repos/mulesoft/mule/issues/2555/comments"},"review_comments":{"href":"https://api.github.com/repos/mulesoft/mule/pulls/2555/comments"},"review_comment":{"href":"https://api.github.com/repos/mulesoft/mule/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mulesoft/mule/pulls/2555/commits"},"statuses":{"href":"https://api.github.com/repos/mulesoft/mule/statuses/0bc7027b0407a1c107088ea51912b3a0266cc63b"}}}}