Permalink
Browse files

Initial commit.

  • Loading branch information...
0 parents commit c251fb5a7e9bac53c9ff8bd2e1be767f67def5d4 @bflorian committed Mar 22, 2012
Showing with 3,651 additions and 0 deletions.
  1. +14 −0 .classpath
  2. +5 −0 .gitignore
  3. +19 −0 .project
  4. +67 −0 CassandraOrmGrailsPlugin.groovy
  5. +22 −0 application.properties
  6. +47 −0 grails-app/conf/BuildConfig.groovy
  7. +40 −0 grails-app/conf/Config.groovy
  8. +48 −0 grails-app/conf/DataSource.groovy
  9. +29 −0 grails-app/conf/UrlMappings.groovy
  10. +48 −0 grails-app/services/com/reachlocal/grails/plugins/cassandra/orm/CassandraOrmService.groovy
  11. +70 −0 grails-app/views/error.gsp
  12. +26 −0 scripts/_Install.groovy
  13. +21 −0 scripts/_Uninstall.groovy
  14. +26 −0 scripts/_Upgrade.groovy
  15. BIN src/groovy/.DS_Store
  16. BIN src/groovy/com/reachlocal/grails/.DS_Store
  17. BIN src/groovy/com/reachlocal/grails/plugins/cassandra/.DS_Store
  18. +58 −0 src/groovy/com/reachlocal/grails/plugins/cassandra/OrmPersistenceMethods.groovy
  19. +33 −0 src/groovy/com/reachlocal/grails/plugins/cassandra/mapping/CassandraMappingException.groovy
  20. +218 −0 src/groovy/com/reachlocal/grails/plugins/cassandra/mapping/ClassMethods.groovy
  21. +260 −0 src/groovy/com/reachlocal/grails/plugins/cassandra/mapping/DataMapping.groovy
  22. +346 −0 src/groovy/com/reachlocal/grails/plugins/cassandra/mapping/InstanceMethods.groovy
  23. +406 −0 src/groovy/com/reachlocal/grails/plugins/cassandra/mapping/MappingUtils.groovy
  24. +153 −0 src/groovy/com/reachlocal/grails/plugins/cassandra/test/MockPersistenceMethods.groovy
  25. +33 −0 src/groovy/com/reachlocal/grails/plugins/cassandra/test/orm/Car.groovy
  26. +35 −0 src/groovy/com/reachlocal/grails/plugins/cassandra/test/orm/Conference.groovy
  27. +33 −0 src/groovy/com/reachlocal/grails/plugins/cassandra/test/orm/Course.groovy
  28. +40 −0 src/groovy/com/reachlocal/grails/plugins/cassandra/test/orm/Grade.groovy
  29. +43 −0 src/groovy/com/reachlocal/grails/plugins/cassandra/test/orm/Household.groovy
  30. +34 −0 src/groovy/com/reachlocal/grails/plugins/cassandra/test/orm/Person.groovy
  31. +35 −0 src/groovy/com/reachlocal/grails/plugins/cassandra/test/orm/School.groovy
  32. +39 −0 src/groovy/com/reachlocal/grails/plugins/cassandra/test/orm/Student.groovy
  33. +38 −0 src/groovy/com/reachlocal/grails/plugins/cassandra/test/orm/Transcript.groovy
  34. +42 −0 src/groovy/com/reachlocal/grails/plugins/cassandra/test/orm/User.groovy
  35. +35 −0 src/groovy/com/reachlocal/grails/plugins/cassandra/test/orm/UserGroup.groovy
  36. +32 −0 src/groovy/com/reachlocal/grails/plugins/cassandra/test/orm/UserGroupMeeting.groovy
  37. +147 −0 test/unit/com/reachlocal/grails/plugins/cassandra/test/ClassMethodsTests.groovy
  38. +69 −0 test/unit/com/reachlocal/grails/plugins/cassandra/test/InstanceMethodTests.groovy
  39. +59 −0 test/unit/com/reachlocal/grails/plugins/cassandra/test/OrmTestCase.groovy
  40. +58 −0 web-app/WEB-INF/applicationContext.xml
  41. +30 −0 web-app/WEB-INF/sitemesh.xml
  42. +566 −0 web-app/WEB-INF/tld/grails.tld
  43. +327 −0 web-app/WEB-INF/tld/spring.tld
