Permalink
Browse files

Revert "Reorganise artefact classes more logically"

This reverts commit e2a2f85.
  • Loading branch information...
1 parent ecb0098 commit 7138d555d40818b7d4eb8cab2516de9508fe28ef @graemerocher graemerocher committed Jul 11, 2014
Showing with 59 additions and 99 deletions.
  1. +2 −2 grails-compat/src/main/groovy/org/codehaus/groovy/grails/commons/DefaultGrailsControllerClass.groovy
  2. +2 −2 grails-compat/src/main/groovy/org/codehaus/groovy/grails/commons/DefaultGrailsDomainClass.groovy
  3. +2 −2 ...compat/src/main/groovy/org/codehaus/groovy/grails/commons/DefaultGrailsDomainClassProperty.groovy
  4. +2 −2 grails-compat/src/main/groovy/org/codehaus/groovy/grails/commons/DefaultGrailsServiceClass.groovy
  5. +2 −2 grails-compat/src/main/groovy/org/codehaus/groovy/grails/commons/DefaultGrailsTagLibClass.groovy
  6. +2 −2 ...ls-compat/src/main/groovy/org/codehaus/groovy/grails/commons/DefaultGrailsUrlMappingsClass.groovy
  7. +1 −1 grails-core/build.gradle
  8. +0 −7 grails-core/src/main/groovy/grails/core/ArtefactHandler.java
  9. +0 −26 grails-core/src/main/groovy/grails/core/ArtefactHandlerAdapter.java
  10. +5 −6 grails-core/src/main/groovy/grails/core/DefaultGrailsApplication.java
  11. +0 −3 grails-core/src/main/groovy/grails/core/GrailsServiceClass.java
  12. +1 −2 ...rails/web/mapping/artefact → grails-core/src/main/groovy/grails/core}/GrailsUrlMappingsClass.java
  13. +1 −2 grails-core/src/main/groovy/org/grails/core/{artefact → }/DefaultGrailsControllerClass.java
  14. +2 −2 grails-core/src/main/groovy/org/grails/core/{artefact → }/DefaultGrailsDomainClass.java
  15. +2 −2 grails-core/src/main/groovy/org/grails/core/{artefact → }/DefaultGrailsDomainClassProperty.java
  16. +1 −3 grails-core/src/main/groovy/org/grails/core/{artefact → }/DefaultGrailsServiceClass.java
  17. +1 −2 grails-core/src/main/groovy/org/grails/core/{artefact → }/DefaultGrailsTagLibClass.java
  18. +2 −3 ...apping/artefact → grails-core/src/main/groovy/org/grails/core}/DefaultGrailsUrlMappingsClass.java
  19. +1 −0 grails-core/src/main/groovy/org/grails/core/artefact/ControllerArtefactHandler.java
  20. +1 −0 grails-core/src/main/groovy/org/grails/core/artefact/DomainClassArtefactHandler.java
  21. +1 −0 grails-core/src/main/groovy/org/grails/core/artefact/ServiceArtefactHandler.java
  22. +1 −0 grails-core/src/main/groovy/org/grails/core/artefact/TagLibArtefactHandler.java
  23. +3 −2 ...b/mapping → grails-core/src/main/groovy/org/grails/core}/artefact/UrlMappingsArtefactHandler.java
  24. +0 −1 grails-core/src/main/resources/META-INF/grails.factories
  25. +1 −1 grails-plugin-codecs/src/main/resources/META-INF/grails.factories
  26. +1 −1 grails-plugin-controllers/src/main/groovy/org/grails/compiler/web/ControllerActionTransformer.java
  27. +1 −1 ...filters/src/test/groovy/org/codehaus/groovy/grails/web/filters/FilterToHandlerAdapterTests.groovy
  28. +1 −1 grails-plugin-testing/src/main/groovy/grails/test/MockUtils.groovy
  29. +1 −1 grails-plugin-testing/src/main/groovy/grails/test/mixin/web/UrlMappingsUnitTestMixin.groovy
  30. +1 −1 grails-plugin-testing/src/main/groovy/grails/test/runtime/ControllerTestPlugin.groovy
  31. +1 −1 grails-plugin-testing/src/main/groovy/org/grails/compiler/injection/test/TestForTransformation.java
  32. +1 −1 ...plugin-url-mappings/src/main/groovy/org/grails/plugins/web/mapping/UrlMappingsGrailsPlugin.groovy
  33. +1 −1 grails-test-suite-uber/src/test/groovy/grails/validation/ConstrainedPropertyTests.java
  34. +1 −1 ...est-suite-uber/src/test/groovy/org/codehaus/groovy/grails/commons/DefaultArtefactInfoTests.groovy
  35. +1 −1 ...r/src/test/groovy/org/codehaus/groovy/grails/commons/DefaultGrailsDomainClassPropertyTests.groovy
  36. +1 −1 ...uite-uber/src/test/groovy/org/codehaus/groovy/grails/commons/DefaultGrailsDomainClassTests.groovy
  37. +1 −1 ...te-uber/src/test/groovy/org/codehaus/groovy/grails/commons/UrlMappingsArtefactHandlerTests.groovy
  38. +1 −1 ...ber/src/test/groovy/org/codehaus/groovy/grails/validation/ConstraintsEvaluatingPropertyTests.java
  39. +1 −1 grails-test-suite-web/src/test/groovy/org/grails/web/taglib/JavascriptTagLibTests.groovy
  40. +1 −1 grails-test-suite-web/src/test/groovy/org/grails/web/taglib/LinkRenderingTagLib2Tests.groovy
  41. +1 −1 grails-test-suite-web/src/test/groovy/org/grails/web/taglib/LinkRenderingTagLibTests.groovy
  42. +1 −1 grails-test-suite-web/src/test/groovy/org/grails/web/taglib/NamespacedNamedUrlMappingTests.groovy
  43. +1 −1 grails-test-suite-web/src/test/groovy/org/grails/web/taglib/OverlappingReverseMappedLinkTests.groovy
  44. +1 −1 grails-test-suite-web/src/test/groovy/org/grails/web/taglib/RenderTagLibTests.groovy
  45. +1 −1 grails-web-gsp-taglib/src/main/groovy/org/grails/web/pages/StandaloneTagLibraryLookup.java
  46. +2 −2 grails-web-url-mappings/src/main/groovy/org/grails/web/mapping/UrlMappingsHolderFactoryBean.java
  47. +0 −1 grails-web-url-mappings/src/main/resources/META-INF/grails.factories
  48. +1 −1 grails-web/src/main/resources/META-INF/grails.factories
