Skip to content

Commit

Permalink
Add JMX support; update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
aalmiray committed Mar 1, 2015
1 parent 6183c1b commit c1a865c
Show file tree
Hide file tree
Showing 9 changed files with 105 additions and 18 deletions.
24 changes: 15 additions & 9 deletions build.gradle
Expand Up @@ -3,17 +3,18 @@ import java.text.SimpleDateFormat
buildscript {
repositories {
jcenter()
mavenLocal()
}

dependencies {
classpath 'org.codehaus.griffon:gradle-griffon-plugin:2.1.0'
classpath 'org.codehaus.griffon:gradle-griffon-build-plugin:2.1.0'
classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.1.0'
classpath 'org.codehaus.griffon:gradle-griffon-plugin:2.2.0'
classpath 'org.codehaus.griffon:gradle-griffon-build-plugin:2.2.0'
classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.3.1'
classpath 'nl.javadude.gradle.plugins:license-gradle-plugin:0.11.0'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.0'
classpath 'org.ajoberstar:gradle-git:0.12.0'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.1'
classpath 'org.ajoberstar:gradle-git:1.0.0'
classpath 'org.kordamp.gradle:stats-gradle-plugin:0.1.3'
classpath 'com.github.ben-manes:gradle-versions-plugin:0.6'
classpath 'com.github.ben-manes:gradle-versions-plugin:0.8'
}
}

Expand Down Expand Up @@ -65,8 +66,13 @@ subprojects { subproj ->
}

subproj.tasks.withType(JavaCompile) {
sourceCompatibility = rootProject.sourceCompatibility
targetCompatibility = rootProject.targetCompatibility
sourceCompatibility = subproj.sourceCompatibility
targetCompatibility = subproj.targetCompatibility
}

subproj.tasks.withType(GroovyCompile) {
sourceCompatibility = subproj.sourceCompatibility
targetCompatibility = subproj.targetCompatibility
}

sourceSets {
Expand All @@ -92,7 +98,7 @@ subprojects { subproj ->
dependencies {
testCompile 'junit:junit:4.12'
testCompile 'org.spockframework:spock-core:0.7-groovy-2.0'
testCompile 'org.slf4j:slf4j-simple:1.7.7'
testCompile 'org.slf4j:slf4j-simple:1.7.10'
}

task sourceJar(type: Jar) {
Expand Down
6 changes: 3 additions & 3 deletions gradle.properties
@@ -1,7 +1,7 @@
group=org.codehaus.griffon.plugins
version=1.0.0
version=1.1.0
pluginBaseName=griffon-gsql
griffonVersion=2.1.0
griffonVersion=2.2.0
griffonPlugin=true
publishJars=false
sourceCompatibility=1.7
Expand All @@ -13,5 +13,5 @@ projectIssueTrackerUrl=https://github.com/griffon-plugins/griffon-gsql-plugin/is
projectVcsUrl=https://github.com/griffon-plugins/griffon-gsql-plugin
javadocFooter=Copyright © 2014 Andres Almiray. All rights reserved.
projectLabels=griffon,plugin,datasource,gsql
jacocoVersion=0.7.2.201409121644
jacocoVersion=0.7.3.201502191951

Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
#Mon Sep 08 14:12:16 CEST 2014
#Mon Feb 16 21:40:54 CET 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.3-bin.zip
6 changes: 3 additions & 3 deletions subprojects/griffon-gsql-core/griffon-gsql-core.gradle
Expand Up @@ -10,12 +10,12 @@ griffon {
apply from: rootProject.file('gradle/code-coverage.gradle')

dependencies {
griffon 'org.codehaus.griffon.plugins:griffon-datasource-plugin:1.1.0'
compile 'org.codehaus.griffon.plugins:griffon-datasource-core:1.2.0'

testCompileOnly "org.codehaus.griffon:griffon-groovy-compile:${griffon.version}"

testRuntime('com.h2database:h2:1.4.184') { transitive = false }
testRuntime "org.slf4j:slf4j-simple:1.7.7"
testRuntime('com.h2database:h2:1.4.185') { transitive = false }
testRuntime "org.slf4j:slf4j-simple:1.7.10"

testRuntime "org.codehaus.griffon:griffon-guice:${griffon.version}"

Expand Down
Expand Up @@ -16,12 +16,16 @@
package org.codehaus.griffon.runtime.gsql;

import griffon.core.GriffonApplication;
import griffon.core.env.Metadata;
import griffon.inject.DependsOn;
import griffon.plugins.gsql.GsqlCallback;
import griffon.plugins.gsql.GsqlFactory;
import griffon.plugins.gsql.GsqlHandler;
import griffon.plugins.gsql.GsqlStorage;
import griffon.plugins.monitor.MBeanManager;
import groovy.sql.Sql;
import org.codehaus.griffon.runtime.core.addon.AbstractGriffonAddon;
import org.codehaus.griffon.runtime.jmx.GsqlStorageMonitor;

import javax.annotation.Nonnull;
import javax.inject.Inject;
Expand All @@ -42,6 +46,20 @@ public class GsqlAddon extends AbstractGriffonAddon {
@Inject
private GsqlFactory gsqlFactory;

@Inject
private GsqlStorage gsqlStorage;

@Inject
private MBeanManager mbeanManager;

@Inject
private Metadata metadata;

@Override
public void init(@Nonnull GriffonApplication application) {
mbeanManager.registerMBean(new GsqlStorageMonitor(metadata, gsqlStorage));
}

public void onStartupStart(@Nonnull GriffonApplication application) {
for (String dataSourceName : gsqlFactory.getDatasourceNames()) {
Map<String, Object> config = gsqlFactory.getConfigurationFor(dataSourceName);
Expand Down
@@ -0,0 +1,38 @@
/*
* Copyright 2014-2015 the original author or authors.
*
* 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 org.codehaus.griffon.runtime.jmx;

import griffon.core.env.Metadata;
import griffon.plugins.gsql.GsqlStorage;
import groovy.sql.Sql;
import org.codehaus.griffon.runtime.monitor.AbstractObjectStorageMonitor;

import javax.annotation.Nonnull;

/**
* @author Andres Almiray
* @since 1.1.0
*/
public class GsqlStorageMonitor extends AbstractObjectStorageMonitor<Sql> implements GsqlStorageMonitorMXBean {
public GsqlStorageMonitor(@Nonnull Metadata metadata, @Nonnull GsqlStorage delegate) {
super(metadata, delegate);
}

@Override
protected String getStorageName() {
return "gsql";
}
}
@@ -0,0 +1,25 @@
/*
* Copyright 2014-2015 the original author or authors.
*
* 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 org.codehaus.griffon.runtime.jmx;

import org.codehaus.griffon.runtime.monitor.ObjectStorageMonitorMXBean;

/**
* @author Andres Almiray
* @since 1.1.0
*/
public interface GsqlStorageMonitorMXBean extends ObjectStorageMonitorMXBean {
}
Expand Up @@ -7,7 +7,7 @@ dependencies {

testCompileOnly "org.codehaus.griffon:griffon-groovy-compile:${griffonVersion}"
testRuntime "org.codehaus.griffon:griffon-guice:${griffonVersion}"
testRuntime "org.slf4j:slf4j-simple:1.7.7"
testRuntime "org.slf4j:slf4j-simple:1.7.10"
}

compileGroovy.enabled = false

0 comments on commit c1a865c

Please sign in to comment.