@@ -0,0 +1,14 @@
+<classpath>
+ <classpathentry kind="src" path="src/java"/>
+ <classpathentry kind="src" path="src/groovy"/>
+ <classpathentry kind="src" path="grails-app/conf"/>
+ <classpathentry kind="src" path="grails-app/controllers"/>
+ <classpathentry kind="src" path="grails-app/domain"/>
+ <classpathentry kind="src" path="grails-app/services"/>
+ <classpathentry kind="src" path="grails-app/taglib"/>
+ <classpathentry kind="src" path="test/integration"/>
+ <classpathentry kind="src" path="test/unit"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="com.springsource.sts.grails.core.CLASSPATH_CONTAINER"/>
+ <classpathentry kind="output" path="web-app/WEB-INF/classes"/>
+</classpath>
@@ -0,0 +1,5 @@
+.idea/
+.settings/
+*.iml
+stacktrace.log
+target/
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>cassandra-orm</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>com.springsource.sts.grails.core.nature</nature>
+ <nature>org.eclipse.jdt.groovy.core.groovyNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2012 ReachLocal Inc.
+ *
+ * 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.
+ */
+
+class CassandraOrmGrailsPlugin
+{
+ // the plugin version
+ def version = "0.1"
+ // the version or versions of Grails the plugin is designed for
+ def grailsVersion = "1.3.7 > *"
+ // 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 author = "Your name"
+ def authorEmail = ""
+ def title = "Plugin summary/headline"
+ def description = '''\\
+Brief description of the plugin.
+'''
+
+ // URL to the plugin's documentation
+ def documentation = "http://grails.org/plugin/cassandra-orm"
+
+ 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'.
+ }
+}
@@ -0,0 +1,22 @@
+#
+# Copyright 2012 ReachLocal Inc.
+#
+# 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.
+#
+
+#Grails Metadata file
+#Wed Mar 21 14:39:42 EDT 2012
+app.grails.version=1.3.7
+app.name=cassandra-orm
+plugins.hibernate=1.3.7
+plugins.tomcat=1.3.7
@@ -0,0 +1,47 @@
+grails.project.class.dir = "target/classes"
+grails.project.test.class.dir = "target/test-classes"
+grails.project.test.reports.dir = "target/test-reports"
+/*
+ * Copyright 2012 ReachLocal Inc.
+ *
+ * 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.
+ */
+
+//grails.project.war.file = "target/${appName}-${appVersion}.war"
+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 {
+ grailsPlugins()
+ grailsHome()
+ 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.
+
+ // runtime 'mysql:mysql-connector-java:5.1.13'
+ }
+}
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2012 ReachLocal Inc.
+ *
+ * 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.
+ */
+
+// 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'
+}
@@ -0,0 +1,48 @@
+dataSource {
+ pooled = true
+ driverClassName = "org.hsqldb.jdbcDriver"
+ username = "sa"
+ password = ""
+}
+hibernate {
+ cache.use_second_level_cache = true
+ cache.use_query_cache = true
+ cache.provider_class = 'net.sf.ehcache.hibernate.EhCacheProvider'
+}
+/*
+ * Copyright 2012 ReachLocal Inc.
+ *
+ * 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.
+ */
+
+// environment specific settings
+environments {
+ development {
+ dataSource {
+ dbCreate = "create-drop" // one of 'create', 'create-drop','update'
+ url = "jdbc:hsqldb:mem:devDB"
+ }
+ }
+ test {
+ dataSource {
+ dbCreate = "update"
+ url = "jdbc:hsqldb:mem:testDb"
+ }
+ }
+ production {
+ dataSource {
+ dbCreate = "update"
+ url = "jdbc:hsqldb:file:prodDb;shutdown=true"
+ }
+ }
+}
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2012 ReachLocal Inc.
+ *
+ * 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.
+ */
+
+class UrlMappings {
+
+ static mappings = {
+ "/$controller/$action?/$id?"{
+ constraints {
+ // apply constraints here
+ }
+ }
+
+ "/"(view:"/index")
+ "500"(view:'/error')
+ }
+}
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2012 ReachLocal Inc.
+ *
+ * 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.
+ */
+
+package com.reachlocal.grails.plugins.cassandra.orm
+
+import org.springframework.beans.factory.InitializingBean
+import org.codehaus.groovy.grails.commons.ConfigurationHolder
+import com.reachlocal.grails.plugins.cassandra.mapping.DataMapping
+
+/**
+ * @author: Bob Florian
+ */
+class CassandraOrmService implements InitializingBean
+{
+ boolean transactional = false
+ def applicationContext
+
+ def ormClientServiceName = ConfigurationHolder.config?.cassandra?.ormClientServiceName ?: "astyanaxService"
+
+ def client
+ def persistence
+ def mapping
+
+ void afterPropertiesSet ()
+ {
+ client = applicationContext.getBean(ormClientServiceName)
+ persistence = client.orm
+ mapping = new DataMapping(persistence: persistence)
+ }
+
+ def execute(keyspace, block) throws Exception
+ {
+ client.execute(keyspace, block)
+ }
+}
Oops, something went wrong.

0 comments on commit c251fb5

Please sign in to comment.