Mercurial > hg > testrepo
changeset 100:163e1ab50baa
Test commit
user: Simon Tooke <stooke@redhat.com>
(no discussion)
author | Simon Tooke <stooke@redhat.com> |
---|---|
date | Tue, 04 Oct 2016 14:08:26 -0400 |
parents | ac47638b9fe2 |
children | 14b0d6849b19 |
files | junk/scripts/thermostat-agent-proxy.cmd junk/scripts/thermostat-agent-syd.cmd junk/scripts/thermostat-command-channel.cmd junk/scripts/thermostat-common.cmd junk/scripts/thermostat-debug.cmd junk/scripts/thermostat-devsetup.cmd junk/scripts/thermostat-ipc-client-common.cmd junk/scripts/thermostat-webservice.cmd junk/scripts/thermostat.cmd |
diffstat | 9 files changed, 777 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/junk/scripts/thermostat-agent-proxy.cmd Tue Oct 04 14:08:26 2016 -0400 @@ -0,0 +1,41 @@ +@echo off + +:: Copyright 2016 Red Hat, Inc. +:: +:: This file is part of Thermostat. +:: +:: Thermostat is free software; you can redistribute it and/or modify +:: it under the terms of the GNU General Public License as published +:: by the Free Software Foundation; either version 2, or (at your +:: option) any later version. +:: +:: Thermostat is distributed in the hope that it will be useful, but +:: WITHOUT ANY WARRANTY; without even the implied warranty of +:: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +:: General Public License for more details. +:: +:: You should have received a copy of the GNU General Public License +:: along with Thermostat; see the file COPYING. If not see +:: <http://www.gnu.org/licenses/>. +:: +:: Linking this code with other modules is making a combined work +:: based on this code. Thus, the terms and conditions of the GNU +:: General Public License cover the whole combination. +:: +:: As a special exception, the copyright holders of this code give +:: you permission to link this code with independent modules to +:: produce an executable, regardless of the license terms of these +:: independent modules, and to copy and distribute the resulting +:: executable under terms of your choice, provided that you also +:: meet, for each linked independent module, the terms and conditions +:: of the license of that module. An independent module is a module +:: which is not derived from or based on this code. If you modify +:: this code, you may extend this exception to your version of the +:: library, but you are not obligated to do so. If you do not wish +:: to do so, delete this exception statement from your version. + +setlocal + +%~dp0\thermostat-common.cmd + +echo thermostat-agent-proxy not implemented on Windows.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/junk/scripts/thermostat-agent-syd.cmd Tue Oct 04 14:08:26 2016 -0400 @@ -0,0 +1,41 @@ +@echo off + +:: Copyright 2016 Red Hat, Inc. +:: +:: This file is part of Thermostat. +:: +:: Thermostat is free software; you can redistribute it and/or modify +:: it under the terms of the GNU General Public License as published +:: by the Free Software Foundation; either version 2, or (at your +:: option) any later version. +:: +:: Thermostat is distributed in the hope that it will be useful, but +:: WITHOUT ANY WARRANTY; without even the implied warranty of +:: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +:: General Public License for more details. +:: +:: You should have received a copy of the GNU General Public License +:: along with Thermostat; see the file COPYING. If not see +:: <http://www.gnu.org/licenses/>. +:: +:: Linking this code with other modules is making a combined work +:: based on this code. Thus, the terms and conditions of the GNU +:: General Public License cover the whole combination. +:: +:: As a special exception, the copyright holders of this code give +:: you permission to link this code with independent modules to +:: produce an executable, regardless of the license terms of these +:: independent modules, and to copy and distribute the resulting +:: executable under terms of your choice, provided that you also +:: meet, for each linked independent module, the terms and conditions +:: of the license of that module. An independent module is a module +:: which is not derived from or based on this code. If you modify +:: this code, you may extend this exception to your version of the +:: library, but you are not obligated to do so. If you do not wish +:: to do so, delete this exception statement from your version. + +setlocal + +%~dp0\thermostat-common.cmd + +echo thermostat-agent-syd not implemented on Windows.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/junk/scripts/thermostat-command-channel.cmd Tue Oct 04 14:08:26 2016 -0400 @@ -0,0 +1,93 @@ +@echo off + +:: Copyright 2016 Red Hat, Inc. +:: +:: This file is part of Thermostat. +:: +:: Thermostat is free software; you can redistribute it and\or modify +:: it under the terms of the GNU General Public License as published +:: by the Free Software Foundation; either version 2, or (at your +:: option) any later version. +:: +:: Thermostat is distributed in the hope that it will be useful, but +:: WITHOUT ANY WARRANTY; without even the implied warranty of +:: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +:: General Public License for more details. +:: +:: You should have received a copy of the GNU General Public License +:: along with Thermostat; see the file COPYING. If not see +:: <http://www.gnu.org/licenses/>. +:: +:: Linking this code with other modules is making a combined work +:: based on this code. Thus, the terms and conditions of the GNU +:: General Public License cover the whole combination. +:: +:: As a special exception, the copyright holders of this code give +:: you permission to link this code with independent modules to +:: produce an executable, regardless of the license terms of these +:: independent modules, and to copy and distribute the resulting +:: executable under terms of your choice, provided that you also +:: meet, for each linked independent module, the terms and conditions +:: of the license of that module. An independent module is a module +:: which is not derived from or based on this code. If you modify +:: this code, you may extend this exception to your version of the +:: library, but you are not obligated to do so. If you do not wish +:: to do so, delete this exception statement from your version. + +setlocal + +if "%3"=="" goto usage +if not "%4"=="" goto usage + +goto skipfuncdefs + +:usage + echo "usage: %~f0 <hostname> <port> <ipcConfigFile>" + exit /b 1 + +:skipfuncdefs + +set HOSTNAME=%1 +set PORT=%2 +set CONFIG_FILE=%3 + +:: Source thermostat-ipc-client-common from same directory as this script +:: Defines IPC_CLASSPATH variable with JARs necessary for the IPC service + +call %~dp0\thermostat-ipc-client-common.cmd +if not "%errorlevel%"=="0" exit /b %errorlevel% + +:: Ensure thermostat-ipc-client-common sourced correctly +if not defined IPC_CLASSPATH ( + echo "Classpath not properly defined for command channel" + exit /b 1 +) + +:: Additional JARs necessary for the server +set IPC_CLASSPATH=%IPC_CLASSPATH%:%THERMOSTAT_LIBS%\thermostat-common-core-@project.version@.jar +set IPC_CLASSPATH=%IPC_CLASSPATH%:%THERMOSTAT_LIBS%\thermostat-shared-config-@project.version@.jar +set IPC_CLASSPATH=%IPC_CLASSPATH%:%THERMOSTAT_LIBS%\thermostat-agent-command-@project.version@.jar +set IPC_CLASSPATH=%IPC_CLASSPATH%:%THERMOSTAT_LIBS%\thermostat-common-command-@project.version@.jar +set IPC_CLASSPATH=%IPC_CLASSPATH%:%THERMOSTAT_LIBS%\thermostat-agent-command-server-@project.version@.jar +set IPC_CLASSPATH=%IPC_CLASSPATH%:%THERMOSTAT_LIBS%\netty-buffer-@netty.version@.jar +set IPC_CLASSPATH=%IPC_CLASSPATH%:%THERMOSTAT_LIBS%\netty-common-@netty.version@.jar +set IPC_CLASSPATH=%IPC_CLASSPATH%:%THERMOSTAT_LIBS%\netty-transport-@netty.version@.jar +set IPC_CLASSPATH=%IPC_CLASSPATH%:%THERMOSTAT_LIBS%\netty-codec-@netty.version@.jar +set IPC_CLASSPATH=%IPC_CLASSPATH%:%THERMOSTAT_LIBS%\netty-handler-@netty.version@.jar +set IPC_CLASSPATH=%IPC_CLASSPATH%:%THERMOSTAT_LIBS%\gson-@gson.version@.jar + +set CMD_CHANNEL_CLASS=com.redhat.thermostat.agent.command.server.internal.CommandChannelServerMain + +:: Set this to remote debug +if defined THERMOSTAT_CMDC_DEBUG ( + set DEBUG_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,quiet=y,address=1083 +) + + +:: Start server + +set CONFIG_FILE_ARG=-DipcConfigFile=%CONFIG_FILE% +%JAVA% %CONFIG_FILE_ARG% %LOGGING_ARGS% -cp %IPC_CLASSPATH% %DEBUG_OPTS% %CMD_CHANNEL_CLASS% %HOSTNAME% %PORT% + + +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/junk/scripts/thermostat-common.cmd Tue Oct 04 14:08:26 2016 -0400 @@ -0,0 +1,80 @@ +@echo off + +:: Copyright 2016 Red Hat, Inc. +:: +:: This file is part of Thermostat. +:: +:: Thermostat is free software; you can redistribute it and/or modify +:: it under the terms of the GNU General Public License as published +:: by the Free Software Foundation; either version 2, or (at your +:: option) any later version. +:: +:: Thermostat is distributed in the hope that it will be useful, but +:: WITHOUT ANY WARRANTY; without even the implied warranty of +:: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +:: General Public License for more details. +:: +:: You should have received a copy of the GNU General Public License +:: along with Thermostat; see the file COPYING. If not see +:: <http://www.gnu.org/licenses/>. +:: +:: Linking this code with other modules is making a combined work +:: based on this code. Thus, the terms and conditions of the GNU +:: General Public License cover the whole combination. +:: +:: As a special exception, the copyright holders of this code give +:: you permission to link this code with independent modules to +:: produce an executable, regardless of the license terms of these +:: independent modules, and to copy and distribute the resulting +:: executable under terms of your choice, provided that you also +:: meet, for each linked independent module, the terms and conditions +:: of the license of that module. An independent module is a module +:: which is not derived from or based on this code. If you modify +:: this code, you may extend this exception to your version of the +:: library, but you are not obligated to do so. If you do not wish +:: to do so, delete this exception statement from your version. + +set THERMOSTAT_HOME=%~dp0.. +set THERMOSTAT_LIBS=%THERMOSTAT_HOME%\libs +set USER_THERMOSTAT_HOME=%USERPROFILE%\.thermostat + +:: Duplicated in ThermostatVmMainLabelDecorator +set THERMOSTAT_MAIN=com.redhat.thermostat.main.Thermostat + +if not defined JAVA_HOME ( + set jdk_home_candidate="@thermostat.jdk.home@" + if exist %jdk_home_candidate%\bin\javac.exe ( + set JAVA_HOME=%jdk_home_candidate% + ) else ( + :: Got likely a JRE, but thermostat expects a full JDK, try + :: one level up and hope this will work. We check + :: if JAVA_HOME is a valid value below. + set JAVA_HOME=%jdk_home_candidate%\.. + ) +) + +if exist %THERMOSTAT_HOME%\etc\thermostatrc.cmd call %THERMOSTAT_HOME%\etc\thermostatrc.cmd +if exist %USER_THERMOSTAT_HOME%\etc\thermostatrc.cmd call %USER_THERMOSTAT_HOME%\etc\thermostatrc.cmd + +:: Verify that JAVA_HOME is a real JDK +if not exist %JAVA_HOME%\bin\javac.exe ( + echo JAVA_HOME does not seem to be a JDK. Thermostat needs a JDK to run. + echo JAVA_HOME was set to '%JAVA_HOME%' + exit /b 2 +) + +set JAVA=%JAVA_HOME%\bin\java + +set SYSTEM_LOG_CONFIG_FILE=%THERMOSTAT_HOME%\etc\logging.properties +if exist %SYSTEM_LOG_CONFIG_FILE% ( + set LOGGING_ARGS=-Djava.util.logging.config.file=%SYSTEM_LOG_CONFIG_FILE% +) + +set USER_LOG_CONFIG_FILE=%USER_THERMOSTAT_HOME%\etc\logging.properties +if exist %USER_LOG_CONFIG_FILE% ( + set LOGGING_ARGS=-Djava.util.logging.config.file=%USER_LOG_CONFIG_FILE% +) + +set LOGGING_ARGS=%LOGGING_ARGS% -Djline.log.jul=true + +exit /b 0 \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/junk/scripts/thermostat-debug.cmd Tue Oct 04 14:08:26 2016 -0400 @@ -0,0 +1,41 @@ +@echo off + +:: Copyright 2016 Red Hat, Inc. +:: +:: This file is part of Thermostat. +:: +:: Thermostat is free software; you can redistribute it and/or modify +:: it under the terms of the GNU General Public License as published +:: by the Free Software Foundation; either version 2, or (at your +:: option) any later version. +:: +:: Thermostat is distributed in the hope that it will be useful, but +:: WITHOUT ANY WARRANTY; without even the implied warranty of +:: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +:: General Public License for more details. +:: +:: You should have received a copy of the GNU General Public License +:: along with Thermostat; see the file COPYING. If not see +:: <http://www.gnu.org/licenses/>. +:: +:: Linking this code with other modules is making a combined work +:: based on this code. Thus, the terms and conditions of the GNU +:: General Public License cover the whole combination. +:: +:: As a special exception, the copyright holders of this code give +:: you permission to link this code with independent modules to +:: produce an executable, regardless of the license terms of these +:: independent modules, and to copy and distribute the resulting +:: executable under terms of your choice, provided that you also +:: meet, for each linked independent module, the terms and conditions +:: of the license of that module. An independent module is a module +:: which is not derived from or based on this code. If you modify +:: this code, you may extend this exception to your version of the +:: library, but you are not obligated to do so. If you do not wish +:: to do so, delete this exception statement from your version. + +setlocal + +%~dp0\thermostat-common.cmd + +echo thermostat-debug not implemented on Windows.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/junk/scripts/thermostat-devsetup.cmd Tue Oct 04 14:08:26 2016 -0400 @@ -0,0 +1,41 @@ +@echo off + +:: Copyright 2016 Red Hat, Inc. +:: +:: This file is part of Thermostat. +:: +:: Thermostat is free software; you can redistribute it and/or modify +:: it under the terms of the GNU General Public License as published +:: by the Free Software Foundation; either version 2, or (at your +:: option) any later version. +:: +:: Thermostat is distributed in the hope that it will be useful, but +:: WITHOUT ANY WARRANTY; without even the implied warranty of +:: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +:: General Public License for more details. +:: +:: You should have received a copy of the GNU General Public License +:: along with Thermostat; see the file COPYING. If not see +:: <http://www.gnu.org/licenses/>. +:: +:: Linking this code with other modules is making a combined work +:: based on this code. Thus, the terms and conditions of the GNU +:: General Public License cover the whole combination. +:: +:: As a special exception, the copyright holders of this code give +:: you permission to link this code with independent modules to +:: produce an executable, regardless of the license terms of these +:: independent modules, and to copy and distribute the resulting +:: executable under terms of your choice, provided that you also +:: meet, for each linked independent module, the terms and conditions +:: of the license of that module. An independent module is a module +:: which is not derived from or based on this code. If you modify +:: this code, you may extend this exception to your version of the +:: library, but you are not obligated to do so. If you do not wish +:: to do so, delete this exception statement from your version. + +setlocal + +%~dp0\thermostat-common.cmd + +echo thermostat-devsetup not implemented on Windows.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/junk/scripts/thermostat-ipc-client-common.cmd Tue Oct 04 14:08:26 2016 -0400 @@ -0,0 +1,69 @@ +@echo off + +:: Copyright 2016 Red Hat, Inc. +:: +:: This file is part of Thermostat. +:: +:: Thermostat is free software; you can redistribute it and\or modify +:: it under the terms of the GNU General Public License as published +:: by the Free Software Foundation; either version 2, or (at your +:: option) any later version. +:: +:: Thermostat is distributed in the hope that it will be useful, but +:: WITHOUT ANY WARRANTY; without even the implied warranty of +:: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +:: General Public License for more details. +:: +:: You should have received a copy of the GNU General Public License +:: along with Thermostat; see the file COPYING. If not see +:: <http:\\www.gnu.org\licenses\>. +:: +:: Linking this code with other modules is making a combined work +:: based on this code. Thus, the terms and conditions of the GNU +:: General Public License cover the whole combination. +:: +:: As a special exception, the copyright holders of this code give +:: you permission to link this code with independent modules to +:: produce an executable, regardless of the license terms of these +:: independent modules, and to copy and distribute the resulting +:: executable under terms of your choice, provided that you also +:: meet, for each linked independent module, the terms and conditions +:: of the license of that module. An independent module is a module +:: which is not derived from or based on this code. If you modify +:: this code, you may extend this exception to your version of the +:: library, but you are not obligated to do so. If you do not wish +:: to do so, delete this exception statement from your version. + +rem setlocal + +call %~dp0\thermostat-common.cmd + +rem endlocal & ( set THERMOSTAT_LIBS=%THERMOSTAT_LIBS% ) + +rem Build classpath shared by all IPC clients + +set IPC_CLASSPATH=%THERMOSTAT_LIBS%\thermostat-agent-ipc-client-%project.version%.jar +set IPC_CLASSPATH=%IPC_CLASSPATH%:%THERMOSTAT_LIBS%\thermostat-agent-ipc-common-%project.version%.jar +set IPC_CLASSPATH=%IPC_CLASSPATH%:%THERMOSTAT_LIBS%\thermostat-agent-ipc-unixsocket-client-%project.version%.jar +set IPC_CLASSPATH=%IPC_CLASSPATH%:%THERMOSTAT_LIBS%\thermostat-agent-ipc-unixsocket-common-%project.version%.jar +set IPC_CLASSPATH=%IPC_CLASSPATH%:%THERMOSTAT_LIBS%\thermostat-agent-ipc-tcpsocket-client-%project.version%.jar +set IPC_CLASSPATH=%IPC_CLASSPATH%:%THERMOSTAT_LIBS%\thermostat-agent-ipc-tcpsocket-common-%project.version%.jar +set IPC_CLASSPATH=%IPC_CLASSPATH%:%THERMOSTAT_LIBS%\jnr-unixsocket-%jnr-unixsocket.version%.jar +set IPC_CLASSPATH=%IPC_CLASSPATH%:%THERMOSTAT_LIBS%\jnr-enxio-%jnr-enxio.version%.jar +set IPC_CLASSPATH=%IPC_CLASSPATH%:%THERMOSTAT_LIBS%\jnr-constants-%jnr-constants.version%.jar +set IPC_CLASSPATH=%IPC_CLASSPATH%:%THERMOSTAT_LIBS%\jnr-posix-%jnr-posix.version%.jar +set IPC_CLASSPATH=%IPC_CLASSPATH%:%THERMOSTAT_LIBS%\jnr-ffi-%jnr-ffi.version%.jar +set IPC_CLASSPATH=%IPC_CLASSPATH%:%THERMOSTAT_LIBS%\jnr-x86asm-%jnr-x86asm.version%.jar +set IPC_CLASSPATH=%IPC_CLASSPATH%:%THERMOSTAT_LIBS%\jffi-%jffi.version%.jar +set IPC_CLASSPATH=%IPC_CLASSPATH%:%THERMOSTAT_LIBS%\jffi-%jffi.version%-native.jar +set IPC_CLASSPATH=%IPC_CLASSPATH%:%THERMOSTAT_LIBS%\asm-%asm.version%.jar +set IPC_CLASSPATH=%IPC_CLASSPATH%:%THERMOSTAT_LIBS%\asm-commons-%asm.version%.jar +set IPC_CLASSPATH=%IPC_CLASSPATH%:%THERMOSTAT_LIBS%\asm-util-%asm.version%.jar +set IPC_CLASSPATH=%IPC_CLASSPATH%:%THERMOSTAT_LIBS%\asm-analysis-%asm.version%.jar +set IPC_CLASSPATH=%IPC_CLASSPATH%:%THERMOSTAT_LIBS%\asm-tree-%asm.version%.jar + +rem set THERMOSTAT_LIBS= + +echo %IPC_CLASSPATH% + +exit /b 0
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/junk/scripts/thermostat-webservice.cmd Tue Oct 04 14:08:26 2016 -0400 @@ -0,0 +1,221 @@ +@echo off + +:: Copyright 2016 Red Hat, Inc. +:: +:: This file is part of Thermostat. +:: +:: Thermostat is free software; you can redistribute it and/or modify +:: it under the terms of the GNU General Public License as published +:: by the Free Software Foundation; either version 2, or (at your +:: option) any later version. +:: +:: Thermostat is distributed in the hope that it will be useful, but +:: WITHOUT ANY WARRANTY; without even the implied warranty of +:: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +:: General Public License for more details. +:: +:: You should have received a copy of the GNU General Public License +:: along with Thermostat; see the file COPYING. If not see +:: <http://www.gnu.org/licenses/>. +:: +:: Linking this code with other modules is making a combined work +:: based on this code. Thus, the terms and conditions of the GNU +:: General Public License cover the whole combination. +:: +:: As a special exception, the copyright holders of this code give +:: you permission to link this code with independent modules to +:: produce an executable, regardless of the license terms of these +:: independent modules, and to copy and distribute the resulting +:: executable under terms of your choice, provided that you also +:: meet, for each linked independent module, the terms and conditions +:: of the license of that module. An independent module is a module +:: which is not derived from or based on this code. If you modify +:: this code, you may extend this exception to your version of the +:: library, but you are not obligated to do so. If you do not wish +:: to do so, delete this exception statement from your version. + +setlocal + +%~dp0\thermostat-common.cmd + +echo thermostat-webservice not implemented on Windows. + +set TOMCAT_DIR=tomcat + +process_args() { + while [ $# -gt 0 ]; do + THIS_ARG=$1 + shift + if [ $THIS_ARG = "-h" -o $THIS_ARG = "--help" -o $THIS_ARG = "help" ] ; then + do_help + exit + break + elif [ $THIS_ARG = "-t" ] ; then + TOMCAT_DIR=$1 + shift + elif [ $THIS_ARG = "start" -o $THIS_ARG = "stop" ] ; then + FUNCTION=$THIS_ARG + else + echo "Unrecognized argument: $THIS_ARG" + exit 1 + fi + done + check_valid_args +} + +do_start() { + rm -rf webapps/thermostat + cp -r "$TH/web/war/target/thermostat-web-war-@project.version@" webapps/thermostat + if [ $CYGWIN_MODE -eq 1 ]; then + JAVA_OPTS="-Djava.security.auth.login.config=`cygpath -w ${TH}/distribution/target/image/etc/thermostat_jaas.conf`" ./bin/startup.sh + else + JAVA_OPTS="-Djava.security.auth.login.config=${TH}/distribution/target/image/etc/thermostat_jaas.conf" ./bin/startup.sh + fi +} + +do_stop() { + ./bin/shutdown.sh +} + +do_function() { + TH="$(pwd)" + cd %TOMCAT_DIR% + case $1 in + start ) + do_start + ;; + stop ) + do_stop + ;; + esac + cd ${TH} +} + +process_args $* +do_function $FUNCTION + +:: Please be familiar with these privileges to decide whether this +:: set of users and roles is appropriate for you or your testing. +:: +:: TH="$(pwd)" +:: cd path/to/tomcat +:: rm -rf webapps/thermostat +:: cp -r $TH/web/war/target/thermostat-web-war-0.16.0-SNAPSHOT webapps/thermostat +:: export JAVA_OPTS="-Djava.security.auth.login.config=${TH}/distribution/target/image/etc/thermostat_jaas.conf" +:: ./bin/startup.sh +:: cd $TH +:: ./distribution/target/image/bin/thermostat storage --start +:: mkdir -p ~/.thermostat/etc +:: echo -e "username=agent-tester\npassword=tester" > ~/.thermostat/etc/agent.auth +:: ./distribution/target/image/bin/thermostat agent -d http://127.0.0.1:8080/thermostat/storage + + +rem functions + +:usage + echo Usage: + echo thermostat-webservice [-t <root of tomcat directory>] <start|stop> + exit /b 0 + + +:check_valid_args + if "x%FUNCTION%" = "x" ( + echo "You must specify either start, stop, or help." + call usage + exit /b 1 + ) + if not exist %TOMCAT_DIR% ( + echo "Tomcat directory does not exist: %TOMCAT_DIR%" + call usage + exit /b 1 + fi + exit /b 0 + + +print_help: +echo thermostat-webservice: A convenience script for starting and stopping +echo tomcat with thermostat web storage application deployed. +echo +echo This script is intended to be an aid for developers to start up +echo tomcat and deploy thermostat web storage app. It is assumed that +echo there is already a backing storage running that the web app can +echo connect to, and that the web.xml file from the build image is +echo correctly configured for this backing storage connection. See +echo the file: +echo +echo web/war/target/thermostat-web-war-0.16.0-SNAPSHOT/WEB-INF/web.xml +echo +echo In addition, an appropriate user and role configuration must be +echo present in the build image. See the files: +echo +echo distribution/target/image/etc/thermostat-users.properties +echo distribution/target/image/etc/thermostat-roles.properties +echo +echo An agent requires authentication configuration in order to connect +echo to secured storage. See the file: +echo +echo ~/.thermostat/etc/agent.auth +echo +echo Possible contents of thermostat-users.properties: +echo +echo agent-tester=tester +echo client-tester=tester +echo +echo Corresponding potential thermostat-roles.properties: +echo +echo agent-tester=thermostat-agent, thermostat-files-grant-write-filename-ALL +echo client-tester=thermostat-client, thermostat-cmdc-allPrivs, \\ +echo thermostat-files-grant-read-filename-ALL +echo thermostat-agent=thermostat-write, thermostat-prepare-statement, \\ +echo thermostat-save-file, thermostat-purge, \\ +echo thermostat-register-category, thermostat-cmdc-verify, \\ +echo thermostat-login, thermostat-realm +echo thermostat-client=thermostat-agents-grant-read-agentId-ALL, \\ +echo thermostat-hosts-grant-read-hostname-ALL, \\ +echo thermostat-vms-grant-read-vmId-ALL, \\ +echo thermostat-vms-grant-read-username-ALL, thermostat-realm, \\ +echo thermostat-login, thermostat-query, \\ +echo thermostat-prepare-statement, thermostat-cmdc-generate, \\ +echo thermostat-load-file, thermostat-get-count, \\ +echo thermostat-register-category +echo thermostat-cmdc-allPrivs = thermostat-cmdc-grant-garbage-collect, \\ +echo thermostat-cmdc-grant-dump-heap, \\ +echo thermostat-cmdc-grant-thread-harvester, \\ +echo thermostat-cmdc-grant-killvm, \\ +echo thermostat-cmdc-grant-ping, \\ +echo thermostat-cmdc-grant-jmx-toggle-notifications +echo +echo Please be familiar with these privileges to decide whether this +echo set of users and roles is appropriate for you or your testing. +echo +echo Contents of ~\.thermostat\etc\agent.auth that would be valid with the above: +echo +echo username=agent-tester +echo password=tester +echo +echo Here is typical use of this script: +echo +echo $ echo %USER_FLUFF% > distribution\target\image\etc\thermostat-users.properties +echo $ echo %ROLE_FLUFF% > distribution\target\image\etc\thermostat-roles.properties +echo $ echo %AGENT_FLUFF% > ~\.thermostat\etc\agent.auth +echo $ .\distribution\target\image\bin\thermostat storage --start +echo $ .\distribution\target\image\bin\thermostat-webservice -t \path\to\tomcat start +echo $ .\distribution\target\image\bin\thermostat agent -d http:/127.0.0.1:8080/thermostat/storage +echo $ .\distribution\target\image\bin\thermostat gui +echo +echo ... and so forth. +echo +echo .\distribution\target\image\bin\thermostat-webservice -t \path\to\tomcat stop +echo .\distribution\target\image\bin\thermostat storage --stop +echo +echo NOTE: Use of this script to start tomcat will blow away webapps/thermostat +echo in your tomcat directory and replace it with the corresponding contents +echo from your build image. +echo +echo NOTE2: If tomcat is already running, results of this script are undefined. +echo +echo . + +:done +exit /b 0 +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/junk/scripts/thermostat.cmd Tue Oct 04 14:08:26 2016 -0400 @@ -0,0 +1,150 @@ +@echo off + +:: Copyright 2016 Red Hat, Inc. +:: +:: This file is part of Thermostat. +:: +:: Thermostat is free software; you can redistribute it and/or modify +:: it under the terms of the GNU General Public License as published +:: by the Free Software Foundation; either version 2, or (at your +:: option) any later version. +:: +:: Thermostat is distributed in the hope that it will be useful, but +:: WITHOUT ANY WARRANTY; without even the implied warranty of +:: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +:: General Public License for more details. +:: +:: You should have received a copy of the GNU General Public License +:: along with Thermostat; see the file COPYING. If not see +:: <http://www.gnu.org/licenses/>. +:: +:: Linking this code with other modules is making a combined work +:: based on this code. Thus, the terms and conditions of the GNU +:: General Public License cover the whole combination. +:: +:: As a special exception, the copyright holders of this code give +:: you permission to link this code with independent modules to +:: produce an executable, regardless of the license terms of these +:: independent modules, and to copy and distribute the resulting +:: executable under terms of your choice, provided that you also +:: meet, for each linked independent module, the terms and conditions +:: of the license of that module. An independent module is a module +:: which is not derived from or based on this code. If you modify +:: this code, you may extend this exception to your version of the +:: library, but you are not obligated to do so. If you do not wish +:: to do so, delete this exception statement from your version. + +setlocal +setlocal EnableDelayedExpansion +set retval=0 + +call %~dp0\thermostat-common.cmd +if not "%errorlevel%"=="0" exit /b %errorlevel% + +:: //////////////////////////////////////////////////////////////////// + +:: NOTE: The following variables come from the system/user +:: profiles (if any) +:: +:: THERMOSTAT_EXT_BOOT_CLASSPATH +:: THERMOSTAT_EXT_JAVA_OPTS +:: THERMOSTAT_EXT_OPTS + +:: This is the minimal boot classpath thermostat needs. Other dependencies +:: will get started by the OSGi framework once that's up. +set BOOT_CLASSPATH=%THERMOSTAT_LIBS%\org.apache.felix.framework-@felix.framework.version@.jar +set BOOT_CLASSPATH=%BOOT_CLASSPATH%;%THERMOSTAT_LIBS%\thermostat-launcher-@project.version@.jar +set BOOT_CLASSPATH=%BOOT_CLASSPATH%;%THERMOSTAT_LIBS%\thermostat-main-@project.version@.jar +set BOOT_CLASSPATH=%BOOT_CLASSPATH%;%THERMOSTAT_LIBS%\thermostat-shared-config-@project.version@.jar + +goto skip_setclasspath +set BOOT_CLASSPATH= +for %%f in (%THERMOSTAT_LIBS%\*.jar) do ( + rem echo jar file %%f + set BOOT_CLASSPATH=!BOOT_CLASSPATH!;%f +) +:skip_setclasspath + +goto foo +echo on +set WANTED_JARS=org.apache.felix.framework- thermostat-launcher- thermostat-main- thermostat-shared-config- +set BOOT_CLASSPATH= +for %%j in (%WANTED_JARS%) do ( + rem echo jar file %%j + for %%f in (%THERMOSTAT_LIBS%\%%j*.jar) do ( + rem echo found file %f + set BOOT_CLASSPATH=!BOOT_CLASSPATH!;%f + ) +) +echo off +:foo + +echo off +set WANTED_JARS=org.apache.felix.framework-4.2.0.jar thermostat-launcher-1.99.12-SNAPSHOT.jar thermostat-main-1.99.12-SNAPSHOT.jar thermostat-shared-config-1.99.12-SNAPSHOT.jar +set BOOT_CLASSPATH=. +for %%j in (%WANTED_JARS%) do ( + rem echo jar file %%j + set BOOT_CLASSPATH=!BOOT_CLASSPATH!;%THERMOSTAT_LIBS%\%%j +) + +:: Append extra class path entries coming from the profiles +if defined THERMOSTAT_EXT_BOOT_CLASSPATH ( + set BOOT_CLASSPATH=%BOOT_CLASSPATH%;%THERMOSTAT_EXT_BOOT_CLASSPATH% +) + +goto skip1 +:usage + echo %~n0 "[-J<java-opt>] [-Tbg PIDFILE] [THERMOSTAT_ARGS]" + exit /b 1 +:skip1 + +:: start parsing arguments, we intercept jvm arguments vs thermostat specific arguments +::echo Thermostat for Windows + +set JVM_ARGS= +set CMD_ARGS= +set RUN_IN_BG=0 +set PID_FILE="" + +:cmdloop +if not x%1==x ( + if "x%1"=="x-Tbg" ( + shift + set RUN_IN_BG=1 + set PID_FILE=%1 + goto argparsed + ) + if "-J"=="%1:~0,2%" ( + set JVM_ARGS=!JAVA_ARGS! %1:~2% + goto argparsed + ) + set CMD_ARGS=%CMD_ARGS% %1 +:argparsed + shift + goto cmdloop +) + +:: in a VM, jline can cause 100 CPU usage on Windows without this +set THERMOSTAT_EXT_JAVA_OPTS=%THERMOSTAT_EXT_JAVA_OPTS% -Djline.terminal=jline.UnsupportedTerminal + +:: Finally run thermostat (optionally in the background +if "%RUN_IN_BG%"=="1" ( + :: The thermostat-agent-sysd script uses this. + if not defined PID_FILE ( + echo "PID_FILE must be defined" + exit /b 1 + ) else ( + start "%JAVA%" %THERMOSTAT_EXT_JAVA_OPTS% %LOGGING_ARGS% "%JVM_ARGS%" -cp "%BOOT_CLASSPATH%" %THERMOSTAT_MAIN% %THERMOSTAT_EXT_OPTS% %CMD_ARGS% + set retval=%ERRORLEVEL% + rem TODO echo thejavapid to a PID_FILE + ) +) else ( + %JAVA% %THERMOSTAT_EXT_JAVA_OPTS% %LOGGING_ARGS% %JVM_ARGS% -cp %BOOT_CLASSPATH% %THERMOSTAT_MAIN% %THERMOSTAT_EXT_OPTS% %CMD_ARGS% + set retval=%ERRORLEVEL% +) +endlocal + +exit /b %retval% + + +