diff options
author | Godin <mandrikov@gmail.com> | 2010-10-16 22:18:26 +0000 |
---|---|---|
committer | Godin <mandrikov@gmail.com> | 2010-10-16 22:18:26 +0000 |
commit | 6636cf363ef274e817efec8885a183cf6e0fc3e2 (patch) | |
tree | 73e52b7b7a2ec9dff38d8fd6a510225a152db39a /sonar-core | |
parent | 300f7336934c36d0624190985434a60ebbcc21d0 (diff) | |
download | sonarqube-6636cf363ef274e817efec8885a183cf6e0fc3e2.tar.gz sonarqube-6636cf363ef274e817efec8885a183cf6e0fc3e2.zip |
SONAR-1862:
* Upgrade to sonar-update-center-common 0.3-SNAPSHOT
* Add column 'child_first_classloader' to table 'plugins'
* Add possibility to use child-first classloader
Diffstat (limited to 'sonar-core')
8 files changed, 30 insertions, 23 deletions
diff --git a/sonar-core/src/main/java/org/sonar/core/classloaders/ClassLoadersCollection.java b/sonar-core/src/main/java/org/sonar/core/classloaders/ClassLoadersCollection.java index 1279edc961e..eed29008bf7 100644 --- a/sonar-core/src/main/java/org/sonar/core/classloaders/ClassLoadersCollection.java +++ b/sonar-core/src/main/java/org/sonar/core/classloaders/ClassLoadersCollection.java @@ -40,18 +40,6 @@ public class ClassLoadersCollection { } /** - * Generates URLClassLoader with parent-first delegation model. - * - * @param key plugin key - * @param urls libraries - * @return created ClassLoader, but actually this method shouldn't return anything, - * because dependencies must be established - see {@link #done()}. - */ - public ClassLoader createClassLoader(String key, Collection<URL> urls) { - return createClassLoader(key, urls, false); - } - - /** * Generates URLClassLoader with specified delegation model. * * @param key plugin key diff --git a/sonar-core/src/main/java/org/sonar/core/plugin/JpaPlugin.java b/sonar-core/src/main/java/org/sonar/core/plugin/JpaPlugin.java index c178f59acaa..27dfc80738d 100644 --- a/sonar-core/src/main/java/org/sonar/core/plugin/JpaPlugin.java +++ b/sonar-core/src/main/java/org/sonar/core/plugin/JpaPlugin.java @@ -25,15 +25,21 @@ import org.apache.commons.lang.builder.ToStringStyle; import org.hibernate.annotations.Cascade; import org.sonar.api.database.BaseIdentifiable; -import javax.persistence.*; import java.net.URI; import java.util.ArrayList; import java.util.Date; import java.util.List; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.OneToMany; +import javax.persistence.Table; + /** * Installed plugins - * + * * @since 2.2 */ @Entity @@ -72,6 +78,9 @@ public class JpaPlugin extends BaseIdentifiable { @Column(name = "core", updatable = true, nullable = true) private Boolean core; + + @Column(name = "child_first_classloader", updatable = true, nullable = true) + private Boolean childFirstClassLoader; @Cascade({org.hibernate.annotations.CascadeType.SAVE_UPDATE, org.hibernate.annotations.CascadeType.DELETE, @@ -200,6 +209,15 @@ public class JpaPlugin extends BaseIdentifiable { return this; } + public Boolean isUseChildFirstClassLoader() { + return childFirstClassLoader; + } + + public JpaPlugin setUseChildFirstClassLoader(boolean use) { + this.childFirstClassLoader = use; + return this; + } + public void createFile(String filename) { JpaPluginFile file = new JpaPluginFile(this, filename); this.files.add(file); @@ -212,7 +230,7 @@ public class JpaPlugin extends BaseIdentifiable { public void removeFiles() { files.clear(); } - + @Override public boolean equals(Object o) { if (this == o) { @@ -241,7 +259,6 @@ public class JpaPlugin extends BaseIdentifiable { .toString(); } - public static JpaPlugin create(String pluginKey) { return new JpaPlugin(pluginKey); } diff --git a/sonar-core/src/main/java/org/sonar/jpa/entity/SchemaMigration.java b/sonar-core/src/main/java/org/sonar/jpa/entity/SchemaMigration.java index 532c7b72b6b..c6d4e942160 100644 --- a/sonar-core/src/main/java/org/sonar/jpa/entity/SchemaMigration.java +++ b/sonar-core/src/main/java/org/sonar/jpa/entity/SchemaMigration.java @@ -30,7 +30,7 @@ import java.sql.Statement; public class SchemaMigration { public final static int VERSION_UNKNOWN = -1; - public static final int LAST_VERSION = 141; + public static final int LAST_VERSION = 142; public final static String TABLE_NAME = "schema_migrations"; diff --git a/sonar-core/src/test/java/org/sonar/core/plugin/JpaPluginDaoTest.java b/sonar-core/src/test/java/org/sonar/core/plugin/JpaPluginDaoTest.java index ba4e26a322b..878c492c89b 100644 --- a/sonar-core/src/test/java/org/sonar/core/plugin/JpaPluginDaoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/plugin/JpaPluginDaoTest.java @@ -56,6 +56,7 @@ public class JpaPluginDaoTest extends AbstractDbUnitTestCase { setupData("shared"); JpaPlugin pmd = JpaPlugin.create("pmd"); pmd.setCore(false); + pmd.setUseChildFirstClassLoader(false); pmd.setName("PMD"); pmd.setVersion("2.2"); pmd.setPluginClass("org.sonar.pmd.Main"); @@ -73,6 +74,7 @@ public class JpaPluginDaoTest extends AbstractDbUnitTestCase { setupData("shared"); JpaPlugin pmd = JpaPlugin.create("pmd"); pmd.setCore(false); + pmd.setUseChildFirstClassLoader(false); pmd.setName("PMD"); pmd.setPluginClass("org.sonar.pmd.Main"); diff --git a/sonar-core/src/test/resources/org/sonar/core/plugin/JpaPluginDaoTest/removePreviousFilesWhenRegisteringPlugin-result.xml b/sonar-core/src/test/resources/org/sonar/core/plugin/JpaPluginDaoTest/removePreviousFilesWhenRegisteringPlugin-result.xml index e7f3523119d..579a381a739 100644 --- a/sonar-core/src/test/resources/org/sonar/core/plugin/JpaPluginDaoTest/removePreviousFilesWhenRegisteringPlugin-result.xml +++ b/sonar-core/src/test/resources/org/sonar/core/plugin/JpaPluginDaoTest/removePreviousFilesWhenRegisteringPlugin-result.xml @@ -1,6 +1,6 @@ <dataset> <plugins id="1" name="Checkstyle" plugin_key="checkstyle" organization="[null]" organization_url="[null]" license="[null]" homepage="[null]" - description="[null]" installation_date="[null]" plugin_class="[null]" core="true" version="2.2" /> + description="[null]" installation_date="[null]" plugin_class="[null]" core="true" child_first_classloader="false" version="2.2" /> <plugin_files id="3" plugin_id="1" filename="newfile.jar"/> </dataset>
\ No newline at end of file diff --git a/sonar-core/src/test/resources/org/sonar/core/plugin/JpaPluginDaoTest/saveDeprecatedPlugin-result.xml b/sonar-core/src/test/resources/org/sonar/core/plugin/JpaPluginDaoTest/saveDeprecatedPlugin-result.xml index aa6e51ec2cd..38f8e3d72d1 100644 --- a/sonar-core/src/test/resources/org/sonar/core/plugin/JpaPluginDaoTest/saveDeprecatedPlugin-result.xml +++ b/sonar-core/src/test/resources/org/sonar/core/plugin/JpaPluginDaoTest/saveDeprecatedPlugin-result.xml @@ -1,9 +1,9 @@ <dataset> <plugins id="1" name="Checkstyle" plugin_key="checkstyle" organization="[null]" organization_url="[null]" license="[null]" homepage="[null]" - description="[null]" installation_date="[null]" plugin_class="[null]" core="true" version="2.2"/> + description="[null]" installation_date="[null]" plugin_class="[null]" core="true" child_first_classloader="false" version="2.2"/> <plugins id="2" name="PMD" plugin_key="pmd" organization="[null]" organization_url="[null]" license="[null]" homepage="[null]" - description="[null]" installation_date="[null]" plugin_class="org.sonar.pmd.Main" core="false" version="[null]" /> + description="[null]" installation_date="[null]" plugin_class="org.sonar.pmd.Main" core="false" child_first_classloader="false" version="[null]" /> <plugin_files id="1" plugin_id="1" filename="checkstyle.jar"/> <plugin_files id="2" plugin_id="1" filename="checkstyle-extension.jar"/> diff --git a/sonar-core/src/test/resources/org/sonar/core/plugin/JpaPluginDaoTest/savePluginAndFiles-result.xml b/sonar-core/src/test/resources/org/sonar/core/plugin/JpaPluginDaoTest/savePluginAndFiles-result.xml index 6c215921357..2ca3c309e6d 100644 --- a/sonar-core/src/test/resources/org/sonar/core/plugin/JpaPluginDaoTest/savePluginAndFiles-result.xml +++ b/sonar-core/src/test/resources/org/sonar/core/plugin/JpaPluginDaoTest/savePluginAndFiles-result.xml @@ -1,9 +1,9 @@ <dataset> <plugins id="1" name="Checkstyle" plugin_key="checkstyle" organization="[null]" organization_url="[null]" license="[null]" homepage="[null]" - description="[null]" installation_date="[null]" plugin_class="[null]" core="true" version="2.2"/> + description="[null]" installation_date="[null]" plugin_class="[null]" core="true" child_first_classloader="false" version="2.2"/> <plugins id="2" name="PMD" plugin_key="pmd" organization="[null]" organization_url="[null]" license="[null]" homepage="[null]" - description="[null]" installation_date="[null]" plugin_class="org.sonar.pmd.Main" core="false" version="2.2" /> + description="[null]" installation_date="[null]" plugin_class="org.sonar.pmd.Main" core="false" child_first_classloader="false" version="2.2" /> <plugin_files id="1" plugin_id="1" filename="checkstyle.jar"/> <plugin_files id="2" plugin_id="1" filename="checkstyle-extension.jar"/> diff --git a/sonar-core/src/test/resources/org/sonar/core/plugin/JpaPluginDaoTest/shared.xml b/sonar-core/src/test/resources/org/sonar/core/plugin/JpaPluginDaoTest/shared.xml index 00861080067..57dfd1358d7 100644 --- a/sonar-core/src/test/resources/org/sonar/core/plugin/JpaPluginDaoTest/shared.xml +++ b/sonar-core/src/test/resources/org/sonar/core/plugin/JpaPluginDaoTest/shared.xml @@ -1,6 +1,6 @@ <dataset> <plugins id="1" name="Checkstyle" plugin_key="checkstyle" organization="[null]" organization_url="[null]" license="[null]" homepage="[null]" - description="[null]" installation_date="[null]" plugin_class="[null]" core="true" version="2.2" /> + description="[null]" installation_date="[null]" plugin_class="[null]" core="true" child_first_classloader="false" version="2.2" /> <plugin_files id="1" plugin_id="1" filename="checkstyle.jar"/> <plugin_files id="2" plugin_id="1" filename="checkstyle-extension.jar"/> |