Permalink
Browse files

whitespace/cleanup

  • Loading branch information...
1 parent 42dd468 commit 8b9003a4a77d50a0d31d3679279a8fb49f5c0cc6 @burtbeckwith burtbeckwith committed Jul 30, 2011
@@ -15,23 +15,23 @@
*/
package org.codehaus.groovy.grails.scaffolding
+import grails.build.logging.GrailsConsole
import grails.util.BuildSettingsHolder
import groovy.text.SimpleTemplateEngine
import groovy.text.Template
+
import org.apache.commons.logging.Log
import org.apache.commons.logging.LogFactory
-import org.codehaus.groovy.grails.cli.CommandLineHelper
import org.codehaus.groovy.grails.commons.GrailsApplication
import org.codehaus.groovy.grails.commons.GrailsDomainClass
+import org.codehaus.groovy.grails.plugins.GrailsPluginManager
+import org.codehaus.groovy.grails.plugins.PluginManagerAware
import org.springframework.context.ResourceLoaderAware
import org.springframework.core.io.ClassPathResource
import org.springframework.core.io.FileSystemResource
import org.springframework.core.io.ResourceLoader
import org.springframework.core.io.support.PathMatchingResourcePatternResolver
import org.springframework.util.Assert
-import org.codehaus.groovy.grails.plugins.PluginManagerAware
-import org.codehaus.groovy.grails.plugins.GrailsPluginManager
-import grails.build.logging.GrailsConsole
/**
* Default implementation of the generator that generates grails artifacts (controllers, views etc.)
@@ -57,7 +57,6 @@ class DefaultGrailsTemplateGenerator implements GrailsTemplateGenerator, Resourc
*/
DefaultGrailsTemplateGenerator(ClassLoader classLoader) {
engine = new SimpleTemplateEngine(classLoader)
-
}
/**
@@ -24,8 +24,7 @@
import java.net.URL;
/**
- *
- * Adds the the controller async APIs to Grails at compile time
+ * Adds the the controller async APIs to Grails at compile time.
*
* @author Graeme Rocher
* @since 2.0
@@ -44,12 +43,12 @@ public String getArtefactType() {
}
@Override
- public Class getInstanceImplementation() {
+ public Class<?> getInstanceImplementation() {
return ControllersAsyncApi.class;
}
@Override
- public Class getStaticImplementation() {
+ public Class<?> getStaticImplementation() {
return null; // none
}
@@ -18,13 +18,12 @@ package org.codehaus.groovy.grails.plugins.web.async
import grails.util.GrailsUtil
/**
- * Async support for the Grails 2.0. Doesn't do much right now, most logic handled by the compile time transform
- *
+ * Async support for the Grails 2.0. Doesn't do much right now, most logic handled
+ * by the compile time transform.
*
* @author Graeme Rocher
* @since 2.0
*/
class ControllersAsyncGrailsPlugin {
-
def version = GrailsUtil.getGrailsVersion()
}
@@ -17,78 +17,76 @@ package org.codehaus.groovy.grails.plugins.web.async
import javax.servlet.AsyncContext
import javax.servlet.AsyncListener
-import org.codehaus.groovy.grails.web.servlet.mvc.GrailsWebRequest
-import org.codehaus.groovy.grails.web.util.WebUtils
+
import org.codehaus.groovy.grails.support.PersistenceContextInterceptor
+import org.codehaus.groovy.grails.web.servlet.mvc.GrailsWebRequest
import org.codehaus.groovy.grails.web.sitemesh.GrailsContentBufferingResponse
import org.codehaus.groovy.grails.web.sitemesh.GroovyPageLayoutFinder
import org.codehaus.groovy.grails.web.sitemesh.GroovyPageLayoutRenderer
+import org.codehaus.groovy.grails.web.util.WebUtils
/**
- * Wraps an AsyncContext providing additional logic to provide the appropriate context to a Grails application
+ * Wraps an AsyncContext providing additional logic to provide the appropriate context to a Grails application.
*
* @author Graeme Rocher
* @since 2.0
*/
-class GrailsAsyncContext implements AsyncContext{
+class GrailsAsyncContext implements AsyncContext {
@Delegate AsyncContext delegate
GrailsWebRequest originalWebRequest
GroovyPageLayoutFinder groovyPageLayoutFinder
GrailsAsyncContext(AsyncContext delegate, GrailsWebRequest webRequest) {
this.delegate = delegate
- this.originalWebRequest = webRequest
- this.groovyPageLayoutFinder = webRequest.getApplicationContext()?.getBean("groovyPageLayoutFinder", GroovyPageLayoutFinder)
+ originalWebRequest = webRequest
+ groovyPageLayoutFinder = webRequest.getApplicationContext()?.getBean("groovyPageLayoutFinder", GroovyPageLayoutFinder)
}
def <T extends AsyncListener> T createListener(Class<T> tClass) {
delegate.createListener(tClass)
}
-
-
- void start(java.lang.Runnable runnable) {
+ void start(Runnable runnable) {
delegate.start {
- GrailsWebRequest webRequest = new GrailsWebRequest(request, response, request.getServletContext());
- WebUtils.storeGrailsWebRequest(webRequest);
+ GrailsWebRequest webRequest = new GrailsWebRequest(request, response, request.getServletContext())
+ WebUtils.storeGrailsWebRequest(webRequest)
def interceptors = getPersistenceInterceptors(webRequest)
- for(PersistenceContextInterceptor i in interceptors) {
+ for (PersistenceContextInterceptor i in interceptors) {
i.init()
}
try {
runnable.run()
- for(PersistenceContextInterceptor i in interceptors) {
+ for (PersistenceContextInterceptor i in interceptors) {
i.flush()
}
} finally {
- for(PersistenceContextInterceptor i in interceptors) {
+ for (PersistenceContextInterceptor i in interceptors) {
i.destroy()
}
- webRequest.requestCompleted();
- WebUtils.clearGrailsWebRequest();
+ webRequest.requestCompleted()
+ WebUtils.clearGrailsWebRequest()
}
}
}
void complete() {
- if(response instanceof GrailsContentBufferingResponse) {
+ if (response instanceof GrailsContentBufferingResponse) {
GrailsContentBufferingResponse bufferingResponse = (GrailsContentBufferingResponse) response
def targetResponse = bufferingResponse.getTargetResponse()
def content = bufferingResponse.getContent()
- if(content != null) {
-
+ if (content != null) {
def decorator = groovyPageLayoutFinder?.findLayout(request, content)
- if(decorator) {
- GroovyPageLayoutRenderer renderer = new GroovyPageLayoutRenderer(decorator, originalWebRequest.attributes.pagesTemplateEngine, originalWebRequest.applicationContext)
+ if (decorator) {
+ GroovyPageLayoutRenderer renderer = new GroovyPageLayoutRenderer(decorator,
+ originalWebRequest.attributes.pagesTemplateEngine, originalWebRequest.applicationContext)
renderer.render(content, request, targetResponse, request.servletContext)
}
else {
content.writeOriginal(targetResponse.getWriter())
}
-
}
}
delegate.complete()
@@ -97,12 +95,10 @@ class GrailsAsyncContext implements AsyncContext{
protected Collection<PersistenceContextInterceptor> getPersistenceInterceptors(GrailsWebRequest webRequest) {
def servletContext = webRequest.servletContext
def interceptors = servletContext?.getAttribute("org.codehaus.groovy.grails.PERSISTENCE_INTERCEPTORS")
- if(interceptors == null) {
-
+ if (interceptors == null) {
interceptors = webRequest.applicationContext?.getBeansOfType(PersistenceContextInterceptor)?.values() ?: []
servletContext.setAttribute("org.codehaus.groovy.grails.PERSISTENCE_INTERCEPTORS", interceptors)
}
return interceptors
}
-
}
@@ -16,14 +16,15 @@
package org.codehaus.groovy.grails.plugins.web.async.api
import javax.servlet.AsyncContext
-import org.codehaus.groovy.grails.web.servlet.mvc.GrailsWebRequest
-import org.springframework.web.context.request.RequestContextHolder
import javax.servlet.http.HttpServletRequest
-import org.codehaus.groovy.grails.web.servlet.GrailsApplicationAttributes
+
import org.codehaus.groovy.grails.plugins.web.async.GrailsAsyncContext
+import org.codehaus.groovy.grails.web.servlet.GrailsApplicationAttributes
+import org.codehaus.groovy.grails.web.servlet.mvc.GrailsWebRequest
+import org.springframework.web.context.request.RequestContextHolder
/**
- * Support API for async request processing
+ * Support API for async request processing.
*
* @author Graeme Rocher
* @since 2.0
@@ -35,8 +36,7 @@ class ControllersAsyncApi {
*
* @return
*/
-
- public AsyncContext startAsync(instance) {
+ AsyncContext startAsync(instance) {
GrailsWebRequest webRequest = RequestContextHolder.currentRequestAttributes()
HttpServletRequest request = webRequest.currentRequest
def ctx = request.startAsync(request, webRequest.currentResponse)
@@ -41,7 +41,6 @@ target(setCompilerSettings: "Updates the compile build settings based on args")
target(compile : "Implementation of compilation phase") {
depends(compilePlugins)
-
profile("Compiling sources to location [$classesDirPath]") {
try {
projectCompiler.compile()
@@ -14,9 +14,10 @@
* limitations under the License.
*/
-import org.springframework.core.io.FileSystemResource
import grails.util.GrailsNameUtils
+import org.springframework.core.io.FileSystemResource
+
/**
* Gant script for creating Grails artifacts of all sorts.
*
@@ -115,8 +116,6 @@ createArtifact = { Map args = [:] ->
event("CreatedFile", [artifactFile])
event("CreatedArtefact", [ artifactFile, className])
-
-
}
private createRootPackage() {

0 comments on commit 8b9003a

Please sign in to comment.