Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to Grails 2.4.5 and Hibernate 4 #47

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
188 changes: 172 additions & 16 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,20 +1,176 @@
web-app
target
build
bin
build.sh
plugin.xml
stacktrace.log
*.tmproj
*.iws
*.zip
*.sha1
##Grails.gitignore-------------------------------------------------------------
# web application files
/web-app/WEB-INF/classes

# default HSQL database files for production mode
/prodDb.*

# general HSQL database files
*Db.properties
*Db.script

# logs
/stacktrace.log
/test/reports
/logs

# project release file
/*.war

# plugin release files
/*.zip
/plugin.xml

# older plugin install locations
/plugins
/web-app/plugins

# "temporary" build files
/target


##Java.gitignore---------------------------------------------------------------
*.class

# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Package Files #
*.jar
*.war
*.ear

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*


##Maven.gitignore--------------------------------------------------------------
target/
**/target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
release.properties
dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties


##Eclipse.gitignore------------------------------------------------------------
*.pydevproject
.metadata
.gradle
.DS_Store
.classpath
bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
local.properties
.settings/
.loadpath

# Eclipse Core
.project
.settings
.idea

# External tool builders
.externalToolBuilders/

# Locally stored "Eclipse launch configurations"
*.launch

# CDT-specific
.cproject

# JDT-specific (Eclipse Java Development Tools)
.classpath

# Java annotation processor (APT)
.factorypath

# PDT-specific
.buildpath

# sbteclipse plugin
.target

# TeXlipse plugin
.texlipse


##SublimeText.gitignore--------------------------------------------------------
# cache files for sublime text
*.tmlanguage.cache
*.tmPreferences.cache
*.stTheme.cache

# workspace files are user-specific
*.sublime-workspace

# project files should be checked into the repository, unless a significant
# proportion of contributors will probably not be using SublimeText
# *.sublime-project

# sftp configuration file
sftp-config.json


##NetBeans.gitignore-----------------------------------------------------------
nbproject/private/
build/
nbbuild/
dist/
nbdist/
nbactions.xml
nb-configuration.xml
.nb-gradle/


##JetBrains.gitignore----------------------------------------------------------
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion

*.iml

## Directory-based project format:
.idea/
# if you remove the above rule, at least ignore the following:

# User-specific stuff:
# .idea/workspace.xml
# .idea/tasks.xml
# .idea/dictionaries

# Sensitive or high-churn files:
# .idea/dataSources.ids
# .idea/dataSources.xml
# .idea/sqlDataSources.xml
# .idea/dynamic.xml
# .idea/uiDesigner.xml

# Gradle:
# .idea/gradle.xml
# .idea/libraries

# Mongo Explorer plugin:
# .idea/mongoSettings.xml

## File-based project format:
*.ipr
.grails
*.iws

## Plugin-specific files:

# IntelliJ
/out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
179 changes: 108 additions & 71 deletions MultiTenantSingleDbGrailsPlugin.groovy
Original file line number Diff line number Diff line change
@@ -1,71 +1,108 @@
import grails.plugin.multitenant.singledb.MtSingleDbPluginSupport
import grails.util.Environment

import org.codehaus.groovy.grails.commons.GrailsApplication
import org.slf4j.Logger
import org.slf4j.LoggerFactory

class MultiTenantSingleDbGrailsPlugin {
private Logger log = LoggerFactory.getLogger('grails.plugin.multiTenant.MultiTenantSingleDbPlugin')

def version = "0.8.3"
def grailsVersion = "1.3.5 > *"

def loadAfter = [
'hawk-eventing',
'hibernate-hijacker',
'controllers'
]

def pluginExcludes = ["**/demo/**" ]

def author = "Kim A. Betti"
def authorEmail = "[email protected]"
def title = "MultiTenant - SingleDB"
def description = "Multi tenant setup focused on single database mode"

def documentation = "https://github.com/multi-tenant/grails-multi-tenant-single-db"

def license = "APACHE"
def developers = [
[ name: "Steve Ronderos", email: "[email protected]" ]
]
def issueManagement = [ system: "github", url: "https://github.com/multi-tenant/grails-multi-tenant-single-db/issues" ]
def scm = [ url: "https://github.com/multi-tenant/grails-multi-tenant-single-db" ]

// make sure the filter chain filter is after the Grails filter
def getWebXmlFilterOrder() {
log.debug("Start getWebXmlFilterOrder")
def filterMap = [:]
try {
def classLoader = new GroovyClassLoader(getClass().getClassLoader())
def slurper = new ConfigSlurper(Environment.getCurrent().getName())
def config = slurper.parse(classLoader.loadClass(GrailsApplication.CONFIG_CLASS))

if(config.multiTenant.resolveTenantBeforeLogin) {
def SecurityFilterPosition = classLoader.loadClass('org.codehaus.groovy.grails.plugins.springsecurity.SecurityFilterPosition')
log.debug("set WebXmlFilterOrder before login")
filterMap = [tenantFilter: SecurityFilterPosition.FORM_LOGIN_FILTER.order - 100]
} else {
def FilterManager = classLoader.loadClass('grails.plugin.webxml.FilterManager')
log.debug("set WebXmlFilterOrder after login")
filterMap = [tenantFilter: FilterManager.SITEMESH_POSITION - 100]
}
} catch (ClassNotFoundException e) {
log.warn "Could not determine desired tenantFilter position."
}
return filterMap
}

def doWithSpring = {
MtSingleDbPluginSupport.doWithSpring.delegate = delegate
MtSingleDbPluginSupport.doWithSpring application
}

def doWithDynamicMethods = { ctx ->
MtSingleDbPluginSupport.doWithDynamicMethods.delegate = delegate
MtSingleDbPluginSupport.doWithDynamicMethods ctx, application
}

def doWithWebDescriptor = MtSingleDbPluginSupport.doWithWebDescriptor
}
import grails.plugin.multitenant.singledb.MtSingleDbPluginSupport
import grails.util.Environment
import groovy.util.logging.Log4j
import org.codehaus.groovy.grails.commons.GrailsApplication

