Author: vamsic007
Date: Tue Jan 11 09:24:36 2011
New Revision: 1057539
URL: http://svn.apache.org/viewvc?rev=1057539&view=rev
Log:
GERONIMO-5749 Command Line utility to enable/disable Monitoring server and Stat query Snapshot
thread for DefaultServer
o Added SQL scripts to enable/disable monitoring on Default Server
o Added Windows and Unix batch files to execute SQL using ij from Derby
o Files will be copied to server's bin directory when the plugin is installed.
o Eg. script to enable monitoring:
runsql localhost 1527 dbadmin manager enable-monitoring
Added:
geronimo/server/branches/2.1/plugins/monitoring/mconsole-ds/src/main/resources/
geronimo/server/branches/2.1/plugins/monitoring/mconsole-ds/src/main/resources/META-INF/
geronimo/server/branches/2.1/plugins/monitoring/mconsole-ds/src/main/resources/META-INF/database/
geronimo/server/branches/2.1/plugins/monitoring/mconsole-ds/src/main/resources/META-INF/database/derby/
geronimo/server/branches/2.1/plugins/monitoring/mconsole-ds/src/main/resources/META-INF/database/derby/disable-monitoring.sql
(with props)
geronimo/server/branches/2.1/plugins/monitoring/mconsole-ds/src/main/resources/META-INF/database/derby/enable-monitoring.sql
(with props)
geronimo/server/branches/2.1/plugins/monitoring/mconsole-ds/src/main/resources/META-INF/database/derby/runsql.bat
(with props)
geronimo/server/branches/2.1/plugins/monitoring/mconsole-ds/src/main/resources/META-INF/database/derby/runsql.sh
(with props)
Modified:
geronimo/server/branches/2.1/plugins/monitoring/mconsole-ds/pom.xml
Modified: geronimo/server/branches/2.1/plugins/monitoring/mconsole-ds/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/plugins/monitoring/mconsole-ds/pom.xml?rev=1057539&r1=1057538&r2=1057539&view=diff
==============================================================================
--- geronimo/server/branches/2.1/plugins/monitoring/mconsole-ds/pom.xml (original)
+++ geronimo/server/branches/2.1/plugins/monitoring/mconsole-ds/pom.xml Tue Jan 11 09:24:36
2011
@@ -1,79 +1,87 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements. See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to You 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.
--->
-
-<!-- $Rev: 605412 $ $Date: 2007-12-18 19:58:03 -0800 (Tue, 18 Dec 2007) $ -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.apache.geronimo.plugins.monitoring</groupId>
- <artifactId>monitoring</artifactId>
- <version>2.1.8-SNAPSHOT</version>
- </parent>
-
- <groupId>org.apache.geronimo.plugins</groupId>
- <artifactId>mconsole-ds</artifactId>
- <name>Geronimo Plugins, Monitoring :: Console DataSource</name>
- <packaging>car</packaging>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.geronimo.configs</groupId>
- <artifactId>system-database</artifactId>
- <version>${version}</version>
- <type>car</type>
- </dependency>
-
- <dependency>
- <groupId>org.tranql</groupId>
- <artifactId>tranql-connector-derby-embed-local</artifactId>
- <type>rar</type>
- </dependency>
-
- <dependency>
- <groupId>org.apache.geronimo.configs</groupId>
- <artifactId>connector-deployer</artifactId>
- <version>${version}</version>
- <type>car</type>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.geronimo.buildsupport</groupId>
- <artifactId>car-maven-plugin</artifactId>
- <configuration>
- <deploymentConfigs>
- <deploymentConfig>${gbeanDeployer}</deploymentConfig>
- <deploymentConfig>${connectorDeployer}</deploymentConfig>
- </deploymentConfigs>
- <category>Monitoring</category>
- <module>
- <groupId>org.tranql</groupId>
- <artifactId>tranql-connector-derby-embed-local</artifactId>
- <type>rar</type>
- </module>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You 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.
+-->
+
+<!-- $Rev: 605412 $ $Date: 2007-12-18 19:58:03 -0800 (Tue, 18 Dec 2007) $ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.geronimo.plugins.monitoring</groupId>
+ <artifactId>monitoring</artifactId>
+ <version>2.1.8-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.apache.geronimo.plugins</groupId>
+ <artifactId>mconsole-ds</artifactId>
+ <name>Geronimo Plugins, Monitoring :: Console DataSource</name>
+ <packaging>car</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.geronimo.configs</groupId>
+ <artifactId>system-database</artifactId>
+ <version>${version}</version>
+ <type>car</type>
+ </dependency>
+
+ <dependency>
+ <groupId>org.tranql</groupId>
+ <artifactId>tranql-connector-derby-embed-local</artifactId>
+ <type>rar</type>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.geronimo.configs</groupId>
+ <artifactId>connector-deployer</artifactId>
+ <version>${version}</version>
+ <type>car</type>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.geronimo.buildsupport</groupId>
+ <artifactId>car-maven-plugin</artifactId>
+ <configuration>
+ <deploymentConfigs>
+ <deploymentConfig>${gbeanDeployer}</deploymentConfig>
+ <deploymentConfig>${connectorDeployer}</deploymentConfig>
+ </deploymentConfigs>
+ <category>Monitoring</category>
+ <module>
+ <groupId>org.tranql</groupId>
+ <artifactId>tranql-connector-derby-embed-local</artifactId>
+ <type>rar</type>
+ </module>
+ <instance>
+ <plugin-artifact>
+ <copy-file relative-to="server" dest-dir="bin">META-INF/database/derby/runsql.bat</copy-file>
+ <copy-file relative-to="server" dest-dir="bin">META-INF/database/derby/runsql.sh</copy-file>
+ <copy-file relative-to="server" dest-dir="bin">META-INF/database/derby/disable-monitoring.sql</copy-file>
+ <copy-file relative-to="server" dest-dir="bin">META-INF/database/derby/enable-monitoring.sql</copy-file>
+ </plugin-artifact>
+ </instance>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
Added: geronimo/server/branches/2.1/plugins/monitoring/mconsole-ds/src/main/resources/META-INF/database/derby/disable-monitoring.sql
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/plugins/monitoring/mconsole-ds/src/main/resources/META-INF/database/derby/disable-monitoring.sql?rev=1057539&view=auto
==============================================================================
--- geronimo/server/branches/2.1/plugins/monitoring/mconsole-ds/src/main/resources/META-INF/database/derby/disable-monitoring.sql
(added)
+++ geronimo/server/branches/2.1/plugins/monitoring/mconsole-ds/src/main/resources/META-INF/database/derby/disable-monitoring.sql
Tue Jan 11 09:24:36 2011
@@ -0,0 +1,19 @@
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements. See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to You 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.
+
+CONNECT 'MonitoringClientDB';
+UPDATE SERVERS SET ENABLED = 0 WHERE SERVER_ID=0;
+UPDATE GRAPHS SET ENABLED = 0 WHERE SERVER_ID=0;
+DISCONNECT;
\ No newline at end of file
Propchange: geronimo/server/branches/2.1/plugins/monitoring/mconsole-ds/src/main/resources/META-INF/database/derby/disable-monitoring.sql
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/branches/2.1/plugins/monitoring/mconsole-ds/src/main/resources/META-INF/database/derby/disable-monitoring.sql
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/server/branches/2.1/plugins/monitoring/mconsole-ds/src/main/resources/META-INF/database/derby/enable-monitoring.sql
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/plugins/monitoring/mconsole-ds/src/main/resources/META-INF/database/derby/enable-monitoring.sql?rev=1057539&view=auto
==============================================================================
--- geronimo/server/branches/2.1/plugins/monitoring/mconsole-ds/src/main/resources/META-INF/database/derby/enable-monitoring.sql
(added)
+++ geronimo/server/branches/2.1/plugins/monitoring/mconsole-ds/src/main/resources/META-INF/database/derby/enable-monitoring.sql
Tue Jan 11 09:24:36 2011
@@ -0,0 +1,19 @@
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements. See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to You 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.
+
+CONNECT 'MonitoringClientDB';
+UPDATE SERVERS SET ENABLED = 1 WHERE SERVER_ID=0;
+UPDATE GRAPHS SET ENABLED = 1 WHERE SERVER_ID=0;
+DISCONNECT;
\ No newline at end of file
Propchange: geronimo/server/branches/2.1/plugins/monitoring/mconsole-ds/src/main/resources/META-INF/database/derby/enable-monitoring.sql
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/branches/2.1/plugins/monitoring/mconsole-ds/src/main/resources/META-INF/database/derby/enable-monitoring.sql
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/server/branches/2.1/plugins/monitoring/mconsole-ds/src/main/resources/META-INF/database/derby/runsql.bat
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/plugins/monitoring/mconsole-ds/src/main/resources/META-INF/database/derby/runsql.bat?rev=1057539&view=auto
==============================================================================
--- geronimo/server/branches/2.1/plugins/monitoring/mconsole-ds/src/main/resources/META-INF/database/derby/runsql.bat
(added)
+++ geronimo/server/branches/2.1/plugins/monitoring/mconsole-ds/src/main/resources/META-INF/database/derby/runsql.bat
Tue Jan 11 09:24:36 2011
@@ -0,0 +1,55 @@
+@REM
+@REM Licensed to the Apache Software Foundation (ASF) under one or more
+@REM contributor license agreements. See the NOTICE file distributed with
+@REM this work for additional information regarding copyright ownership.
+@REM The ASF licenses this file to You under the Apache License, Version 2.0
+@REM (the "License"); you may not use this file except in compliance with
+@REM the License. You may obtain a copy of the License at
+@REM
+@REM http://www.apache.org/licenses/LICENSE-2.0
+@REM
+@REM Unless required by applicable law or agreed to in writing, software
+@REM distributed under the License is distributed on an "AS IS" BASIS,
+@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@REM See the License for the specific language governing permissions and
+@REM limitations under the License.
+
+@REM --------------------------------------------------------------------
+@REM $Rev$ $Date$
+@REM --------------------------------------------------------------------
+
+@REM -- This batch file is used to run sql to enable/disable monitoring
+@REM -- on Default Server using ij in a NetworkServer environment.
+@REM --
+@REM -- REQUIREMENTS:
+@REM -- You must have the Derby, Derby Client, and Derby Tools libraries in your classpath
+@REM --
+@REM -- You may need to modify the values below for a different
+@REM -- GERONIMO_HOME
+@REM --
+@REM -- This file for use on Windows systems
+@REM --------------------------------------------------------------------
+@setlocal enableextensions
+
+@REM -- GERONIMO_HOME may need to be changed
+@REM --------------------------------------------------------------------
+@REM %~dp0 is expanded pathname of the current script
+set GERONIMO_HOME="%~dp0.."
+for %%z in (%GERONIMO_HOME%) do set GERONIMO_HOME=%%~sz
+set classpath=%GERONIMO_HOME%;%GERONIMO_HOME%\repository\org\apache\derby\derbyclient\${derbyVersion}\derbyclient-${derbyVersion}.jar;%GERONIMO_HOME%\repository\org\apache\derby\derbytools\${derbyVersion}\derbytools-${derbyVersion}.jar
+
+@REM --------------------------------------------------------------------
+@REM -- To use a different JVM with a different syntax, simply edit
+@REM -- this file
+@REM --------------------------------------------------------------------
+if exist "%GERONIMO_HOME%\bin\setenv.bat" call "%GERONIMO_HOME%\bin\setenv.bat"
+
+@REM --------------------------------------------------------------------
+@REM -- start ij
+@REM -- Arguments 5 to the script are [host], [port], [username], [password] and
+@REM -- ["enable-monitoring"|"disable-monitoring"] in that order.
+@REM --------------------------------------------------------------------
+"%JAVA_HOME%\bin\java.exe" %JAVA_OPTS% -Dij.driver=org.apache.derby.jdbc.ClientDriver -Dij.protocol=jdbc:derby://%1:%2/
-Dij.user=%3 -Dij.password=%4 org.apache.derby.tools.ij -f %GERONIMO_HOME%\bin\%5.sql
+
+@endlocal
+cmd /c exit /b %errorlevel%
Propchange: geronimo/server/branches/2.1/plugins/monitoring/mconsole-ds/src/main/resources/META-INF/database/derby/runsql.bat
------------------------------------------------------------------------------
svn:eol-style = CRLF
Propchange: geronimo/server/branches/2.1/plugins/monitoring/mconsole-ds/src/main/resources/META-INF/database/derby/runsql.bat
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/server/branches/2.1/plugins/monitoring/mconsole-ds/src/main/resources/META-INF/database/derby/runsql.sh
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/plugins/monitoring/mconsole-ds/src/main/resources/META-INF/database/derby/runsql.sh?rev=1057539&view=auto
==============================================================================
--- geronimo/server/branches/2.1/plugins/monitoring/mconsole-ds/src/main/resources/META-INF/database/derby/runsql.sh
(added)
+++ geronimo/server/branches/2.1/plugins/monitoring/mconsole-ds/src/main/resources/META-INF/database/derby/runsql.sh
Tue Jan 11 09:24:36 2011
@@ -0,0 +1,88 @@
+#!/bin/sh
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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.
+
+# --------------------------------------------------------------------
+# $Rev$ $Date$
+# --------------------------------------------------------------------
+
+# --------------------------------------------------------------------
+# -- This batch file is used to run sql to enable/disable monitoring
+# -- on Default Server using ij in a NetworkServer environment.
+# --
+#-- REQUIREMENTS:
+# -- You must have the Derby, Derby Client, and Derby Tools libraries in your classpath
+# --
+# --You may need to modify the values below for a different
+# --GERONIMO_HOME
+# --
+# -- This file for use on Unix sh systems
+# --------------------------------------------------------------------
+
+ARGS=
+
+# resolve links - $0 may be a softlink
+PRG="$0"
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '.*/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`/"$link"
+ fi
+done
+
+# Get standard environment variables
+PRGDIR=`dirname "$PRG"`
+GERONIMO_HOME=$PRGDIR/..
+
+# --------------------------------------------------------------------
+# -- To use a different JVM with a different syntax, simply edit
+# -- this file
+# --------------------------------------------------------------------
+if [ -r "$GERONIMO_HOME"/bin/setenv.sh ]; then
+ . "$GERONIMO_HOME"/bin/setenv.sh
+fi
+
+if [ -z "$JAVA_HOME" ]; then
+ JAVA=`which java`
+ if [ -z "$JAVA" ]; then
+ echo "Unable to locate Java binary. Please add it to the PATH."
+ exit 1
+ fi
+ JAVA_BIN=`dirname $JAVA`
+ JAVA_HOME=$JAVA_BIN/..
+fi
+
+JAVA=$JAVA_HOME/bin/java
+if [ ! -f "$JAVA" ]; then
+ echo "Unable to locate Java"
+ exit 1
+fi
+
+ENDORSED_DIR=$GERONIMO_HOME/lib/endorsed
+
+Derby_CLASS_PATH=${GERONIMO_HOME}/repository/org/apache/derby
+CLASS_PATH=${Derby_CLASS_PATH}/derbytools/${derbyVersion}/derbytools-${derbyVersion}.jar:${Derby_CLASS_PATH}/derbyclient/${derbyVersion}/derbyclient-${derbyVersion}.jar:$CLASS_PATH
+
+# --------------------------------------------------------------------
+# -- start ij
+# -- Arguments 5 to the script are [host], [port], [username], [password] and
+# -- ["enable-monitoring"|"disable-monitoring"] in that order.
+# --------------------------------------------------------------------
+$JAVA $JAVA_OPTS -cp $CLASS_PATH -Dij.driver=org.apache.derby.jdbc.ClientDriver -Dij.protocol=jdbc:derby://$1:$2/
-Dij.user=$3 -Dij.password=$4 $ARGS org.apache.derby.tools.ij -f $GERONIMO_HOME/bin/$5.sql
+
Propchange: geronimo/server/branches/2.1/plugins/monitoring/mconsole-ds/src/main/resources/META-INF/database/derby/runsql.sh
------------------------------------------------------------------------------
svn:eol-style = LF
Propchange: geronimo/server/branches/2.1/plugins/monitoring/mconsole-ds/src/main/resources/META-INF/database/derby/runsql.sh
------------------------------------------------------------------------------
svn:executable = *
Propchange: geronimo/server/branches/2.1/plugins/monitoring/mconsole-ds/src/main/resources/META-INF/database/derby/runsql.sh
------------------------------------------------------------------------------
svn:keywords = Date Revision
|