-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPortletsPlutoGrailsPlugin.groovy
78 lines (69 loc) · 2.65 KB
/
PortletsPlutoGrailsPlugin.groovy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import grails.util.GrailsUtil
import org.springframework.core.io.Resource
class PortletsPlutoGrailsPlugin {
// the plugin version
def version = "0.2"
// the version or versions of Grails the plugin is designed for
def grailsVersion = "1.1 > *"
// the other plugins this plugin depends on
def dependsOn = [portlets: "0.2 > *"]
// resources that are excluded from plugin packaging
def pluginExcludes = [
"grails-app/views/error.gsp"
]
// TODO Fill in these fields
def author = "Kenji Nakamura"
def authorEmail = "kenji_nakamura@diva-america.com"
def title = "Apache Pluto portlets Plugin"
def description = '''\\
This plugin generates pluto portal server specific configuration files.
'''
// URL to the plugin's documentation
def documentation = "http://grails.org/plugin/portlets-pluto"
def watchedResources = ['file:./grails-app/portlets/**/*Portlet.groovy',
'file:./plugins/*/grails-app/portlets/**/*Portlet.groovy'
]
def doWithSpring = {
portletContainerAdapter(org.codehaus.grails.portlets.container.pluto.PlutoPortletContainerAdapter)
}
def doWithWebDescriptor = {webXml ->
if (watchedResources.length > 0) {
log.info("Creating Pluto servlets for ${watchedResources.length} portlets...")
for (Resource portlet in watchedResources) {
def portletName = portlet.filename - 'Portlet.groovy'
def servletElement = webXml.'servlet'
servletElement = servletElement[servletElement.size() - 1]
servletElement + {
'servlet'
{
'servlet-name'(portletName)
'servlet-class'('org.apache.pluto.core.PortletServlet')
'init-param'
{
'param-name'('portlet-name')
'param-value'(portletName)
}
'load-on-startup'('1')
}
}
def mappingElement = webXml.'servlet-mapping'
mappingElement = mappingElement[mappingElement.size() - 1]
mappingElement + {
'servlet-mapping'
{
'servlet-name'(portletName)
'url-pattern'("/PlutoInvoker/${portletName}")
}
}
}
}
}
def doWithApplicationContext = { applicationContext ->
}
def doWithDynamicMethods = { ctx ->
}
def onChange = { event ->
}
def onConfigChange = { event ->
}
}