modules/enterprise/remoting/cli/pom.xml
| 19 ++
modules/enterprise/remoting/cli/src/etc/Remoting_Setup.txt
| 43 -----
modules/enterprise/remoting/cli/src/etc/build.xml
| 80 ----------
modules/enterprise/remoting/cli/src/etc/generate-jaxb-client-types.bat
| 16 --
modules/enterprise/remoting/cli/src/etc/generate-jaxb-client-types.sh
| 18 --
modules/enterprise/remoting/cli/src/etc/rhq-cli-env.bat
| 32 +++-
modules/enterprise/remoting/cli/src/etc/rhq-cli-env.sh
| 32 +++-
modules/enterprise/remoting/cli/src/etc/rhq-cli.bat
| 51 +++++-
modules/enterprise/remoting/cli/src/etc/rhq-cli.sh
| 51 +++++-
modules/enterprise/remoting/cli/src/etc/toRun.txt
| 3
modules/enterprise/remoting/cli/src/main/java/org/rhq/enterprise/client/script/ModulesDirectoryScriptSourceProvider.java
| 33 +++-
modules/enterprise/remoting/cli/src/main/scripts/rhq-client.build.xml
| 2
modules/enterprise/remoting/cli/src/test/java/org/rhq/enterprise/client/script/ModulesDirectoryScriptSourceProviderTest.java
| 67 ++++++++
13 files changed, 258 insertions(+), 189 deletions(-)
New commits:
commit 83d7c260f412c218c12374642174a9af0e2ac23d
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Thu Dec 12 22:43:55 2013 +0100
Better testability in the ModulesDirectoryScriptSourceProvider.
Also changed the default module path from "./samples/modules" to
"./modules". This should be safe with the fix for BZ 959603 which
causes the CLI to always pass the system property to load the modules
from. The new default path is less coupled with the FS layout of the CLI
distribution.
diff --git
a/modules/enterprise/remoting/cli/src/main/java/org/rhq/enterprise/client/script/ModulesDirectoryScriptSourceProvider.java
b/modules/enterprise/remoting/cli/src/main/java/org/rhq/enterprise/client/script/ModulesDirectoryScriptSourceProvider.java
index 0e46abe..6040e8e 100644
---
a/modules/enterprise/remoting/cli/src/main/java/org/rhq/enterprise/client/script/ModulesDirectoryScriptSourceProvider.java
+++
b/modules/enterprise/remoting/cli/src/main/java/org/rhq/enterprise/client/script/ModulesDirectoryScriptSourceProvider.java
@@ -30,13 +30,38 @@ import java.net.URI;
*/
public class ModulesDirectoryScriptSourceProvider extends FileSystemScriptSourceProvider
{
- private static final File ROOT_DIR = new
File(System.getProperty("rhq.scripting.modules.root-dir",
"./samples/modules"));
private static final String SCHEME = "modules";
-
+
+ private File rootDir;
+
+ /**
+ * Creates a new instance of module script source provider that looks for the module
sources in a directory
+ * specified by the "rhq.scripting.modules.root-dir" system property. If
none such exists, the default value
+ * is assumed to be "./modules".
+ */
public ModulesDirectoryScriptSourceProvider() {
+ this(new File(System.getProperty("rhq.scripting.modules.root-dir",
"./modules")));
+ }
+
+ /**
+ * Provided for testing purposes. A script source provider is only instantiated
through its no-arg constructor
+ * in the scripting environment.
+ *
+ * @param rootDir the root directory under which to locate module sources
+ */
+ public ModulesDirectoryScriptSourceProvider(File rootDir) {
super(SCHEME);
+ this.rootDir = rootDir;
}
-
+
+ public File getRootDir() {
+ return rootDir;
+ }
+
+ public void setRootDir(File rootDir) {
+ this.rootDir = rootDir;
+ }
+
@Override
protected File getFile(URI location) {
String path = location.getPath();
@@ -44,6 +69,6 @@ public class ModulesDirectoryScriptSourceProvider extends
FileSystemScriptSource
//remove the leading /
path = path.substring(1);
- return new File(ROOT_DIR, path);
+ return new File(rootDir, path);
}
}
diff --git
a/modules/enterprise/remoting/cli/src/test/java/org/rhq/enterprise/client/script/ModulesDirectoryScriptSourceProviderTest.java
b/modules/enterprise/remoting/cli/src/test/java/org/rhq/enterprise/client/script/ModulesDirectoryScriptSourceProviderTest.java
new file mode 100644
index 0000000..4060d07
--- /dev/null
+++
b/modules/enterprise/remoting/cli/src/test/java/org/rhq/enterprise/client/script/ModulesDirectoryScriptSourceProviderTest.java
@@ -0,0 +1,67 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2013 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program 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 version 2 of the License.
+ *
+ * This program 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+package org.rhq.enterprise.client.script;
+
+import static org.testng.Assert.assertEquals;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.net.URI;
+import java.net.URISyntaxException;
+
+import org.junit.BeforeClass;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.Test;
+
+/**
+ * @author Lukas Krejci
+ * @since 4.10.0
+ */
+@Test
+public class ModulesDirectoryScriptSourceProviderTest {
+
+ private File scriptFile;
+
+ @BeforeClass
+ public void createScriptFile() throws IOException {
+ scriptFile = File.createTempFile("modules-test", ".js", new
File("."));
+ PrintWriter wrt = new PrintWriter(new FileOutputStream(scriptFile));
+ try {
+ wrt.write("var a = 2;");
+ } finally {
+ wrt.close();
+ }
+ }
+
+ @AfterClass
+ public void deleteScriptFile() {
+ scriptFile.delete();
+ }
+
+ public void testLoad() throws URISyntaxException {
+ ModulesDirectoryScriptSourceProvider provider = new
ModulesDirectoryScriptSourceProvider(new File("."));
+
+ File f = provider.getFile(new URI("modules:/" +
scriptFile.getName()));
+
+ assertEquals(f, scriptFile, "Unexpected file loaded");
+ }
+}
commit f35bbe1a20a775c8273b551a924261e254dd199d
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Thu Dec 12 23:10:14 2013 +0100
[BZ 959603] - Don't change CWD on CLI startup.
Since the very beginning of CLI, RHQ always changed the CWD to
$RHQ_CLI_HOME when starting up, which is rather strange and
non-standard.
To keep the backwards compatibility, the behavior can be toggled on
or off.
The default behavior can be changed in the build by setting the
rhq.cli.change-dir-on-start-default
property. In RHQ, this defaults to "false", causing RHQ to NOT change
directories when starting up the CLI anymore.
Further, the behavior can be toggled by the user by setting the
RHQ_CLI_CHANGE_DIR_ON_START environment variable to "true" (or any
other value but "false" actually) or "false" explicitly.
Additionally, a new environment variable called "RHQ_CLI_MODULES_DIR"
was added. This was necessary to not break the loading of the
provided CommonJS modules available in the
$RHQ_CLI_HOME/samples/modules directory if the CLI was started from
another directory.
By adding the new RHQ_CLI_MODULES_DIR, which is initialized to the
correct value if not provided externally, we correctly load the
sample modules with the additional benefit of easier change of the
modules location for the user (previously this was only possible
through
RHQ_CLI_ADDITIONAL_JAVA_OPTS="-Drhq.scripting.modules.root-dir=..."
, while now one only needs RHQ_CLI_MODULES_DIR=...).
diff --git a/modules/enterprise/remoting/cli/pom.xml
b/modules/enterprise/remoting/cli/pom.xml
index 7515110..296b490 100644
--- a/modules/enterprise/remoting/cli/pom.xml
+++ b/modules/enterprise/remoting/cli/pom.xml
@@ -13,7 +13,11 @@
<name>RHQ Enterprise Remote CLI</name>
<description>RHQ Enterprise Remote Command Line Interface</description>
-
+
+ <properties>
+
<rhq.cli.change-dir-on-start-default>false</rhq.cli.change-dir-on-start-default>
+ </properties>
+
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
@@ -78,7 +82,18 @@
</dependencies>
<build>
- <plugins>
+ <resources>
+ <resource>
+ <directory>src/etc</directory>
+ <filtering>true</filtering>
+
<targetPath>${project.build.outputDirectory}/../etc</targetPath>
+ </resource>
+ <resource>
+ <directory>src/main/resources</directory>
+ </resource>
+ </resources>
+
+ <plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
diff --git a/modules/enterprise/remoting/cli/src/etc/rhq-cli-env.bat
b/modules/enterprise/remoting/cli/src/etc/rhq-cli-env.bat
index d5d1189..dcf1ec8 100644
--- a/modules/enterprise/remoting/cli/src/etc/rhq-cli-env.bat
+++ b/modules/enterprise/remoting/cli/src/etc/rhq-cli-env.bat
@@ -37,7 +37,7 @@ rem CLI's defaults. If you only want to add
options
rem to the CLI's defaults, then you will want to
rem use RHQ_CLI_ADDITIONAL_JAVA_OPTS instead.
rem
-rem set RHQ_CLI_JAVA_OPTS=-Xms64m -Xmx128m -Djava.net.preferIPv4Stack=true
+rem set RHQ_CLI_JAVA_OPTS=-Xms64m -Xmx128m -Djava.net.preferIPv4Stack=true
-Drhq.scripting.modules.root-dir="%RHQ_CLI_MODULES_DIR%"
rem RHQ_CLI_JAVA_ENDORSED_DIRS - Java VM command line option to set the
rem endorsed dirs for the CLI's VM. If this
@@ -74,3 +74,33 @@ rem line options and the ones specified
here will
rem be passed to the CLI.
rem
rem set RHQ_CLI_CMDLINE_OPTS=
+
+rem RHQ_CLI_CHANGE_DIR_ON_START - By setting this variable to true (or any
+rem other value than "false") you can make
RHQ
+rem change the directory to $RHQ_CLI_HOME when
+rem starting the CLI. When this variable is set
+rem to false, the current working directory is
+rem NOT changed when starting the CLI.
+rem
+rem If not set, this variable is understood
+rem to be: ${rhq.cli.change-dir-on-start-default}
+rem set RHQ_CLI_CHANGE_DIR_ON_START=true
+
+rem RHQ_CLI_MODULES_DIR - The default location from which to load CommonJS
+rem modules available through the "modules:/" scheme
+rem is $RHQ_CLI_HOME/samples/modules.
+rem Setting this variable to another value, causes
+rem the modules to be loaded from another location.
+rem
+rem Notice that this can be a relative path, too.
+rem For example, setting:
+rem RHQ_CLI_MODULES_DIR=./modules
+rem would cause the CLI to load modules from the
+rem "modules" subdirectory of whichever current
+rem working directory it is started from.
+rem (See RHQ_CLI_JAVA_OPTS and
+rem RHQ_CLI_CHANGE_DIR_ON_START variables above for
+rem further details of this approach).
+rem
+rem set RHQ_CLI_MODULE_DIR=Z:\company-wide\rhq\cli\modules
+
diff --git a/modules/enterprise/remoting/cli/src/etc/rhq-cli-env.sh
b/modules/enterprise/remoting/cli/src/etc/rhq-cli-env.sh
index 2c0affa..112ec66 100755
--- a/modules/enterprise/remoting/cli/src/etc/rhq-cli-env.sh
+++ b/modules/enterprise/remoting/cli/src/etc/rhq-cli-env.sh
@@ -41,7 +41,7 @@
# to the CLI's defaults, then you will want to
# use RHQ_CLI_ADDITIONAL_JAVA_OPTS instead.
#
-#RHQ_CLI_JAVA_OPTS="-Xms64m -Xmx128m -Djava.net.preferIPv4Stack=true"
+#RHQ_CLI_JAVA_OPTS="-Xms64m -Xmx128m -Djava.net.preferIPv4Stack=true
-Drhq.scripting.modules.root-dir=${RHQ_CLI_MODULES_DIR}"
# RHQ_CLI_JAVA_ENDORSED_DIRS - Java VM command line option to set the
# endorsed dirs for the CLI's VM. If this
@@ -78,3 +78,33 @@
# be passed to the CLI.
#
#RHQ_CLI_CMDLINE_OPTS=""
+
+# RHQ_CLI_CHANGE_DIR_ON_START - By setting this variable to true (or any
+# other value than "false") you can make RHQ
+# change the directory to $RHQ_CLI_HOME when
+# starting the CLI. When this variable is set
+# to false, the current working directory is
+# NOT changed when starting the CLI.
+#
+# If not set, this variable is understood
+# to be: ${rhq.cli.change-dir-on-start-default}
+#RHQ_CLI_CHANGE_DIR_ON_START=true
+
+# RHQ_CLI_MODULES_DIR - The default location from which to load CommonJS
+# modules available through the "modules:/" scheme
+# is $RHQ_CLI_HOME/samples/modules.
+# Setting this variable to another value, causes
+# the modules to be loaded from another location.
+#
+# Notice that this can be a relative path, too.
+# For example, setting:
+# RHQ_CLI_MODULES_DIR=./modules
+# would cause the CLI to load modules from the
+# "modules" subdirectory of whichever current
+# working directory it is started from.
+# (See RHQ_CLI_JAVA_OPTS and
+# RHQ_CLI_CHANGE_DIR_ON_START variables above for
+# further details of this approach).
+#
+#RHQ_CLI_MODULE_DIR=/opt/company-wide/rhq/cli/modules
+
diff --git a/modules/enterprise/remoting/cli/src/etc/rhq-cli.bat
b/modules/enterprise/remoting/cli/src/etc/rhq-cli.bat
index 8c96ed7..13dd762 100644
--- a/modules/enterprise/remoting/cli/src/etc/rhq-cli.bat
+++ b/modules/enterprise/remoting/cli/src/etc/rhq-cli.bat
@@ -20,13 +20,6 @@ if "%RHQ_CLI_DEBUG%" == "false" (
set RHQ_CLI_DEBUG=
)
-rem ----------------------------------------------------------------------
-rem Change directory so the current directory is the CLI home.
-rem Here we assume this script is a child directory of the CLI home
-rem We also assume our custom environment script is located in the same
-rem place as this script.
-rem ----------------------------------------------------------------------
-
set RHQ_CLI_BIN_DIR_PATH=%~dp0
if exist "%RHQ_CLI_BIN_DIR_PATH%\rhq-cli-env.bat" (
@@ -36,11 +29,38 @@ if exist "%RHQ_CLI_BIN_DIR_PATH%\rhq-cli-env.bat" (
if defined RHQ_CLI_DEBUG echo No environment script found at:
%RHQ_CLI_BIN_DIR_PATH%\rhq-cli-env.bat
)
-rem if debug variable is set, it is assumed to be on, unless its value is false
+rem this variable is set during the build and defines the desired default behavior for
directory changing
+rem we do want to change the dir in RHQ, but possibly don't want to do that in JBoss
ON for backwards compatibility
+rem reasons.
+set RHQ_CLI_CHANGE_DIR_ON_START_DEFAULT=${rhq.cli.change-dir-on-start-default}
+
+if not defined RHQ_CLI_CHANGE_DIR_ON_START (
+ set RHQ_CLI_CHANGE_DIR_ON_START=%RHQ_CLI_CHANGE_DIR_ON_START_DEFAULT%
+)
+
+rem RHQ_CLI_CHANGE_DIR_ON_START behaves the same as RHQ_CLI_DEBUG - if set, it is assumed
on, unless equal to false
+if "%RHQ_CLI_CHANGE_DIR_ON_START%" == "false" (
+ set RHQ_CLI_CHANGE_DIR_ON_START=
+)
+
+rem if debug variable is set, it is assumed to be on, unless its value is false (do this
again after we've loaded
+rem the env script)
if "%RHQ_CLI_DEBUG%" == "false" (
set RHQ_CLI_DEBUG=
)
+rem ----------------------------------------------------------------------
+rem Change directory so the current directory is the CLI home.
+rem Here we assume this script is a child directory of the CLI home
+rem We also assume our custom environment script is located in the same
+rem place as this script.
+rem ----------------------------------------------------------------------
+
+rem since RHQ 4.10.0 we don't change the directory to the RHQ_CLI_HOME by default
+if not defined RHQ_CLI_CHANGE_DIR_ON_START (
+ pushd .
+)
+
if not defined RHQ_CLI_HOME (
cd "%RHQ_CLI_BIN_DIR_PATH%\.."
) else (
@@ -52,9 +72,22 @@ if not defined RHQ_CLI_HOME (
set RHQ_CLI_HOME=%CD%
+rem since RHQ 4.10.0 we don't change the directory to the RHQ_CLI_HOME by default
+if not defined RHQ_CLI_CHANGE_DIR_ON_START (
+ popd
+)
+
if defined RHQ_CLI_DEBUG echo RHQ_CLI_HOME: %RHQ_CLI_HOME%
rem ----------------------------------------------------------------------
+rem Prepare the modules:/ script source provider to by default load our
+rem sample modules.
+rem ----------------------------------------------------------------------
+if not defined RHQ_CLI_MODULES_DIR (
+ set RHQ_CLI_MODULES_DIR="%RHQ_CLI_HOME%\samples\modules"
+)
+
+rem ----------------------------------------------------------------------
rem Find the Java executable and verify we have a VM available
rem Note that RHQ_CLI_JAVA_* props are still handled for back compat
rem ----------------------------------------------------------------------
@@ -105,7 +138,7 @@ rem Prepare the VM command line options to be passed in
rem ----------------------------------------------------------------------
if not defined RHQ_CLI_JAVA_OPTS (
- set RHQ_CLI_JAVA_OPTS=-Xms64m -Xmx128m -Djava.net.preferIPv4Stack=true
+ set RHQ_CLI_JAVA_OPTS=-Xms64m -Xmx128m -Djava.net.preferIPv4Stack=true
-Drhq.scripting.modules.root-dir="%RHQ_CLI_MODULES_DIR%"
)
if defined RHQ_CLI_DEBUG echo RHQ_CLI_JAVA_OPTS: %RHQ_CLI_JAVA_OPTS%
diff --git a/modules/enterprise/remoting/cli/src/etc/rhq-cli.sh
b/modules/enterprise/remoting/cli/src/etc/rhq-cli.sh
index 9fce451..8399b50 100644
--- a/modules/enterprise/remoting/cli/src/etc/rhq-cli.sh
+++ b/modules/enterprise/remoting/cli/src/etc/rhq-cli.sh
@@ -49,20 +49,51 @@ else
debug_msg "No environment script found at:
${RHQ_CLI_BIN_DIR_PATH}/rhq-cli-env.sh"
fi
-if [ -z "$RHQ_CLI_HOME" ]; then
- cd "${RHQ_CLI_BIN_DIR_PATH}/.."
-else
- cd "${RHQ_CLI_HOME}" || {
- echo "Cannot go to the RHQ_CLI_HOME directory: ${RHQ_CLI_HOME}"
- exit 1
- }
+# this variable is set during the build and defines the desired default behavior for
directory changing
+# we do want to change the dir in RHQ, but possibly don't want to do that in JBoss ON
for backwards compatibility
+# reasons.
+RHQ_CLI_CHANGE_DIR_ON_START_DEFAULT=${rhq.cli.change-dir-on-start-default}
+if [ -z "$RHQ_CLI_CHANGE_DIR_ON_START" ]; then
+ RHQ_CLI_CHANGE_DIR_ON_START="$RHQ_CLI_CHANGE_DIR_ON_START_DEFAULT"
fi
-RHQ_CLI_HOME=`pwd`
+# Only change the directory on start when told so. This is new in RHQ 4.10.0.
+# Previous versions always changed directory.
+if [ -n "$RHQ_CLI_CHANGE_DIR_ON_START" -a
"$RHQ_CLI_CHANGE_DIR_ON_START" != "false" ]; then
+ if [ -z "$RHQ_CLI_HOME" ]; then
+ cd "${RHQ_CLI_BIN_DIR_PATH}/.."
+ else
+ cd "${RHQ_CLI_HOME}" || {
+ echo "Cannot go to the RHQ_CLI_HOME directory: ${RHQ_CLI_HOME}"
+ exit 1
+ }
+ fi
+ RHQ_CLI_HOME=`pwd`
+else
+ if [ -z "$RHQ_CLI_HOME" ]; then
+ RHQ_CLI_HOME="${RHQ_CLI_BIN_DIR_PATH}/.."
+ fi
+
+ #get an absolute path
+ RHQ_CLI_HOME=`readlink -f "$RHQ_CLI_HOME"`
+
+ if [ ! -d "$RHQ_CLI_HOME" ]; then
+ echo "RHQ_CLI_HOME detected or defined as [${RHQ_CLI_HOME}] doesn't seem
to exist or is not a directory"
+ exit 1
+ fi
+fi
debug_msg "RHQ_CLI_HOME: $RHQ_CLI_HOME"
# ----------------------------------------------------------------------
+# Prepare the modules:/ script source provider to by default load our
+# sample modules.
+# ----------------------------------------------------------------------
+if [ -z "$RHQ_CLI_MODULES_DIR" ]; then
+ RHQ_CLI_MODULES_DIR="${RHQ_CLI_HOME}/samples/modules"
+fi
+
+# ----------------------------------------------------------------------
# If we are on a Mac and JAVA_HOME is not set, then set it to /usr
# as this is the default location.
# ----------------------------------------------------------------------
@@ -113,8 +144,6 @@ for _JAR in $_JAR_FILES ; do
fi
debug_msg "CLASSPATH entry: $_JAR"
done
-_JAR="${RHQ_CLI_HOME}/jbossws-native-dist/deploy/lib/jbossws-client.jar"
-CLASSPATH="${CLASSPATH}:${_JAR}"
debug_msg "CLASSPATH entry: $_JAR"
# ----------------------------------------------------------------------
@@ -122,7 +151,7 @@ debug_msg "CLASSPATH entry: $_JAR"
# ----------------------------------------------------------------------
if [ -z "$RHQ_CLI_JAVA_OPTS" ]; then
- RHQ_CLI_JAVA_OPTS="-Xms64m -Xmx128m -Djava.net.preferIPv4Stack=true"
+ RHQ_CLI_JAVA_OPTS="-Xms64m -Xmx128m -Djava.net.preferIPv4Stack=true
-Drhq.scripting.modules.root-dir=${RHQ_CLI_MODULES_DIR}"
fi
debug_msg "RHQ_CLI_JAVA_OPTS: $RHQ_CLI_JAVA_OPTS"
diff --git a/modules/enterprise/remoting/cli/src/main/scripts/rhq-client.build.xml
b/modules/enterprise/remoting/cli/src/main/scripts/rhq-client.build.xml
index 1836e9f..a752037 100644
--- a/modules/enterprise/remoting/cli/src/main/scripts/rhq-client.build.xml
+++ b/modules/enterprise/remoting/cli/src/main/scripts/rhq-client.build.xml
@@ -26,7 +26,7 @@
<target name="prepare-bin-dir">
<echo>*** Populating bin scripts...</echo>
<copy verbose="true" toDir="${bin.home}">
- <fileset dir="${basedir}/src/etc/" includes="rhq-cli*.*"
/>
+ <fileset dir="${basedir}/target/etc/"
includes="rhq-cli*.*" />
</copy>
<chmod dir="${bin.home}" perm="ug+rx"
includes="*.sh" />
</target>
commit a2d1d54d12433edf375134a1aa2c36581edda636
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Thu Dec 12 13:43:56 2013 +0100
Removing old WS client files from CLI codebase
diff --git a/modules/enterprise/remoting/cli/src/etc/Remoting_Setup.txt
b/modules/enterprise/remoting/cli/src/etc/Remoting_Setup.txt
deleted file mode 100644
index 10bf3dc..0000000
--- a/modules/enterprise/remoting/cli/src/etc/Remoting_Setup.txt
+++ /dev/null
@@ -1,43 +0,0 @@
-# Steps to build and run Remoting CLI:
-
-i) Checkout RHQ
-
-ii) Enable [rhq_source]/modules/enterprise/client/src/main/java as a java source
directory for your ide. For eclipse users, 'use as source folder'
-
-iii) Build RHQ from [rhq_source] and enable the Webservice endpoints by passing in the
following additional parameter at build time:
- -Drhq.server.enable.ws
-
-iv) Run rhq as normal and after startup, verify that your webservices are deployed at
http://[server]:7080/jbossws/services
-
-v) Until we figure out how to correctly fit this client side portion into the maven
build, or even if, the following will need to be done in your IDE/Dev environment to get
the client side JAXB generated types to run the following steps successfully. Jay is
tasked with Maven-izing it.
- a) Open up a shell and navigate to [rhq_source]/modules/enterprise/client/src/ and run
generate-jaxb-client-types.sh/bat script to generate all JAXB types to ./output directory.
- b) Add ./output directory to the top of your classpath setup in your IDE.
- c) Add the XStream 1.2.2 library from your maven repository to the classpath for your
project as well.
- d) Download JLine 0.9.94 library and add it to the classpath for your project as
well.
-
-vi) Run the test suite (currently incomplete and we'll be enhancing it as we move
forward) by:
- a)Log into the RHQ GUI client and create a new WS test user, u:ws-test p:ws-test and
the "Super User" Role.
- b)You should be able to startup XMLClientMainTest.java from you IDE and run it as a
junit test.
-
-
-Notes:
--i) Take extra care that the classes that you are using for the exposed SLSBs are coming
out of the 'org.rhq.enterprise.server.ws' package only. Any components that are
using types NOT from these client side JAXB elements is using server side types which we
do NOT want to do. We need to continue to operate as a pure JAXB client so that we most
closely mimic the operating environment for all WS* clients.
-
-ii) Sometimes it is helpful when debugging the webservice interface to see what the
client side or server side type actually looks like as XML. XStream, while inefficient
for serializing arbitrary java object trees, is much less picky about serializing these
object trees so you can get a quick picture of a given object. JAXB typically will not
serialize unless you do some extra coding.
-
-
-iii) After jaxb type generation may need to:
-
- A)
-Navigate to org.rhq.enterprise.server.ws.ContentManagerRemote.getPackageTypes and change
-
-throws ResourceTypeNotFoundException_Exception
- to
-throws ResourceTypeNotFoundException
-
- B) Navigate to and change
-public class ResourceTypeNotFoundException {
- to
-public class ResourceTypeNotFoundException extends Throwable {
-
- C) Delete the ResourceTypeNotFoundException_Exception class.
diff --git a/modules/enterprise/remoting/cli/src/etc/build.xml
b/modules/enterprise/remoting/cli/src/etc/build.xml
deleted file mode 100644
index 6aa91c1..0000000
--- a/modules/enterprise/remoting/cli/src/etc/build.xml
+++ /dev/null
@@ -1,80 +0,0 @@
-<project name="RHQ Remoting" basedir="."
default="jar">
-
- <!--location that JAXB remote ws types are compiled to -->
- <property name="rhq-jaxb-types-location"
- location="${basedir}/output"/>
-
- <!--location that RHQ client classes are compiled to -->
- <property name="rhq-remote-classes"
- location="${basedir}/bin"/>
-
- <!--location for JLine dependency -->
- <property name="jline-jar"
- location="C:/installers/Jline/jline-0.9.94/jline-0.9.94.jar"/>
-
- <!-- -->
- <property name="repo" location="C:/Documents and
Settings/Simeon/.m2/repository"/>
-
- <!--location for Gnu-Getopt dependency -->
- <property name="gnu-jar"
- location="${repo}/gnu-getopt/getopt/1.0.13/getopt-1.0.13.jar"/>
-
- <!--location for Gnu-Getopt dependency -->
- <property name="i18-jar"
- location="${repo}/i18nlog/i18nlog/1.0.10/i18nlog-1.0.10.jar"/>
-
- <property name="runLocation" value="${basedir}/run"/>
-
- <path id="project.class.path">
- <pathelement location="${runLocation}/getopt-1.0.13.jar"/>
- <pathelement location="${runLocation}/remoting.jar"/>
- <pathelement location="${runLocation}/jline-0.9.94.jar"/>
- <pathelement location="${runLocation}/i18nlog-1.0.10.jar"/>
-<!-- <pathelement path="${java.class.path}/"/>
- <pathelement path="${additional.path}"/> -->
- </path>
-
-
- <!--This target bundles up the remoting elements as an
- executable jar
- -->
- <target name="jar" description="Make executable jar">
- <delete file="${runLocation}/remoting.jar"/>
- <jar destfile="${runLocation}/remoting.jar"
- basedir="${rhq-remote-classes}"
- includes="org/rhq/**"
- excludes="**/WsFindGroupsCommand.class"
- />
-
- <!-- Copy all necessary jars to that location too -->
- <copy tofile="${runLocation}/jline-0.9.94.jar"
file="${jline-jar}"/>
- <copy tofile="${runLocation}/getopt-1.0.13.jar"
file="${gnu-jar}"/>
- <copy tofile="${runLocation}/i18nlog-1.0.10.jar"
file="${i18-jar}"/>
- <copy tofile="${runLocation}/toRun.txt"
file="${basedir}/toRun.txt"/>
-<!-- <copy todir="${runLocation}">
- <fileset dir="src_dir" excludes="**/*.java"/>
- </copy> -->
-
- </target>
-
- <target name="zip" depends="jar">
- <delete file="${runLocation}/bundle.zip"/>
- <zip destfile="${runLocation}/bundle.zip"
- basedir="${runLocation}"
- />
- </target>
-
- <target name="run">
- <java classname="org.rhq.enterprise.client.ClientMain">
- <!-- <arg value="-h"/> -->
- <classpath refid="project.class.path">
- <!-- <pathelement refid="project.class.path"/>
- <pathelement path="${java.class.path}"/> -->
-
- </classpath>
- </java>
-
-
- </target>
-
-</project>
diff --git a/modules/enterprise/remoting/cli/src/etc/generate-jaxb-client-types.bat
b/modules/enterprise/remoting/cli/src/etc/generate-jaxb-client-types.bat
deleted file mode 100644
index 68e8706..0000000
--- a/modules/enterprise/remoting/cli/src/etc/generate-jaxb-client-types.bat
+++ /dev/null
@@ -1,16 +0,0 @@
-rem This script should consume all the wsdls and compile the JAXB types all
-rem into one directory.
-
-call ../../../../dev-container/jbossas/bin/wsconsume.bat -k
http://127.0.0.1:7080/rhq-rhq-server/RoleManagerBean?wsdl -p org.rhq.enterprise.server.ws
-
-call ../../../../dev-container/jbossas/bin/wsconsume.bat -k
http://127.0.0.1:7080/rhq-rhq-server/ContentManagerBean?wsdl -p
org.rhq.enterprise.server.ws
-
-call ../../../../dev-container/jbossas/bin/wsconsume.bat -k
http://127.0.0.1:7080/rhq-rhq-server/SubjectManagerBean?wsdl -p
org.rhq.enterprise.server.ws
-
-call ../../../../dev-container/jbossas/bin/wsconsume.bat -k
http://127.0.0.1:7080/rhq-rhq-server/OperationManagerBean?wsdl -p
org.rhq.enterprise.server.ws
-
-call ../../../../dev-container/jbossas/bin/wsconsume.bat -k
http://127.0.0.1:7080/rhq-rhq-server/RepoManagerBean?wsdl -p org.rhq.enterprise.server.ws
-
-call ../../../../dev-container/jbossas/bin/wsconsume.bat -k
http://127.0.0.1:7080/rhq-rhq-server/ConfigurationManagerBean?wsdl -p
org.rhq.enterprise.server.ws
-
-call ../../../../dev-container/jbossas/bin/wsconsume.bat -k
http://127.0.0.1:7080/rhq-rhq-server/ResourceManagerBean?wsdl -p
org.rhq.enterprise.server.ws
\ No newline at end of file
diff --git a/modules/enterprise/remoting/cli/src/etc/generate-jaxb-client-types.sh
b/modules/enterprise/remoting/cli/src/etc/generate-jaxb-client-types.sh
deleted file mode 100644
index f83293b..0000000
--- a/modules/enterprise/remoting/cli/src/etc/generate-jaxb-client-types.sh
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/sh
-
-# This script should consume all the wsdls and compile the JAXB types all
-# into one directory.
-
-../../../../dev-container/jbossas/bin/wsconsume.sh -k
http://localhost:7080/rhq-rhq-server/RoleManagerBean?wsdl -p org.rhq.enterprise.server.ws
-
-../../../../dev-container/jbossas/bin/wsconsume.sh -k
http://localhost:7080/rhq-rhq-server/ContentManagerBean?wsdl -p
org.rhq.enterprise.server.ws
-
-../../../../dev-container/jbossas/bin/wsconsume.sh -k
http://localhost:7080/rhq-rhq-server/SubjectManagerBean?wsdl -p
org.rhq.enterprise.server.ws
-
-../../../../dev-container/jbossas/bin/wsconsume.sh -k
http://localhost:7080/rhq-rhq-server/OperationManagerBean?wsdl -p
org.rhq.enterprise.server.ws
-
-../../../../dev-container/jbossas/bin/wsconsume.sh -k
http://localhost:7080/rhq-rhq-server/RepoManagerBean?wsdl -p org.rhq.enterprise.server.ws
-
-../../../../dev-container/jbossas/bin/wsconsume.sh -k
http://localhost:7080/rhq-rhq-server/ConfigurationManagerBean?wsdl -p
org.rhq.enterprise.server.ws
-
-../../../../dev-container/jbossas/bin/wsconsume.sh -k
http://localhost:7080/rhq-rhq-server/ResourceManagerBean?wsdl -p
org.rhq.enterprise.server.ws
\ No newline at end of file
diff --git a/modules/enterprise/remoting/cli/src/etc/toRun.txt
b/modules/enterprise/remoting/cli/src/etc/toRun.txt
deleted file mode 100644
index a86a75b..0000000
--- a/modules/enterprise/remoting/cli/src/etc/toRun.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-java -cp getopt-1.0.13.jar:remoting.jar:jline-0.9.94.jar:i18nlog-1.0.9.jar
org.rhq.enterprise.client.ClientMain
-
-java -cp getopt-1.0.13.jar;remoting.jar;jline-0.9.94.jar;i18nlog-1.0.9.jar
org.rhq.enterprise.client.ClientMain
\ No newline at end of file