blob: 5ec355e323b2fdcd5a7ad098fc4a99ffdebd9324 [file] [log] [blame]
import org.codehaus.groovy.grails.commons.GrailsDomainClassProperty
import org.grails.datastore.mapping.reflect.ClassPropertyFetcher
import org.grails.datastore.mapping.model.PersistentEntity
import org.grails.datastore.mapping.simpledb.engine.SimpleDBDomainResolver
import org.grails.datastore.mapping.simpledb.engine.SimpleDBDomainResolverFactory
import org.grails.datastore.mapping.simpledb.engine.SimpleDBAssociationInfo
import org.grails.datastore.mapping.simpledb.util.SimpleDBTemplate
import org.grails.datastore.mapping.simpledb.util.SimpleDBConst
import org.grails.datastore.gorm.simpledb.plugin.support.SimpleDBSpringConfigurer
import org.grails.datastore.gorm.simpledb.plugin.support.SimpleDBMethodsConfigurer
import org.grails.datastore.gorm.simpledb.plugin.support.SimpleDBOnChangeHandler
import org.grails.datastore.gorm.simpledb.plugin.support.SimpleDBApplicationContextConfigurer
class SimpledbGrailsPlugin {
def license = "Apache 2.0 License"
def scm = [ url: "https://github.com/grails/grails-data-mapping" ]
def developers = [
[ name: "Roman Stepanenko", email: "rs.opensource@gmail.com" ] ]
def version = "0.6.BUILD-SNAPSHOT"
def grailsVersion = "1.3.5 > *"
def observe = ['services', 'domainClass']
def loadAfter = ['domainClass', 'hibernate', 'services', 'cloudFoundry']
def dependsOn = [:]
def pluginExcludes = [
"grails-app/views/error.gsp"
]
def author = "Roman Stepanenko"
def authorEmail = "rs.opensource@gmail.com"
def title = "SimpleDB GORM"
def description = 'A plugin that integrates the AWS SimpleDB datastore into Grails, providing a GORM API onto it'
// URL to the plugin's documentation
def documentation = "http://projects.spring.io/grails-data-mapping/simpledb/manual/index.html"
def doWithSpring = new SimpleDBSpringConfigurer().getConfiguration()
def doWithDynamicMethods = { ctx ->
println 'simpledb plugin: '+version
def datastore = ctx.simpledbDatastore
def transactionManager = ctx.simpledbTransactionManager
def methodsConfigurer = new SimpleDBMethodsConfigurer(datastore, transactionManager)
methodsConfigurer.hasExistingDatastore = manager.hasGrailsPlugin("hibernate")
def foe = application?.config?.grails?.gorm?.failOnError
methodsConfigurer.failOnError = foe instanceof Boolean ? foe : false
methodsConfigurer.configure()
}
def doWithApplicationContext = { ctx ->
new SimpleDBApplicationContextConfigurer().configure(ctx)
}
def onChange = { event ->
if(event.ctx) {
new SimpleDBOnChangeHandler(event.ctx.simpledbDatastore, event.ctx.simpledbTransactionManager).onChange(delegate, event)
}
}
}