From 21c02634dccca3c2795733773b39af8314bc17ad Mon Sep 17 00:00:00 2001 From: Burt Beckwith Date: Mon, 7 Sep 2015 18:23:29 -0400 Subject: [PATCH] converted to Grails 3 --- .gitignore | 10 +- LICENSE | 201 ++++++ MandrillGrailsPlugin.groovy | 69 -- application.properties | 4 - build.gradle | 66 ++ gradle.properties | 8 + grails-app/conf/BuildConfig.groovy | 42 -- grails-app/conf/Config.groovy | 32 - grails-app/conf/DataSource.groovy | 43 -- grails-app/conf/application.yml | 11 + grails-app/conf/logback.groovy | 24 + .../org/grails/mandrill/Application.groovy | 10 + .../grails/mandrill/HttpWrapperService.groovy | 85 +-- .../grails/mandrill/MandrillService.groovy | 55 +- plugin.xml | 26 - scripts/_Install.groovy | 30 - scripts/_Uninstall.groovy | 5 - scripts/_Upgrade.groovy | 10 - settings.gradle | 1 + .../grails/mandrill/MandrillAttachment.groovy | 0 .../mandrill/MandrillGrailsPlugin.groovy | 15 + .../grails/mandrill/MandrillMessage.groovy | 12 +- .../grails/mandrill/MandrillRecipient.groovy | 3 - .../org/grails/mandrill/MergeVar.groovy | 0 .../org/grails/mandrill/RecipientVars.groovy | 0 .../org/grails/mandrill/SendResponse.groovy | 3 + .../mandrill/MandrillServiceTests.groovy | 38 + .../mandrill/MandrillServiceTests.groovy | 51 -- web-app/WEB-INF/applicationContext.xml | 33 - web-app/WEB-INF/sitemesh.xml | 14 - web-app/WEB-INF/tld/c.tld | 572 --------------- web-app/WEB-INF/tld/fmt.tld | 671 ------------------ web-app/WEB-INF/tld/grails.tld | 550 -------------- web-app/WEB-INF/tld/spring.tld | 311 -------- 34 files changed, 456 insertions(+), 2549 deletions(-) create mode 100644 LICENSE delete mode 100755 MandrillGrailsPlugin.groovy delete mode 100755 application.properties create mode 100755 build.gradle create mode 100755 gradle.properties delete mode 100755 grails-app/conf/BuildConfig.groovy delete mode 100755 grails-app/conf/Config.groovy delete mode 100755 grails-app/conf/DataSource.groovy create mode 100644 grails-app/conf/application.yml create mode 100644 grails-app/conf/logback.groovy create mode 100644 grails-app/init/org/grails/mandrill/Application.groovy delete mode 100644 plugin.xml delete mode 100755 scripts/_Install.groovy delete mode 100755 scripts/_Uninstall.groovy delete mode 100755 scripts/_Upgrade.groovy create mode 100644 settings.gradle rename src/{ => main}/groovy/org/grails/mandrill/MandrillAttachment.groovy (100%) create mode 100755 src/main/groovy/org/grails/mandrill/MandrillGrailsPlugin.groovy rename src/{ => main}/groovy/org/grails/mandrill/MandrillMessage.groovy (68%) rename src/{ => main}/groovy/org/grails/mandrill/MandrillRecipient.groovy (87%) rename src/{ => main}/groovy/org/grails/mandrill/MergeVar.groovy (100%) rename src/{ => main}/groovy/org/grails/mandrill/RecipientVars.groovy (100%) rename src/{ => main}/groovy/org/grails/mandrill/SendResponse.groovy (87%) create mode 100755 src/test/groovy/org/grails/mandrill/MandrillServiceTests.groovy delete mode 100755 test/unit/org/grails/mandrill/MandrillServiceTests.groovy delete mode 100755 web-app/WEB-INF/applicationContext.xml delete mode 100755 web-app/WEB-INF/sitemesh.xml delete mode 100755 web-app/WEB-INF/tld/c.tld delete mode 100755 web-app/WEB-INF/tld/fmt.tld delete mode 100755 web-app/WEB-INF/tld/grails.tld delete mode 100755 web-app/WEB-INF/tld/spring.tld diff --git a/.gitignore b/.gitignore index 3115edc..e1bb63d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,9 @@ *.iml *.ipr *.iws -.idea/ -target/ -grails-mandrill-*.zip -out/ +*.log +.DS_Store +/.gradle +/.idea +/build +/out diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..29f81d8 --- /dev/null +++ b/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/MandrillGrailsPlugin.groovy b/MandrillGrailsPlugin.groovy deleted file mode 100755 index 6488168..0000000 --- a/MandrillGrailsPlugin.groovy +++ /dev/null @@ -1,69 +0,0 @@ -class MandrillGrailsPlugin { - // the plugin version - def version = "0.5" - // the version or versions of Grails the plugin is designed for - def grailsVersion = "2.1 > *" - // the other plugins this plugin depends on - def dependsOn = [:] - // resources that are excluded from plugin packaging - def pluginExcludes = [ - "grails-app/views/error.gsp" - ] - - // TODO Fill in these fields - def title = "Grails Mandrill Plugin" // Headline display name of the plugin - def author = "Damien Pacaud" - def authorEmail = "damien.pacaud@gmail.com" - def description = '''\ - This is a simple wrapper for the Mandrill REST API (http://www.mandrillapp.com) -''' - - - // URL to the plugin's documentation - def documentation = "https://github.com/dpacaud/mandrill" - - // Extra (optional) plugin metadata - - // License: one of 'APACHE', 'GPL2', 'GPL3' - def license = "APACHE" - - // Any additional developers beyond the author specified above. - def developers = [ [ name: "Damien Pacaud", email: "damien.pacaud@gmail.com" ]] - - // Location of the plugin's issue tracker. - def issueManagement = [ system: "GITHUB", url: "https://github.com/dpacaud/mandrill/issues" ] - - // Online location of the plugin's browseable source code. - def scm = [ url: "https://github.com/dpacaud/mandrill" ] - - def doWithWebDescriptor = { xml -> - // TODO Implement additions to web.xml (optional), this event occurs before - } - - def doWithSpring = { - // TODO Implement runtime spring config (optional) - } - - def doWithDynamicMethods = { ctx -> - // TODO Implement registering dynamic methods to classes (optional) - } - - def doWithApplicationContext = { applicationContext -> - // TODO Implement post initialization spring config (optional) - } - - def onChange = { event -> - // TODO Implement code that is executed when any artefact that this plugin is - // watching is modified and reloaded. The event contains: event.source, - // event.application, event.manager, event.ctx, and event.plugin. - } - - def onConfigChange = { event -> - // TODO Implement code that is executed when the project configuration changes. - // The event is the same as for 'onChange'. - } - - def onShutdown = { event -> - // TODO Implement code that is executed when the application shuts down (optional) - } -} diff --git a/application.properties b/application.properties deleted file mode 100755 index 86c7483..0000000 --- a/application.properties +++ /dev/null @@ -1,4 +0,0 @@ -#Grails Metadata file -#Fri Sep 21 18:06:16 CEST 2012 -app.grails.version=2.1.1 -app.name=mandrill diff --git a/build.gradle b/build.gradle new file mode 100755 index 0000000..2a50ddd --- /dev/null +++ b/build.gradle @@ -0,0 +1,66 @@ +buildscript { + ext { + grailsVersion = project.grailsVersion + } + repositories { + mavenLocal() + maven { url 'https://repo.grails.org/grails/core' } + } + dependencies { + classpath "org.grails:grails-gradle-plugin:$grailsVersion" + } +} + +plugins { + id 'io.spring.dependency-management' version '0.5.2.RELEASE' + id 'com.jfrog.bintray' version '1.2' +} + +version 'TODO' +group 'org.grails.plugins' + +apply plugin: 'maven-publish' +apply plugin: 'spring-boot' +apply plugin: 'org.grails.grails-plugin' + +apply from:'https://raw.githubusercontent.com/grails/grails-profile-repository/master/profiles/plugin/templates/grailsCentralPublishing.gradle' +apply from:'https://raw.githubusercontent.com/grails/grails-profile-repository/master/profiles/plugin/templates/bintrayPublishing.gradle' + +ext { + grailsVersion = project.grailsVersion + gradleWrapperVersion = project.gradleWrapperVersion +} + +sourceCompatibility = targetCompatibility = 1.7 + +repositories { + mavenLocal() + mavenCentral() + maven { url 'https://repo.grails.org/grails/core' } +} + +dependencyManagement { + imports { + mavenBom "org.grails:grails-bom:$grailsVersion" + } + applyMavenExclusions false +} + +dependencies { + + provided 'javax.servlet:javax.servlet-api:3.1.0' + provided 'org.grails:grails-dependencies' + provided 'org.grails:grails-web-boot' + + compile 'org.codehaus.groovy.modules.http-builder:http-builder:0.7.1', { + ['commons-logging', 'xml-apis', 'groovy'].each { exclude module: it } + } + + console 'org.grails:grails-console' + + testCompile 'org.grails:grails-plugin-testing' +} + +task wrapper(type: Wrapper) { + gradleVersion = gradleWrapperVersion +} diff --git a/gradle.properties b/gradle.properties new file mode 100755 index 0000000..c2ff1a7 --- /dev/null +++ b/gradle.properties @@ -0,0 +1,8 @@ +grailsVersion=3.0.4 +gradleWrapperVersion=2.3 + +repo=TODO +userOrg=TODO +websiteUrl=https://github.com/dpacaud/mandrill +issueTrackerUrl=https://github.com/dpacaud/mandrill/issues +vcsUrl=https://github.com/dpacaud/mandrill diff --git a/grails-app/conf/BuildConfig.groovy b/grails-app/conf/BuildConfig.groovy deleted file mode 100755 index 41ab3d0..0000000 --- a/grails-app/conf/BuildConfig.groovy +++ /dev/null @@ -1,42 +0,0 @@ -grails.project.class.dir = "target/classes" -grails.project.test.class.dir = "target/test-classes" -grails.project.test.reports.dir = "target/test-reports" - -grails.project.dependency.resolution = { - // inherit Grails' default dependencies - inherits("global") { - // uncomment to disable ehcache - // excludes 'ehcache' - } - log "warn" // log level of Ivy resolver, either 'error', 'warn', 'info', 'debug' or 'verbose' - repositories { - grailsCentral() - // uncomment the below to enable remote dependency resolution - // from public Maven repositories - //mavenLocal() - //mavenCentral() - //mavenRepo "http://snapshots.repository.codehaus.org" - //mavenRepo "http://repository.codehaus.org" - //mavenRepo "http://download.java.net/maven/2/" - //mavenRepo "http://repository.jboss.com/maven2/" - } - dependencies { - // specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes eg. - compile('org.codehaus.groovy.modules.http-builder:http-builder:0.5.2') { - excludes "commons-logging", "xml-apis", "groovy" - } - // runtime 'mysql:mysql-connector-java:5.1.18' - } - - plugins { - build(":tomcat:$grailsVersion", - ":release:2.2.1", - ":rest-client-builder:1.0.3") { - export = false - } - } - - //grails.project.repos.grailsCentral.username = "" - //grails.project.repos.grailsCentral.password = "" -} - diff --git a/grails-app/conf/Config.groovy b/grails-app/conf/Config.groovy deleted file mode 100755 index 47ae088..0000000 --- a/grails-app/conf/Config.groovy +++ /dev/null @@ -1,32 +0,0 @@ -// configuration for plugin testing - will not be included in the plugin zip - -log4j = { - // Example of changing the log pattern for the default console - // appender: - // - //appenders { - // console name:'stdout', layout:pattern(conversionPattern: '%c{2} %m%n') - //} - - error 'org.codehaus.groovy.grails.web.servlet', // controllers - 'org.codehaus.groovy.grails.web.pages', // GSP - 'org.codehaus.groovy.grails.web.sitemesh', // layouts - 'org.codehaus.groovy.grails.web.mapping.filter', // URL mapping - 'org.codehaus.groovy.grails.web.mapping', // URL mapping - 'org.codehaus.groovy.grails.commons', // core / classloading - 'org.codehaus.groovy.grails.plugins', // plugins - 'org.codehaus.groovy.grails.orm.hibernate', // hibernate integration - 'org.springframework', - 'org.hibernate', - 'net.sf.ehcache.hibernate' - - warn 'org.mortbay.log' -} - -mandrill { - apiKey = "" - //proxy { - // host = "" - // port = "" - //} -} \ No newline at end of file diff --git a/grails-app/conf/DataSource.groovy b/grails-app/conf/DataSource.groovy deleted file mode 100755 index afe0e6f..0000000 --- a/grails-app/conf/DataSource.groovy +++ /dev/null @@ -1,43 +0,0 @@ -dataSource { - pooled = true - driverClassName = "org.h2.Driver" - username = "sa" - password = "" -} -hibernate { - cache.use_second_level_cache = true - cache.use_query_cache = false - cache.region.factory_class = 'net.sf.ehcache.hibernate.EhCacheRegionFactory' -} -// environment specific settings -environments { - development { - dataSource { - dbCreate = "create-drop" // one of 'create', 'create-drop', 'update', 'validate', '' - url = "jdbc:h2:mem:devDb;MVCC=TRUE;LOCK_TIMEOUT=10000" - } - } - test { - dataSource { - dbCreate = "update" - url = "jdbc:h2:mem:testDb;MVCC=TRUE;LOCK_TIMEOUT=10000" - } - } - production { - dataSource { - dbCreate = "update" - url = "jdbc:h2:prodDb;MVCC=TRUE;LOCK_TIMEOUT=10000" - pooled = true - properties { - maxActive = -1 - minEvictableIdleTimeMillis=1800000 - timeBetweenEvictionRunsMillis=1800000 - numTestsPerEvictionRun=3 - testOnBorrow=true - testWhileIdle=true - testOnReturn=true - validationQuery="SELECT 1" - } - } - } -} diff --git a/grails-app/conf/application.yml b/grails-app/conf/application.yml new file mode 100644 index 0000000..9318b6c --- /dev/null +++ b/grails-app/conf/application.yml @@ -0,0 +1,11 @@ +grails: + profile: web-plugin + doc: + authors: 'Damien Pacaud' + license: 'Apache License 2.0' + title: 'Mandrill Plugin' +info: + app: + name: '@info.app.name@' + version: '@info.app.version@' + grailsVersion: '@info.app.grailsVersion@' diff --git a/grails-app/conf/logback.groovy b/grails-app/conf/logback.groovy new file mode 100644 index 0000000..4118f24 --- /dev/null +++ b/grails-app/conf/logback.groovy @@ -0,0 +1,24 @@ +import grails.util.BuildSettings +import grails.util.Environment + +appender('STDOUT', ConsoleAppender) { + encoder(PatternLayoutEncoder) { + pattern = '%level %logger - %msg%n' + } +} + +root ERROR, ['STDOUT'] + +File targetDir = BuildSettings.TARGET_DIR +if (Environment.developmentMode && targetDir) { + + appender('FULL_STACKTRACE', FileAppender) { + file = "$targetDir/stacktrace.log" + append = true + encoder(PatternLayoutEncoder) { + pattern = '%level %logger - %msg%n' + } + } + + logger 'StackTrace', ERROR, ['FULL_STACKTRACE'], false +} diff --git a/grails-app/init/org/grails/mandrill/Application.groovy b/grails-app/init/org/grails/mandrill/Application.groovy new file mode 100644 index 0000000..58f9432 --- /dev/null +++ b/grails-app/init/org/grails/mandrill/Application.groovy @@ -0,0 +1,10 @@ +package org.grails.mandrill + +import grails.boot.GrailsApp +import grails.boot.config.GrailsAutoConfiguration + +class Application extends GrailsAutoConfiguration { + static void main(String[] args) { + GrailsApp.run Application, args + } +} diff --git a/grails-app/services/org/grails/mandrill/HttpWrapperService.groovy b/grails-app/services/org/grails/mandrill/HttpWrapperService.groovy index 48a84f0..70072d7 100755 --- a/grails-app/services/org/grails/mandrill/HttpWrapperService.groovy +++ b/grails-app/services/org/grails/mandrill/HttpWrapperService.groovy @@ -1,34 +1,33 @@ - package org.grails.mandrill import grails.converters.JSON +import groovy.util.logging.Slf4j import groovyx.net.http.ContentType import groovyx.net.http.HTTPBuilder import groovyx.net.http.Method +@Slf4j class HttpWrapperService { + static transactional = false - def grailsApplication - def postText(String baseUrl, String path, query, method = Method.POST) { - try { + def grailsApplication - def ret = null + String postText(String baseUrl, String path, query, method = Method.POST) { + try { + def proxyConf = grailsApplication.config.mandrill.proxy + String ret def http = new HTTPBuilder(baseUrl) + // Handling Proxy configuration - /************************************* - * Handling Proxy configuration - *************************************/ + if (proxyConf?.host && proxyConf?.port) { + if (!proxyConf.port?.isInteger()) { + throw new NumberFormatException("mandrill Proxy PORT must be an integer, please correct the config file") + } - if(grailsApplication.config.mandrill.proxy?.host && grailsApplication.config.mandrill.proxy?.port){ - if(grailsApplication.config.mandrill.proxy?.port?.isInteger()){ - log.info "Mandrill plugin is setting setting Proxy to : ${grailsApplication.config.mandrill.proxy.host} on port : ${grailsApplication.config.mandrill.proxy.port}" - http.setProxy(grailsApplication.config.mandrill.proxy.host,Integer.parseInt(grailsApplication.config.mandrill.proxy.port),null) - } - else { - throw new NumberFormatException("mandrill Proxy PORT must be an integer, please correct the config file") - } - } + log.info "Mandrill plugin is setting setting Proxy to : {} on port : {}", proxyConf.host, proxyConf.port + http.setProxy(proxyConf.host, proxyConf.port as int, null) + } // perform a POST request, expecting TEXT response http.request(method, ContentType.TEXT) { @@ -36,51 +35,41 @@ class HttpWrapperService { uri.path = path body = new JSON(query) - // response handler for a success response code response.success = { resp, reader -> - log.debug "response status: ${resp.statusLine}" - log.debug 'Headers: -----------' - resp.headers.each { h -> - log.debug " ${h.name} : ${h.value}" + if (log.debugEnabled) { + log.debug "response status: {}", resp.statusLine + log.debug 'Headers: -----------' + resp.headers.each { h -> log.debug " {} : {}", h.name, h.value } } - ret = reader.getText() + ret = reader.text - log.debug 'Response data: -----' - log.debug ret - log.debug '--------------------' + if (log.debugEnabled) { + log.debug 'Response data: -----' + log.debug ret + log.debug '--------------------' + } } response.failure = { resp, reader -> - log.debug "------ Failure ------ " - resp.headers.each { h -> - log.debug " ${h.name} : ${h.value}" + if (log.debugEnabled) { + log.debug "------ Failure ------ " + resp.headers.each { h -> log.debug " {} : {}", h.name, h.value } + ret = reader.text } - ret = reader.getText() - log.debug 'Response data: -----' - log.debug ret - log.debug '--------------------' + if (log.debugEnabled) { + log.debug 'Response data: -----' + log.debug ret + log.debug '--------------------' + } } } return ret - - } catch (groovyx.net.http.HttpResponseException ex) { - log.error ex.getMessage() - return null - } catch (java.net.ConnectException ex) { - log.error ex.getMessage() - return null } - catch (NumberFormatException nfe) { - log.error nfe.getMessage() - return null - } - catch (Exception e) { - log.error e.getMessage() - return null + catch (e) { + log.error e.message, e } } - } diff --git a/grails-app/services/org/grails/mandrill/MandrillService.groovy b/grails-app/services/org/grails/mandrill/MandrillService.groovy index 5707167..d8c9dbc 100755 --- a/grails-app/services/org/grails/mandrill/MandrillService.groovy +++ b/grails-app/services/org/grails/mandrill/MandrillService.groovy @@ -1,41 +1,48 @@ package org.grails.mandrill + +import javax.annotation.PostConstruct + import grails.converters.JSON class MandrillService { + static transactional = false + + def grailsApplication def httpWrapperService - def grailsApplication - - def BASE_URL = "https://mandrillapp.com/api/1.0/" - //TODO : Handle the API key and throw an error when it is absent - def ping() { - def path = "users/ping.json" - def query = [key:grailsApplication.config.mandrill.apiKey] - return httpWrapperService.postText(BASE_URL, path ,query) - } + static final String BASE_URL = "https://mandrillapp.com/api/1.0/" - def info() { - def path = "users/info.json" - def query = [key:grailsApplication.config.mandrill.apiKey] - return httpWrapperService.postText(BASE_URL, path ,query) + //TODO : Handle the API key and throw an error when it is absent + String ping() { + postText "users/ping.json" } + String info() { + postText "users/info.json" + } - def send(MandrillMessage message) { + List send(MandrillMessage message) { + JSON.parse(postText("messages/send.json", [message: message])).collect { new SendResponse(it) } + } - def path = "messages/send.json" - def query = [key:grailsApplication.config.mandrill.apiKey,message:message] - def data = JSON.parse(httpWrapperService.postText(BASE_URL, path ,query)).collect { new SendResponse(it) } - return data + List sendTemplate(MandrillMessage message, String templateName, List templateContent) { + def query = [template_name: templateName, template_content: templateContent, message: message] + JSON.parse(postText("messages/send-template.json", query)).collect { new SendResponse(it) } } - def sendTemplate(MandrillMessage message, String templateName, List templateContent) { - def path = "messages/send-template.json" - def query = [key:grailsApplication.config.mandrill.apiKey, template_name:templateName, - template_content:templateContent, message:message] - def data = JSON.parse(httpWrapperService.postText(BASE_URL, path ,query)).collect { new SendResponse(it) } - return data + private String postText(String path, Map query = [:]) { + httpWrapperService.postText(BASE_URL, path, query + [key: mandrillConfig.apiKey]) } + @PostConstruct + private void init() { + if (!mandrillConfig.apiKey && System.getenv('MANDRILL_APIKEY')) { + mandrillConfig.apiKey = System.getenv('MANDRILL_APIKEY') + } + } + + private getMandrillConfig() { + grailsApplication.config.mandrill + } } diff --git a/plugin.xml b/plugin.xml deleted file mode 100644 index 6fc8053..0000000 --- a/plugin.xml +++ /dev/null @@ -1,26 +0,0 @@ - - Damien Pacaud - damien.pacaud@gmail.com - Grails Mandrill Plugin - This is a simple wrapper for the Mandrill REST API (http://www.mandrillapp.com) - - https://github.com/dpacaud/mandrill - MandrillGrailsPlugin - - org.grails.mandrill.HttpWrapperService - org.grails.mandrill.MandrillService - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/scripts/_Install.groovy b/scripts/_Install.groovy deleted file mode 100755 index d2f2dbe..0000000 --- a/scripts/_Install.groovy +++ /dev/null @@ -1,30 +0,0 @@ -// -// This script is executed by Grails after plugin was installed to project. -// This script is a Gant script so you can use all special variables provided -// by Gant (such as 'baseDir' which points on project base dir). You can -// use 'ant' to access a global instance of AntBuilder -// -// For example you can create directory under project tree: -// -// ant.mkdir(dir:"${basedir}/grails-app/jobs") -// - - -def configFile = new File(basedir, 'grails-app/conf/Config.groovy') - -if (configFile.exists() && configFile.text.indexOf("mandrill") == -1) { - println "Adding mandrill config options to the Config file" -configFile.withWriterAppend { -it.writeLine '\n// Added by the Grails Mandrill plugin:' -it.writeLine '''mandrill { - apiKey = "" - // insert proxy values if needed - //proxy { - // host = "" - // The port Value has to be an integer ;) - // port = "" - //} -} -''' - } -} \ No newline at end of file diff --git a/scripts/_Uninstall.groovy b/scripts/_Uninstall.groovy deleted file mode 100755 index 7c53169..0000000 --- a/scripts/_Uninstall.groovy +++ /dev/null @@ -1,5 +0,0 @@ -// -// This script is executed by Grails when the plugin is uninstalled from project. -// Use this script if you intend to do any additional clean-up on uninstall, but -// beware of messing up SVN directories! -// diff --git a/scripts/_Upgrade.groovy b/scripts/_Upgrade.groovy deleted file mode 100755 index 6a1a4c9..0000000 --- a/scripts/_Upgrade.groovy +++ /dev/null @@ -1,10 +0,0 @@ -// -// This script is executed by Grails during application upgrade ('grails upgrade' -// command). This script is a Gant script so you can use all special variables -// provided by Gant (such as 'baseDir' which points on project base dir). You can -// use 'ant' to access a global instance of AntBuilder -// -// For example you can create directory under project tree: -// -// ant.mkdir(dir:"${basedir}/grails-app/jobs") -// diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000..1350e48 --- /dev/null +++ b/settings.gradle @@ -0,0 +1 @@ +rootProject.name = 'mandrill' diff --git a/src/groovy/org/grails/mandrill/MandrillAttachment.groovy b/src/main/groovy/org/grails/mandrill/MandrillAttachment.groovy similarity index 100% rename from src/groovy/org/grails/mandrill/MandrillAttachment.groovy rename to src/main/groovy/org/grails/mandrill/MandrillAttachment.groovy diff --git a/src/main/groovy/org/grails/mandrill/MandrillGrailsPlugin.groovy b/src/main/groovy/org/grails/mandrill/MandrillGrailsPlugin.groovy new file mode 100755 index 0000000..d2d395b --- /dev/null +++ b/src/main/groovy/org/grails/mandrill/MandrillGrailsPlugin.groovy @@ -0,0 +1,15 @@ +package org.grails.mandrill + +import grails.plugins.Plugin + +class MandrillGrailsPlugin extends Plugin { + def grailsVersion = "3.0.0 > *" + def title = "Grails Mandrill Plugin" + def description = 'A simple wrapper for the Mandrill REST API (http://www.mandrillapp.com)' + def documentation = "https://github.com/dpacaud/mandrill" + def license = "APACHE" + def developers = [[name: "Damien Pacaud", email: "damien.pacaud@gmail.com"]] + def issueManagement = [url: "https://github.com/dpacaud/mandrill/issues"] + def scm = [url: "https://github.com/dpacaud/mandrill"] + def profiles = ['web'] +} diff --git a/src/groovy/org/grails/mandrill/MandrillMessage.groovy b/src/main/groovy/org/grails/mandrill/MandrillMessage.groovy similarity index 68% rename from src/groovy/org/grails/mandrill/MandrillMessage.groovy rename to src/main/groovy/org/grails/mandrill/MandrillMessage.groovy index 5366696..aac84ab 100755 --- a/src/groovy/org/grails/mandrill/MandrillMessage.groovy +++ b/src/main/groovy/org/grails/mandrill/MandrillMessage.groovy @@ -1,6 +1,5 @@ package org.grails.mandrill - class MandrillMessage { String text @@ -10,16 +9,15 @@ class MandrillMessage { String from_name List attachments = [] List to = [] - boolean track_opens=false - boolean track_clicks=false - boolean auto_text=false - boolean url_strip_qs=false + boolean track_opens = false + boolean track_clicks = false + boolean auto_text = false + boolean url_strip_qs = false List merge_vars - boolean preserve_recipients=false + boolean preserve_recipients = false List tags = [] // String[] google_analytics_domains = new String[0] // String[] google_analytics_campaign = new String[0] Map headers // Map headers - } diff --git a/src/groovy/org/grails/mandrill/MandrillRecipient.groovy b/src/main/groovy/org/grails/mandrill/MandrillRecipient.groovy similarity index 87% rename from src/groovy/org/grails/mandrill/MandrillRecipient.groovy rename to src/main/groovy/org/grails/mandrill/MandrillRecipient.groovy index 27424a9..9189206 100755 --- a/src/groovy/org/grails/mandrill/MandrillRecipient.groovy +++ b/src/main/groovy/org/grails/mandrill/MandrillRecipient.groovy @@ -1,9 +1,6 @@ package org.grails.mandrill - class MandrillRecipient { - String email String name - } diff --git a/src/groovy/org/grails/mandrill/MergeVar.groovy b/src/main/groovy/org/grails/mandrill/MergeVar.groovy similarity index 100% rename from src/groovy/org/grails/mandrill/MergeVar.groovy rename to src/main/groovy/org/grails/mandrill/MergeVar.groovy diff --git a/src/groovy/org/grails/mandrill/RecipientVars.groovy b/src/main/groovy/org/grails/mandrill/RecipientVars.groovy similarity index 100% rename from src/groovy/org/grails/mandrill/RecipientVars.groovy rename to src/main/groovy/org/grails/mandrill/RecipientVars.groovy diff --git a/src/groovy/org/grails/mandrill/SendResponse.groovy b/src/main/groovy/org/grails/mandrill/SendResponse.groovy similarity index 87% rename from src/groovy/org/grails/mandrill/SendResponse.groovy rename to src/main/groovy/org/grails/mandrill/SendResponse.groovy index cc8947a..362b837 100644 --- a/src/groovy/org/grails/mandrill/SendResponse.groovy +++ b/src/main/groovy/org/grails/mandrill/SendResponse.groovy @@ -1,5 +1,8 @@ package org.grails.mandrill +import groovy.transform.ToString + +@ToString(includeNames=true) class SendResponse { String status String message diff --git a/src/test/groovy/org/grails/mandrill/MandrillServiceTests.groovy b/src/test/groovy/org/grails/mandrill/MandrillServiceTests.groovy new file mode 100755 index 0000000..f49348c --- /dev/null +++ b/src/test/groovy/org/grails/mandrill/MandrillServiceTests.groovy @@ -0,0 +1,38 @@ +package org.grails.mandrill + +import grails.test.mixin.TestMixin +import grails.test.mixin.web.ControllerUnitTestMixin +import spock.lang.Specification + +@TestMixin(ControllerUnitTestMixin) +class MandrillServiceTests extends Specification { + + def mandrillService = new MandrillService() + + void setup() { + mandrillService.httpWrapperService = new HttpWrapperService(grailsApplication: grailsApplication) + mandrillService.grailsApplication = grailsApplication + mandrillService.init() + } + + void 'ping'() { + expect: + mandrillService.ping() == '"PONG!"' + } + + void 'send'() { + when: + def recpts = [new MandrillRecipient(name: "Damien", email: "toto@yopmail.com"), + new MandrillRecipient(name: "TATA", email: "tata@yopmail.com")] + def message = new MandrillMessage( + text: "this is a text message", + subject: "this is a subject", + from_email: "thisisatest@yopmail.com", + to: recpts) + message.tags << "test" + List responses = mandrillService.send(message) + + then: + responses.every { SendResponse response -> response.status == 'sent' } + } +} diff --git a/test/unit/org/grails/mandrill/MandrillServiceTests.groovy b/test/unit/org/grails/mandrill/MandrillServiceTests.groovy deleted file mode 100755 index 90c4890..0000000 --- a/test/unit/org/grails/mandrill/MandrillServiceTests.groovy +++ /dev/null @@ -1,51 +0,0 @@ -package org.grails.mandrill - -import static org.junit.Assert.* -import grails.test.mixin.* -import grails.test.mixin.support.GrailsUnitTestMixin -import grails.test.mixin.web.ControllerUnitTestMixin - -import org.grails.mandrill.HttpWrapperService; -import org.grails.mandrill.MandrillService; -import org.junit.* - -@TestMixin([GrailsUnitTestMixin, ControllerUnitTestMixin]) -class MandrillServiceTests { - - def mandrillService - def httpWrapperService - @Before - void setUp() { - - mandrillService = new MandrillService() - httpWrapperService = new HttpWrapperService() - mandrillService.httpWrapperService = httpWrapperService - def application = new org.codehaus.groovy.grails.commons.DefaultGrailsApplication() - mandrillService.grailsApplication = application - httpWrapperService.grailsApplication = application - } - - @After - void tearDown() { - // Tear down logic here - } - - @Test - void testPing() { - assert mandrillService.ping() == "\"PONG!\"" - } - - @Test - void testSend() { - def recpts = [] - recpts.add(new MandrillRecipient(name:"Damien", email:"toto@yopmail.com")) - recpts.add(new MandrillRecipient(name:"TATA", email:"tata@yopmail.com")) - def message = new MandrillMessage( - text:"this is a text message", - subject:"this is a subject", - from_email:"thisisatest@yopmail.com", - to:recpts) - message.tags.add("test") - assert mandrillService.send(message).contains("\"status\":\"sent\"") - } -} diff --git a/web-app/WEB-INF/applicationContext.xml b/web-app/WEB-INF/applicationContext.xml deleted file mode 100755 index 69fbef3..0000000 --- a/web-app/WEB-INF/applicationContext.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - Grails application factory bean - - - - - - A bean that manages Grails plugins - - - - - - - - - - - - - - - - utf-8 - - - \ No newline at end of file diff --git a/web-app/WEB-INF/sitemesh.xml b/web-app/WEB-INF/sitemesh.xml deleted file mode 100755 index 72399ce..0000000 --- a/web-app/WEB-INF/sitemesh.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/web-app/WEB-INF/tld/c.tld b/web-app/WEB-INF/tld/c.tld deleted file mode 100755 index 5e18236..0000000 --- a/web-app/WEB-INF/tld/c.tld +++ /dev/null @@ -1,572 +0,0 @@ - - - - - JSTL 1.2 core library - JSTL core - 1.2 - c - http://java.sun.com/jsp/jstl/core - - - - Provides core validation features for JSTL tags. - - - org.apache.taglibs.standard.tlv.JstlCoreTLV - - - - - - Catches any Throwable that occurs in its body and optionally - exposes it. - - catch - org.apache.taglibs.standard.tag.common.core.CatchTag - JSP - - -Name of the exported scoped variable for the -exception thrown from a nested action. The type of the -scoped variable is the type of the exception thrown. - - var - false - false - - - - - - Simple conditional tag that establishes a context for - mutually exclusive conditional operations, marked by - <when> and <otherwise> - - choose - org.apache.taglibs.standard.tag.common.core.ChooseTag - JSP - - - - - Simple conditional tag, which evalutes its body if the - supplied condition is true and optionally exposes a Boolean - scripting variable representing the evaluation of this condition - - if - org.apache.taglibs.standard.tag.rt.core.IfTag - JSP - - -The test condition that determines whether or -not the body content should be processed. - - test - true - true - boolean - - - -Name of the exported scoped variable for the -resulting value of the test condition. The type -of the scoped variable is Boolean. - - var - false - false - - - -Scope for var. - - scope - false - false - - - - - - Retrieves an absolute or relative URL and exposes its contents - to either the page, a String in 'var', or a Reader in 'varReader'. - - import - org.apache.taglibs.standard.tag.rt.core.ImportTag - org.apache.taglibs.standard.tei.ImportTEI - JSP - - -The URL of the resource to import. - - url - true - true - - - -Name of the exported scoped variable for the -resource's content. The type of the scoped -variable is String. - - var - false - false - - - -Scope for var. - - scope - false - false - - - -Name of the exported scoped variable for the -resource's content. The type of the scoped -variable is Reader. - - varReader - false - false - - - -Name of the context when accessing a relative -URL resource that belongs to a foreign -context. - - context - false - true - - - -Character encoding of the content at the input -resource. - - charEncoding - false - true - - - - - - The basic iteration tag, accepting many different - collection types and supporting subsetting and other - functionality - - forEach - org.apache.taglibs.standard.tag.rt.core.ForEachTag - org.apache.taglibs.standard.tei.ForEachTEI - JSP - - -Collection of items to iterate over. - - items - false - true - java.lang.Object - - java.lang.Object - - - - -If items specified: -Iteration begins at the item located at the -specified index. First item of the collection has -index 0. -If items not specified: -Iteration begins with index set at the value -specified. - - begin - false - true - int - - - -If items specified: -Iteration ends at the item located at the -specified index (inclusive). -If items not specified: -Iteration ends when index reaches the value -specified. - - end - false - true - int - - - -Iteration will only process every step items of -the collection, starting with the first one. - - step - false - true - int - - - -Name of the exported scoped variable for the -current item of the iteration. This scoped -variable has nested visibility. Its type depends -on the object of the underlying collection. - - var - false - false - - - -Name of the exported scoped variable for the -status of the iteration. Object exported is of type -javax.servlet.jsp.jstl.core.LoopTagStatus. This scoped variable has nested -visibility. - - varStatus - false - false - - - - - - Iterates over tokens, separated by the supplied delimeters - - forTokens - org.apache.taglibs.standard.tag.rt.core.ForTokensTag - JSP - - -String of tokens to iterate over. - - items - true - true - java.lang.String - - java.lang.String - - - - -The set of delimiters (the characters that -separate the tokens in the string). - - delims - true - true - java.lang.String - - - -Iteration begins at the token located at the -specified index. First token has index 0. - - begin - false - true - int - - - -Iteration ends at the token located at the -specified index (inclusive). - - end - false - true - int - - - -Iteration will only process every step tokens -of the string, starting with the first one. - - step - false - true - int - - - -Name of the exported scoped variable for the -current item of the iteration. This scoped -variable has nested visibility. - - var - false - false - - - -Name of the exported scoped variable for the -status of the iteration. Object exported is of -type -javax.servlet.jsp.jstl.core.LoopTag -Status. This scoped variable has nested -visibility. - - varStatus - false - false - - - - - - Like <%= ... >, but for expressions. - - out - org.apache.taglibs.standard.tag.rt.core.OutTag - JSP - - -Expression to be evaluated. - - value - true - true - - - -Default value if the resulting value is null. - - default - false - true - - - -Determines whether characters <,>,&,'," in the -resulting string should be converted to their -corresponding character entity codes. Default value is -true. - - escapeXml - false - true - - - - - - - Subtag of <choose> that follows <when> tags - and runs only if all of the prior conditions evaluated to - 'false' - - otherwise - org.apache.taglibs.standard.tag.common.core.OtherwiseTag - JSP - - - - - Adds a parameter to a containing 'import' tag's URL. - - param - org.apache.taglibs.standard.tag.rt.core.ParamTag - JSP - - -Name of the query string parameter. - - name - true - true - - - -Value of the parameter. - - value - false - true - - - - - - Redirects to a new URL. - - redirect - org.apache.taglibs.standard.tag.rt.core.RedirectTag - JSP - - -The URL of the resource to redirect to. - - url - false - true - - - -Name of the context when redirecting to a relative URL -resource that belongs to a foreign context. - - context - false - true - - - - - - Removes a scoped variable (from a particular scope, if specified). - - remove - org.apache.taglibs.standard.tag.common.core.RemoveTag - empty - - -Name of the scoped variable to be removed. - - var - true - false - - - -Scope for var. - - scope - false - false - - - - - - Sets the result of an expression evaluation in a 'scope' - - set - org.apache.taglibs.standard.tag.rt.core.SetTag - JSP - - -Name of the exported scoped variable to hold the value -specified in the action. The type of the scoped variable is -whatever type the value expression evaluates to. - - var - false - false - - - -Expression to be evaluated. - - value - false - true - - java.lang.Object - - - - -Target object whose property will be set. Must evaluate to -a JavaBeans object with setter property property, or to a -java.util.Map object. - - target - false - true - - - -Name of the property to be set in the target object. - - property - false - true - - - -Scope for var. - - scope - false - false - - - - - - Creates a URL with optional query parameters. - - url - org.apache.taglibs.standard.tag.rt.core.UrlTag - JSP - - -Name of the exported scoped variable for the -processed url. The type of the scoped variable is -String. - - var - false - false - - - -Scope for var. - - scope - false - false - - - -URL to be processed. - - value - false - true - - - -Name of the context when specifying a relative URL -resource that belongs to a foreign context. - - context - false - true - - - - - - Subtag of <choose> that includes its body if its - condition evalutes to 'true' - - when - org.apache.taglibs.standard.tag.rt.core.WhenTag - JSP - - -The test condition that determines whether or not the -body content should be processed. - - test - true - true - boolean - - - - diff --git a/web-app/WEB-INF/tld/fmt.tld b/web-app/WEB-INF/tld/fmt.tld deleted file mode 100755 index 2ae4776..0000000 --- a/web-app/WEB-INF/tld/fmt.tld +++ /dev/null @@ -1,671 +0,0 @@ - - - - - JSTL 1.2 i18n-capable formatting library - JSTL fmt - 1.2 - fmt - http://java.sun.com/jsp/jstl/fmt - - - - Provides core validation features for JSTL tags. - - - org.apache.taglibs.standard.tlv.JstlFmtTLV - - - - - - Sets the request character encoding - - requestEncoding - org.apache.taglibs.standard.tag.rt.fmt.RequestEncodingTag - empty - - -Name of character encoding to be applied when -decoding request parameters. - - value - false - true - - - - - - Stores the given locale in the locale configuration variable - - setLocale - org.apache.taglibs.standard.tag.rt.fmt.SetLocaleTag - empty - - -A String value is interpreted as the -printable representation of a locale, which -must contain a two-letter (lower-case) -language code (as defined by ISO-639), -and may contain a two-letter (upper-case) -country code (as defined by ISO-3166). -Language and country codes must be -separated by hyphen (-) or underscore -(_). - - value - true - true - - - -Vendor- or browser-specific variant. -See the java.util.Locale javadocs for -more information on variants. - - variant - false - true - - - -Scope of the locale configuration variable. - - scope - false - false - - - - - - Specifies the time zone for any time formatting or parsing actions - nested in its body - - timeZone - org.apache.taglibs.standard.tag.rt.fmt.TimeZoneTag - JSP - - -The time zone. A String value is interpreted as -a time zone ID. This may be one of the time zone -IDs supported by the Java platform (such as -"America/Los_Angeles") or a custom time zone -ID (such as "GMT-8"). See -java.util.TimeZone for more information on -supported time zone formats. - - value - true - true - - - - - - Stores the given time zone in the time zone configuration variable - - setTimeZone - org.apache.taglibs.standard.tag.rt.fmt.SetTimeZoneTag - empty - - -The time zone. A String value is interpreted as -a time zone ID. This may be one of the time zone -IDs supported by the Java platform (such as -"America/Los_Angeles") or a custom time zone -ID (such as "GMT-8"). See java.util.TimeZone for -more information on supported time zone -formats. - - value - true - true - - - -Name of the exported scoped variable which -stores the time zone of type -java.util.TimeZone. - - var - false - false - - - -Scope of var or the time zone configuration -variable. - - scope - false - false - - - - - - Loads a resource bundle to be used by its tag body - - bundle - org.apache.taglibs.standard.tag.rt.fmt.BundleTag - JSP - - -Resource bundle base name. This is the bundle's -fully-qualified resource name, which has the same -form as a fully-qualified class name, that is, it uses -"." as the package component separator and does not -have any file type (such as ".class" or ".properties") -suffix. - - basename - true - true - - - -Prefix to be prepended to the value of the message -key of any nested <fmt:message> action. - - prefix - false - true - - - - - - Loads a resource bundle and stores it in the named scoped variable or - the bundle configuration variable - - setBundle - org.apache.taglibs.standard.tag.rt.fmt.SetBundleTag - empty - - -Resource bundle base name. This is the bundle's -fully-qualified resource name, which has the same -form as a fully-qualified class name, that is, it uses -"." as the package component separator and does not -have any file type (such as ".class" or ".properties") -suffix. - - basename - true - true - - - -Name of the exported scoped variable which stores -the i18n localization context of type -javax.servlet.jsp.jstl.fmt.LocalizationC -ontext. - - var - false - false - - - -Scope of var or the localization context -configuration variable. - - scope - false - false - - - - - - Maps key to localized message and performs parametric replacement - - message - org.apache.taglibs.standard.tag.rt.fmt.MessageTag - JSP - - -Message key to be looked up. - - key - false - true - - - -Localization context in whose resource -bundle the message key is looked up. - - bundle - false - true - - - -Name of the exported scoped variable -which stores the localized message. - - var - false - false - - - -Scope of var. - - scope - false - false - - - - - - Supplies an argument for parametric replacement to a containing - <message> tag - - param - org.apache.taglibs.standard.tag.rt.fmt.ParamTag - JSP - - -Argument used for parametric replacement. - - value - false - true - - - - - - Formats a numeric value as a number, currency, or percentage - - formatNumber - org.apache.taglibs.standard.tag.rt.fmt.FormatNumberTag - JSP - - -Numeric value to be formatted. - - value - false - true - - - -Specifies whether the value is to be -formatted as number, currency, or -percentage. - - type - false - true - - - -Custom formatting pattern. - - pattern - false - true - - - -ISO 4217 currency code. Applied only -when formatting currencies (i.e. if type is -equal to "currency"); ignored otherwise. - - currencyCode - false - true - - - -Currency symbol. Applied only when -formatting currencies (i.e. if type is equal -to "currency"); ignored otherwise. - - currencySymbol - false - true - - - -Specifies whether the formatted output -will contain any grouping separators. - - groupingUsed - false - true - - - -Maximum number of digits in the integer -portion of the formatted output. - - maxIntegerDigits - false - true - - - -Minimum number of digits in the integer -portion of the formatted output. - - minIntegerDigits - false - true - - - -Maximum number of digits in the -fractional portion of the formatted output. - - maxFractionDigits - false - true - - - -Minimum number of digits in the -fractional portion of the formatted output. - - minFractionDigits - false - true - - - -Name of the exported scoped variable -which stores the formatted result as a -String. - - var - false - false - - - -Scope of var. - - scope - false - false - - - - - - Parses the string representation of a number, currency, or percentage - - parseNumber - org.apache.taglibs.standard.tag.rt.fmt.ParseNumberTag - JSP - - -String to be parsed. - - value - false - true - - - -Specifies whether the string in the value -attribute should be parsed as a number, -currency, or percentage. - - type - false - true - - - -Custom formatting pattern that determines -how the string in the value attribute is to be -parsed. - - pattern - false - true - - - -Locale whose default formatting pattern (for -numbers, currencies, or percentages, -respectively) is to be used during the parse -operation, or to which the pattern specified -via the pattern attribute (if present) is -applied. - - parseLocale - false - true - - - -Specifies whether just the integer portion of -the given value should be parsed. - - integerOnly - false - true - - - -Name of the exported scoped variable which -stores the parsed result (of type -java.lang.Number). - - var - false - false - - - -Scope of var. - - scope - false - false - - - - - - Formats a date and/or time using the supplied styles and pattern - - formatDate - org.apache.taglibs.standard.tag.rt.fmt.FormatDateTag - empty - - -Date and/or time to be formatted. - - value - true - true - - - -Specifies whether the time, the date, or both -the time and date components of the given -date are to be formatted. - - type - false - true - - - -Predefined formatting style for dates. Follows -the semantics defined in class -java.text.DateFormat. Applied only -when formatting a date or both a date and -time (i.e. if type is missing or is equal to -"date" or "both"); ignored otherwise. - - dateStyle - false - true - - - -Predefined formatting style for times. Follows -the semantics defined in class -java.text.DateFormat. Applied only -when formatting a time or both a date and -time (i.e. if type is equal to "time" or "both"); -ignored otherwise. - - timeStyle - false - true - - - -Custom formatting style for dates and times. - - pattern - false - true - - - -Time zone in which to represent the formatted -time. - - timeZone - false - true - - - -Name of the exported scoped variable which -stores the formatted result as a String. - - var - false - false - - - -Scope of var. - - scope - false - false - - - - - - Parses the string representation of a date and/or time - - parseDate - org.apache.taglibs.standard.tag.rt.fmt.ParseDateTag - JSP - - -Date string to be parsed. - - value - false - true - - - -Specifies whether the date string in the -value attribute is supposed to contain a -time, a date, or both. - - type - false - true - - - -Predefined formatting style for days -which determines how the date -component of the date string is to be -parsed. Applied only when formatting a -date or both a date and time (i.e. if type -is missing or is equal to "date" or "both"); -ignored otherwise. - - dateStyle - false - true - - - -Predefined formatting styles for times -which determines how the time -component in the date string is to be -parsed. Applied only when formatting a -time or both a date and time (i.e. if type -is equal to "time" or "both"); ignored -otherwise. - - timeStyle - false - true - - - -Custom formatting pattern which -determines how the date string is to be -parsed. - - pattern - false - true - - - -Time zone in which to interpret any time -information in the date string. - - timeZone - false - true - - - -Locale whose predefined formatting styles -for dates and times are to be used during -the parse operation, or to which the -pattern specified via the pattern -attribute (if present) is applied. - - parseLocale - false - true - - - -Name of the exported scoped variable in -which the parsing result (of type -java.util.Date) is stored. - - var - false - false - - - -Scope of var. - - scope - false - false - - - - diff --git a/web-app/WEB-INF/tld/grails.tld b/web-app/WEB-INF/tld/grails.tld deleted file mode 100755 index 9bd036b..0000000 --- a/web-app/WEB-INF/tld/grails.tld +++ /dev/null @@ -1,550 +0,0 @@ - - - The Grails custom tag library - 0.2 - grails - http://grails.codehaus.org/tags - - - link - org.codehaus.groovy.grails.web.taglib.jsp.JspLinkTag - JSP - - action - false - true - - - controller - false - true - - - id - false - true - - - url - false - true - - - params - false - true - - true - - - form - org.codehaus.groovy.grails.web.taglib.jsp.JspFormTag - JSP - - action - false - true - - - controller - false - true - - - id - false - true - - - url - false - true - - - method - true - true - - true - - - select - org.codehaus.groovy.grails.web.taglib.jsp.JspSelectTag - JSP - - name - true - true - - - value - false - true - - - optionKey - false - true - - - optionValue - false - true - - true - - - datePicker - org.codehaus.groovy.grails.web.taglib.jsp.JspDatePickerTag - empty - - name - true - true - - - value - false - true - - - precision - false - true - - false - - - currencySelect - org.codehaus.groovy.grails.web.taglib.jsp.JspCurrencySelectTag - empty - - name - true - true - - - value - false - true - - true - - - localeSelect - org.codehaus.groovy.grails.web.taglib.jsp.JspLocaleSelectTag - empty - - name - true - true - - - value - false - true - - true - - - timeZoneSelect - org.codehaus.groovy.grails.web.taglib.jsp.JspTimeZoneSelectTag - empty - - name - true - true - - - value - false - true - - true - - - checkBox - org.codehaus.groovy.grails.web.taglib.jsp.JspCheckboxTag - empty - - name - true - true - - - value - true - true - - true - - - hasErrors - org.codehaus.groovy.grails.web.taglib.jsp.JspHasErrorsTag - JSP - - model - false - true - - - bean - false - true - - - field - false - true - - false - - - eachError - org.codehaus.groovy.grails.web.taglib.jsp.JspEachErrorTag - JSP - - model - false - true - - - bean - false - true - - - field - false - true - - false - - - renderErrors - org.codehaus.groovy.grails.web.taglib.jsp.JspEachErrorTag - JSP - - model - false - true - - - bean - false - true - - - field - false - true - - - as - true - true - - false - - - message - org.codehaus.groovy.grails.web.taglib.jsp.JspMessageTag - JSP - - code - false - true - - - error - false - true - - - default - false - true - - false - - - remoteFunction - org.codehaus.groovy.grails.web.taglib.jsp.JspRemoteFunctionTag - empty - - before - false - true - - - after - false - true - - - action - false - true - - - controller - false - true - - - id - false - true - - - url - false - true - - - params - false - true - - - asynchronous - false - true - - - method - false - true - - - update - false - true - - - onSuccess - false - true - - - onFailure - false - true - - - onComplete - false - true - - - onLoading - false - true - - - onLoaded - false - true - - - onInteractive - false - true - - true - - - remoteLink - org.codehaus.groovy.grails.web.taglib.jsp.JspRemoteLinkTag - JSP - - before - false - true - - - after - false - true - - - action - false - true - - - controller - false - true - - - id - false - true - - - url - false - true - - - params - false - true - - - asynchronous - false - true - - - method - false - true - - - update - false - true - - - onSuccess - false - true - - - onFailure - false - true - - - onComplete - false - true - - - onLoading - false - true - - - onLoaded - false - true - - - onInteractive - false - true - - true - - - formRemote - org.codehaus.groovy.grails.web.taglib.jsp.JspFormRemoteTag - JSP - - before - false - true - - - after - false - true - - - action - false - true - - - controller - false - true - - - id - false - true - - - url - false - true - - - params - false - true - - - asynchronous - false - true - - - method - false - true - - - update - false - true - - - onSuccess - false - true - - - onFailure - false - true - - - onComplete - false - true - - - onLoading - false - true - - - onLoaded - false - true - - - onInteractive - false - true - - true - - - invokeTag - org.codehaus.groovy.grails.web.taglib.jsp.JspInvokeGrailsTagLibTag - JSP - - it - java.lang.Object - true - NESTED - - - tagName - true - true - - true - - - diff --git a/web-app/WEB-INF/tld/spring.tld b/web-app/WEB-INF/tld/spring.tld deleted file mode 100755 index 1bc7091..0000000 --- a/web-app/WEB-INF/tld/spring.tld +++ /dev/null @@ -1,311 +0,0 @@ - - - - - - 1.1.1 - - 1.2 - - Spring - - http://www.springframework.org/tags - - Spring Framework JSP Tag Library. Authors: Rod Johnson, Juergen Hoeller - - - - - htmlEscape - org.springframework.web.servlet.tags.HtmlEscapeTag - JSP - - - Sets default HTML escape value for the current page. - Overrides a "defaultHtmlEscape" context-param in web.xml, if any. - - - - defaultHtmlEscape - true - true - - - - - - - - escapeBody - org.springframework.web.servlet.tags.EscapeBodyTag - JSP - - - Escapes its enclosed body content, applying HTML escaping and/or JavaScript escaping. - The HTML escaping flag participates in a page-wide or application-wide setting - (i.e. by HtmlEscapeTag or a "defaultHtmlEscape" context-param in web.xml). - - - - htmlEscape - false - true - - - - javaScriptEscape - false - true - - - - - - - - message - org.springframework.web.servlet.tags.MessageTag - JSP - - - Retrieves the message with the given code, or text if code isn't resolvable. - The HTML escaping flag participates in a page-wide or application-wide setting - (i.e. by HtmlEscapeTag or a "defaultHtmlEscape" context-param in web.xml). - - - - code - false - true - - - - arguments - false - true - - - - text - false - true - - - - var - false - true - - - - scope - false - true - - - - htmlEscape - false - true - - - - javaScriptEscape - false - true - - - - - - - - theme - org.springframework.web.servlet.tags.ThemeTag - JSP - - - Retrieves the theme message with the given code, or text if code isn't resolvable. - The HTML escaping flag participates in a page-wide or application-wide setting - (i.e. by HtmlEscapeTag or a "defaultHtmlEscape" context-param in web.xml). - - - - code - false - true - - - - arguments - false - true - - - - text - false - true - - - - var - false - true - - - - scope - false - true - - - - htmlEscape - false - true - - - - javaScriptEscape - false - true - - - - - - - - hasBindErrors - org.springframework.web.servlet.tags.BindErrorsTag - JSP - - - Provides Errors instance in case of bind errors. - The HTML escaping flag participates in a page-wide or application-wide setting - (i.e. by HtmlEscapeTag or a "defaultHtmlEscape" context-param in web.xml). - - - - errors - org.springframework.validation.Errors - - - - name - true - true - - - - htmlEscape - false - true - - - - - - - - nestedPath - org.springframework.web.servlet.tags.NestedPathTag - JSP - - - Sets a nested path to be used by the bind tag's path. - - - - nestedPath - java.lang.String - - - - path - true - true - - - - - - - - bind - org.springframework.web.servlet.tags.BindTag - JSP - - - Provides BindStatus object for the given bind path. - The HTML escaping flag participates in a page-wide or application-wide setting - (i.e. by HtmlEscapeTag or a "defaultHtmlEscape" context-param in web.xml). - - - - status - org.springframework.web.servlet.support.BindStatus - - - - path - true - true - - - - ignoreNestedPath - false - true - - - - htmlEscape - false - true - - - - - - - - transform - org.springframework.web.servlet.tags.TransformTag - JSP - - - Provides transformation of variables to Strings, using an appropriate - custom PropertyEditor from BindTag (can only be used inside BindTag). - The HTML escaping flag participates in a page-wide or application-wide setting - (i.e. by HtmlEscapeTag or a "defaultHtmlEscape" context-param in web.xml). - - - - value - true - true - - - - var - false - true - - - - scope - false - true - - - - htmlEscape - false - true - - - - -