Permalink
Browse files

fix broken bootstrap which wasn't loading console/shell/etc. with cor…

…rect plugin manager
  • Loading branch information...
1 parent bdd36e5 commit 509ee8ffd6294a43a5376d54cd9cb229c08a682d @graemerocher graemerocher committed Jul 26, 2012
@@ -18,6 +18,7 @@
import grails.spring.BeanBuilder;
import grails.util.CollectionUtils;
import grails.util.Environment;
+import grails.util.Holders;
import groovy.lang.Binding;
import groovy.lang.Closure;
import groovy.lang.Script;
@@ -33,7 +34,6 @@
import org.codehaus.groovy.grails.commons.GrailsApplication;
import org.codehaus.groovy.grails.plugins.DefaultGrailsPluginManager;
import org.codehaus.groovy.grails.plugins.GrailsPluginManager;
-import org.codehaus.groovy.grails.plugins.PluginManagerHolder;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
@@ -95,17 +95,16 @@ public GrailsRuntimeConfigurator(GrailsApplication application, ApplicationConte
try {
pluginManager = parent == null ? null : parent.getBean(GrailsPluginManager.class);
- pluginManager = pluginManager == null ? PluginManagerHolder.getPluginManager() : pluginManager;
} catch (BeansException e) {
// ignore
}
if (pluginManager == null) {
- pluginManager = PluginManagerHolder.getPluginManager();
+ pluginManager = Holders.getPluginManager();
}
if (pluginManager == null) {
pluginManager = new DefaultGrailsPluginManager("**/plugins/*/**GrailsPlugin.groovy", application);
}
- PluginManagerHolder.setPluginManager(pluginManager);
+ Holders.setPluginManager(pluginManager);
}
/**
@@ -53,7 +53,6 @@ public static boolean isExcludedClass(Class<?> theClass) {
theClass == DocumentedMethod.class ||
theClass == DocumentedProperty.class ||
theClass == DocumentedElement.class ||
- theClass == DocumentationContextThreadLocal.class ||
theClass == Boolean.class || Closure.class.isAssignableFrom(theClass);
}
@@ -76,20 +75,12 @@ public boolean hasModifiedMetaClass(ExpandoMetaClass emc) {
* Enables the ExpandoMetaClassCreationHandle with the registry.
*
* <code>ExpandoMetaClassCreationHandle.enable();</code>
+ *
+ * @deprecated Dynamic document generation no longer supported
*/
public static void enable() {
- final MetaClassRegistry metaClassRegistry = GroovySystem.getMetaClassRegistry();
- if (metaClassRegistry.getMetaClassCreationHandler() != INSTANCE) {
- ClassInfo.clearModifiedExpandos();
- metaClassRegistry.setMetaClassCreationHandle(INSTANCE);
- }
}
public static void disable() {
- final MetaClassRegistry metaClassRegistry = GroovySystem.getMetaClassRegistry();
- if (metaClassRegistry.getMetaClassCreationHandler() == INSTANCE) {
- ClassInfo.clearModifiedExpandos();
- metaClassRegistry.setMetaClassCreationHandle(new MetaClassRegistry.MetaClassCreationHandle());
- }
}
}
@@ -15,7 +15,7 @@
*/
package org.codehaus.groovy.grails.plugins;
-import org.springframework.util.Assert;
+import grails.util.Holders;
/**
* Manages a thread bound plugin manager instance.
@@ -25,11 +25,11 @@
*/
public abstract class PluginManagerHolder {
- private static GrailsPluginManager gpm;
- private static Boolean inCreation = false;
+ /**
+ * @deprecated
+ */
public static void setInCreation(boolean inCreation) {
- PluginManagerHolder.inCreation = inCreation;
}
/**
@@ -40,10 +40,7 @@ public static void setInCreation(boolean inCreation) {
*/
@Deprecated
public static void setPluginManager(GrailsPluginManager pluginManager) {
- if (pluginManager != null) {
- inCreation = false;
- }
- gpm = pluginManager;
+ Holders.setPluginManager(pluginManager);
}
/**
@@ -54,15 +51,7 @@ public static void setPluginManager(GrailsPluginManager pluginManager) {
*/
@Deprecated
public static GrailsPluginManager getPluginManager() {
- while (inCreation) {
- try {
- Thread.sleep(100);
- }
- catch (InterruptedException e) {
- break;
- }
- }
- return gpm;
+ return Holders.getPluginManager();
}
/**
@@ -74,8 +63,6 @@ public static GrailsPluginManager getPluginManager() {
*/
@Deprecated
public static GrailsPluginManager currentPluginManager() {
- GrailsPluginManager current = getPluginManager();
- Assert.state(current != null, "No PluginManager set");
- return current;
+ return Holders.currentPluginManager();
}
}
@@ -72,7 +72,7 @@ target(loadApp:"Loads the Grails application object") {
def builder = new WebBeanBuilder(ctx)
newBeans = builder.beans {
delegate."pluginManager"(MethodInvokingFactoryBean) {
- targetClass = PluginManagerHolder
+ targetClass = grails.util.Holders
targetMethod = "getPluginManager"
}
}

0 comments on commit 509ee8f

Please sign in to comment.