@Log4j
class MultiTenantSingleDbGrailsPlugin {
// the plugin version
def version = "1.0"
// the version or versions of Grails the plugin is designed for
def grailsVersion = "2.4 > *"
// resources that are excluded from plugin packaging
def pluginExcludes = [
'**/demo/**',
"grails-app/views/error.gsp",
]

def loadAfter = [
'hawk-eventing',
'hibernate-hijacker',
'controllers'
]

// TODO Fill in these fields
def title = "MultiTenant - SingleDB" // Headline display name of the plugin
def author = "Sandeep Poonia"
def authorEmail = "[email protected]"
def description = '''\
Multi tenant setup focused on single database mode
'''

// URL to the plugin's documentation
def documentation = "https://github.com/spoonia/grails-multi-tenant-single-db"

// Extra (optional) plugin metadata

// License: one of 'APACHE', 'GPL2', 'GPL3'
def license = "APACHE"

// Details of company behind the plugin (if there is one)
// def organization = [ name: "My Company", url: "http://www.my-company.com/" ]

// Any additional developers beyond the author specified above.
// def developers = [ [ name: "Joe Bloggs", email: "[email protected]" ]]

// Location of the plugin's issue tracker.
def issueManagement = [system: "github", url: "https://github.com/spoonia/grails-multi-tenant-single-db/issues"]

// Online location of the plugin's browseable source code.
def scm = [url: "https://github.com/spoonia/grails-multi-tenant-single-db"]

// make sure the filter chain filter is after the Grails filter
def getWebXmlFilterOrder() {
log.debug("Start getWebXmlFilterOrder")
def filterMap = [:]
try {
def classLoader = new GroovyClassLoader(getClass().getClassLoader())
def slurper = new ConfigSlurper(Environment.getCurrent().getName())
def config = slurper.parse(classLoader.loadClass(GrailsApplication.CONFIG_CLASS))

if (config.multiTenant.resolveTenantBeforeLogin) {
def SecurityFilterPosition = classLoader.loadClass('org.codehaus.groovy.grails.plugins.springsecurity.SecurityFilterPosition')
log.debug("set WebXmlFilterOrder before login")
filterMap = [tenantFilter: SecurityFilterPosition.FORM_LOGIN_FILTER.order - 100]
} else {
def FilterManager = classLoader.loadClass('grails.plugin.webxml.FilterManager')
log.debug("set WebXmlFilterOrder after login")
filterMap = [tenantFilter: FilterManager.SITEMESH_POSITION - 100]
}
} catch (ClassNotFoundException e) {
log.warn "Could not determine desired tenantFilter position."
}
return filterMap
}

def doWithWebDescriptor = { xml ->
MtSingleDbPluginSupport.doWithWebDescriptor xml
}

def doWithSpring = {
MtSingleDbPluginSupport.doWithSpring.delegate = delegate
MtSingleDbPluginSupport.doWithSpring application
}

def doWithDynamicMethods = { ctx ->
MtSingleDbPluginSupport.doWithDynamicMethods.delegate = delegate
MtSingleDbPluginSupport.doWithDynamicMethods ctx, application
}

def doWithApplicationContext = { ctx ->
// 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)
}
}
5 changes: 4 additions & 1 deletion application.properties
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
app.grails.version=2.0.4
#Grails Metadata file
#Wed Mar 23 08:34:23 IST 2016
app.grails.version=2.4.5
app.name=multi-tenant-single-db
Loading