@@ -24,11 +24,11 @@ import groovy.transform.CompileStatic
* @author Graeme Rocher
* @author Steven Devijver
* @since 0.1
- * @deprecated Use {@link org.grails.core.artefact.DefaultGrailsControllerClass} instead
+ * @deprecated Use {@link org.grails.core.DefaultGrailsControllerClass} instead
*/
@Deprecated
@CompileStatic
-class DefaultGrailsControllerClass extends org.grails.core.artefact.DefaultGrailsControllerClass {
+class DefaultGrailsControllerClass extends org.grails.core.DefaultGrailsControllerClass {
DefaultGrailsControllerClass(Class<?> clazz) {
super(clazz)
@@ -19,10 +19,10 @@ import groovy.transform.CompileStatic
/**
* @author Graeme Rocher
- * @deprecated Use {@link org.grails.core.artefact.DefaultGrailsDomainClass} instead
+ * @deprecated Use {@link org.grails.core.DefaultGrailsDomainClass} instead
*/
@CompileStatic
-class DefaultGrailsDomainClass extends org.grails.core.artefact.DefaultGrailsDomainClass {
+class DefaultGrailsDomainClass extends org.grails.core.DefaultGrailsDomainClass {
DefaultGrailsDomainClass(Class<?> clazz, Map<String, Object> defaultConstraints) {
super(clazz, defaultConstraints)
}
@@ -21,11 +21,11 @@ import java.beans.PropertyDescriptor
/**
* @author Graeme Rocher
- * @deprecated Use {@link org.grails.core.artefact.DefaultGrailsDomainClassProperty} instead
+ * @deprecated Use {@link org.grails.core.DefaultGrailsDomainClassProperty} instead
*/
@Deprecated
@CompileStatic
-class DefaultGrailsDomainClassProperty extends org.grails.core.artefact.DefaultGrailsDomainClassProperty {
+class DefaultGrailsDomainClassProperty extends org.grails.core.DefaultGrailsDomainClassProperty {
DefaultGrailsDomainClassProperty(grails.core.GrailsDomainClass domainClass, PropertyDescriptor descriptor) {
super(domainClass, descriptor)
@@ -4,11 +4,11 @@ import groovy.transform.CompileStatic
/**
* @author Graeme Rocher
- * @deprecated Use {@link DefaultGrailsServiceClass} instead
+ * @deprecated Use {@link org.grails.core.DefaultGrailsServiceClass} instead
*/
@Deprecated
@CompileStatic
-class DefaultGrailsServiceClass extends DefaultGrailsServiceClass {
+class DefaultGrailsServiceClass extends org.grails.core.DefaultGrailsServiceClass {
DefaultGrailsServiceClass(Class<?> clazz) {
super(clazz)
}
@@ -17,9 +17,9 @@ package org.codehaus.groovy.grails.commons
/**
* @author Graeme Rocher
- * @deprecated Use {@link org.grails.core.artefact.DefaultGrailsTagLibClass} instead
+ * @deprecated Use {@link org.grails.core.DefaultGrailsTagLibClass} instead
*/
-class DefaultGrailsTagLibClass extends org.grails.core.artefact.DefaultGrailsTagLibClass {
+class DefaultGrailsTagLibClass extends org.grails.core.DefaultGrailsTagLibClass {
DefaultGrailsTagLibClass(Class<?> clazz) {
super(clazz)
@@ -18,11 +18,11 @@ package org.codehaus.groovy.grails.commons
import groovy.transform.CompileStatic
/**
- * @deprecated Use {@link org.grails.web.mapping.artefact.DefaultGrailsUrlMappingsClass} instead
+ * @deprecated Use {@link org.grails.core.DefaultGrailsUrlMappingsClass} instead
*/
@Deprecated
@CompileStatic
-class DefaultGrailsUrlMappingsClass extends org.grails.web.mapping.artefact.DefaultGrailsUrlMappingsClass {
+class DefaultGrailsUrlMappingsClass extends org.grails.core.DefaultGrailsUrlMappingsClass {
DefaultGrailsUrlMappingsClass(Class<?> clazz) {
super(clazz)
}
View
@@ -7,7 +7,7 @@ dependencies {
compile( "com.googlecode.concurrentlinkedhashmap:concurrentlinkedhashmap-lru:${concurrentlinkedhashmapVersion}" ) {
exclude group: 'commons-logging', module:'commons-logging'
}
- compile("org.springframework.boot:spring-boot:1.1.4.RELEASE")
+ compile("org.springframework.boot:spring-boot:1.1.0.M2")
compile("org.springframework:spring-core:${springVersion}") {
exclude group: 'commons-logging', module:'commons-logging'
}
@@ -15,8 +15,6 @@
*/
package grails.core;
-import org.codehaus.groovy.ast.ClassNode;
-
/**
* <p>The ArtefactHandler interface's purpose is to allow the analysis of conventions within a Grails application.
* An artefact is represented by the GrailsClass interface and this interface provides methods that allow artefacts to
@@ -46,11 +44,6 @@
String getType();
/**
- * @param classNode The ClassNode instance
- * @return True if the given ClassNode instance is an instance of the Artefact type
- */
- boolean isArtefact(ClassNode classNode);
- /**
* <p>Called by the GrailsApplication whenever it needs to know if a given class
* is considered to be the kind of artefact represented by this handler.</p>
* <p>Typically you will check the name of the class and some other properties to see
@@ -20,15 +20,9 @@
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Modifier;
-import java.net.MalformedURLException;
-import java.net.URI;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.codehaus.groovy.ast.ClassNode;
-import org.codehaus.groovy.ast.InnerClassNode;
-import org.grails.io.support.GrailsResourceUtils;
-import org.grails.io.support.UrlResource;
/**
* Adapter for the {@link grails.core.ArtefactHandler} interface
@@ -71,26 +65,6 @@ public String getType() {
return type;
}
- @Override
- public boolean isArtefact(ClassNode classNode) {
- int modifiers = classNode.getModifiers();
- URI uri = classNode.getModule().getContext().getSource().getURI();
- if(uri == null) return false;
- try {
- if(!GrailsResourceUtils.isGrailsResource(new UrlResource(uri))) return false;
- } catch (MalformedURLException e) {
- return false;
- }
- if(classNode instanceof InnerClassNode) return false;
-
- if(!classNode.isEnum() && !classNode.isInterface() && !Modifier.isAbstract(modifiers)) {
- if(classNode.getName().endsWith(artefactSuffix)) {
- return true;
- }
- }
- return false;
- }
-
public final boolean isArtefact(@SuppressWarnings("rawtypes") Class aClass) {
if (aClass == null) {
return false;
@@ -185,15 +185,14 @@ protected void initArtefactHandlers() {
registerArtefactHandler(tagLibArtefactHandler);
}
- List<org.codehaus.groovy.grails.commons.ArtefactHandler> legacyArtefactHandlers = GrailsFactoriesLoader.loadFactories(org.codehaus.groovy.grails.commons.ArtefactHandler.class, getClassLoader());
-
- for (org.codehaus.groovy.grails.commons.ArtefactHandler artefactHandler : legacyArtefactHandlers) {
- registerArtefactHandler(artefactHandler);
+ final UrlMappingsArtefactHandler urlMappingsArtefactHandler = new UrlMappingsArtefactHandler();
+ if (!hasArtefactHandler(urlMappingsArtefactHandler.getType())) {
+ registerArtefactHandler(urlMappingsArtefactHandler);
}
- List<ArtefactHandler> additionalArtefactHandlers = GrailsFactoriesLoader.loadFactories(ArtefactHandler.class, getClassLoader());
+ List<org.codehaus.groovy.grails.commons.ArtefactHandler> additionalArtefactHandlers = GrailsFactoriesLoader.loadFactories(org.codehaus.groovy.grails.commons.ArtefactHandler.class, getClassLoader());
- for (ArtefactHandler artefactHandler : additionalArtefactHandlers) {
+ for (org.codehaus.groovy.grails.commons.ArtefactHandler artefactHandler : additionalArtefactHandlers) {
registerArtefactHandler(artefactHandler);
}
@@ -15,10 +15,7 @@
*/
package grails.core;
-import grails.core.InjectableGrailsClass;
-
/**
- * @author Graeme Rocher
* @author Steven Devijver
*/
public interface GrailsServiceClass extends InjectableGrailsClass {
@@ -13,9 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package grails.web.mapping.artefact;
+package grails.core;
-import grails.core.GrailsClass;
import groovy.lang.Closure;
import java.util.List;
@@ -13,12 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.grails.core.artefact;
+package org.grails.core;
import grails.core.GrailsControllerClass;
import grails.web.Action;
import groovy.lang.GroovyObject;
-import org.grails.core.AbstractInjectableGrailsClass;
import org.springframework.util.ReflectionUtils;
import java.lang.reflect.Method;
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.grails.core.artefact;
+package org.grails.core;
import grails.core.ComponentCapableDomainClass;
import grails.core.GrailsDomainClass;
@@ -32,7 +32,7 @@
import java.util.Map;
import java.util.Set;
-import org.grails.core.AbstractGrailsClass;
+import org.grails.core.artefact.DomainClassArtefactHandler;
import org.grails.core.io.support.GrailsFactoriesLoader;
import org.grails.core.exceptions.GrailsDomainException;
import org.grails.core.exceptions.InvalidPropertyException;
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.grails.core.artefact;
+package org.grails.core;
import grails.core.ComponentCapableDomainClass;
import grails.core.GrailsDomainClass;
@@ -31,7 +31,7 @@
import java.util.Set;
import grails.validation.Constrained;
-import org.grails.core.AbstractGrailsClass;
+import org.grails.core.artefact.DomainClassArtefactHandler;
import org.grails.core.io.support.GrailsFactoriesLoader;
import grails.validation.ConstraintsEvaluator;
import org.grails.core.support.GrailsDomainConfigurationUtil;
@@ -13,13 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.grails.core.artefact;
+package org.grails.core;
import grails.core.GrailsServiceClass;
-import org.grails.core.AbstractInjectableGrailsClass;
/**
- * @author Graeme Rocher
* @author Steven Devijver
*/
public class DefaultGrailsServiceClass extends AbstractInjectableGrailsClass implements GrailsServiceClass {
@@ -13,11 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.grails.core.artefact;
+package org.grails.core;
import grails.core.GrailsTagLibClass;
import groovy.lang.Closure;
-import org.grails.core.AbstractInjectableGrailsClass;
import org.grails.core.artefact.TagLibArtefactHandler;
import java.beans.PropertyDescriptor;
@@ -13,11 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.grails.web.mapping.artefact;
+package org.grails.core;
-import grails.web.mapping.artefact.GrailsUrlMappingsClass;
+import grails.core.GrailsUrlMappingsClass;
import groovy.lang.Closure;
-import org.grails.core.AbstractGrailsClass;
import java.util.ArrayList;
import java.util.List;
@@ -19,6 +19,7 @@
import grails.core.ArtefactHandlerAdapter;
import grails.core.GrailsClass;
import grails.core.GrailsControllerClass;
+import org.grails.core.DefaultGrailsControllerClass;
/**
* Lookup controllers for uris.
@@ -25,6 +25,7 @@
import java.util.concurrent.ConcurrentHashMap;
import grails.core.support.GrailsApplicationAware;
+import org.grails.core.DefaultGrailsDomainClass;
import org.grails.core.support.GrailsDomainConfigurationUtil;
import org.grails.validation.ConstraintEvalUtils;
@@ -17,6 +17,7 @@
import grails.core.ArtefactHandlerAdapter;
import grails.core.GrailsServiceClass;
+import org.grails.core.DefaultGrailsServiceClass;
/**
* @author Marc Palmer (marc@anyware.co.uk)
@@ -24,6 +24,7 @@
import grails.core.GrailsTagLibClass;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.grails.core.DefaultGrailsTagLibClass;
/**
* Configures tag libraries within namespaces in Grails.
@@ -13,10 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package grails.web.mapping.artefact;
+package org.grails.core.artefact;
import grails.core.ArtefactHandlerAdapter;
-import org.grails.web.mapping.artefact.DefaultGrailsUrlMappingsClass;
+import grails.core.GrailsUrlMappingsClass;
+import org.grails.core.DefaultGrailsUrlMappingsClass;
/**
* A handler for UrlMappings.
@@ -1 +0,0 @@
-grails.core.ArtefactHandler=org.grails.core.artefact.ServiceArtefactHandler
@@ -1 +1 @@
-grails.core.ArtefactHandler=org.grails.commons.CodecArtefactHandler
+org.codehaus.groovy.grails.commons.ArtefactHandler=org.grails.commons.CodecArtefactHandler
@@ -81,7 +81,7 @@
import org.codehaus.groovy.classgen.GeneratorContext;
import org.codehaus.groovy.control.SourceUnit;
import org.grails.core.artefact.ControllerArtefactHandler;
-import org.grails.core.artefact.DefaultGrailsControllerClass;
+import org.grails.core.DefaultGrailsControllerClass;
import grails.compiler.ast.AnnotatedClassInjector;
import grails.compiler.ast.AstTransformer;
import org.grails.compiler.injection.GrailsASTUtils;
@@ -4,7 +4,7 @@ import grails.web.CamelCaseUrlConverter
import grails.web.UrlConverter
import grails.core.DefaultGrailsApplication
-import org.grails.core.artefact.DefaultGrailsControllerClass
+import org.grails.core.DefaultGrailsControllerClass
import org.grails.plugins.web.filters.FilterToHandlerAdapter
import org.springframework.context.support.GenericApplicationContext
@@ -34,7 +34,7 @@ import org.grails.web.converters.Converter
import org.grails.web.pages.GroovyPageBinding
import org.grails.web.taglib.GroovyPageAttributes
import org.grails.web.taglib.exceptions.GrailsTagException
-import org.grails.core.artefact.DefaultGrailsDomainClass
+import org.grails.core.DefaultGrailsDomainClass
import org.grails.core.artefact.DomainClassArtefactHandler
import org.grails.plugins.web.mime.FormatInterceptor
import org.grails.validation.ConstrainedPropertyBuilder
@@ -23,7 +23,7 @@ import junit.framework.AssertionFailedError
import org.grails.core.artefact.ControllerArtefactHandler
import grails.core.GrailsControllerClass
-import grails.web.mapping.artefact.UrlMappingsArtefactHandler
+import org.grails.core.artefact.UrlMappingsArtefactHandler
import grails.web.mapping.UrlMappingInfo
import grails.web.mapping.UrlMappingsHolder
import org.grails.web.mapping.UrlMappingsHolderFactoryBean
@@ -29,7 +29,7 @@ import org.springframework.web.multipart.support.StandardServletMultipartResolve
import javax.servlet.ServletContext
import grails.core.GrailsApplication
-import grails.web.mapping.artefact.UrlMappingsArtefactHandler
+import org.grails.core.artefact.UrlMappingsArtefactHandler
import org.grails.plugins.CodecsGrailsPlugin
import org.grails.plugins.codecs.DefaultCodecLookup
import org.grails.plugins.converters.ConvertersGrailsPlugin
@@ -65,7 +65,7 @@
import org.grails.core.artefact.ControllerArtefactHandler;
import org.grails.core.artefact.ServiceArtefactHandler;
import org.grails.core.artefact.TagLibArtefactHandler;
-import grails.web.mapping.artefact.UrlMappingsArtefactHandler;
+import org.grails.core.artefact.UrlMappingsArtefactHandler;
import grails.web.servlet.context.GrailsWebApplicationContext;
import org.grails.compiler.injection.GrailsASTUtils;
import grails.compiler.ast.GrailsArtefactClassInjector;
Oops, something went wrong.

0 comments on commit 7138d55

Please sign in to comment.