[rhq] Branch 'mazz/test-rhq-on-as7' - modules/enterprise
mazz
mazz at fedoraproject.org
Wed Aug 1 23:50:11 UTC 2012
modules/enterprise/gui/gwt-installer-war/pom.xml | 407 ------
modules/enterprise/gui/gwt-installer-war/src/main/java/org/rhq/common/jbossas/client/controller/Address.java | 82 -
modules/enterprise/gui/gwt-installer-war/src/main/java/org/rhq/common/jbossas/client/controller/DatasourceJBossASClient.java | 34
modules/enterprise/gui/gwt-installer-war/src/main/java/org/rhq/common/jbossas/client/controller/FailureException.java | 77 -
modules/enterprise/gui/gwt-installer-war/src/main/java/org/rhq/common/jbossas/client/controller/JBossASClient.java | 304 ----
modules/enterprise/gui/gwt-installer-war/src/main/java/org/rhq/common/jbossas/client/controller/SecurityDomainJBossASClient.java | 110 -
modules/enterprise/gui/gwt-installer-war/src/main/java/org/rhq/enterprise/gui/installer/client/Installer.java | 651 ----------
modules/enterprise/gui/gwt-installer-war/src/main/java/org/rhq/enterprise/gui/installer/client/ServerPropertyRecordList.java | 62
modules/enterprise/gui/gwt-installer-war/src/main/java/org/rhq/enterprise/gui/installer/client/gwt/InstallerGWTService.java | 105 -
modules/enterprise/gui/gwt-installer-war/src/main/java/org/rhq/enterprise/gui/installer/client/shared/ServerDetails.java | 115 -
modules/enterprise/gui/gwt-installer-war/src/main/java/org/rhq/enterprise/gui/installer/client/shared/ServerProperties.java | 53
modules/enterprise/gui/gwt-installer-war/src/main/java/org/rhq/enterprise/gui/installer/server/service/ManagementService.java | 100 -
modules/enterprise/gui/gwt-installer-war/src/main/java/org/rhq/enterprise/gui/installer/server/servlet/InstallerGWTServiceImpl.java | 161 --
modules/enterprise/gui/gwt-installer-war/src/main/java/org/rhq/enterprise/gui/installer/server/servlet/ServerInstallUtil.java | 274 ----
modules/enterprise/gui/gwt-installer-war/src/main/resources/org/rhq/enterprise/gui/installer/Installer.gwt.xml | 35
modules/enterprise/gui/gwt-installer-war/src/main/resources/org/rhq/enterprise/gui/installer/client/Messages.properties | 21
modules/enterprise/gui/gwt-installer-war/src/main/resources/org/rhq/enterprise/gui/installer/client/ServerPropertiesMessages.properties | 23
modules/enterprise/gui/gwt-installer-war/src/main/webapp/WEB-INF/classes/META-INF/services/org.jboss.msc.service.ServiceActivator | 1
modules/enterprise/gui/gwt-installer-war/src/main/webapp/WEB-INF/web.xml | 9
modules/enterprise/gui/gwt-installer-war/src/main/webapp/index.html | 45
modules/enterprise/gui/installer/pom.xml | 407 ++++++
modules/enterprise/gui/installer/src/main/java/org/rhq/common/jbossas/client/controller/Address.java | 82 +
modules/enterprise/gui/installer/src/main/java/org/rhq/common/jbossas/client/controller/DatasourceJBossASClient.java | 34
modules/enterprise/gui/installer/src/main/java/org/rhq/common/jbossas/client/controller/FailureException.java | 77 +
modules/enterprise/gui/installer/src/main/java/org/rhq/common/jbossas/client/controller/JBossASClient.java | 304 ++++
modules/enterprise/gui/installer/src/main/java/org/rhq/common/jbossas/client/controller/SecurityDomainJBossASClient.java | 110 +
modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/client/Installer.java | 651 ++++++++++
modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/client/ServerPropertyRecordList.java | 62
modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/client/gwt/InstallerGWTService.java | 105 +
modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/client/shared/ServerDetails.java | 115 +
modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/client/shared/ServerProperties.java | 53
modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/service/ManagementService.java | 100 +
modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/servlet/InstallerGWTServiceImpl.java | 161 ++
modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/servlet/ServerInstallUtil.java | 274 ++++
modules/enterprise/gui/installer/src/main/resources/org/rhq/enterprise/gui/installer/Installer.gwt.xml | 35
modules/enterprise/gui/installer/src/main/resources/org/rhq/enterprise/gui/installer/client/Messages.properties | 21
modules/enterprise/gui/installer/src/main/resources/org/rhq/enterprise/gui/installer/client/ServerPropertiesMessages.properties | 23
modules/enterprise/gui/installer/src/main/webapp/WEB-INF/classes/META-INF/services/org.jboss.msc.service.ServiceActivator | 1
modules/enterprise/gui/installer/src/main/webapp/WEB-INF/web.xml | 9
modules/enterprise/gui/installer/src/main/webapp/index.html | 45
modules/enterprise/gui/pom.xml | 2
modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml | 8
42 files changed, 2674 insertions(+), 2674 deletions(-)
New commits:
commit 6f44c23c4d3eec665e4f7d278c76b6ed210f5525
Author: John Mazzitelli <mazz at redhat.com>
Date: Wed Aug 1 19:50:07 2012 -0400
rename the installer module and the war itself so it doesn't have the annoying -war.war file ending
diff --git a/modules/enterprise/gui/gwt-installer-war/pom.xml b/modules/enterprise/gui/gwt-installer-war/pom.xml
deleted file mode 100644
index 3b73c6c..0000000
--- a/modules/enterprise/gui/gwt-installer-war/pom.xml
+++ /dev/null
@@ -1,407 +0,0 @@
-<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.rhq</groupId>
- <artifactId>rhq-parent</artifactId>
- <version>4.5.0-SNAPSHOT</version>
- <relativePath>../../../../pom.xml</relativePath>
- </parent>
-
- <groupId>org.rhq</groupId>
- <artifactId>rhq-gwt-installer-war</artifactId>
- <packaging>war</packaging>
-
- <name>RHQ Enterprise GWT Installer GUI</name>
- <description>The RHQ Enterprise GWT Installer GUI webapp</description>
-
- <properties>
- <!-- dependency versions -->
- <gwt.version>2.4.0</gwt.version>
- <smartgwt.version>3.0</smartgwt.version>
- <jboss.as.version>7.1.1.Final</jboss.as.version> <!-- our AS7 container -->
- <jboss.msc.version>1.0.2.GA</jboss.msc.version> <!-- this ships with our AS7 container -->
- <jboss.dmr.version>1.1.1.Final</jboss.dmr.version> <!-- this ships with our AS7 container -->
-
- <installerGuiParams />
- <installerGuiRunTarget>'http://localhost:7080/rhq-gwt-installer/index.html${installerGuiParams}'</installerGuiRunTarget>
-
- <!-- If this is too much memory to allocate to your gwt:debug process then
- override this property in in your settings.xml -->
- <gwt-plugin.extraJvmArgs>-Xms512M -Xmx512M -XX:PermSize=128M -XX:MaxPermSize=256M</gwt-plugin.extraJvmArgs>
- <gwt-plugin.localWorkers>4</gwt-plugin.localWorkers>
-
- <gwt.userAgent>ie8,ie9,gecko1_8,safari,opera</gwt.userAgent>
- <gwt.draftCompile>false</gwt.draftCompile>
- <gwt.soyc>false</gwt.soyc>
- <gwt.style>PRETTY</gwt.style>
- <!-- <gwt.locale>en,de,ja,pt,zh,ru,cs</gwt.locale> -->
- <gwt.locale>en</gwt.locale>
- <gwt.fallback.locale>en</gwt.fallback.locale>
-
- <enable-tags>true</enable-tags>
- </properties>
-
- <dependencyManagement>
- <dependencies>
- <!-- JBoss distributes a complete set of Java EE 6 APIs. We use this here
- so that we always get the correct versions of artifacts.
- TODO: We should probably move this up to the root pom. -->
- <dependency>
- <groupId>org.jboss.spec</groupId>
- <artifactId>jboss-javaee-6.0</artifactId>
- <version>3.0.0.Final</version>
- <type>pom</type>
- <scope>import</scope>
- </dependency>
- </dependencies>
- </dependencyManagement>
-
- <dependencies>
- <dependency>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-core-dbutils</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <dependency>
- <groupId>com.google.gwt</groupId>
- <artifactId>gwt-servlet</artifactId>
- <version>${gwt.version}</version>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>com.google.gwt</groupId>
- <artifactId>gwt-user</artifactId>
- <version>${gwt.version}</version>
- <scope>provided</scope>
- </dependency>
-
- <!-- This is so we can compile custom GWT Generators to be called during
- gwt compilation. Is is not needed at runtime and so is not included in the
- WAR. -->
- <dependency>
- <groupId>com.google.gwt</groupId>
- <artifactId>gwt-dev</artifactId>
- <version>${gwt.version}</version>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>com.smartgwt</groupId>
- <artifactId>smartgwt</artifactId>
- <version>${smartgwt.version}</version>
- </dependency>
-
- <!-- Import the Servlet API -->
- <dependency>
- <groupId>org.jboss.spec.javax.servlet</groupId>
- <artifactId>jboss-servlet-api_3.0_spec</artifactId>
- <scope>provided</scope> <!-- provided by AS7 -->
- </dependency>
-
- <!-- we need these so we can have our own service to provide a co-located management client -->
- <dependency>
- <groupId>org.jboss.msc</groupId>
- <artifactId>jboss-msc</artifactId>
- <version>${jboss.msc.version}</version>
- <scope>provided</scope> <!-- provided by AS7 -->
- </dependency>
-
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-dmr</artifactId>
- <version>${jboss.dmr.version}</version>
- <scope>provided</scope> <!-- provided by AS7 -->
- </dependency>
-
- <dependency>
- <groupId>org.jboss.as</groupId>
- <artifactId>jboss-as-naming</artifactId>
- <version>${jboss.as.version}</version>
- <scope>provided</scope> <!-- provided by AS7 -->
- </dependency>
-
- <dependency>
- <groupId>org.jboss.as</groupId>
- <artifactId>jboss-as-server</artifactId>
- <version>${jboss.as.version}</version>
- <scope>provided</scope> <!-- provided by AS7 -->
- </dependency>
-
- <dependency>
- <groupId>org.jboss.as</groupId>
- <artifactId>jboss-as-controller</artifactId>
- <version>${jboss.as.version}</version>
- <scope>provided</scope> <!-- provided by AS7 -->
- </dependency>
-
- <dependency>
- <groupId>org.jboss.as</groupId>
- <artifactId>jboss-as-controller-client</artifactId>
- <version>${jboss.as.version}</version>
- <scope>provided</scope> <!-- provided by AS7 -->
- </dependency>
-
- </dependencies>
-
- <build>
- <finalName>rhq-gwt-installer</finalName>
-
- <resources>
- <resource>
- <targetPath>${project.build.directory}/generated-sources/gwt</targetPath>
- <directory>src/main/resources</directory>
- <filtering>true</filtering>
- <includes>
- <include>**/*.gwt.xml</include>
- <include>**/*.properties</include>
- </includes>
- </resource>
- <resource>
- <directory>src/main/java</directory>
- <includes>
- <include>**/*.java</include>
- </includes>
- </resource>
- </resources>
-
- <plugins>
-
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>gwt-maven-plugin</artifactId>
- <version>2.4.0</version>
- <configuration>
- <noServer>true</noServer>
- <inplace>false</inplace>
- <logLevel>INFO</logLevel>
- <runTarget>${installerGuiRunTarget}</runTarget>
- <extraJvmArgs>${gwt-plugin.extraJvmArgs}</extraJvmArgs>
- <localWorkers>${gwt-plugin.localWorkers}</localWorkers>
- <draftCompile>${gwt.draftCompile}</draftCompile>
- <soyc>${gwt.soyc}</soyc>
- <buildOutputDirectory>target/gwtclasses</buildOutputDirectory>
- <hostedWebapp>target/hostedWar</hostedWebapp>
- <debugSuspend>false</debugSuspend>
- <servicePattern>**/gwt/*GWTService.java</servicePattern>
- <i18nMessagesBundle>org.rhq.enterprise.gui.installer.client.Messages</i18nMessagesBundle>
- <i18nConstantsWithLookupBundle>org.rhq.enterprise.gui.installer.client.ServerPropertiesMessages</i18nConstantsWithLookupBundle>
- <style>${gwt.style}</style>
- <strict>true</strict>
- <!-- compiles gwt artifacts like symbolMap outside of war so it doesnt
- get packaged -->
- <deploy>${project.build.directory}/gwt-deploy</deploy>
- </configuration>
-
- <executions>
- <execution>
- <id>gwt-goals</id>
- <goals>
- <goal>compile</goal>
- <goal>generateAsync</goal>
- <goal>i18n</goal>
- </goals>
- </execution>
- <execution>
- <!-- This id is what does the trick, don't change it. For this to work
- maven 2.2.0 and later is needed. -->
- <id>default-cli</id>
- <goals>
- <goal>debug</goal>
- </goals>
- <configuration>
- <module>org.rhq.enterprise.gui.installer.Installer</module>
- </configuration>
- </execution>
- </executions>
- </plugin>
-
- <plugin>
- <artifactId>maven-war-plugin</artifactId>
- <configuration>
- <archive>
- <manifest>
- <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
- <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
- </manifest>
- <manifestEntries>
- <Build-Number>${buildNumber}</Build-Number>
- <Dependencies>org.jboss.msc,org.jboss.as.controller-client,org.jboss.as.controller,org.jboss.as.server</Dependencies>
- </manifestEntries>
- </archive>
- <webResources>
- <resource>
- <filtering>false</filtering>
- <directory>${basedir}/src/main/webapp</directory>
- </resource>
- </webResources>
- </configuration>
- </plugin>
-
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>build-helper-maven-plugin</artifactId>
- <executions>
- <execution>
- <id>add-gwt-source</id>
- <phase>generate-sources</phase>
- <goals>
- <goal>add-source</goal>
- </goals>
- <configuration>
- <sources>
- <source>${basedir}/target/generated-sources/gwt</source>
- </sources>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
-
- </build>
-
- <profiles>
- <profile>
- <id>dev</id>
-
- <properties>
- <rhq.rootDir>../../../..</rhq.rootDir>
- <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir>
- <rhq.deploymentName>${project.build.finalName}.war</rhq.deploymentName>
- <rhq.deploymentDir>${rhq.containerDir}/jbossas/server/default/deploy/${rhq.earName}/${rhq.deploymentName}</rhq.deploymentDir>
- </properties>
-
- <build>
- <plugins>
-
- <plugin>
- <artifactId>maven-antrun-plugin</artifactId>
- <executions>
-
- <execution>
- <id>deploy-classes</id>
- <phase>compile</phase>
- <configuration>
- <target>
- <property name="deployment.dir" location="${rhq.deploymentDir}" />
- <echo>*** Copying updated files from src${file.separator}main${file.separator}webapp${file.separator} to ${deployment.dir}${file.separator}...</echo>
- <copy todir="${deployment.dir}" verbose="${rhq.verbose}">
- <fileset dir="${basedir}/src/main/webapp" />
- </copy>
- </target>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
-
- <execution>
- <id>deploy</id>
- <phase>package</phase>
- <configuration>
- <target>
- <property name="deployment.dir" location="${rhq.deploymentDir}" />
- <echo>*** Copying updated files from target${file.separator}${project.build.finalName}${file.separator} to ${deployment.dir}${file.separator}...</echo>
- <copy todir="${deployment.dir}" verbose="${rhq.verbose}">
- <fileset dir="${basedir}/target/${project.build.finalName}" />
- </copy>
- </target>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
-
- <execution>
- <id>undeploy</id>
- <phase>clean</phase>
- <configuration>
- <target>
- <property name="deployment.dir" location="${rhq.deploymentDir}" />
- <echo>*** Deleting ${deployment.dir}${file.separator}...</echo>
- <delete dir="${deployment.dir}" />
- </target>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
-
- </executions>
- </plugin>
-
- </plugins>
- </build>
- </profile>
-
- <!-- Change the installerGuiRunTarget to not have single quotes. The quotes
- work for linux but not win -->
- <profile>
- <id>windows</id>
- <activation>
- <os>
- <family>Windows</family>
- </os>
- </activation>
- <properties>
- <installerGuiRunTarget>http://localhost:7080//rhq-gwt-installer/index.html${installerGuiParams}</installerGuiRunTarget>
- </properties>
- </profile>
-
- <profile>
- <id>msg</id>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <includes>
- <include>org/rhq/enterprise/gui/installer/client/*Messages.java</include>
- </includes>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
-
- <profile>
- <id>disable-tags</id>
- <activation>
- <property>
- <name>brew</name>
- </property>
- </activation>
- <properties>
- <enable.tags>false</enable.tags>
- </properties>
- </profile>
-
- </profiles>
-
-
- <repositories>
- <repository>
- <id>smartgwt</id>
- <name>SmartGWT Releases</name>
- <url>http://www.smartclient.com/maven2/</url>
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- </repository>
-
- <repository>
- <id>codehaus</id>
- <name>Codehaus Releases</name>
- <url>http://repository.codehaus.org/</url>
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- </repository>
-
- </repositories>
-
-</project>
diff --git a/modules/enterprise/gui/gwt-installer-war/src/main/java/org/rhq/common/jbossas/client/controller/Address.java b/modules/enterprise/gui/gwt-installer-war/src/main/java/org/rhq/common/jbossas/client/controller/Address.java
deleted file mode 100644
index 1a54d36..0000000
--- a/modules/enterprise/gui/gwt-installer-war/src/main/java/org/rhq/common/jbossas/client/controller/Address.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2012 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.common.jbossas.client.controller;
-
-import java.util.Arrays;
-
-import org.jboss.dmr.ModelNode;
-
-/**
- * Identifies a managed resource.
- *
- * @author John Mazzitelli
- */
-public class Address implements Cloneable {
- private ModelNode addressNode;
-
- public static Address root() {
- return new Address();
- }
-
- public Address() {
- addressNode = new ModelNode();
- }
-
- public Address(String... addressParts) {
- this();
- add(addressParts);
- }
-
- public ModelNode getAddressNode() {
- return addressNode;
- }
-
- public Address add(String... addressParts) {
- if (addressParts != null) {
- if ((addressParts.length % 2) != 0) {
- throw new IllegalArgumentException("address is incomplete: " + Arrays.toString(addressParts));
- }
-
- if (addressParts.length > 0) {
- for (int i = 0; i < addressParts.length; i += 2) {
- addressNode.add(addressParts[i], addressParts[i + 1]);
- }
- }
- }
-
- return this;
- }
-
- public Address add(String type, String name) {
- addressNode.add(type, name);
- return this;
- }
-
- @Override
- public Address clone() throws CloneNotSupportedException {
- Address clone = new Address();
- clone.addressNode = addressNode.clone();
- return clone;
- }
-
- @Override
- public String toString() {
- return addressNode.asString();
- }
-}
\ No newline at end of file
diff --git a/modules/enterprise/gui/gwt-installer-war/src/main/java/org/rhq/common/jbossas/client/controller/DatasourceJBossASClient.java b/modules/enterprise/gui/gwt-installer-war/src/main/java/org/rhq/common/jbossas/client/controller/DatasourceJBossASClient.java
deleted file mode 100644
index fb3135c..0000000
--- a/modules/enterprise/gui/gwt-installer-war/src/main/java/org/rhq/common/jbossas/client/controller/DatasourceJBossASClient.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2012 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.common.jbossas.client.controller;
-
-import org.jboss.as.controller.client.ModelControllerClient;
-
-/**
- * Provides convienence methods associated with datasource management.
- *
- * @author John Mazzitelli
- */
-public class DatasourceJBossASClient extends JBossASClient {
-
- public DatasourceJBossASClient(ModelControllerClient client) {
- super(client);
- }
-
-}
diff --git a/modules/enterprise/gui/gwt-installer-war/src/main/java/org/rhq/common/jbossas/client/controller/FailureException.java b/modules/enterprise/gui/gwt-installer-war/src/main/java/org/rhq/common/jbossas/client/controller/FailureException.java
deleted file mode 100644
index 6dde289..0000000
--- a/modules/enterprise/gui/gwt-installer-war/src/main/java/org/rhq/common/jbossas/client/controller/FailureException.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2012 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.common.jbossas.client.controller;
-
-import org.jboss.dmr.ModelNode;
-
-/**
- * Indicates a failed client request.
- *
- * @author John Mazzitelli
- */
-public class FailureException extends RuntimeException {
- private static final long serialVersionUID = 1L;
-
- private static final String GENERIC_ERROR = "Failed request";
-
- public FailureException(ModelNode failureNode) {
- super(buildErrorMessage(GENERIC_ERROR, failureNode));
- }
-
- public FailureException(ModelNode failureNode, String errMsg) {
- super(buildErrorMessage(errMsg, failureNode));
- }
-
- public FailureException(ModelNode failureNode, Throwable cause) {
- super(buildErrorMessage(GENERIC_ERROR, failureNode), cause);
- }
-
- public FailureException(ModelNode failureNode, String errMsg, Throwable cause) {
- super(buildErrorMessage(errMsg, failureNode), cause);
- }
-
- public FailureException(String errMsg, Throwable cause) {
- super((errMsg != null) ? errMsg : GENERIC_ERROR, cause);
- }
-
- public FailureException(String errMsg) {
- super((errMsg != null) ? errMsg : GENERIC_ERROR);
- }
-
- public FailureException(Throwable cause) {
- super(GENERIC_ERROR, cause);
- }
-
- public FailureException() {
- super(GENERIC_ERROR);
- }
-
- private static final String buildErrorMessage(String errMsg, ModelNode failureNode) {
- if (errMsg == null) {
- errMsg = GENERIC_ERROR;
- }
-
- String description = JBossASClient.getFailureDescription(failureNode);
- if (description != null) {
- errMsg += ": " + description;
- }
-
- return errMsg;
- }
-}
diff --git a/modules/enterprise/gui/gwt-installer-war/src/main/java/org/rhq/common/jbossas/client/controller/JBossASClient.java b/modules/enterprise/gui/gwt-installer-war/src/main/java/org/rhq/common/jbossas/client/controller/JBossASClient.java
deleted file mode 100644
index c8d040c..0000000
--- a/modules/enterprise/gui/gwt-installer-war/src/main/java/org/rhq/common/jbossas/client/controller/JBossASClient.java
+++ /dev/null
@@ -1,304 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2012 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.common.jbossas.client.controller;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import org.jboss.as.controller.client.ModelControllerClient;
-import org.jboss.as.controller.client.OperationMessageHandler;
-import org.jboss.dmr.ModelNode;
-
-/**
- * A client that can be used to talk to a JBossAS server via the DMR/ModelControllerClient API.
- *
- * @author John Mazzitelli
- */
-public class JBossASClient {
-
- // protected to allow subclasses to have a logger, too, without explicitly declaring one themselves
- protected final Log log = LogFactory.getLog(this.getClass());
-
- public static final String BATCH = "composite";
- public static final String BATCH_STEPS = "steps";
- public static final String OPERATION = "operation";
- public static final String ADDRESS = "address";
- public static final String RESULT = "result";
- public static final String OUTCOME = "outcome";
- public static final String OUTCOME_SUCCESS = "success";
- public static final String SUBSYSTEM = "subsystem";
- public static final String FAILURE_DESCRIPTION = "failure-description";
- public static final String NAME = "name";
- public static final String VALUE = "value";
- public static final String READ_ATTRIBUTE = "read-attribute";
- public static final String READ_RESOURCE = "read-resource";
- public static final String WRITE_ATTRIBUTE = "write-attribute";
- public static final String ADD = "add";
-
- private ModelControllerClient client;
-
- public JBossASClient(ModelControllerClient client) {
- this.client = client;
- }
-
- /////////////////////////////////////////////////////////////////
- // Some static methods useful for convienence
-
- /**
- * Convienence method that allows you to create request that reads a single attribute
- * value to a resource.
- *
- * @param attributeName the name of the attribute whose value is to be read
- * @param address identifies the resource
- * @return the request
- */
- public static ModelNode createReadAttributeRequest(String attributeName, Address address) {
- return createReadAttributeRequest(false, attributeName, address);
- }
-
- /**
- * Convienence method that allows you to create request that reads a single attribute
- * value to a resource.
- *
- * @param runtime if <code>true</code>, the attribute is a runtime attribute
- * @param attributeName the name of the attribute whose value is to be read
- * @param address identifies the resource
- * @return the request
- */
- public static ModelNode createReadAttributeRequest(boolean runtime, String attributeName, Address address) {
- ModelNode op = createRequest(READ_ATTRIBUTE, address);
- op.get("include-runtime").set(runtime);
- op.get(NAME).set(attributeName);
- return op;
- }
-
- /**
- * Convienence method that allows you to create request that writes a single attribute's
- * string value to a resource.
- *
- * @param attributeName the name of the attribute whose value is to be written
- * @param attributeValue the attribute value that is to be written
- * @param address identifies the resource
- * @return the request
- */
- public static ModelNode createWriteAttributeRequest(String attributeName, String attributeValue, Address address) {
- ModelNode op = createRequest(WRITE_ATTRIBUTE, address);
- op.get(NAME).set(attributeName);
- op.get(VALUE).set(attributeValue);
- return op;
- }
-
- /**
- * Convienence method that builds a partial operation request node.
- *
- * @param operation the operation to be requested
- * @param address identifies the target resource
- * @return the partial operation request node - caller should fill this in further to complete the node
- */
- public static ModelNode createRequest(String operation, Address address) {
- final ModelNode request = new ModelNode();
- request.get(OPERATION).set(operation);
- request.get(ADDRESS).set(address.getAddressNode());
- return request;
- }
-
- /**
- * Creates a batch of operations that can be atomically invoked.
- *
- * @param steps the different operation steps of the batch
- *
- * @return the batch operation node
- */
- public static ModelNode createBatchRequest(ModelNode... steps) {
- final ModelNode composite = new ModelNode();
- composite.get(OPERATION).set(BATCH);
- composite.get(ADDRESS).setEmptyList();
- final ModelNode stepsNode = composite.get(BATCH_STEPS);
- for (ModelNode step : steps) {
- stepsNode.add(step);
- }
- return composite;
- }
-
- /**
- * If the given node has a result list, that list will be returned
- * with the values as Strings. Otherwise, an empty list is returned.
- *
- * @param operationResult the node to examine
- * @return the result list as Strings if there is a list, empty otherwise
- */
- public static List<String> getResultListAsStrings(ModelNode operationResult) {
- if (!operationResult.hasDefined(RESULT)) {
- return Collections.emptyList();
- }
-
- List<ModelNode> nodeList = operationResult.get(RESULT).asList();
- if (nodeList.isEmpty()) {
- return Collections.emptyList();
- }
-
- List<String> list = new ArrayList<String>(nodeList.size());
- for (ModelNode node : nodeList) {
- list.add(node.asString());
- }
-
- return list;
- }
-
- /**
- * If the given node has results, those results are returned in a ModelNode.
- * Otherwise, an empty node is returned.
- *
- * @param operationResult the node to examine
- * @return the results as a ModelNode
- */
- public static ModelNode getResults(ModelNode operationResult) {
- if (!operationResult.hasDefined(RESULT)) {
- return new ModelNode();
- }
-
- return operationResult.get(RESULT);
- }
-
- /**
- * Examines the given node's result list and if the item is found, returns true.
- *
- * @param operationResult the node to examine
- * @param item the item to look for in the node's result list
- * @return true if the node has a result list and it contains the item; false otherwise
- */
- public static boolean listContains(ModelNode operationResult, String item) {
- if (!operationResult.hasDefined(RESULT)) {
- return false;
- }
-
- List<ModelNode> nodeList = operationResult.get(RESULT).asList();
- if (nodeList.isEmpty()) {
- return false;
- }
-
- for (ModelNode node : nodeList) {
- if (node.asString().equals(item)) {
- return true;
- }
- }
-
- return false;
- }
-
- /**
- * Returns <code>true</code> if the operation was a success; <code>false</code> otherwise.
- *
- * @param operationResult the operation result to test
- * @return the success or failure flag of the result
- */
- public static boolean isSuccess(ModelNode operationResult) {
- if (operationResult != null) {
- return operationResult.hasDefined(OUTCOME)
- && operationResult.get(OUTCOME).asString().equals(OUTCOME_SUCCESS);
- }
- return false;
- }
-
- /**
- * If the operation result was a failure, this returns the failure description if there is one.
- * A generic failure message will be returned if the operation was a failure but has no failure
- * description. A <code>null</code> is returned if the operation was a success.
- *
- * @param operationResult the operation whose failure description is to be returned
- * @return the failure description of <code>null</code> if the operation was a success
- */
- public static String getFailureDescription(ModelNode operationResult) {
- if (isSuccess(operationResult)) {
- return null;
- }
- if (operationResult != null) {
- ModelNode descr = operationResult.get(FAILURE_DESCRIPTION);
- if (descr != null) {
- return descr.asString();
- }
- }
- return "Unknown failure";
- }
-
- /////////////////////////////////////////////////////////////////
- // Non-static methods that need the client
-
- public ModelControllerClient getModelControllerClient() {
- return client;
- }
-
- /**
- * Convienence method that executes the request.
- *
- * @param request
- * @return results
- * @throws Exception
- */
- public ModelNode execute(ModelNode request) throws Exception {
- try {
- return getModelControllerClient().execute(request, OperationMessageHandler.logging);
- } catch (Exception e) {
- log.error("Failed to execute request", e);
- throw e;
- }
- }
-
- /**
- * Convienence method that allows you to obtain a single attribute's string value from
- * a resource.
- *
- * @param attributeName the attribute whose value is to be returned
- * @param address identifies the resource
- * @return the attribute value
- *
- * @throws Exception if failed to obtain the attribute value
- */
- public String getStringAttribute(String attributeName, Address address) throws Exception {
- return getStringAttribute(false, attributeName, address);
- }
-
- /**
- * Convienence method that allows you to obtain a single attribute's string value from
- * a resource.
- *
- * @param runtime if <code>true</code>, the attribute to be retrieved is a runtime attribute
- * @param attributeName the attribute whose value is to be returned
- * @param address identifies the resource
- * @return the attribute value
- *
- * @throws Exception if failed to obtain the attribute value
- */
- public String getStringAttribute(boolean runtime, String attributeName, Address address) throws Exception {
- ModelNode op = createReadAttributeRequest(runtime, attributeName, address);
- ModelNode results = execute(op);
- if (isSuccess(results)) {
- ModelNode version = getResults(results);
- String attributeValue = version.asString();
- return attributeValue;
- } else {
- throw new FailureException(results, "Failed to get attribute [" + attributeName + "] from [" + address
- + "]");
- }
- }
-}
diff --git a/modules/enterprise/gui/gwt-installer-war/src/main/java/org/rhq/common/jbossas/client/controller/SecurityDomainJBossASClient.java b/modules/enterprise/gui/gwt-installer-war/src/main/java/org/rhq/common/jbossas/client/controller/SecurityDomainJBossASClient.java
deleted file mode 100644
index a73ba79..0000000
--- a/modules/enterprise/gui/gwt-installer-war/src/main/java/org/rhq/common/jbossas/client/controller/SecurityDomainJBossASClient.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2012 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.common.jbossas.client.controller;
-
-import java.util.List;
-
-import org.jboss.as.controller.client.ModelControllerClient;
-import org.jboss.dmr.ModelNode;
-
-/**
- * Provides convienence methods associated with security domain management.
- *
- * @author John Mazzitelli
- */
-public class SecurityDomainJBossASClient extends JBossASClient {
-
- public static final String SUBSYSTEM_SECURITY = "security";
- public static final String SECURITY_DOMAIN = "security-domain";
- public static final String CACHE_TYPE = "cache-type";
- public static final String AUTHENTICATION = "authentication";
- public static final String LOGIN_MODULES = "login-modules";
- public static final String CLASSIC = "classic";
- public static final String CODE = "code";
- public static final String FLAG = "flag";
- public static final String MODULE_OPTIONS = "module-options";
- public static final String USERNAME = "username";
- public static final String PASSWORD = "password";
-
- public SecurityDomainJBossASClient(ModelControllerClient client) {
- super(client);
- }
-
- /**
- * Checks to see if there is already a security domain with the given name.
- *
- * @param securityDomainName the name to check
- * @return true if there is a security domain with the given name already in existence
- */
- public boolean isSecurityDomain(String securityDomainName) throws Exception {
- Address addr = Address.root().add(SUBSYSTEM, SUBSYSTEM_SECURITY);
- ModelNode queryNode = createRequest(READ_RESOURCE, addr);
- ModelNode results = execute(queryNode);
- if (isSuccess(results)) {
- ModelNode domains = getResults(results).get(SECURITY_DOMAIN);
- List<ModelNode> list = domains.asList();
- for (ModelNode domain : list) {
- if (domain.has(securityDomainName)) {
- return true;
- }
- }
- return false;
- } else {
- throw new FailureException(results, "Failed to get security domains");
- }
- }
-
- /**
- * Convienence method that builds a request which can create a new security-domain
- * using the SecureIdentity authentication method. This is used when you want
- * to obfuscate a database password in the configuration.
- *
- * @param securityDomainName the name of the new security domain
- * @param username the username associated with the security domain
- * @param password the value of the password to store in the configuration (e.g. the obfuscated password itself)
- *
- * @throws Exception if failed to create security domain
- */
- public void createNewSecureIdentitySecurityDomainRequest(String securityDomainName, String username, String password)
- throws Exception {
-
- Address addr = Address.root().add(SUBSYSTEM, SUBSYSTEM_SECURITY, SECURITY_DOMAIN, securityDomainName);
- ModelNode addTopNode = createRequest(ADD, addr);
- addTopNode.get(CACHE_TYPE).set("default");
-
- ModelNode addAuthNode = createRequest(ADD, addr.clone().add(AUTHENTICATION, CLASSIC));
- ModelNode loginModulesNode = addAuthNode.get(LOGIN_MODULES);
- ModelNode loginModule = new ModelNode();
- loginModule.get(CODE).set("SecureIdentity");
- loginModule.get(FLAG).set("required");
- ModelNode moduleOptions = loginModule.get(MODULE_OPTIONS);
- moduleOptions.setEmptyList();
- moduleOptions.add(USERNAME, username);
- moduleOptions.add(PASSWORD, password);
- loginModulesNode.add(loginModule);
-
- ModelNode batch = createBatchRequest(addTopNode, addAuthNode);
- ModelNode results = execute(batch);
- if (!isSuccess(results)) {
- throw new FailureException(results, "Failed to create security domain [" + securityDomainName + "]");
- }
-
- return;
- }
-}
diff --git a/modules/enterprise/gui/gwt-installer-war/src/main/java/org/rhq/enterprise/gui/installer/client/Installer.java b/modules/enterprise/gui/gwt-installer-war/src/main/java/org/rhq/enterprise/gui/installer/client/Installer.java
deleted file mode 100644
index 0fc0215..0000000
--- a/modules/enterprise/gui/gwt-installer-war/src/main/java/org/rhq/enterprise/gui/installer/client/Installer.java
+++ /dev/null
@@ -1,651 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2012 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.gui.installer.client;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import com.google.gwt.core.client.EntryPoint;
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.dom.client.Element;
-import com.google.gwt.user.client.DOM;
-import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.smartgwt.client.types.Alignment;
-import com.smartgwt.client.types.Side;
-import com.smartgwt.client.types.VerticalAlignment;
-import com.smartgwt.client.util.SC;
-import com.smartgwt.client.widgets.Button;
-import com.smartgwt.client.widgets.Canvas;
-import com.smartgwt.client.widgets.IButton;
-import com.smartgwt.client.widgets.Label;
-import com.smartgwt.client.widgets.events.ClickEvent;
-import com.smartgwt.client.widgets.events.ClickHandler;
-import com.smartgwt.client.widgets.form.DynamicForm;
-import com.smartgwt.client.widgets.form.fields.ButtonItem;
-import com.smartgwt.client.widgets.form.fields.FormItem;
-import com.smartgwt.client.widgets.form.fields.FormItemIcon;
-import com.smartgwt.client.widgets.form.fields.PasswordItem;
-import com.smartgwt.client.widgets.form.fields.SelectItem;
-import com.smartgwt.client.widgets.form.fields.SpacerItem;
-import com.smartgwt.client.widgets.form.fields.SpinnerItem;
-import com.smartgwt.client.widgets.form.fields.TextItem;
-import com.smartgwt.client.widgets.form.fields.events.ChangedEvent;
-import com.smartgwt.client.widgets.form.fields.events.ChangedHandler;
-import com.smartgwt.client.widgets.form.fields.events.IconClickEvent;
-import com.smartgwt.client.widgets.form.fields.events.IconClickHandler;
-import com.smartgwt.client.widgets.grid.ListGrid;
-import com.smartgwt.client.widgets.grid.ListGridField;
-import com.smartgwt.client.widgets.grid.events.EditCompleteEvent;
-import com.smartgwt.client.widgets.grid.events.EditCompleteHandler;
-import com.smartgwt.client.widgets.layout.VLayout;
-import com.smartgwt.client.widgets.tab.Tab;
-import com.smartgwt.client.widgets.tab.TabSet;
-import com.smartgwt.client.widgets.toolbar.ToolStrip;
-
-import org.rhq.enterprise.gui.installer.client.gwt.InstallerGWTServiceAsync;
-import org.rhq.enterprise.gui.installer.client.shared.ServerDetails;
-import org.rhq.enterprise.gui.installer.client.shared.ServerProperties;
-
-/**
- * The GWT {@link EntryPoint entry point} to the RHQ Installer GUI.
- *
- * @author John Mazzitelli
- */
-public class Installer implements EntryPoint {
-
- // This must come first to ensure proper I18N class loading for dev mode
- public static final Messages MSG = GWT.create(Messages.class);
- public static final ServerPropertiesMessages PROPS_MSG = GWT.create(ServerPropertiesMessages.class);
-
- private static final String NEW_SERVER_TO_REGISTER = "*new*";
-
- private final InstallerGWTServiceAsync installerService = InstallerGWTServiceAsync.Util.getInstance();
- private final ServerPropertyRecordList serverProperties = new ServerPropertyRecordList();
- private final HashMap<String, String> originalProperties = new HashMap<String, String>();
- private final LinkedHashMap<String, String> registeredServerNames = new LinkedHashMap<String, String>();
-
- private ListGrid advancedPropertyItemGrid;
- private Button mainInstallButton;
- private TextItem dbConnectionUrl;
- private TextItem dbUsername;
- private PasswordItem dbPassword;
- private SelectItem dbExistingSchemaOption;
- private ButtonItem testConnectionButton;
- private SelectItem dbType;
- private TextItem serverSettingServerName;
- private TextItem serverSettingPublicAddress;
- private SpinnerItem serverSettingWebHttpPort;
- private SpinnerItem serverSettingWebSecureHttpPort;
- private SelectItem registeredServersSelection;
- private TextItem serverSettingEmailSMTPHostname;
- private TextItem serverSettingEmailFromAddress;
-
- public void onModuleLoad() {
- Canvas header = createHeader();
- mainInstallButton = createMainInstallButton();
- Canvas tabSet = createTabSet();
-
- VLayout layout = new VLayout();
- layout.setWidth100();
- layout.setHeight100();
- layout.setLayoutMargin(10);
- layout.setMembersMargin(5);
- layout.setDefaultLayoutAlign(Alignment.CENTER);
- layout.addMember(header);
- layout.addMember(mainInstallButton);
- layout.addMember(tabSet);
- layout.draw();
-
- // Remove loading image in case we don't completely cover it
- Element loadingPanel = DOM.getElementById("Loading-Panel");
- loadingPanel.removeFromParent();
-
- // get the server properties from the server
- loadServerProperties();
-
- }
-
- private void updateServerProperty(String name, Object value) {
- serverProperties.putServerProperty(name, value == null ? "" : value.toString());
- refreshAdvancedView();
- }
-
- private void loadServerProperties() {
- // load the initial server properties
- installerService.getServerProperties(new AsyncCallback<HashMap<String, String>>() {
- public void onSuccess(HashMap<String, String> result) {
- if (result.size() == 0) {
- SC.say("Initial server properties are missing.");
- }
- serverProperties.replaceServerProperties(result);
-
- // remember these original properties in case the user wants to reset them back
- originalProperties.clear();
- originalProperties.putAll(result);
-
- // refresh the simple view with the new data
- refreshSimpleView();
-
- // refresh the advanced view with the new data
- refreshAdvancedView();
- }
-
- public void onFailure(Throwable caught) {
- SC.say("Cannot load properties: " + caught);
- }
- });
- }
-
- private void refreshSimpleView() {
- Map<String, String> props = serverProperties.getMap();
-
- // DB SETTINGS
- dbType.setValue(props.get(ServerProperties.PROP_DATABASE_TYPE));
- dbConnectionUrl.setValue(props.get(ServerProperties.PROP_DATABASE_CONNECTION_URL));
- dbUsername.setValue(props.get(ServerProperties.PROP_DATABASE_USERNAME));
- // do not prefill the database password - force the user to know it and type it in for security purposes
-
- // SERVER SETTINGS
- serverSettingServerName.setValue(props.get(ServerProperties.PROP_HIGH_AVAILABILITY_NAME));
- serverSettingWebHttpPort.setValue(props.get(ServerProperties.PROP_WEB_HTTP_PORT));
- serverSettingWebSecureHttpPort.setValue(props.get(ServerProperties.PROP_WEB_HTTPS_PORT));
- serverSettingEmailSMTPHostname.setValue(props.get(ServerProperties.PROP_EMAIL_SMTP_HOST));
- serverSettingEmailFromAddress.setValue(props.get(ServerProperties.PROP_EMAIL_FROM_ADDRESS));
-
- forceAnotherTestConnection();
- }
-
- private void refreshAdvancedView() {
- advancedPropertyItemGrid.markForRedraw();
- }
-
- private Canvas createHeader() {
- ToolStrip strip = new ToolStrip();
- strip.setWidth100();
- strip.setAlign(Alignment.CENTER);
-
- Label title = new Label();
- title.setWidth100();
- title.setHeight100();
- title.setWrap(false);
- title.setValign(VerticalAlignment.CENTER);
- title.setAlign(Alignment.CENTER);
- title.setContents("<span style=\"font-size:16pt;font-weight:bold;\">" + MSG.welcome_title() + "</span>");
- strip.addMember(title);
- return strip;
- }
-
- private Button createMainInstallButton() {
- Button installButton = new Button(MSG.button_startInstallation());
- installButton.setWrap(false);
- installButton.setAutoFit(true);
- installButton.setDisabled(true); // we can't allow the user to install yet
- installButton.addClickHandler(new ClickHandler() {
- public void onClick(ClickEvent event) {
- SC.say("TODO: this should start the install");
- }
- });
-
- return installButton;
- }
-
- private TabSet createTabSet() {
- final TabSet topTabSet = new TabSet();
- topTabSet.setTabBarPosition(Side.TOP);
- topTabSet.setTabBarAlign(Side.LEFT);
- topTabSet.setWidth("90%");
-
- final Tab welcomeTab = new Tab(MSG.tab_welcome());
- Label welcomeLabel = new Label(MSG.tab_welcome_content());
- welcomeTab.setPane(welcomeLabel);
-
- final Tab simpleViewTab = new Tab(MSG.tab_simpleView());
- Canvas simpleForm = createSimpleForm();
- simpleViewTab.setPane(simpleForm);
-
- final Tab advancedViewTab = new Tab(MSG.tab_advancedView());
- Canvas advancedView = createAdvancedView();
- advancedViewTab.setPane(advancedView);
-
- topTabSet.addTab(welcomeTab);
- topTabSet.addTab(simpleViewTab);
- topTabSet.addTab(advancedViewTab);
-
- return topTabSet;
- }
-
- private Canvas createAdvancedView() {
- VLayout layout = new VLayout();
-
- ToolStrip strip = new ToolStrip();
- strip.setWidth100();
-
- IButton saveButton = new IButton(MSG.button_save());
- saveButton.addClickHandler(new ClickHandler() {
- public void onClick(ClickEvent event) {
- installerService.saveServerProperties(serverProperties.getMap(), new AsyncCallback<Void>() {
- public void onSuccess(Void result) {
- originalProperties.clear();
- originalProperties.putAll(serverProperties.getMap());
- SC.say("Properties saved to server");
- }
-
- public void onFailure(Throwable caught) {
- SC.say("Failed to save properties to server");
- }
- });
- }
- });
- IButton resetButton = new IButton(MSG.button_reset());
- resetButton.addClickHandler(new ClickHandler() {
- public void onClick(ClickEvent event) {
- serverProperties.replaceServerProperties(originalProperties);
- refreshAdvancedView();
- }
- });
- strip.addMember(saveButton);
- strip.addMember(resetButton);
- layout.addMember(strip);
-
- advancedPropertyItemGrid = new ListGrid();
- advancedPropertyItemGrid.setWidth100();
- advancedPropertyItemGrid.setHeight100();
- advancedPropertyItemGrid.setData(serverProperties);
-
- ListGridField nameField = new ListGridField(ServerPropertyRecordList.PROPERTY_NAME, MSG.property_name_label());
- nameField.setCanEdit(false);
-
- ListGridField valueField = new ListGridField(ServerPropertyRecordList.PROPERTY_VALUE,
- MSG.property_value_label());
- valueField.setCanEdit(true);
-
- advancedPropertyItemGrid.setFields(nameField, valueField);
- advancedPropertyItemGrid.setSortField(ServerPropertyRecordList.PROPERTY_NAME);
-
- advancedPropertyItemGrid.addEditCompleteHandler(new EditCompleteHandler() {
- public void onEditComplete(EditCompleteEvent event) {
- String newValue = (String) event.getNewValues().values().iterator().next().toString();
- String changedProperty = event.getOldRecord().getAttribute(ServerPropertyRecordList.PROPERTY_NAME);
- serverProperties.getMap().put(changedProperty, newValue); // we need this to be reflected in the internal map
- refreshSimpleView();
- }
- });
-
- layout.addMember(advancedPropertyItemGrid);
-
- return layout;
- }
-
- private Canvas createSimpleForm() {
-
- final int fieldWidth = 300;
-
- ////////////////////////////////////////////////////////
- // The Database form
-
- final DynamicForm databaseForm = new DynamicForm();
- databaseForm.setAutoWidth();
- databaseForm.setPadding(5);
- databaseForm.setCellPadding(5);
- databaseForm.setWrapItemTitles(false);
- databaseForm.setIsGroup(true);
- databaseForm.setGroupTitle(MSG.tab_simpleView_database());
-
- dbConnectionUrl = new TextItem(ServerProperties.PROP_DATABASE_CONNECTION_URL,
- PROPS_MSG.rhq_server_database_connection_url());
- dbConnectionUrl.setWidth(fieldWidth);
- dbConnectionUrl.setValue("jdbc:postgresql://127.0.0.1:5432/rhq");
- dbConnectionUrl.addChangedHandler(new ChangedHandler() {
- public void onChanged(ChangedEvent event) {
- updateServerProperty(ServerProperties.PROP_DATABASE_CONNECTION_URL, String.valueOf(event.getValue()));
- forceAnotherTestConnection();
- }
- });
-
- dbUsername = new TextItem(ServerProperties.PROP_DATABASE_USERNAME,
- PROPS_MSG.rhq_server_database_user_name());
- dbUsername.setWidth(fieldWidth);
- dbUsername.addChangedHandler(new ChangedHandler() {
- public void onChanged(ChangedEvent event) {
- updateServerProperty(ServerProperties.PROP_DATABASE_USERNAME, String.valueOf(event.getValue()));
- forceAnotherTestConnection();
- }
- });
-
- dbPassword = new PasswordItem(ServerProperties.PROP_DATABASE_PASSWORD,
- PROPS_MSG.rhq_server_database_password());
- dbPassword.setWidth(fieldWidth);
- dbPassword.addChangedHandler(new ChangedHandler() {
- public void onChanged(ChangedEvent event) {
- updateServerProperty(ServerProperties.PROP_DATABASE_PASSWORD, String.valueOf(event.getValue()));
- forceAnotherTestConnection();
- }
- });
-
- dbExistingSchemaOption = new SelectItem("existingSchemaOption", MSG.schema_update_question());
- final LinkedHashMap<String, String> schemaOpt = new LinkedHashMap<String, String>();
- schemaOpt.put("keep", MSG.schema_update_keep());
- schemaOpt.put("overwrite", MSG.schema_update_overwrite());
- schemaOpt.put("skip", MSG.schema_update_skip());
- dbExistingSchemaOption.setValueMap(schemaOpt);
- dbExistingSchemaOption.setDefaultToFirstOption(true);
- dbExistingSchemaOption.setVisible(false);
- dbExistingSchemaOption.setWidth(fieldWidth);
- dbExistingSchemaOption.setWrapTitle(true);
- dbExistingSchemaOption.addChangedHandler(new ChangedHandler() {
- public void onChanged(ChangedEvent event) {
- if (registeredServersSelection != null) {
- String selected = event.getValue().toString();
- if ("overwrite".equals(selected)) {
- registeredServersSelection.setValue((String) null);
- registeredServersSelection.disable();
- } else {
- registeredServersSelection.enable();
- }
- }
- }
- });
-
- testConnectionButton = new ButtonItem("testConnectionButton", MSG.button_testConnection());
- testConnectionButton.addClickHandler(new com.smartgwt.client.widgets.form.fields.events.ClickHandler() {
- public void onClick(com.smartgwt.client.widgets.form.fields.events.ClickEvent event) {
- final Conn conn = new Conn();
- installerService.testConnection(conn.url(), conn.username(), conn.password(),
- new AsyncCallback<String>() {
- public void onSuccess(String result) {
- if (result != null) {
- forceAnotherTestConnection();
- testConnectionButton.setIcon("[SKIN]/actions/exclamation.png");
- SC.say("Could not connect to the database: " + result);
- } else {
- connectedToDatabase();
- }
- }
-
- public void onFailure(Throwable caught) {
- forceAnotherTestConnection();
- testConnectionButton.setIcon("[SKIN]/actions/exclamation.png");
- SC.say("Failed to test connection: " + caught.toString());
- }
- });
-
- }
- });
-
- dbType = new SelectItem(ServerProperties.PROP_DATABASE_TYPE,
- PROPS_MSG.rhq_server_database_type_mapping());
- final LinkedHashMap<String, String> dbs = new LinkedHashMap<String, String>();
- dbs.put("PostgreSQL", "PostgreSQL");
- dbs.put("Oracle", "Oracle");
- dbType.setValueMap(dbs);
- dbType.setDefaultToFirstOption(true);
- dbType.addChangedHandler(new ChangedHandler() {
- public void onChanged(ChangedEvent event) {
- forceAnotherTestConnection();
-
- String newDBType = (String) event.getValue();
- String newURL = "";
- String dialect = "";
- String quartzDriverDelegateClass = "org.quartz.impl.jdbcjobstore.StdJDBCDelegate";
- String quartzSelectWithLockSQL = "SELECT * FROM {0}LOCKS ROWLOCK WHERE LOCK_NAME = ? FOR UPDATE";
- String quartzLockHandlerClass = "org.quartz.impl.jdbcjobstore.StdRowLockSemaphore";
-
- if ("PostgreSQL".equalsIgnoreCase(newDBType)) {
- newURL = "jdbc:postgresql://127.0.0.1:5432/rhq";
- dialect = "org.hibernate.dialect.PostgreSQLDialect";
- quartzDriverDelegateClass = "org.quartz.impl.jdbcjobstore.PostgreSQLDelegate";
- } else if ("Oracle".equalsIgnoreCase(newDBType)) {
- newURL = "jdbc:oracle:thin:@127.0.0.1:1521:rhq";
- dialect = "org.hibernate.dialect.Oracle10gDialect";
- quartzDriverDelegateClass = "org.quartz.impl.jdbcjobstore.oracle.OracleDelegate";
- }
- dbConnectionUrl.setValue(newURL);
-
- updateServerProperty(ServerProperties.PROP_DATABASE_CONNECTION_URL, newURL);
- updateServerProperty(ServerProperties.PROP_DATABASE_HIBERNATE_DIALECT, dialect);
- updateServerProperty(ServerProperties.PROP_QUARTZ_DRIVER_DELEGATE_CLASS, quartzDriverDelegateClass);
- updateServerProperty(ServerProperties.PROP_QUARTZ_SELECT_WITH_LOCK_SQL, quartzSelectWithLockSQL);
- updateServerProperty(ServerProperties.PROP_QUARTZ_LOCK_HANDLER_CLASS, quartzLockHandlerClass);
- updateServerProperty(ServerProperties.PROP_DATABASE_TYPE, newDBType); // this refreshes the advanced view, too
- }
- });
-
- // use this to move the button over to the second column - it looks better this way
- SpacerItem buttonSpacer = new SpacerItem();
- buttonSpacer.setEndRow(false);
- testConnectionButton.setStartRow(false);
-
- databaseForm.setFields(dbType, dbConnectionUrl, dbUsername, dbPassword, buttonSpacer, testConnectionButton,
- dbExistingSchemaOption);
-
- ////////////////////////////////////////////////////////
- // The Server Settings form
-
- final DynamicForm serverSettingsForm = new DynamicForm();
- serverSettingsForm.setPadding(5);
- serverSettingsForm.setCellPadding(5);
- serverSettingsForm.setAutoWidth();
- serverSettingsForm.setIsGroup(true);
- serverSettingsForm.setWrapItemTitles(false);
- serverSettingsForm.setGroupTitle(MSG.tab_simpleView_serverSettings());
-
- serverSettingServerName = new TextItem(ServerProperties.PROP_HIGH_AVAILABILITY_NAME,
- PROPS_MSG.rhq_server_high_availability_name());
- serverSettingServerName.setWidth(fieldWidth);
- serverSettingServerName.addChangedHandler(new ChangedHandler() {
- public void onChanged(ChangedEvent event) {
- updateServerProperty(ServerProperties.PROP_HIGH_AVAILABILITY_NAME, String.valueOf(event.getValue()));
- if (registeredServersSelection != null) {
- registeredServersSelection.setValue((String) null); // flip it back to *new* since the server name changed
- }
- }
- });
-
- serverSettingPublicAddress = new TextItem("serverPublicAddress",
- MSG.tab_simpleView_serverSettings_publicAddress());
- serverSettingPublicAddress.setWidth(fieldWidth);
-
- serverSettingWebHttpPort = new SpinnerItem(ServerProperties.PROP_WEB_HTTP_PORT,
- PROPS_MSG.rhq_server_startup_web_http_port());
- serverSettingWebHttpPort.setWidth(fieldWidth);
- serverSettingWebHttpPort.setMin(1);
- serverSettingWebHttpPort.setMax(65535);
- serverSettingWebHttpPort.addChangedHandler(new ChangedHandler() {
- public void onChanged(ChangedEvent event) {
- updateServerProperty(ServerProperties.PROP_WEB_HTTP_PORT, String.valueOf(event.getValue()));
- }
- });
-
- serverSettingWebSecureHttpPort = new SpinnerItem(ServerProperties.PROP_WEB_HTTPS_PORT,
- PROPS_MSG.rhq_server_startup_web_https_port());
- serverSettingWebSecureHttpPort.setWidth(fieldWidth);
- serverSettingWebSecureHttpPort.setMin(1);
- serverSettingWebSecureHttpPort.setMax(65535);
- serverSettingWebSecureHttpPort.addChangedHandler(new ChangedHandler() {
- public void onChanged(ChangedEvent event) {
- updateServerProperty(ServerProperties.PROP_WEB_HTTPS_PORT, String.valueOf(event.getValue()));
- }
- });
-
- registeredServersSelection = new SelectItem("registeredServersSelectItem",
- MSG.tab_simpleView_serverSettings_registeredServers());
- registeredServersSelection.setWidth(fieldWidth);
- addContextualHelp(registeredServersSelection, MSG.help_registeredServers());
- registeredServerNames.put(NEW_SERVER_TO_REGISTER,
- MSG.tab_simpleView_serverSettings_registeredServers_newServer());
- registeredServersSelection.setValueMap(registeredServerNames);
- registeredServersSelection.setDefaultToFirstOption(true);
- registeredServersSelection.addChangedHandler(new ChangedHandler() {
- public void onChanged(ChangedEvent event) {
- final String selectedServerName = String.valueOf(event.getValue());
- final boolean newServer = NEW_SERVER_TO_REGISTER.equals(selectedServerName);
- if (newServer) {
- serverSettingServerName.setValue("");
- serverSettingPublicAddress.setValue("");
- updateServerProperty(ServerProperties.PROP_HIGH_AVAILABILITY_NAME, "");
- } else {
- final Conn conn = new Conn();
- installerService.getServerDetails(conn.url(), conn.username(), conn.password(), selectedServerName,
- new AsyncCallback<ServerDetails>() {
- public void onSuccess(ServerDetails details) {
- serverSettingServerName.setValue(details.getName());
- serverSettingPublicAddress.setValue(details.getEndpointAddress());
- serverSettingWebHttpPort.setValue(details.getEndpointPortString());
- serverSettingWebSecureHttpPort.setValue(details.getEndpointSecurePortString());
- updateServerProperty(ServerProperties.PROP_HIGH_AVAILABILITY_NAME, details.getName());
- updateServerProperty(ServerProperties.PROP_WEB_HTTP_PORT,
- details.getEndpointPortString());
- updateServerProperty(ServerProperties.PROP_WEB_HTTPS_PORT,
- details.getEndpointSecurePortString());
- }
-
- public void onFailure(Throwable caught) {
- SC.say("Failed to get details on selected server [" + selectedServerName + "]");
- }
- });
- }
- }
- });
-
- serverSettingEmailSMTPHostname = new TextItem(ServerProperties.PROP_EMAIL_SMTP_HOST,
- PROPS_MSG.rhq_server_email_smtp_host());
- serverSettingEmailSMTPHostname.setWidth(fieldWidth);
- serverSettingEmailSMTPHostname.addChangedHandler(new ChangedHandler() {
- public void onChanged(ChangedEvent event) {
- updateServerProperty(ServerProperties.PROP_EMAIL_SMTP_HOST, String.valueOf(event.getValue()));
- }
- });
-
- serverSettingEmailFromAddress = new TextItem(ServerProperties.PROP_EMAIL_FROM_ADDRESS,
- PROPS_MSG.rhq_server_email_from_address());
- serverSettingEmailFromAddress.setWidth(fieldWidth);
- serverSettingEmailFromAddress.addChangedHandler(new ChangedHandler() {
- public void onChanged(ChangedEvent event) {
- updateServerProperty(ServerProperties.PROP_EMAIL_FROM_ADDRESS, String.valueOf(event.getValue()));
- }
- });
-
- serverSettingsForm.setItems(registeredServersSelection, serverSettingServerName, serverSettingPublicAddress,
- serverSettingWebHttpPort, serverSettingWebSecureHttpPort, serverSettingEmailSMTPHostname,
- serverSettingEmailFromAddress);
-
- ////////////////////////////////////////////////////////
- // The layout holding the forms in the simple view tab
-
- VLayout simpleForm = new VLayout();
- simpleForm.setLayoutMargin(5);
- simpleForm.setMembersMargin(5);
- simpleForm.setWidth100();
- simpleForm.setHeight100();
- simpleForm.setDefaultLayoutAlign(Alignment.CENTER);
- simpleForm.addMember(databaseForm);
- simpleForm.addMember(serverSettingsForm);
-
- return simpleForm;
- }
-
- private void connectedToDatabase() {
- final Conn conn = new Conn();
- testConnectionButton.setIcon("[SKIN]/actions/ok.png");
- installerService.isDatabaseSchemaExist(conn.url(), conn.username(), conn.password(),
- new AsyncCallback<Boolean>() {
- public void onSuccess(Boolean schemaExists) {
- if (schemaExists) {
- dbExistingSchemaOption.show();
- registeredServersSelection.enable();
-
- installerService.getServerNames(conn.url(), conn.username(), conn.password(),
- new AsyncCallback<ArrayList<String>>() {
- public void onSuccess(ArrayList<String> servers) {
- registeredServerNames.clear();
- registeredServerNames.put(NEW_SERVER_TO_REGISTER,
- MSG.tab_simpleView_serverSettings_registeredServers_newServer());
- for (String server : servers) {
- registeredServerNames.put(server, server);
- }
- registeredServersSelection.setValueMap(registeredServerNames);
- }
-
- public void onFailure(Throwable caught) {
- SC.say("Cannot get the registered server names");
- }
- });
- } else {
- dbExistingSchemaOption.hide();
- registeredServersSelection.setValue((String) null);
- registeredServersSelection.disable();
- }
- mainInstallButton.enable();
- }
-
- public void onFailure(Throwable caught) {
- SC.say("Cannot determine the status of the database schema: " + caught);
- }
- });
- }
-
- private void addContextualHelp(final FormItem item, final String helpText) {
- final FormItemIcon helpIcon = new FormItemIcon();
- helpIcon.setSrc("[SKIN]/actions/help.png");
- helpIcon.setNeverDisable(true);
- item.setIcons(helpIcon);
-
- item.addIconClickHandler(new IconClickHandler() {
- public void onIconClick(IconClickEvent event) {
- if (event.getIcon().equals(helpIcon)) {
- SC.say(helpText);
- }
- }
- });
- }
-
- /**
- * Call this when the user changed something (like connection URL or password) that renders
- * the old connection test invalid. This will ensure the user is forced to re-test the connection.
- */
- private void forceAnotherTestConnection() {
- mainInstallButton.disable();
- testConnectionButton.setIcon(null);
- dbExistingSchemaOption.hide();
-
- if (registeredServerNames.size() > 1) {
- registeredServerNames.clear();
- registeredServerNames.put(NEW_SERVER_TO_REGISTER, MSG.tab_simpleView_serverSettings_registeredServers_newServer());
- }
- registeredServersSelection.setValue((String) null);
- registeredServersSelection.setValueMap(registeredServerNames);
- }
-
- // for convienence, so we can get the conn url, user, pass in one object
- private class Conn {
- public String url() {
- return Installer.this.dbConnectionUrl.getValueAsString();
- }
-
- public String username() {
- return Installer.this.dbUsername.getValueAsString();
- }
-
- public String password() {
- return Installer.this.dbPassword.getValueAsString();
- }
- }
-}
diff --git a/modules/enterprise/gui/gwt-installer-war/src/main/java/org/rhq/enterprise/gui/installer/client/ServerPropertyRecordList.java b/modules/enterprise/gui/gwt-installer-war/src/main/java/org/rhq/enterprise/gui/installer/client/ServerPropertyRecordList.java
deleted file mode 100644
index 654e3cf..0000000
--- a/modules/enterprise/gui/gwt-installer-war/src/main/java/org/rhq/enterprise/gui/installer/client/ServerPropertyRecordList.java
+++ /dev/null
@@ -1,62 +0,0 @@
-package org.rhq.enterprise.gui.installer.client;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import com.smartgwt.client.data.Record;
-import com.smartgwt.client.data.RecordList;
-
-/**
- * This provides a RecordList that is really a map underneath (each record is nothing more
- * than a name/value pair; that is, each record has two attributes: name and value).
- *
- * We use this because this RecordList will be the list backing the Advanced View grid.
- * So changing this list will be automatically reflected in that grid.
- *
- * @author John Mazzitelli
- */
-public class ServerPropertyRecordList extends RecordList {
-
- public static final String PROPERTY_NAME = "n";
- public static final String PROPERTY_VALUE = "v";
-
- // this map is kept in sync with the record list
- private HashMap<String, String> map = new HashMap<String, String>();
-
- public HashMap<String, String> getMap() {
- return map;
- }
-
- public String getServerProperty(String name) {
- String value = map.get(name);
- return (value == null) ? "" : value;
- }
-
- public void putServerProperty(String name, String value) {
- // fill in the internal map
- map.put(name, value);
-
- // now update the record list
- Record found = find(PROPERTY_NAME, name);
- if (found == null) {
- Record record = new Record();
- record.setAttribute(PROPERTY_NAME, name);
- record.setAttribute(PROPERTY_VALUE, value);
- add(record);
- } else {
- found.setAttribute(PROPERTY_VALUE, value);
- }
- }
-
- public void replaceServerProperties(Map<String, String> newMap) {
- // first update the internal map
- map.clear();
- map.putAll(newMap);
-
- // now update the record list
- setLength(0);
- for (Map.Entry<String, String> entry : newMap.entrySet()) {
- putServerProperty(entry.getKey(), entry.getValue());
- }
- }
-}
diff --git a/modules/enterprise/gui/gwt-installer-war/src/main/java/org/rhq/enterprise/gui/installer/client/gwt/InstallerGWTService.java b/modules/enterprise/gui/gwt-installer-war/src/main/java/org/rhq/enterprise/gui/installer/client/gwt/InstallerGWTService.java
deleted file mode 100644
index c37d923..0000000
--- a/modules/enterprise/gui/gwt-installer-war/src/main/java/org/rhq/enterprise/gui/installer/client/gwt/InstallerGWTService.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2012 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.gui.installer.client.gwt;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-
-import com.google.gwt.user.client.rpc.RemoteService;
-
-import org.rhq.enterprise.gui.installer.client.shared.ServerDetails;
-
-/**
- * @author John Mazzitelli
- */
-public interface InstallerGWTService extends RemoteService {
-
- /**
- * Returns a list of all registered servers in the database.
- *
- * @param connectionUrl
- * @param username
- * @param password
- * @return list of all existing servers registered in the database.
- * @throws Exception
- */
- ArrayList<String> getServerNames(String connectionUrl, String username, String password) throws Exception;
-
- /**
- * Returns details on a specific server that is registered in the database.
- *
- * @param connectionUrl
- * @param username
- * @param password
- * @param serverName the name of the server whose details are to be retrieved
- * @return the details of the server or null if the server does not exist
- * @throws Exception
- */
- ServerDetails getServerDetails(String connectionUrl, String username, String password, String serverName)
- throws Exception;
-
- /**
- * Tests to see if there is already a schema installed.
- *
- * @param connectionUrl
- * @param username
- * @param password
- * @return <code>true</code> if there appears to be a schema installed in the database already.
- * @throws Exception
- */
- boolean isDatabaseSchemaExist(String connectionUrl, String username, String password) throws Exception;
-
- /**
- * Tests that the database can be connected to with the given URL and credentials.
- * @param connectionUrl
- * @param username
- * @param password
- * @return <code>null</code> if the connection succeeded; this will be an error message if failed
- * @throws Exception
- */
- String testConnection(String connectionUrl, String username, String password) throws Exception;
-
- /**
- * Returns the rhq-server.properties values in a map.
- * @return server properties
- * @throws Exception
- */
- HashMap<String, String> getServerProperties() throws Exception;
-
- /**
- * Saves the rhq-server.properties with the given values.
- * @param serverProperties
- * @throws Exception
- */
- void saveServerProperties(HashMap<String, String> serverProperties) throws Exception;
-
- /**
- * Returns the version string for the app server itself (e.g. "7.1.2.Final").
- * @return version string of app server
- * @throws Exception
- */
- String getAppServerVersion() throws Exception;
-
- /**
- * Returns the general type of operating system the server is running on (e.g. "Linux").
- * @return os type name
- * @throws Exception
- */
- String getOperatingSystem() throws Exception;
-}
diff --git a/modules/enterprise/gui/gwt-installer-war/src/main/java/org/rhq/enterprise/gui/installer/client/shared/ServerDetails.java b/modules/enterprise/gui/gwt-installer-war/src/main/java/org/rhq/enterprise/gui/installer/client/shared/ServerDetails.java
deleted file mode 100644
index b54e380..0000000
--- a/modules/enterprise/gui/gwt-installer-war/src/main/java/org/rhq/enterprise/gui/installer/client/shared/ServerDetails.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2012 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.gui.installer.client.shared;
-
-import java.io.Serializable;
-
-public class ServerDetails implements Serializable {
- private static final long serialVersionUID = 1L;
-
- public static final String DEFAULT_AFFINITY_GROUP = "";
- public static final int DEFAULT_ENDPOINT_PORT = 7080;
- public static final int DEFAULT_ENDPOINT_SECURE_PORT = 7443;
-
- private String name;
- private String endpointAddress;
- private int endpointPort;
- private int endpointSecurePort;
- private String affinityGroup;
-
- protected ServerDetails() {
- // for GWT
- }
-
- public ServerDetails(String name, String endpointAddress, int port, int securePort, String affinityGroup) {
- this.name = name;
- this.endpointAddress = endpointAddress;
- this.endpointPort = port;
- this.endpointSecurePort = securePort;
- this.affinityGroup = affinityGroup;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- if ((null != name) && (!"".equals(name.trim()))) {
- this.name = name;
- }
- }
-
- public String getEndpointAddress() {
- return endpointAddress;
- }
-
- public void setEndpointAddress(String endpointAddress) {
- if ((null != endpointAddress) && (!"".equals(endpointAddress.trim()))) {
- this.endpointAddress = endpointAddress;
- }
- }
-
- public int getEndpointPort() {
- return endpointPort;
- }
-
- public void setEndpointPort(int endpointPort) {
- this.endpointPort = endpointPort;
- }
-
- public String getEndpointPortString() {
- return (String.valueOf(endpointPort));
- }
-
- public void setEndpointPortString(String endpointPort) {
- this.endpointPort = Integer.valueOf(endpointPort).intValue();
- }
-
- public int getEndpointSecurePort() {
- return endpointSecurePort;
- }
-
- public void setEndpointSecurePort(int endpointSecurePort) {
- this.endpointSecurePort = endpointSecurePort;
- }
-
- public String getEndpointSecurePortString() {
- return (String.valueOf(endpointSecurePort));
- }
-
- public void setEndpointSecurePortString(String endpointSecurePort) {
- this.endpointSecurePort = Integer.valueOf(endpointSecurePort).intValue();
- }
-
- public String getAffinityGroup() {
- return affinityGroup;
- }
-
- public void setAffinityGroup(String affinityGroup) {
- if ((null != affinityGroup) && (!"".equals(affinityGroup.trim()))) {
- this.affinityGroup = affinityGroup;
- }
- }
-
- @Override
- public String toString() {
- return "[name=" + name + " address=" + endpointAddress + " port=" + endpointPort + " secureport="
- + endpointSecurePort + " affinitygroup=" + affinityGroup + "]";
- }
-}
diff --git a/modules/enterprise/gui/gwt-installer-war/src/main/java/org/rhq/enterprise/gui/installer/client/shared/ServerProperties.java b/modules/enterprise/gui/gwt-installer-war/src/main/java/org/rhq/enterprise/gui/installer/client/shared/ServerProperties.java
deleted file mode 100644
index d92d4ce..0000000
--- a/modules/enterprise/gui/gwt-installer-war/src/main/java/org/rhq/enterprise/gui/installer/client/shared/ServerProperties.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2008 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.gui.installer.client.shared;
-
-/**
- * Settings found in the rhq-server.properties file that controls the startup configuration of the server.
- *
- * @author John Mazzitelli
- */
-public class ServerProperties {
- public static final String PREFIX_PROP_DATABASE = "rhq.server.database.";
- public static final String PROP_DATABASE_TYPE = PREFIX_PROP_DATABASE + "type-mapping";
- public static final String PROP_DATABASE_CONNECTION_URL = PREFIX_PROP_DATABASE + "connection-url";
- public static final String PROP_DATABASE_USERNAME = PREFIX_PROP_DATABASE + "user-name";
- public static final String PROP_DATABASE_PASSWORD = PREFIX_PROP_DATABASE + "password";
- public static final String PROP_DATABASE_SERVER_NAME = PREFIX_PROP_DATABASE + "server-name";
- public static final String PROP_DATABASE_PORT = PREFIX_PROP_DATABASE + "port";
- public static final String PROP_DATABASE_DB_NAME = PREFIX_PROP_DATABASE + "db-name";
- public static final String PROP_DATABASE_HIBERNATE_DIALECT = "hibernate.dialect";
- public static final String PROP_QUARTZ_DRIVER_DELEGATE_CLASS = "rhq.server.quartz.driverDelegateClass";
- public static final String PROP_QUARTZ_SELECT_WITH_LOCK_SQL = "rhq.server.quartz.selectWithLockSQL";
- public static final String PROP_QUARTZ_LOCK_HANDLER_CLASS = "rhq.server.quartz.lockHandlerClass";
-
- public static final String PREFIX_PROP_WEB = "rhq.server.startup.web.";
- public static final String PROP_WEB_HTTP_PORT = PREFIX_PROP_WEB + "http.port";
- public static final String PROP_WEB_HTTPS_PORT = PREFIX_PROP_WEB + "https.port";
-
- public static final String PREFIX_PROP_EMBEDDED_AGENT = "rhq.server.embedded-agent.";
- public static final String PROP_EMBEDDED_AGENT_ENABLED = PREFIX_PROP_EMBEDDED_AGENT + "enabled";
-
- public static final String PREFIX_PROP_EMAIL = "rhq.server.email.";
- public static final String PROP_EMAIL_SMTP_HOST = PREFIX_PROP_EMAIL + "smtp-host";
- public static final String PROP_EMAIL_FROM_ADDRESS = PREFIX_PROP_EMAIL + "from-address";
-
- public static final String PROP_HIGH_AVAILABILITY_NAME = "rhq.server.high-availability.name";
- public static final String PROP_MM_AT_START = "rhq.server.maintenance-mode-at-startup";
-}
\ No newline at end of file
diff --git a/modules/enterprise/gui/gwt-installer-war/src/main/java/org/rhq/enterprise/gui/installer/server/service/ManagementService.java b/modules/enterprise/gui/gwt-installer-war/src/main/java/org/rhq/enterprise/gui/installer/server/service/ManagementService.java
deleted file mode 100644
index add78a6..0000000
--- a/modules/enterprise/gui/gwt-installer-war/src/main/java/org/rhq/enterprise/gui/installer/server/service/ManagementService.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2012 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.gui.installer.server.service;
-
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ThreadFactory;
-
-import org.jboss.as.controller.ModelController;
-import org.jboss.as.controller.client.ModelControllerClient;
-import org.jboss.as.server.Services;
-import org.jboss.msc.service.Service;
-import org.jboss.msc.service.ServiceActivator;
-import org.jboss.msc.service.ServiceActivatorContext;
-import org.jboss.msc.service.ServiceName;
-import org.jboss.msc.service.ServiceRegistryException;
-import org.jboss.msc.service.StartContext;
-import org.jboss.msc.service.StartException;
-import org.jboss.msc.service.StopContext;
-import org.jboss.msc.value.InjectedValue;
-
-/**
- * This will provide our co-located management service.
- * This is useful because it helps us avoid performing any management
- * over a remote connector. Since we know we are running co-located
- * in the same app server container that we want to manage, this
- * service will provide us with a management client that does not go
- * over a remote connector to talk to our app server container.
- *
- * @author John Mazzitelli
- */
-public class ManagementService implements ServiceActivator {
-
- private static volatile ModelController controller;
- private static volatile ExecutorService executor;
-
- public static ModelControllerClient getClient() {
- return controller.createClient(executor);
- }
-
- @Override
- public void activate(ServiceActivatorContext context) throws ServiceRegistryException {
- final GetModelControllerService service = new GetModelControllerService();
- context
- .getServiceTarget()
- .addService(ServiceName.of("rhq", "installer", "management", "client", "getter"), service)
- .addDependency(Services.JBOSS_SERVER_CONTROLLER, ModelController.class, service.modelControllerValue)
- .install();
- }
-
- private class GetModelControllerService implements Service<Void> {
- private InjectedValue<ModelController> modelControllerValue = new InjectedValue<ModelController>();
-
- @Override
- public Void getValue() throws IllegalStateException, IllegalArgumentException {
- return null;
- }
-
- @Override
- public void start(StartContext context) throws StartException {
- ManagementService.executor = Executors.newFixedThreadPool(5, new ThreadFactory() {
- @Override
- public Thread newThread(Runnable r) {
- Thread t = new Thread(r);
- t.setDaemon(true);
- t.setName("ManagementServiceModelControllerClientThread");
- return t;
- }
- });
- ManagementService.controller = modelControllerValue.getValue();
- }
-
- @Override
- public void stop(StopContext context) {
- try {
- ManagementService.executor.shutdownNow();
- } finally {
- ManagementService.executor = null;
- ManagementService.controller = null;
- }
- }
-
- }
-}
diff --git a/modules/enterprise/gui/gwt-installer-war/src/main/java/org/rhq/enterprise/gui/installer/server/servlet/InstallerGWTServiceImpl.java b/modules/enterprise/gui/gwt-installer-war/src/main/java/org/rhq/enterprise/gui/installer/server/servlet/InstallerGWTServiceImpl.java
deleted file mode 100644
index 6247168..0000000
--- a/modules/enterprise/gui/gwt-installer-war/src/main/java/org/rhq/enterprise/gui/installer/server/servlet/InstallerGWTServiceImpl.java
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2012 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.gui.installer.server.servlet;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Properties;
-
-import javax.servlet.annotation.WebServlet;
-
-import com.google.gwt.user.server.rpc.RemoteServiceServlet;
-
-import org.jboss.as.controller.client.ModelControllerClient;
-
-import org.rhq.common.jbossas.client.controller.Address;
-import org.rhq.common.jbossas.client.controller.JBossASClient;
-import org.rhq.common.jbossas.client.controller.SecurityDomainJBossASClient;
-import org.rhq.core.util.PropertiesFileUpdate;
-import org.rhq.enterprise.gui.installer.client.gwt.InstallerGWTService;
-import org.rhq.enterprise.gui.installer.client.shared.ServerDetails;
-import org.rhq.enterprise.gui.installer.server.service.ManagementService;
-
-/**
- * @author John Mazzitelli
- */
- at WebServlet(value = "/org.rhq.enterprise.gui.installer.Installer/InstallerGWTService")
-public class InstallerGWTServiceImpl extends RemoteServiceServlet implements InstallerGWTService {
-
- private static final long serialVersionUID = 1L;
-
- private static final String RHQ_SECURITY_DOMAIN = "RHQDSSecurityDomain";
-
- @Override
- public ArrayList<String> getServerNames(String connectionUrl, String username, String password) throws Exception {
- try {
- return ServerInstallUtil.getServerNames(connectionUrl, username, password);
- } catch (Exception e) {
- log("Could not get the list of registered server names", e);
- return null;
- }
- }
-
- @Override
- public ServerDetails getServerDetails(String connectionUrl, String username, String password, String serverName)
- throws Exception {
- try {
- return ServerInstallUtil.getServerDetails(connectionUrl, username, password, serverName);
- } catch (Exception e) {
- log("Could not get server details for [" + serverName + "]", e);
- return null;
- }
- }
-
- @Override
- public boolean isDatabaseSchemaExist(String connectionUrl, String username, String password) throws Exception {
- try {
- return ServerInstallUtil.isDatabaseSchemaExist(connectionUrl, username, password);
- } catch (Exception e) {
- log("Could not determine database existence", e);
- return false;
- }
- }
-
- @Override
- public String testConnection(String connectionUrl, String username, String password) throws Exception {
- String results = ServerInstallUtil.testConnection(connectionUrl, username, password);
- return results;
- }
-
- @Override
- public HashMap<String, String> getServerProperties() throws Exception {
- File serverPropertiesFile = getServerPropertiesFile();
- PropertiesFileUpdate propsFile = new PropertiesFileUpdate(serverPropertiesFile.getAbsolutePath());
- Properties props = propsFile.loadExistingProperties();
-
- // GWT can't handle Properties - convert to HashMap
- HashMap<String, String> map = new HashMap<String, String>(props.size());
- for (Object property : props.keySet()) {
- map.put(property.toString(), props.getProperty(property.toString()));
- }
- return map;
- }
-
- @Override
- public void saveServerProperties(HashMap<String, String> serverProperties) throws Exception {
- File serverPropertiesFile = getServerPropertiesFile();
- PropertiesFileUpdate propsFile = new PropertiesFileUpdate(serverPropertiesFile.getAbsolutePath());
-
- // GWT can't handle Properties - convert from HashMap
- Properties props = new Properties();
- for (Map.Entry<String, String> entry : serverProperties.entrySet()) {
- props.setProperty(entry.getKey(), entry.getValue());
- }
-
- propsFile.update(props);
-
- return;
- }
-
- @Override
- public String getAppServerVersion() throws Exception {
- JBossASClient client = new JBossASClient(getClient());
- String version = client.getStringAttribute("release-version", Address.root());
- return version;
- }
-
- @Override
- public String getOperatingSystem() throws Exception {
- JBossASClient client = new JBossASClient(getClient());
- String[] address = { "core-service", "platform-mbean", "type", "operating-system" };
- String osName = client.getStringAttribute("name", Address.root().add(address));
- return osName;
- }
-
- private String getAppServerHomeDir() throws Exception {
- JBossASClient client = new JBossASClient(getClient());
- String[] address = { "core-service", "server-environment" };
- String dir = client.getStringAttribute(true, "home-dir", Address.root().add(address));
- return dir;
- }
-
- private File getServerPropertiesFile() throws Exception {
- File appServerHomeDir = new File(getAppServerHomeDir());
- File serverPropertiesFile = new File(appServerHomeDir, "../bin/rhq-server.properties");
- return serverPropertiesFile;
- }
-
- private ModelControllerClient getClient() {
- ModelControllerClient client = ManagementService.getClient();
- return client;
- }
-
- private void createDatasourceSecurityDomain(String username, String password) throws Exception {
- final SecurityDomainJBossASClient client = new SecurityDomainJBossASClient(getClient());
- final String securityDomain = RHQ_SECURITY_DOMAIN;
- if (!client.isSecurityDomain(securityDomain)) {
- client.createNewSecureIdentitySecurityDomainRequest(securityDomain, username, password);
- log("Security domain [" + securityDomain + "] created");
- } else {
- log("Security domain [" + securityDomain + "] already exists, skipping the creation request");
- }
- }
-}
diff --git a/modules/enterprise/gui/gwt-installer-war/src/main/java/org/rhq/enterprise/gui/installer/server/servlet/ServerInstallUtil.java b/modules/enterprise/gui/gwt-installer-war/src/main/java/org/rhq/enterprise/gui/installer/server/servlet/ServerInstallUtil.java
deleted file mode 100644
index 4577789..0000000
--- a/modules/enterprise/gui/gwt-installer-war/src/main/java/org/rhq/enterprise/gui/installer/server/servlet/ServerInstallUtil.java
+++ /dev/null
@@ -1,274 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2012 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.gui.installer.server.servlet;
-
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.util.ArrayList;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import org.rhq.core.db.DatabaseType;
-import org.rhq.core.db.DatabaseTypeFactory;
-import org.rhq.core.db.DbUtil;
-import org.rhq.core.util.exception.ThrowableUtil;
-import org.rhq.enterprise.gui.installer.client.shared.ServerDetails;
-
-/**
- * Provides utility methods necessary to complete the server installation.
- *
- * @author John Mazzitelli
- */
-public class ServerInstallUtil {
- private static final Log LOG = LogFactory.getLog(ServerInstallUtil.class);
-
- public enum ExistingSchemaOption {
- OVERWRITE, KEEP, SKIP
- };
-
- public static boolean isKeepExistingSchema(ExistingSchemaOption existingSchemaOption) {
- return ExistingSchemaOption.KEEP.name().equals(existingSchemaOption)
- || ExistingSchemaOption.SKIP.name().equals(existingSchemaOption);
- }
-
- /**
- * Returns <code>true</code> if the database already has the database schema created for it. It will not be known
- * what version of schema or if its the latest, all this method tells you is that some RHQ database schema exists.
- *
- * @param connectionUrl
- * @param username
- * @param password
- * @return <code>true</code> if the database can be connected to
- *
- * @throws Exception if failed to communicate with the database
- */
- public static boolean isDatabaseSchemaExist(String connectionUrl, String username, String password)
- throws Exception {
-
- Connection conn = getDatabaseConnection(connectionUrl, username, password);
- DatabaseType db = DatabaseTypeFactory.getDatabaseType(conn);
-
- try {
- return db.checkTableExists(conn, "RHQ_PRINCIPAL");
- } catch (IllegalStateException e) {
- return false;
- } finally {
- db.closeConnection(conn);
- }
- }
-
- /**
- * Get the list of existing servers from an existing schema.
- *
- * @param connectionUrl
- * @param username
- * @param password
- * @return List of server names registered in the database. Empty list if the table does not exist or there are no entries in the table.
- *
- * @throws Exception if failed to communicate with the database
- */
- public static ArrayList<String> getServerNames(String connectionUrl, String username, String password)
- throws Exception {
- DatabaseType db = null;
- Connection conn = null;
- Statement stm = null;
- ResultSet rs = null;
- ArrayList<String> result = new ArrayList<String>();
-
- try {
- conn = getDatabaseConnection(connectionUrl, username, password);
- db = DatabaseTypeFactory.getDatabaseType(conn);
-
- if (db.checkTableExists(conn, "rhq_server")) {
-
- stm = conn.createStatement();
- rs = stm.executeQuery("SELECT name FROM rhq_server ORDER BY name asc");
-
- while (rs.next()) {
- result.add(rs.getString(1));
- }
- }
- } catch (IllegalStateException e) {
- // table does not exist
- } catch (SQLException e) {
- LOG.info("Unable to fetch existing server info: " + e.getMessage());
- } finally {
- if (null != db) {
- db.closeJDBCObjects(conn, stm, rs);
- }
- }
-
- return result;
- }
-
- /**
- * Returns information on the server as found in the database (port numbers, affinity group, etc).
- *
- * @param connectionUrl
- * @param username
- * @param password
- * @param serverName the server whose details are to be returned
- * @return the information on the named server
- */
- public static ServerDetails getServerDetails(String connectionUrl, String username, String password,
- String serverName) {
-
- DatabaseType db = null;
- Connection conn = null;
- ServerDetails result = null;
-
- try {
- conn = getDatabaseConnection(connectionUrl, username, password);
- db = DatabaseTypeFactory.getDatabaseType(conn);
-
- result = getServerDetails(db, conn, serverName);
-
- } catch (Exception e) {
- LOG.info("Unable to get server detail: " + e.getMessage());
- } finally {
- if (null != db) {
- db.closeConnection(conn);
- }
- }
-
- return result;
- }
-
- private static ServerDetails getServerDetails(DatabaseType db, Connection conn, String serverName) {
- PreparedStatement stm = null;
- ResultSet rs = null;
- ServerDetails result = null;
-
- if (null == serverName) {
- return result;
- }
-
- try {
- stm = conn.prepareStatement("" //
- + "SELECT s.address, s.port, s.secure_port, ag.name " //
- + " FROM rhq_server s LEFT JOIN rhq_affinity_group ag ON ag.id = s.affinity_group_id " //
- + " WHERE s.name = ?");
- stm.setString(1, serverName.trim());
-
- rs = stm.executeQuery();
-
- if (rs.next()) {
- result = new ServerDetails(serverName, rs.getString(1), rs.getInt(2), rs.getInt(3), rs.getString(4));
- }
-
- } catch (SQLException e) {
- LOG.info("Unable to get affinity group name for server: " + e.getMessage());
- } finally {
- if (null != db) {
- db.closeResultSet(rs);
- db.closeStatement(stm);
- }
- }
-
- return result;
- }
-
- /**
- * Tests to make sure the server can be connected to with the given settings.
- * If the test is successful, <code>null</code>. If the test fails, the returned string
- * will be the error message to indicate the problem.
- *
- * @param connectionUrl
- * @param username
- * @param password
- * @return error message if test failed; <code>null</code> if test succeeded
- */
- public static String testConnection(String connectionUrl, String username, String password) {
-
- // its possible the JDBC URL was changed, clear the factory cache in case the DB version is different now
- DatabaseTypeFactory.clearDatabaseTypeCache();
-
- try {
- ensureDatabaseIsSupported(connectionUrl, username, password);
- return null;
- } catch (Exception e) {
- LOG.warn("Installer failed to test connection", e);
- return ThrowableUtil.getAllMessages(e);
- }
- }
-
- /**
- * Call this when you need to confirm that the database is supported.
- *
- * @param connectionUrl
- * @param username
- * @param password
- *
- * @throws Exception if the database is not supported
- */
- public static void ensureDatabaseIsSupported(String connectionUrl, String username, String password)
- throws Exception {
- Connection conn = null;
- DatabaseType db = null;
-
- try {
- conn = getDatabaseConnection(connectionUrl, username, password);
- db = DatabaseTypeFactory.getDatabaseType(conn);
-
- String version = db.getVersion();
-
- if (DatabaseTypeFactory.isPostgres(db)) {
- if (version.startsWith("7") || version.equals("8") || version.startsWith("8.0")
- || version.startsWith("8.1")) {
- throw new Exception("Unsupported PostgreSQL [" + db + "]");
- }
- } else if (DatabaseTypeFactory.isOracle(db)) {
- if (version.startsWith("8") || version.startsWith("9")) {
- throw new Exception("Unsupported Oracle [" + db + "]");
- }
- } else {
- throw new Exception("Unsupported DB [" + db + "]");
- }
-
- LOG.info("Database is supported: " + db);
- } finally {
- if (db != null) {
- db.closeConnection(conn);
- }
- }
-
- return;
- }
-
- /**
- * Returns a database connection with the given set of properties providing the settings that allow for a successful
- * database connection. If <code>props</code> is <code>null</code>, it will use the server properties from
- * {@link #getServerProperties()}.
- *
- * @param connectionUrl
- * @param userName
- * @param password
- * @return the database connection
- *
- * @throws SQLException if cannot successfully connect to the database
- */
- public static Connection getDatabaseConnection(String connectionUrl, String userName, String password)
- throws SQLException {
- return DbUtil.getConnection(connectionUrl, userName, password);
- }
-}
diff --git a/modules/enterprise/gui/gwt-installer-war/src/main/resources/org/rhq/enterprise/gui/installer/Installer.gwt.xml b/modules/enterprise/gui/gwt-installer-war/src/main/resources/org/rhq/enterprise/gui/installer/Installer.gwt.xml
deleted file mode 100644
index 164e94a..0000000
--- a/modules/enterprise/gui/gwt-installer-war/src/main/resources/org/rhq/enterprise/gui/installer/Installer.gwt.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.4.0//EN"
- "http://google-web-toolkit.googlecode.com/svn/tags/2.4.0/distro-source/core/src/gwt-module.dtd">
-
-<module>
-
- <inherits name='com.google.gwt.user.User'/>
- <inherits name='com.google.gwt.i18n.I18N'/>
- <inherits name="com.google.gwt.logging.Logging"/>
-
- <inherits name='com.smartgwt.SmartGwt' />
- <inherits name="com.smartgwt.tools.SmartGwtTools"/>
-
- <!-- ============================ gwt logging ============================= -->
- <set-property name="gwt.logging.enabled" value="TRUE"/>
- <!-- FINE ~= DEBUG in gwt-log -->
- <set-property name="gwt.logging.logLevel" value="FINE"/>
- <set-property name="gwt.logging.consoleHandler" value="ENABLED" />
- <set-property name="gwt.logging.developmentModeHandler" value="ENABLED" />
- <set-property name="gwt.logging.firebugHandler" value="ENABLED" />
- <set-property name="gwt.logging.hasWidgetsHandler" value="DISABLED" />
- <set-property name="gwt.logging.popupHandler" value="DISABLED" />
- <set-property name="gwt.logging.systemHandler" value="ENABLED" />
- <set-property name="gwt.logging.simpleRemoteHandler" value="DISABLED" />
-
- <set-property name="user.agent" value="${gwt.userAgent}"/>
- <extend-property name="locale" values="${gwt.locale}" />
-
- <set-configuration-property name="locale.usemeta" value="Y"/>
- <set-configuration-property name="locale.useragent" value="Y"/>
- <set-configuration-property name="locale.searchorder" value="queryparam,meta,useragent,cookie"/>
- <set-property-fallback name="locale" value="${gwt.fallback.locale}"/>
-
- <entry-point class='org.rhq.enterprise.gui.installer.client.Installer'/>
-
-</module>
diff --git a/modules/enterprise/gui/gwt-installer-war/src/main/resources/org/rhq/enterprise/gui/installer/client/Messages.properties b/modules/enterprise/gui/gwt-installer-war/src/main/resources/org/rhq/enterprise/gui/installer/client/Messages.properties
deleted file mode 100644
index 5915f40..0000000
--- a/modules/enterprise/gui/gwt-installer-war/src/main/resources/org/rhq/enterprise/gui/installer/client/Messages.properties
+++ /dev/null
@@ -1,21 +0,0 @@
-button_reset = Reset
-button_save = Save
-button_startInstallation = Press To Start The Installation Now
-button_testConnection = Test Connection
-help_registeredServers = If you are performing an upgrade or a re-installation then you should select a server from this list of registered servers. If you want to install a new server into the system, select the *New Server* option. (Note that if you are going to overwrite your existing schema, you cannot select an existing registered server since they will be deleted when the overwrite is performed.)
-property_name_label = Property
-property_value_label = Value
-schema_update_keep = Keep (Maintain Existing Data)
-schema_update_overwrite = Overwrite (Lose Existing Data!)
-schema_update_question = A database schema already exists. What do you want to do?
-schema_update_skip = Skip (Leave Database As-Is)
-tab_advancedView = Advanced View
-tab_simpleView = Simple View
-tab_simpleView_database = Database Settings
-tab_simpleView_serverSettings = Server Settings
-tab_simpleView_serverSettings_publicAddress = Server Public Address
-tab_simpleView_serverSettings_registeredServers = Registered Server Names
-tab_simpleView_serverSettings_registeredServers_newServer = *New Server*
-tab_welcome = Welcome
-tab_welcome_content = <h1>Welcome to the new GWT Installer</h1>\nThis is the <b>new</b> installer.\nAny HTML can go in here.
-welcome_title = Installing the Server
diff --git a/modules/enterprise/gui/gwt-installer-war/src/main/resources/org/rhq/enterprise/gui/installer/client/ServerPropertiesMessages.properties b/modules/enterprise/gui/gwt-installer-war/src/main/resources/org/rhq/enterprise/gui/installer/client/ServerPropertiesMessages.properties
deleted file mode 100644
index 6c53445..0000000
--- a/modules/enterprise/gui/gwt-installer-war/src/main/resources/org/rhq/enterprise/gui/installer/client/ServerPropertiesMessages.properties
+++ /dev/null
@@ -1,23 +0,0 @@
-### RHQ Server Configuration Properties
-### These should match the actual property names in rhq-server.properties.
-
-# Database
-rhq.server.database.connection-url=Database Connection URL
-rhq.server.database.user-name=Database Username
-rhq.server.database.password=Database Password
-rhq.server.database.type-mapping=Database Type
-
-# High Availability (HA)
-rhq.server.high-availability.name=Server Name
-rhq.server.maintenance-mode-at-startup=Maintenance Mode At Startup
-
-# General Properties
-rhq.server.startup.web.http.port=HTTP Port
-rhq.server.startup.web.https.port=Secure HTTP Port
-
-# Embedded RHQ Agent
-rhq.server.embedded-agent.enabled=Embedded Agent Enabled
-
-# Email
-rhq.server.email.smtp-host=Email SMTP Host
-rhq.server.email.from-address=Email From Address
\ No newline at end of file
diff --git a/modules/enterprise/gui/gwt-installer-war/src/main/webapp/WEB-INF/classes/META-INF/services/org.jboss.msc.service.ServiceActivator b/modules/enterprise/gui/gwt-installer-war/src/main/webapp/WEB-INF/classes/META-INF/services/org.jboss.msc.service.ServiceActivator
deleted file mode 100644
index c64cc21..0000000
--- a/modules/enterprise/gui/gwt-installer-war/src/main/webapp/WEB-INF/classes/META-INF/services/org.jboss.msc.service.ServiceActivator
+++ /dev/null
@@ -1 +0,0 @@
-org.rhq.enterprise.gui.installer.server.service.ManagementService
\ No newline at end of file
diff --git a/modules/enterprise/gui/gwt-installer-war/src/main/webapp/WEB-INF/web.xml b/modules/enterprise/gui/gwt-installer-war/src/main/webapp/WEB-INF/web.xml
deleted file mode 100644
index b970eb3..0000000
--- a/modules/enterprise/gui/gwt-installer-war/src/main/webapp/WEB-INF/web.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
-
- <welcome-file-list>
- <welcome-file>index.html</welcome-file>
- </welcome-file-list>
-
-</web-app>
diff --git a/modules/enterprise/gui/gwt-installer-war/src/main/webapp/index.html b/modules/enterprise/gui/gwt-installer-war/src/main/webapp/index.html
deleted file mode 100644
index cb9016e..0000000
--- a/modules/enterprise/gui/gwt-installer-war/src/main/webapp/index.html
+++ /dev/null
@@ -1,45 +0,0 @@
-<html>
-<head>
- <!-- this forces us to emulate IE8 "quirks" mode regardless of IE browser version. It:
- 1) Follows the SmartGWT recommendation of not declaring a DOCTYPE and instead using these meta elements.
- http://forums.smartclient.com/showthread.php?t=15973
- 2) solves initial app load issues that we experienced on some XP and Vista/Windows7 flavors.
- -->
- <meta http-equiv="X-UA-Compatible" content="IE=8" />
-
- <!-- support internationalized characters -->
- <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
-
- <script>
- var search = location.search;
- // only do this if you have not specified locale as query param
- if(search.indexOf("locale") == -1){
- // IE uses browserLanguage
- var lang = navigator.language!=null ? navigator.language : navigator.browserLanguage;
- var lang = lang.replace("-", "_");
- document.write("<meta name='gwt:property' content='locale="+lang +"'>");
- }
- </script>
-
- <title>RHQ Installer</title>
-
- <script type="text/javascript">
- var isomorphicDir = "org.rhq.enterprise.gui.installer.Installer/sc/";
- </script>
-
-</head>
-<body>
-
- <script type="text/javascript" language="javascript"
- src="org.rhq.enterprise.gui.installer.Installer/org.rhq.enterprise.gui.installer.Installer.nocache.js"></script>
-
- <div id="Loading-Panel" style="width: 214px; height: 90px; margin-top: 300px; margin-left: 40%; margin-right: 40%;">
- <div style="text-align: center; border: 3px solid lightgray;">
- Loading Installer...
- </div>
- </div>
-
- <iframe src="javascript:''" id="__gwt_historyFrame" style="width:0;height:0;border:0"></iframe>
-
-</body>
-</html>
diff --git a/modules/enterprise/gui/installer/pom.xml b/modules/enterprise/gui/installer/pom.xml
new file mode 100644
index 0000000..2c0193c
--- /dev/null
+++ b/modules/enterprise/gui/installer/pom.xml
@@ -0,0 +1,407 @@
+<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.rhq</groupId>
+ <artifactId>rhq-parent</artifactId>
+ <version>4.5.0-SNAPSHOT</version>
+ <relativePath>../../../../pom.xml</relativePath>
+ </parent>
+
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-installer</artifactId>
+ <packaging>war</packaging>
+
+ <name>RHQ Enterprise GWT Installer GUI</name>
+ <description>The RHQ Enterprise GWT Installer GUI webapp</description>
+
+ <properties>
+ <!-- dependency versions -->
+ <gwt.version>2.4.0</gwt.version>
+ <smartgwt.version>3.0</smartgwt.version>
+ <jboss.as.version>7.1.1.Final</jboss.as.version> <!-- our AS7 container -->
+ <jboss.msc.version>1.0.2.GA</jboss.msc.version> <!-- this ships with our AS7 container -->
+ <jboss.dmr.version>1.1.1.Final</jboss.dmr.version> <!-- this ships with our AS7 container -->
+
+ <installerGuiParams />
+ <installerGuiRunTarget>'http://localhost:7080/rhq-installer/index.html${installerGuiParams}'</installerGuiRunTarget>
+
+ <!-- If this is too much memory to allocate to your gwt:debug process then
+ override this property in in your settings.xml -->
+ <gwt-plugin.extraJvmArgs>-Xms512M -Xmx512M -XX:PermSize=128M -XX:MaxPermSize=256M</gwt-plugin.extraJvmArgs>
+ <gwt-plugin.localWorkers>4</gwt-plugin.localWorkers>
+
+ <gwt.userAgent>ie8,ie9,gecko1_8,safari,opera</gwt.userAgent>
+ <gwt.draftCompile>false</gwt.draftCompile>
+ <gwt.soyc>false</gwt.soyc>
+ <gwt.style>PRETTY</gwt.style>
+ <!-- <gwt.locale>en,de,ja,pt,zh,ru,cs</gwt.locale> -->
+ <gwt.locale>en</gwt.locale>
+ <gwt.fallback.locale>en</gwt.fallback.locale>
+
+ <enable-tags>true</enable-tags>
+ </properties>
+
+ <dependencyManagement>
+ <dependencies>
+ <!-- JBoss distributes a complete set of Java EE 6 APIs. We use this here
+ so that we always get the correct versions of artifacts.
+ TODO: We should probably move this up to the root pom. -->
+ <dependency>
+ <groupId>org.jboss.spec</groupId>
+ <artifactId>jboss-javaee-6.0</artifactId>
+ <version>3.0.0.Final</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-core-dbutils</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>com.google.gwt</groupId>
+ <artifactId>gwt-servlet</artifactId>
+ <version>${gwt.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>com.google.gwt</groupId>
+ <artifactId>gwt-user</artifactId>
+ <version>${gwt.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- This is so we can compile custom GWT Generators to be called during
+ gwt compilation. Is is not needed at runtime and so is not included in the
+ WAR. -->
+ <dependency>
+ <groupId>com.google.gwt</groupId>
+ <artifactId>gwt-dev</artifactId>
+ <version>${gwt.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>com.smartgwt</groupId>
+ <artifactId>smartgwt</artifactId>
+ <version>${smartgwt.version}</version>
+ </dependency>
+
+ <!-- Import the Servlet API -->
+ <dependency>
+ <groupId>org.jboss.spec.javax.servlet</groupId>
+ <artifactId>jboss-servlet-api_3.0_spec</artifactId>
+ <scope>provided</scope> <!-- provided by AS7 -->
+ </dependency>
+
+ <!-- we need these so we can have our own service to provide a co-located management client -->
+ <dependency>
+ <groupId>org.jboss.msc</groupId>
+ <artifactId>jboss-msc</artifactId>
+ <version>${jboss.msc.version}</version>
+ <scope>provided</scope> <!-- provided by AS7 -->
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-dmr</artifactId>
+ <version>${jboss.dmr.version}</version>
+ <scope>provided</scope> <!-- provided by AS7 -->
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.as</groupId>
+ <artifactId>jboss-as-naming</artifactId>
+ <version>${jboss.as.version}</version>
+ <scope>provided</scope> <!-- provided by AS7 -->
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.as</groupId>
+ <artifactId>jboss-as-server</artifactId>
+ <version>${jboss.as.version}</version>
+ <scope>provided</scope> <!-- provided by AS7 -->
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.as</groupId>
+ <artifactId>jboss-as-controller</artifactId>
+ <version>${jboss.as.version}</version>
+ <scope>provided</scope> <!-- provided by AS7 -->
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.as</groupId>
+ <artifactId>jboss-as-controller-client</artifactId>
+ <version>${jboss.as.version}</version>
+ <scope>provided</scope> <!-- provided by AS7 -->
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>rhq-installer</finalName>
+
+ <resources>
+ <resource>
+ <targetPath>${project.build.directory}/generated-sources/gwt</targetPath>
+ <directory>src/main/resources</directory>
+ <filtering>true</filtering>
+ <includes>
+ <include>**/*.gwt.xml</include>
+ <include>**/*.properties</include>
+ </includes>
+ </resource>
+ <resource>
+ <directory>src/main/java</directory>
+ <includes>
+ <include>**/*.java</include>
+ </includes>
+ </resource>
+ </resources>
+
+ <plugins>
+
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>gwt-maven-plugin</artifactId>
+ <version>2.4.0</version>
+ <configuration>
+ <noServer>true</noServer>
+ <inplace>false</inplace>
+ <logLevel>INFO</logLevel>
+ <runTarget>${installerGuiRunTarget}</runTarget>
+ <extraJvmArgs>${gwt-plugin.extraJvmArgs}</extraJvmArgs>
+ <localWorkers>${gwt-plugin.localWorkers}</localWorkers>
+ <draftCompile>${gwt.draftCompile}</draftCompile>
+ <soyc>${gwt.soyc}</soyc>
+ <buildOutputDirectory>target/gwtclasses</buildOutputDirectory>
+ <hostedWebapp>target/hostedWar</hostedWebapp>
+ <debugSuspend>false</debugSuspend>
+ <servicePattern>**/gwt/*GWTService.java</servicePattern>
+ <i18nMessagesBundle>org.rhq.enterprise.gui.installer.client.Messages</i18nMessagesBundle>
+ <i18nConstantsWithLookupBundle>org.rhq.enterprise.gui.installer.client.ServerPropertiesMessages</i18nConstantsWithLookupBundle>
+ <style>${gwt.style}</style>
+ <strict>true</strict>
+ <!-- compiles gwt artifacts like symbolMap outside of war so it doesnt
+ get packaged -->
+ <deploy>${project.build.directory}/gwt-deploy</deploy>
+ </configuration>
+
+ <executions>
+ <execution>
+ <id>gwt-goals</id>
+ <goals>
+ <goal>compile</goal>
+ <goal>generateAsync</goal>
+ <goal>i18n</goal>
+ </goals>
+ </execution>
+ <execution>
+ <!-- This id is what does the trick, don't change it. For this to work
+ maven 2.2.0 and later is needed. -->
+ <id>default-cli</id>
+ <goals>
+ <goal>debug</goal>
+ </goals>
+ <configuration>
+ <module>org.rhq.enterprise.gui.installer.Installer</module>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <artifactId>maven-war-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifest>
+ <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
+ <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
+ </manifest>
+ <manifestEntries>
+ <Build-Number>${buildNumber}</Build-Number>
+ <Dependencies>org.jboss.msc,org.jboss.as.controller-client,org.jboss.as.controller,org.jboss.as.server</Dependencies>
+ </manifestEntries>
+ </archive>
+ <webResources>
+ <resource>
+ <filtering>false</filtering>
+ <directory>${basedir}/src/main/webapp</directory>
+ </resource>
+ </webResources>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>add-gwt-source</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>add-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>${basedir}/target/generated-sources/gwt</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+
+ </build>
+
+ <profiles>
+ <profile>
+ <id>dev</id>
+
+ <properties>
+ <rhq.rootDir>../../../..</rhq.rootDir>
+ <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir>
+ <rhq.deploymentName>${project.build.finalName}.war</rhq.deploymentName>
+ <rhq.deploymentDir>${rhq.containerDir}/jbossas/server/default/deploy/${rhq.earName}/${rhq.deploymentName}</rhq.deploymentDir>
+ </properties>
+
+ <build>
+ <plugins>
+
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+
+ <execution>
+ <id>deploy-classes</id>
+ <phase>compile</phase>
+ <configuration>
+ <target>
+ <property name="deployment.dir" location="${rhq.deploymentDir}" />
+ <echo>*** Copying updated files from src${file.separator}main${file.separator}webapp${file.separator} to ${deployment.dir}${file.separator}...</echo>
+ <copy todir="${deployment.dir}" verbose="${rhq.verbose}">
+ <fileset dir="${basedir}/src/main/webapp" />
+ </copy>
+ </target>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+
+ <execution>
+ <id>deploy</id>
+ <phase>package</phase>
+ <configuration>
+ <target>
+ <property name="deployment.dir" location="${rhq.deploymentDir}" />
+ <echo>*** Copying updated files from target${file.separator}${project.build.finalName}${file.separator} to ${deployment.dir}${file.separator}...</echo>
+ <copy todir="${deployment.dir}" verbose="${rhq.verbose}">
+ <fileset dir="${basedir}/target/${project.build.finalName}" />
+ </copy>
+ </target>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+
+ <execution>
+ <id>undeploy</id>
+ <phase>clean</phase>
+ <configuration>
+ <target>
+ <property name="deployment.dir" location="${rhq.deploymentDir}" />
+ <echo>*** Deleting ${deployment.dir}${file.separator}...</echo>
+ <delete dir="${deployment.dir}" />
+ </target>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+
+ </executions>
+ </plugin>
+
+ </plugins>
+ </build>
+ </profile>
+
+ <!-- Change the installerGuiRunTarget to not have single quotes. The quotes
+ work for linux but not win -->
+ <profile>
+ <id>windows</id>
+ <activation>
+ <os>
+ <family>Windows</family>
+ </os>
+ </activation>
+ <properties>
+ <installerGuiRunTarget>http://localhost:7080//rhq-installer/index.html${installerGuiParams}</installerGuiRunTarget>
+ </properties>
+ </profile>
+
+ <profile>
+ <id>msg</id>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <includes>
+ <include>org/rhq/enterprise/gui/installer/client/*Messages.java</include>
+ </includes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+ <profile>
+ <id>disable-tags</id>
+ <activation>
+ <property>
+ <name>brew</name>
+ </property>
+ </activation>
+ <properties>
+ <enable.tags>false</enable.tags>
+ </properties>
+ </profile>
+
+ </profiles>
+
+
+ <repositories>
+ <repository>
+ <id>smartgwt</id>
+ <name>SmartGWT Releases</name>
+ <url>http://www.smartclient.com/maven2/</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+
+ <repository>
+ <id>codehaus</id>
+ <name>Codehaus Releases</name>
+ <url>http://repository.codehaus.org/</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+
+ </repositories>
+
+</project>
diff --git a/modules/enterprise/gui/installer/src/main/java/org/rhq/common/jbossas/client/controller/Address.java b/modules/enterprise/gui/installer/src/main/java/org/rhq/common/jbossas/client/controller/Address.java
new file mode 100644
index 0000000..1a54d36
--- /dev/null
+++ b/modules/enterprise/gui/installer/src/main/java/org/rhq/common/jbossas/client/controller/Address.java
@@ -0,0 +1,82 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2012 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.common.jbossas.client.controller;
+
+import java.util.Arrays;
+
+import org.jboss.dmr.ModelNode;
+
+/**
+ * Identifies a managed resource.
+ *
+ * @author John Mazzitelli
+ */
+public class Address implements Cloneable {
+ private ModelNode addressNode;
+
+ public static Address root() {
+ return new Address();
+ }
+
+ public Address() {
+ addressNode = new ModelNode();
+ }
+
+ public Address(String... addressParts) {
+ this();
+ add(addressParts);
+ }
+
+ public ModelNode getAddressNode() {
+ return addressNode;
+ }
+
+ public Address add(String... addressParts) {
+ if (addressParts != null) {
+ if ((addressParts.length % 2) != 0) {
+ throw new IllegalArgumentException("address is incomplete: " + Arrays.toString(addressParts));
+ }
+
+ if (addressParts.length > 0) {
+ for (int i = 0; i < addressParts.length; i += 2) {
+ addressNode.add(addressParts[i], addressParts[i + 1]);
+ }
+ }
+ }
+
+ return this;
+ }
+
+ public Address add(String type, String name) {
+ addressNode.add(type, name);
+ return this;
+ }
+
+ @Override
+ public Address clone() throws CloneNotSupportedException {
+ Address clone = new Address();
+ clone.addressNode = addressNode.clone();
+ return clone;
+ }
+
+ @Override
+ public String toString() {
+ return addressNode.asString();
+ }
+}
\ No newline at end of file
diff --git a/modules/enterprise/gui/installer/src/main/java/org/rhq/common/jbossas/client/controller/DatasourceJBossASClient.java b/modules/enterprise/gui/installer/src/main/java/org/rhq/common/jbossas/client/controller/DatasourceJBossASClient.java
new file mode 100644
index 0000000..fb3135c
--- /dev/null
+++ b/modules/enterprise/gui/installer/src/main/java/org/rhq/common/jbossas/client/controller/DatasourceJBossASClient.java
@@ -0,0 +1,34 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2012 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.common.jbossas.client.controller;
+
+import org.jboss.as.controller.client.ModelControllerClient;
+
+/**
+ * Provides convienence methods associated with datasource management.
+ *
+ * @author John Mazzitelli
+ */
+public class DatasourceJBossASClient extends JBossASClient {
+
+ public DatasourceJBossASClient(ModelControllerClient client) {
+ super(client);
+ }
+
+}
diff --git a/modules/enterprise/gui/installer/src/main/java/org/rhq/common/jbossas/client/controller/FailureException.java b/modules/enterprise/gui/installer/src/main/java/org/rhq/common/jbossas/client/controller/FailureException.java
new file mode 100644
index 0000000..6dde289
--- /dev/null
+++ b/modules/enterprise/gui/installer/src/main/java/org/rhq/common/jbossas/client/controller/FailureException.java
@@ -0,0 +1,77 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2012 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.common.jbossas.client.controller;
+
+import org.jboss.dmr.ModelNode;
+
+/**
+ * Indicates a failed client request.
+ *
+ * @author John Mazzitelli
+ */
+public class FailureException extends RuntimeException {
+ private static final long serialVersionUID = 1L;
+
+ private static final String GENERIC_ERROR = "Failed request";
+
+ public FailureException(ModelNode failureNode) {
+ super(buildErrorMessage(GENERIC_ERROR, failureNode));
+ }
+
+ public FailureException(ModelNode failureNode, String errMsg) {
+ super(buildErrorMessage(errMsg, failureNode));
+ }
+
+ public FailureException(ModelNode failureNode, Throwable cause) {
+ super(buildErrorMessage(GENERIC_ERROR, failureNode), cause);
+ }
+
+ public FailureException(ModelNode failureNode, String errMsg, Throwable cause) {
+ super(buildErrorMessage(errMsg, failureNode), cause);
+ }
+
+ public FailureException(String errMsg, Throwable cause) {
+ super((errMsg != null) ? errMsg : GENERIC_ERROR, cause);
+ }
+
+ public FailureException(String errMsg) {
+ super((errMsg != null) ? errMsg : GENERIC_ERROR);
+ }
+
+ public FailureException(Throwable cause) {
+ super(GENERIC_ERROR, cause);
+ }
+
+ public FailureException() {
+ super(GENERIC_ERROR);
+ }
+
+ private static final String buildErrorMessage(String errMsg, ModelNode failureNode) {
+ if (errMsg == null) {
+ errMsg = GENERIC_ERROR;
+ }
+
+ String description = JBossASClient.getFailureDescription(failureNode);
+ if (description != null) {
+ errMsg += ": " + description;
+ }
+
+ return errMsg;
+ }
+}
diff --git a/modules/enterprise/gui/installer/src/main/java/org/rhq/common/jbossas/client/controller/JBossASClient.java b/modules/enterprise/gui/installer/src/main/java/org/rhq/common/jbossas/client/controller/JBossASClient.java
new file mode 100644
index 0000000..c8d040c
--- /dev/null
+++ b/modules/enterprise/gui/installer/src/main/java/org/rhq/common/jbossas/client/controller/JBossASClient.java
@@ -0,0 +1,304 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2012 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.common.jbossas.client.controller;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.jboss.as.controller.client.ModelControllerClient;
+import org.jboss.as.controller.client.OperationMessageHandler;
+import org.jboss.dmr.ModelNode;
+
+/**
+ * A client that can be used to talk to a JBossAS server via the DMR/ModelControllerClient API.
+ *
+ * @author John Mazzitelli
+ */
+public class JBossASClient {
+
+ // protected to allow subclasses to have a logger, too, without explicitly declaring one themselves
+ protected final Log log = LogFactory.getLog(this.getClass());
+
+ public static final String BATCH = "composite";
+ public static final String BATCH_STEPS = "steps";
+ public static final String OPERATION = "operation";
+ public static final String ADDRESS = "address";
+ public static final String RESULT = "result";
+ public static final String OUTCOME = "outcome";
+ public static final String OUTCOME_SUCCESS = "success";
+ public static final String SUBSYSTEM = "subsystem";
+ public static final String FAILURE_DESCRIPTION = "failure-description";
+ public static final String NAME = "name";
+ public static final String VALUE = "value";
+ public static final String READ_ATTRIBUTE = "read-attribute";
+ public static final String READ_RESOURCE = "read-resource";
+ public static final String WRITE_ATTRIBUTE = "write-attribute";
+ public static final String ADD = "add";
+
+ private ModelControllerClient client;
+
+ public JBossASClient(ModelControllerClient client) {
+ this.client = client;
+ }
+
+ /////////////////////////////////////////////////////////////////
+ // Some static methods useful for convienence
+
+ /**
+ * Convienence method that allows you to create request that reads a single attribute
+ * value to a resource.
+ *
+ * @param attributeName the name of the attribute whose value is to be read
+ * @param address identifies the resource
+ * @return the request
+ */
+ public static ModelNode createReadAttributeRequest(String attributeName, Address address) {
+ return createReadAttributeRequest(false, attributeName, address);
+ }
+
+ /**
+ * Convienence method that allows you to create request that reads a single attribute
+ * value to a resource.
+ *
+ * @param runtime if <code>true</code>, the attribute is a runtime attribute
+ * @param attributeName the name of the attribute whose value is to be read
+ * @param address identifies the resource
+ * @return the request
+ */
+ public static ModelNode createReadAttributeRequest(boolean runtime, String attributeName, Address address) {
+ ModelNode op = createRequest(READ_ATTRIBUTE, address);
+ op.get("include-runtime").set(runtime);
+ op.get(NAME).set(attributeName);
+ return op;
+ }
+
+ /**
+ * Convienence method that allows you to create request that writes a single attribute's
+ * string value to a resource.
+ *
+ * @param attributeName the name of the attribute whose value is to be written
+ * @param attributeValue the attribute value that is to be written
+ * @param address identifies the resource
+ * @return the request
+ */
+ public static ModelNode createWriteAttributeRequest(String attributeName, String attributeValue, Address address) {
+ ModelNode op = createRequest(WRITE_ATTRIBUTE, address);
+ op.get(NAME).set(attributeName);
+ op.get(VALUE).set(attributeValue);
+ return op;
+ }
+
+ /**
+ * Convienence method that builds a partial operation request node.
+ *
+ * @param operation the operation to be requested
+ * @param address identifies the target resource
+ * @return the partial operation request node - caller should fill this in further to complete the node
+ */
+ public static ModelNode createRequest(String operation, Address address) {
+ final ModelNode request = new ModelNode();
+ request.get(OPERATION).set(operation);
+ request.get(ADDRESS).set(address.getAddressNode());
+ return request;
+ }
+
+ /**
+ * Creates a batch of operations that can be atomically invoked.
+ *
+ * @param steps the different operation steps of the batch
+ *
+ * @return the batch operation node
+ */
+ public static ModelNode createBatchRequest(ModelNode... steps) {
+ final ModelNode composite = new ModelNode();
+ composite.get(OPERATION).set(BATCH);
+ composite.get(ADDRESS).setEmptyList();
+ final ModelNode stepsNode = composite.get(BATCH_STEPS);
+ for (ModelNode step : steps) {
+ stepsNode.add(step);
+ }
+ return composite;
+ }
+
+ /**
+ * If the given node has a result list, that list will be returned
+ * with the values as Strings. Otherwise, an empty list is returned.
+ *
+ * @param operationResult the node to examine
+ * @return the result list as Strings if there is a list, empty otherwise
+ */
+ public static List<String> getResultListAsStrings(ModelNode operationResult) {
+ if (!operationResult.hasDefined(RESULT)) {
+ return Collections.emptyList();
+ }
+
+ List<ModelNode> nodeList = operationResult.get(RESULT).asList();
+ if (nodeList.isEmpty()) {
+ return Collections.emptyList();
+ }
+
+ List<String> list = new ArrayList<String>(nodeList.size());
+ for (ModelNode node : nodeList) {
+ list.add(node.asString());
+ }
+
+ return list;
+ }
+
+ /**
+ * If the given node has results, those results are returned in a ModelNode.
+ * Otherwise, an empty node is returned.
+ *
+ * @param operationResult the node to examine
+ * @return the results as a ModelNode
+ */
+ public static ModelNode getResults(ModelNode operationResult) {
+ if (!operationResult.hasDefined(RESULT)) {
+ return new ModelNode();
+ }
+
+ return operationResult.get(RESULT);
+ }
+
+ /**
+ * Examines the given node's result list and if the item is found, returns true.
+ *
+ * @param operationResult the node to examine
+ * @param item the item to look for in the node's result list
+ * @return true if the node has a result list and it contains the item; false otherwise
+ */
+ public static boolean listContains(ModelNode operationResult, String item) {
+ if (!operationResult.hasDefined(RESULT)) {
+ return false;
+ }
+
+ List<ModelNode> nodeList = operationResult.get(RESULT).asList();
+ if (nodeList.isEmpty()) {
+ return false;
+ }
+
+ for (ModelNode node : nodeList) {
+ if (node.asString().equals(item)) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Returns <code>true</code> if the operation was a success; <code>false</code> otherwise.
+ *
+ * @param operationResult the operation result to test
+ * @return the success or failure flag of the result
+ */
+ public static boolean isSuccess(ModelNode operationResult) {
+ if (operationResult != null) {
+ return operationResult.hasDefined(OUTCOME)
+ && operationResult.get(OUTCOME).asString().equals(OUTCOME_SUCCESS);
+ }
+ return false;
+ }
+
+ /**
+ * If the operation result was a failure, this returns the failure description if there is one.
+ * A generic failure message will be returned if the operation was a failure but has no failure
+ * description. A <code>null</code> is returned if the operation was a success.
+ *
+ * @param operationResult the operation whose failure description is to be returned
+ * @return the failure description of <code>null</code> if the operation was a success
+ */
+ public static String getFailureDescription(ModelNode operationResult) {
+ if (isSuccess(operationResult)) {
+ return null;
+ }
+ if (operationResult != null) {
+ ModelNode descr = operationResult.get(FAILURE_DESCRIPTION);
+ if (descr != null) {
+ return descr.asString();
+ }
+ }
+ return "Unknown failure";
+ }
+
+ /////////////////////////////////////////////////////////////////
+ // Non-static methods that need the client
+
+ public ModelControllerClient getModelControllerClient() {
+ return client;
+ }
+
+ /**
+ * Convienence method that executes the request.
+ *
+ * @param request
+ * @return results
+ * @throws Exception
+ */
+ public ModelNode execute(ModelNode request) throws Exception {
+ try {
+ return getModelControllerClient().execute(request, OperationMessageHandler.logging);
+ } catch (Exception e) {
+ log.error("Failed to execute request", e);
+ throw e;
+ }
+ }
+
+ /**
+ * Convienence method that allows you to obtain a single attribute's string value from
+ * a resource.
+ *
+ * @param attributeName the attribute whose value is to be returned
+ * @param address identifies the resource
+ * @return the attribute value
+ *
+ * @throws Exception if failed to obtain the attribute value
+ */
+ public String getStringAttribute(String attributeName, Address address) throws Exception {
+ return getStringAttribute(false, attributeName, address);
+ }
+
+ /**
+ * Convienence method that allows you to obtain a single attribute's string value from
+ * a resource.
+ *
+ * @param runtime if <code>true</code>, the attribute to be retrieved is a runtime attribute
+ * @param attributeName the attribute whose value is to be returned
+ * @param address identifies the resource
+ * @return the attribute value
+ *
+ * @throws Exception if failed to obtain the attribute value
+ */
+ public String getStringAttribute(boolean runtime, String attributeName, Address address) throws Exception {
+ ModelNode op = createReadAttributeRequest(runtime, attributeName, address);
+ ModelNode results = execute(op);
+ if (isSuccess(results)) {
+ ModelNode version = getResults(results);
+ String attributeValue = version.asString();
+ return attributeValue;
+ } else {
+ throw new FailureException(results, "Failed to get attribute [" + attributeName + "] from [" + address
+ + "]");
+ }
+ }
+}
diff --git a/modules/enterprise/gui/installer/src/main/java/org/rhq/common/jbossas/client/controller/SecurityDomainJBossASClient.java b/modules/enterprise/gui/installer/src/main/java/org/rhq/common/jbossas/client/controller/SecurityDomainJBossASClient.java
new file mode 100644
index 0000000..a73ba79
--- /dev/null
+++ b/modules/enterprise/gui/installer/src/main/java/org/rhq/common/jbossas/client/controller/SecurityDomainJBossASClient.java
@@ -0,0 +1,110 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2012 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.common.jbossas.client.controller;
+
+import java.util.List;
+
+import org.jboss.as.controller.client.ModelControllerClient;
+import org.jboss.dmr.ModelNode;
+
+/**
+ * Provides convienence methods associated with security domain management.
+ *
+ * @author John Mazzitelli
+ */
+public class SecurityDomainJBossASClient extends JBossASClient {
+
+ public static final String SUBSYSTEM_SECURITY = "security";
+ public static final String SECURITY_DOMAIN = "security-domain";
+ public static final String CACHE_TYPE = "cache-type";
+ public static final String AUTHENTICATION = "authentication";
+ public static final String LOGIN_MODULES = "login-modules";
+ public static final String CLASSIC = "classic";
+ public static final String CODE = "code";
+ public static final String FLAG = "flag";
+ public static final String MODULE_OPTIONS = "module-options";
+ public static final String USERNAME = "username";
+ public static final String PASSWORD = "password";
+
+ public SecurityDomainJBossASClient(ModelControllerClient client) {
+ super(client);
+ }
+
+ /**
+ * Checks to see if there is already a security domain with the given name.
+ *
+ * @param securityDomainName the name to check
+ * @return true if there is a security domain with the given name already in existence
+ */
+ public boolean isSecurityDomain(String securityDomainName) throws Exception {
+ Address addr = Address.root().add(SUBSYSTEM, SUBSYSTEM_SECURITY);
+ ModelNode queryNode = createRequest(READ_RESOURCE, addr);
+ ModelNode results = execute(queryNode);
+ if (isSuccess(results)) {
+ ModelNode domains = getResults(results).get(SECURITY_DOMAIN);
+ List<ModelNode> list = domains.asList();
+ for (ModelNode domain : list) {
+ if (domain.has(securityDomainName)) {
+ return true;
+ }
+ }
+ return false;
+ } else {
+ throw new FailureException(results, "Failed to get security domains");
+ }
+ }
+
+ /**
+ * Convienence method that builds a request which can create a new security-domain
+ * using the SecureIdentity authentication method. This is used when you want
+ * to obfuscate a database password in the configuration.
+ *
+ * @param securityDomainName the name of the new security domain
+ * @param username the username associated with the security domain
+ * @param password the value of the password to store in the configuration (e.g. the obfuscated password itself)
+ *
+ * @throws Exception if failed to create security domain
+ */
+ public void createNewSecureIdentitySecurityDomainRequest(String securityDomainName, String username, String password)
+ throws Exception {
+
+ Address addr = Address.root().add(SUBSYSTEM, SUBSYSTEM_SECURITY, SECURITY_DOMAIN, securityDomainName);
+ ModelNode addTopNode = createRequest(ADD, addr);
+ addTopNode.get(CACHE_TYPE).set("default");
+
+ ModelNode addAuthNode = createRequest(ADD, addr.clone().add(AUTHENTICATION, CLASSIC));
+ ModelNode loginModulesNode = addAuthNode.get(LOGIN_MODULES);
+ ModelNode loginModule = new ModelNode();
+ loginModule.get(CODE).set("SecureIdentity");
+ loginModule.get(FLAG).set("required");
+ ModelNode moduleOptions = loginModule.get(MODULE_OPTIONS);
+ moduleOptions.setEmptyList();
+ moduleOptions.add(USERNAME, username);
+ moduleOptions.add(PASSWORD, password);
+ loginModulesNode.add(loginModule);
+
+ ModelNode batch = createBatchRequest(addTopNode, addAuthNode);
+ ModelNode results = execute(batch);
+ if (!isSuccess(results)) {
+ throw new FailureException(results, "Failed to create security domain [" + securityDomainName + "]");
+ }
+
+ return;
+ }
+}
diff --git a/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/client/Installer.java b/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/client/Installer.java
new file mode 100644
index 0000000..0fc0215
--- /dev/null
+++ b/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/client/Installer.java
@@ -0,0 +1,651 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2012 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.gui.installer.client;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+import com.google.gwt.core.client.EntryPoint;
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.dom.client.Element;
+import com.google.gwt.user.client.DOM;
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.types.Alignment;
+import com.smartgwt.client.types.Side;
+import com.smartgwt.client.types.VerticalAlignment;
+import com.smartgwt.client.util.SC;
+import com.smartgwt.client.widgets.Button;
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.IButton;
+import com.smartgwt.client.widgets.Label;
+import com.smartgwt.client.widgets.events.ClickEvent;
+import com.smartgwt.client.widgets.events.ClickHandler;
+import com.smartgwt.client.widgets.form.DynamicForm;
+import com.smartgwt.client.widgets.form.fields.ButtonItem;
+import com.smartgwt.client.widgets.form.fields.FormItem;
+import com.smartgwt.client.widgets.form.fields.FormItemIcon;
+import com.smartgwt.client.widgets.form.fields.PasswordItem;
+import com.smartgwt.client.widgets.form.fields.SelectItem;
+import com.smartgwt.client.widgets.form.fields.SpacerItem;
+import com.smartgwt.client.widgets.form.fields.SpinnerItem;
+import com.smartgwt.client.widgets.form.fields.TextItem;
+import com.smartgwt.client.widgets.form.fields.events.ChangedEvent;
+import com.smartgwt.client.widgets.form.fields.events.ChangedHandler;
+import com.smartgwt.client.widgets.form.fields.events.IconClickEvent;
+import com.smartgwt.client.widgets.form.fields.events.IconClickHandler;
+import com.smartgwt.client.widgets.grid.ListGrid;
+import com.smartgwt.client.widgets.grid.ListGridField;
+import com.smartgwt.client.widgets.grid.events.EditCompleteEvent;
+import com.smartgwt.client.widgets.grid.events.EditCompleteHandler;
+import com.smartgwt.client.widgets.layout.VLayout;
+import com.smartgwt.client.widgets.tab.Tab;
+import com.smartgwt.client.widgets.tab.TabSet;
+import com.smartgwt.client.widgets.toolbar.ToolStrip;
+
+import org.rhq.enterprise.gui.installer.client.gwt.InstallerGWTServiceAsync;
+import org.rhq.enterprise.gui.installer.client.shared.ServerDetails;
+import org.rhq.enterprise.gui.installer.client.shared.ServerProperties;
+
+/**
+ * The GWT {@link EntryPoint entry point} to the RHQ Installer GUI.
+ *
+ * @author John Mazzitelli
+ */
+public class Installer implements EntryPoint {
+
+ // This must come first to ensure proper I18N class loading for dev mode
+ public static final Messages MSG = GWT.create(Messages.class);
+ public static final ServerPropertiesMessages PROPS_MSG = GWT.create(ServerPropertiesMessages.class);
+
+ private static final String NEW_SERVER_TO_REGISTER = "*new*";
+
+ private final InstallerGWTServiceAsync installerService = InstallerGWTServiceAsync.Util.getInstance();
+ private final ServerPropertyRecordList serverProperties = new ServerPropertyRecordList();
+ private final HashMap<String, String> originalProperties = new HashMap<String, String>();
+ private final LinkedHashMap<String, String> registeredServerNames = new LinkedHashMap<String, String>();
+
+ private ListGrid advancedPropertyItemGrid;
+ private Button mainInstallButton;
+ private TextItem dbConnectionUrl;
+ private TextItem dbUsername;
+ private PasswordItem dbPassword;
+ private SelectItem dbExistingSchemaOption;
+ private ButtonItem testConnectionButton;
+ private SelectItem dbType;
+ private TextItem serverSettingServerName;
+ private TextItem serverSettingPublicAddress;
+ private SpinnerItem serverSettingWebHttpPort;
+ private SpinnerItem serverSettingWebSecureHttpPort;
+ private SelectItem registeredServersSelection;
+ private TextItem serverSettingEmailSMTPHostname;
+ private TextItem serverSettingEmailFromAddress;
+
+ public void onModuleLoad() {
+ Canvas header = createHeader();
+ mainInstallButton = createMainInstallButton();
+ Canvas tabSet = createTabSet();
+
+ VLayout layout = new VLayout();
+ layout.setWidth100();
+ layout.setHeight100();
+ layout.setLayoutMargin(10);
+ layout.setMembersMargin(5);
+ layout.setDefaultLayoutAlign(Alignment.CENTER);
+ layout.addMember(header);
+ layout.addMember(mainInstallButton);
+ layout.addMember(tabSet);
+ layout.draw();
+
+ // Remove loading image in case we don't completely cover it
+ Element loadingPanel = DOM.getElementById("Loading-Panel");
+ loadingPanel.removeFromParent();
+
+ // get the server properties from the server
+ loadServerProperties();
+
+ }
+
+ private void updateServerProperty(String name, Object value) {
+ serverProperties.putServerProperty(name, value == null ? "" : value.toString());
+ refreshAdvancedView();
+ }
+
+ private void loadServerProperties() {
+ // load the initial server properties
+ installerService.getServerProperties(new AsyncCallback<HashMap<String, String>>() {
+ public void onSuccess(HashMap<String, String> result) {
+ if (result.size() == 0) {
+ SC.say("Initial server properties are missing.");
+ }
+ serverProperties.replaceServerProperties(result);
+
+ // remember these original properties in case the user wants to reset them back
+ originalProperties.clear();
+ originalProperties.putAll(result);
+
+ // refresh the simple view with the new data
+ refreshSimpleView();
+
+ // refresh the advanced view with the new data
+ refreshAdvancedView();
+ }
+
+ public void onFailure(Throwable caught) {
+ SC.say("Cannot load properties: " + caught);
+ }
+ });
+ }
+
+ private void refreshSimpleView() {
+ Map<String, String> props = serverProperties.getMap();
+
+ // DB SETTINGS
+ dbType.setValue(props.get(ServerProperties.PROP_DATABASE_TYPE));
+ dbConnectionUrl.setValue(props.get(ServerProperties.PROP_DATABASE_CONNECTION_URL));
+ dbUsername.setValue(props.get(ServerProperties.PROP_DATABASE_USERNAME));
+ // do not prefill the database password - force the user to know it and type it in for security purposes
+
+ // SERVER SETTINGS
+ serverSettingServerName.setValue(props.get(ServerProperties.PROP_HIGH_AVAILABILITY_NAME));
+ serverSettingWebHttpPort.setValue(props.get(ServerProperties.PROP_WEB_HTTP_PORT));
+ serverSettingWebSecureHttpPort.setValue(props.get(ServerProperties.PROP_WEB_HTTPS_PORT));
+ serverSettingEmailSMTPHostname.setValue(props.get(ServerProperties.PROP_EMAIL_SMTP_HOST));
+ serverSettingEmailFromAddress.setValue(props.get(ServerProperties.PROP_EMAIL_FROM_ADDRESS));
+
+ forceAnotherTestConnection();
+ }
+
+ private void refreshAdvancedView() {
+ advancedPropertyItemGrid.markForRedraw();
+ }
+
+ private Canvas createHeader() {
+ ToolStrip strip = new ToolStrip();
+ strip.setWidth100();
+ strip.setAlign(Alignment.CENTER);
+
+ Label title = new Label();
+ title.setWidth100();
+ title.setHeight100();
+ title.setWrap(false);
+ title.setValign(VerticalAlignment.CENTER);
+ title.setAlign(Alignment.CENTER);
+ title.setContents("<span style=\"font-size:16pt;font-weight:bold;\">" + MSG.welcome_title() + "</span>");
+ strip.addMember(title);
+ return strip;
+ }
+
+ private Button createMainInstallButton() {
+ Button installButton = new Button(MSG.button_startInstallation());
+ installButton.setWrap(false);
+ installButton.setAutoFit(true);
+ installButton.setDisabled(true); // we can't allow the user to install yet
+ installButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent event) {
+ SC.say("TODO: this should start the install");
+ }
+ });
+
+ return installButton;
+ }
+
+ private TabSet createTabSet() {
+ final TabSet topTabSet = new TabSet();
+ topTabSet.setTabBarPosition(Side.TOP);
+ topTabSet.setTabBarAlign(Side.LEFT);
+ topTabSet.setWidth("90%");
+
+ final Tab welcomeTab = new Tab(MSG.tab_welcome());
+ Label welcomeLabel = new Label(MSG.tab_welcome_content());
+ welcomeTab.setPane(welcomeLabel);
+
+ final Tab simpleViewTab = new Tab(MSG.tab_simpleView());
+ Canvas simpleForm = createSimpleForm();
+ simpleViewTab.setPane(simpleForm);
+
+ final Tab advancedViewTab = new Tab(MSG.tab_advancedView());
+ Canvas advancedView = createAdvancedView();
+ advancedViewTab.setPane(advancedView);
+
+ topTabSet.addTab(welcomeTab);
+ topTabSet.addTab(simpleViewTab);
+ topTabSet.addTab(advancedViewTab);
+
+ return topTabSet;
+ }
+
+ private Canvas createAdvancedView() {
+ VLayout layout = new VLayout();
+
+ ToolStrip strip = new ToolStrip();
+ strip.setWidth100();
+
+ IButton saveButton = new IButton(MSG.button_save());
+ saveButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent event) {
+ installerService.saveServerProperties(serverProperties.getMap(), new AsyncCallback<Void>() {
+ public void onSuccess(Void result) {
+ originalProperties.clear();
+ originalProperties.putAll(serverProperties.getMap());
+ SC.say("Properties saved to server");
+ }
+
+ public void onFailure(Throwable caught) {
+ SC.say("Failed to save properties to server");
+ }
+ });
+ }
+ });
+ IButton resetButton = new IButton(MSG.button_reset());
+ resetButton.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent event) {
+ serverProperties.replaceServerProperties(originalProperties);
+ refreshAdvancedView();
+ }
+ });
+ strip.addMember(saveButton);
+ strip.addMember(resetButton);
+ layout.addMember(strip);
+
+ advancedPropertyItemGrid = new ListGrid();
+ advancedPropertyItemGrid.setWidth100();
+ advancedPropertyItemGrid.setHeight100();
+ advancedPropertyItemGrid.setData(serverProperties);
+
+ ListGridField nameField = new ListGridField(ServerPropertyRecordList.PROPERTY_NAME, MSG.property_name_label());
+ nameField.setCanEdit(false);
+
+ ListGridField valueField = new ListGridField(ServerPropertyRecordList.PROPERTY_VALUE,
+ MSG.property_value_label());
+ valueField.setCanEdit(true);
+
+ advancedPropertyItemGrid.setFields(nameField, valueField);
+ advancedPropertyItemGrid.setSortField(ServerPropertyRecordList.PROPERTY_NAME);
+
+ advancedPropertyItemGrid.addEditCompleteHandler(new EditCompleteHandler() {
+ public void onEditComplete(EditCompleteEvent event) {
+ String newValue = (String) event.getNewValues().values().iterator().next().toString();
+ String changedProperty = event.getOldRecord().getAttribute(ServerPropertyRecordList.PROPERTY_NAME);
+ serverProperties.getMap().put(changedProperty, newValue); // we need this to be reflected in the internal map
+ refreshSimpleView();
+ }
+ });
+
+ layout.addMember(advancedPropertyItemGrid);
+
+ return layout;
+ }
+
+ private Canvas createSimpleForm() {
+
+ final int fieldWidth = 300;
+
+ ////////////////////////////////////////////////////////
+ // The Database form
+
+ final DynamicForm databaseForm = new DynamicForm();
+ databaseForm.setAutoWidth();
+ databaseForm.setPadding(5);
+ databaseForm.setCellPadding(5);
+ databaseForm.setWrapItemTitles(false);
+ databaseForm.setIsGroup(true);
+ databaseForm.setGroupTitle(MSG.tab_simpleView_database());
+
+ dbConnectionUrl = new TextItem(ServerProperties.PROP_DATABASE_CONNECTION_URL,
+ PROPS_MSG.rhq_server_database_connection_url());
+ dbConnectionUrl.setWidth(fieldWidth);
+ dbConnectionUrl.setValue("jdbc:postgresql://127.0.0.1:5432/rhq");
+ dbConnectionUrl.addChangedHandler(new ChangedHandler() {
+ public void onChanged(ChangedEvent event) {
+ updateServerProperty(ServerProperties.PROP_DATABASE_CONNECTION_URL, String.valueOf(event.getValue()));
+ forceAnotherTestConnection();
+ }
+ });
+
+ dbUsername = new TextItem(ServerProperties.PROP_DATABASE_USERNAME,
+ PROPS_MSG.rhq_server_database_user_name());
+ dbUsername.setWidth(fieldWidth);
+ dbUsername.addChangedHandler(new ChangedHandler() {
+ public void onChanged(ChangedEvent event) {
+ updateServerProperty(ServerProperties.PROP_DATABASE_USERNAME, String.valueOf(event.getValue()));
+ forceAnotherTestConnection();
+ }
+ });
+
+ dbPassword = new PasswordItem(ServerProperties.PROP_DATABASE_PASSWORD,
+ PROPS_MSG.rhq_server_database_password());
+ dbPassword.setWidth(fieldWidth);
+ dbPassword.addChangedHandler(new ChangedHandler() {
+ public void onChanged(ChangedEvent event) {
+ updateServerProperty(ServerProperties.PROP_DATABASE_PASSWORD, String.valueOf(event.getValue()));
+ forceAnotherTestConnection();
+ }
+ });
+
+ dbExistingSchemaOption = new SelectItem("existingSchemaOption", MSG.schema_update_question());
+ final LinkedHashMap<String, String> schemaOpt = new LinkedHashMap<String, String>();
+ schemaOpt.put("keep", MSG.schema_update_keep());
+ schemaOpt.put("overwrite", MSG.schema_update_overwrite());
+ schemaOpt.put("skip", MSG.schema_update_skip());
+ dbExistingSchemaOption.setValueMap(schemaOpt);
+ dbExistingSchemaOption.setDefaultToFirstOption(true);
+ dbExistingSchemaOption.setVisible(false);
+ dbExistingSchemaOption.setWidth(fieldWidth);
+ dbExistingSchemaOption.setWrapTitle(true);
+ dbExistingSchemaOption.addChangedHandler(new ChangedHandler() {
+ public void onChanged(ChangedEvent event) {
+ if (registeredServersSelection != null) {
+ String selected = event.getValue().toString();
+ if ("overwrite".equals(selected)) {
+ registeredServersSelection.setValue((String) null);
+ registeredServersSelection.disable();
+ } else {
+ registeredServersSelection.enable();
+ }
+ }
+ }
+ });
+
+ testConnectionButton = new ButtonItem("testConnectionButton", MSG.button_testConnection());
+ testConnectionButton.addClickHandler(new com.smartgwt.client.widgets.form.fields.events.ClickHandler() {
+ public void onClick(com.smartgwt.client.widgets.form.fields.events.ClickEvent event) {
+ final Conn conn = new Conn();
+ installerService.testConnection(conn.url(), conn.username(), conn.password(),
+ new AsyncCallback<String>() {
+ public void onSuccess(String result) {
+ if (result != null) {
+ forceAnotherTestConnection();
+ testConnectionButton.setIcon("[SKIN]/actions/exclamation.png");
+ SC.say("Could not connect to the database: " + result);
+ } else {
+ connectedToDatabase();
+ }
+ }
+
+ public void onFailure(Throwable caught) {
+ forceAnotherTestConnection();
+ testConnectionButton.setIcon("[SKIN]/actions/exclamation.png");
+ SC.say("Failed to test connection: " + caught.toString());
+ }
+ });
+
+ }
+ });
+
+ dbType = new SelectItem(ServerProperties.PROP_DATABASE_TYPE,
+ PROPS_MSG.rhq_server_database_type_mapping());
+ final LinkedHashMap<String, String> dbs = new LinkedHashMap<String, String>();
+ dbs.put("PostgreSQL", "PostgreSQL");
+ dbs.put("Oracle", "Oracle");
+ dbType.setValueMap(dbs);
+ dbType.setDefaultToFirstOption(true);
+ dbType.addChangedHandler(new ChangedHandler() {
+ public void onChanged(ChangedEvent event) {
+ forceAnotherTestConnection();
+
+ String newDBType = (String) event.getValue();
+ String newURL = "";
+ String dialect = "";
+ String quartzDriverDelegateClass = "org.quartz.impl.jdbcjobstore.StdJDBCDelegate";
+ String quartzSelectWithLockSQL = "SELECT * FROM {0}LOCKS ROWLOCK WHERE LOCK_NAME = ? FOR UPDATE";
+ String quartzLockHandlerClass = "org.quartz.impl.jdbcjobstore.StdRowLockSemaphore";
+
+ if ("PostgreSQL".equalsIgnoreCase(newDBType)) {
+ newURL = "jdbc:postgresql://127.0.0.1:5432/rhq";
+ dialect = "org.hibernate.dialect.PostgreSQLDialect";
+ quartzDriverDelegateClass = "org.quartz.impl.jdbcjobstore.PostgreSQLDelegate";
+ } else if ("Oracle".equalsIgnoreCase(newDBType)) {
+ newURL = "jdbc:oracle:thin:@127.0.0.1:1521:rhq";
+ dialect = "org.hibernate.dialect.Oracle10gDialect";
+ quartzDriverDelegateClass = "org.quartz.impl.jdbcjobstore.oracle.OracleDelegate";
+ }
+ dbConnectionUrl.setValue(newURL);
+
+ updateServerProperty(ServerProperties.PROP_DATABASE_CONNECTION_URL, newURL);
+ updateServerProperty(ServerProperties.PROP_DATABASE_HIBERNATE_DIALECT, dialect);
+ updateServerProperty(ServerProperties.PROP_QUARTZ_DRIVER_DELEGATE_CLASS, quartzDriverDelegateClass);
+ updateServerProperty(ServerProperties.PROP_QUARTZ_SELECT_WITH_LOCK_SQL, quartzSelectWithLockSQL);
+ updateServerProperty(ServerProperties.PROP_QUARTZ_LOCK_HANDLER_CLASS, quartzLockHandlerClass);
+ updateServerProperty(ServerProperties.PROP_DATABASE_TYPE, newDBType); // this refreshes the advanced view, too
+ }
+ });
+
+ // use this to move the button over to the second column - it looks better this way
+ SpacerItem buttonSpacer = new SpacerItem();
+ buttonSpacer.setEndRow(false);
+ testConnectionButton.setStartRow(false);
+
+ databaseForm.setFields(dbType, dbConnectionUrl, dbUsername, dbPassword, buttonSpacer, testConnectionButton,
+ dbExistingSchemaOption);
+
+ ////////////////////////////////////////////////////////
+ // The Server Settings form
+
+ final DynamicForm serverSettingsForm = new DynamicForm();
+ serverSettingsForm.setPadding(5);
+ serverSettingsForm.setCellPadding(5);
+ serverSettingsForm.setAutoWidth();
+ serverSettingsForm.setIsGroup(true);
+ serverSettingsForm.setWrapItemTitles(false);
+ serverSettingsForm.setGroupTitle(MSG.tab_simpleView_serverSettings());
+
+ serverSettingServerName = new TextItem(ServerProperties.PROP_HIGH_AVAILABILITY_NAME,
+ PROPS_MSG.rhq_server_high_availability_name());
+ serverSettingServerName.setWidth(fieldWidth);
+ serverSettingServerName.addChangedHandler(new ChangedHandler() {
+ public void onChanged(ChangedEvent event) {
+ updateServerProperty(ServerProperties.PROP_HIGH_AVAILABILITY_NAME, String.valueOf(event.getValue()));
+ if (registeredServersSelection != null) {
+ registeredServersSelection.setValue((String) null); // flip it back to *new* since the server name changed
+ }
+ }
+ });
+
+ serverSettingPublicAddress = new TextItem("serverPublicAddress",
+ MSG.tab_simpleView_serverSettings_publicAddress());
+ serverSettingPublicAddress.setWidth(fieldWidth);
+
+ serverSettingWebHttpPort = new SpinnerItem(ServerProperties.PROP_WEB_HTTP_PORT,
+ PROPS_MSG.rhq_server_startup_web_http_port());
+ serverSettingWebHttpPort.setWidth(fieldWidth);
+ serverSettingWebHttpPort.setMin(1);
+ serverSettingWebHttpPort.setMax(65535);
+ serverSettingWebHttpPort.addChangedHandler(new ChangedHandler() {
+ public void onChanged(ChangedEvent event) {
+ updateServerProperty(ServerProperties.PROP_WEB_HTTP_PORT, String.valueOf(event.getValue()));
+ }
+ });
+
+ serverSettingWebSecureHttpPort = new SpinnerItem(ServerProperties.PROP_WEB_HTTPS_PORT,
+ PROPS_MSG.rhq_server_startup_web_https_port());
+ serverSettingWebSecureHttpPort.setWidth(fieldWidth);
+ serverSettingWebSecureHttpPort.setMin(1);
+ serverSettingWebSecureHttpPort.setMax(65535);
+ serverSettingWebSecureHttpPort.addChangedHandler(new ChangedHandler() {
+ public void onChanged(ChangedEvent event) {
+ updateServerProperty(ServerProperties.PROP_WEB_HTTPS_PORT, String.valueOf(event.getValue()));
+ }
+ });
+
+ registeredServersSelection = new SelectItem("registeredServersSelectItem",
+ MSG.tab_simpleView_serverSettings_registeredServers());
+ registeredServersSelection.setWidth(fieldWidth);
+ addContextualHelp(registeredServersSelection, MSG.help_registeredServers());
+ registeredServerNames.put(NEW_SERVER_TO_REGISTER,
+ MSG.tab_simpleView_serverSettings_registeredServers_newServer());
+ registeredServersSelection.setValueMap(registeredServerNames);
+ registeredServersSelection.setDefaultToFirstOption(true);
+ registeredServersSelection.addChangedHandler(new ChangedHandler() {
+ public void onChanged(ChangedEvent event) {
+ final String selectedServerName = String.valueOf(event.getValue());
+ final boolean newServer = NEW_SERVER_TO_REGISTER.equals(selectedServerName);
+ if (newServer) {
+ serverSettingServerName.setValue("");
+ serverSettingPublicAddress.setValue("");
+ updateServerProperty(ServerProperties.PROP_HIGH_AVAILABILITY_NAME, "");
+ } else {
+ final Conn conn = new Conn();
+ installerService.getServerDetails(conn.url(), conn.username(), conn.password(), selectedServerName,
+ new AsyncCallback<ServerDetails>() {
+ public void onSuccess(ServerDetails details) {
+ serverSettingServerName.setValue(details.getName());
+ serverSettingPublicAddress.setValue(details.getEndpointAddress());
+ serverSettingWebHttpPort.setValue(details.getEndpointPortString());
+ serverSettingWebSecureHttpPort.setValue(details.getEndpointSecurePortString());
+ updateServerProperty(ServerProperties.PROP_HIGH_AVAILABILITY_NAME, details.getName());
+ updateServerProperty(ServerProperties.PROP_WEB_HTTP_PORT,
+ details.getEndpointPortString());
+ updateServerProperty(ServerProperties.PROP_WEB_HTTPS_PORT,
+ details.getEndpointSecurePortString());
+ }
+
+ public void onFailure(Throwable caught) {
+ SC.say("Failed to get details on selected server [" + selectedServerName + "]");
+ }
+ });
+ }
+ }
+ });
+
+ serverSettingEmailSMTPHostname = new TextItem(ServerProperties.PROP_EMAIL_SMTP_HOST,
+ PROPS_MSG.rhq_server_email_smtp_host());
+ serverSettingEmailSMTPHostname.setWidth(fieldWidth);
+ serverSettingEmailSMTPHostname.addChangedHandler(new ChangedHandler() {
+ public void onChanged(ChangedEvent event) {
+ updateServerProperty(ServerProperties.PROP_EMAIL_SMTP_HOST, String.valueOf(event.getValue()));
+ }
+ });
+
+ serverSettingEmailFromAddress = new TextItem(ServerProperties.PROP_EMAIL_FROM_ADDRESS,
+ PROPS_MSG.rhq_server_email_from_address());
+ serverSettingEmailFromAddress.setWidth(fieldWidth);
+ serverSettingEmailFromAddress.addChangedHandler(new ChangedHandler() {
+ public void onChanged(ChangedEvent event) {
+ updateServerProperty(ServerProperties.PROP_EMAIL_FROM_ADDRESS, String.valueOf(event.getValue()));
+ }
+ });
+
+ serverSettingsForm.setItems(registeredServersSelection, serverSettingServerName, serverSettingPublicAddress,
+ serverSettingWebHttpPort, serverSettingWebSecureHttpPort, serverSettingEmailSMTPHostname,
+ serverSettingEmailFromAddress);
+
+ ////////////////////////////////////////////////////////
+ // The layout holding the forms in the simple view tab
+
+ VLayout simpleForm = new VLayout();
+ simpleForm.setLayoutMargin(5);
+ simpleForm.setMembersMargin(5);
+ simpleForm.setWidth100();
+ simpleForm.setHeight100();
+ simpleForm.setDefaultLayoutAlign(Alignment.CENTER);
+ simpleForm.addMember(databaseForm);
+ simpleForm.addMember(serverSettingsForm);
+
+ return simpleForm;
+ }
+
+ private void connectedToDatabase() {
+ final Conn conn = new Conn();
+ testConnectionButton.setIcon("[SKIN]/actions/ok.png");
+ installerService.isDatabaseSchemaExist(conn.url(), conn.username(), conn.password(),
+ new AsyncCallback<Boolean>() {
+ public void onSuccess(Boolean schemaExists) {
+ if (schemaExists) {
+ dbExistingSchemaOption.show();
+ registeredServersSelection.enable();
+
+ installerService.getServerNames(conn.url(), conn.username(), conn.password(),
+ new AsyncCallback<ArrayList<String>>() {
+ public void onSuccess(ArrayList<String> servers) {
+ registeredServerNames.clear();
+ registeredServerNames.put(NEW_SERVER_TO_REGISTER,
+ MSG.tab_simpleView_serverSettings_registeredServers_newServer());
+ for (String server : servers) {
+ registeredServerNames.put(server, server);
+ }
+ registeredServersSelection.setValueMap(registeredServerNames);
+ }
+
+ public void onFailure(Throwable caught) {
+ SC.say("Cannot get the registered server names");
+ }
+ });
+ } else {
+ dbExistingSchemaOption.hide();
+ registeredServersSelection.setValue((String) null);
+ registeredServersSelection.disable();
+ }
+ mainInstallButton.enable();
+ }
+
+ public void onFailure(Throwable caught) {
+ SC.say("Cannot determine the status of the database schema: " + caught);
+ }
+ });
+ }
+
+ private void addContextualHelp(final FormItem item, final String helpText) {
+ final FormItemIcon helpIcon = new FormItemIcon();
+ helpIcon.setSrc("[SKIN]/actions/help.png");
+ helpIcon.setNeverDisable(true);
+ item.setIcons(helpIcon);
+
+ item.addIconClickHandler(new IconClickHandler() {
+ public void onIconClick(IconClickEvent event) {
+ if (event.getIcon().equals(helpIcon)) {
+ SC.say(helpText);
+ }
+ }
+ });
+ }
+
+ /**
+ * Call this when the user changed something (like connection URL or password) that renders
+ * the old connection test invalid. This will ensure the user is forced to re-test the connection.
+ */
+ private void forceAnotherTestConnection() {
+ mainInstallButton.disable();
+ testConnectionButton.setIcon(null);
+ dbExistingSchemaOption.hide();
+
+ if (registeredServerNames.size() > 1) {
+ registeredServerNames.clear();
+ registeredServerNames.put(NEW_SERVER_TO_REGISTER, MSG.tab_simpleView_serverSettings_registeredServers_newServer());
+ }
+ registeredServersSelection.setValue((String) null);
+ registeredServersSelection.setValueMap(registeredServerNames);
+ }
+
+ // for convienence, so we can get the conn url, user, pass in one object
+ private class Conn {
+ public String url() {
+ return Installer.this.dbConnectionUrl.getValueAsString();
+ }
+
+ public String username() {
+ return Installer.this.dbUsername.getValueAsString();
+ }
+
+ public String password() {
+ return Installer.this.dbPassword.getValueAsString();
+ }
+ }
+}
diff --git a/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/client/ServerPropertyRecordList.java b/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/client/ServerPropertyRecordList.java
new file mode 100644
index 0000000..654e3cf
--- /dev/null
+++ b/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/client/ServerPropertyRecordList.java
@@ -0,0 +1,62 @@
+package org.rhq.enterprise.gui.installer.client;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import com.smartgwt.client.data.Record;
+import com.smartgwt.client.data.RecordList;
+
+/**
+ * This provides a RecordList that is really a map underneath (each record is nothing more
+ * than a name/value pair; that is, each record has two attributes: name and value).
+ *
+ * We use this because this RecordList will be the list backing the Advanced View grid.
+ * So changing this list will be automatically reflected in that grid.
+ *
+ * @author John Mazzitelli
+ */
+public class ServerPropertyRecordList extends RecordList {
+
+ public static final String PROPERTY_NAME = "n";
+ public static final String PROPERTY_VALUE = "v";
+
+ // this map is kept in sync with the record list
+ private HashMap<String, String> map = new HashMap<String, String>();
+
+ public HashMap<String, String> getMap() {
+ return map;
+ }
+
+ public String getServerProperty(String name) {
+ String value = map.get(name);
+ return (value == null) ? "" : value;
+ }
+
+ public void putServerProperty(String name, String value) {
+ // fill in the internal map
+ map.put(name, value);
+
+ // now update the record list
+ Record found = find(PROPERTY_NAME, name);
+ if (found == null) {
+ Record record = new Record();
+ record.setAttribute(PROPERTY_NAME, name);
+ record.setAttribute(PROPERTY_VALUE, value);
+ add(record);
+ } else {
+ found.setAttribute(PROPERTY_VALUE, value);
+ }
+ }
+
+ public void replaceServerProperties(Map<String, String> newMap) {
+ // first update the internal map
+ map.clear();
+ map.putAll(newMap);
+
+ // now update the record list
+ setLength(0);
+ for (Map.Entry<String, String> entry : newMap.entrySet()) {
+ putServerProperty(entry.getKey(), entry.getValue());
+ }
+ }
+}
diff --git a/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/client/gwt/InstallerGWTService.java b/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/client/gwt/InstallerGWTService.java
new file mode 100644
index 0000000..c37d923
--- /dev/null
+++ b/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/client/gwt/InstallerGWTService.java
@@ -0,0 +1,105 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2012 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.gui.installer.client.gwt;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+import com.google.gwt.user.client.rpc.RemoteService;
+
+import org.rhq.enterprise.gui.installer.client.shared.ServerDetails;
+
+/**
+ * @author John Mazzitelli
+ */
+public interface InstallerGWTService extends RemoteService {
+
+ /**
+ * Returns a list of all registered servers in the database.
+ *
+ * @param connectionUrl
+ * @param username
+ * @param password
+ * @return list of all existing servers registered in the database.
+ * @throws Exception
+ */
+ ArrayList<String> getServerNames(String connectionUrl, String username, String password) throws Exception;
+
+ /**
+ * Returns details on a specific server that is registered in the database.
+ *
+ * @param connectionUrl
+ * @param username
+ * @param password
+ * @param serverName the name of the server whose details are to be retrieved
+ * @return the details of the server or null if the server does not exist
+ * @throws Exception
+ */
+ ServerDetails getServerDetails(String connectionUrl, String username, String password, String serverName)
+ throws Exception;
+
+ /**
+ * Tests to see if there is already a schema installed.
+ *
+ * @param connectionUrl
+ * @param username
+ * @param password
+ * @return <code>true</code> if there appears to be a schema installed in the database already.
+ * @throws Exception
+ */
+ boolean isDatabaseSchemaExist(String connectionUrl, String username, String password) throws Exception;
+
+ /**
+ * Tests that the database can be connected to with the given URL and credentials.
+ * @param connectionUrl
+ * @param username
+ * @param password
+ * @return <code>null</code> if the connection succeeded; this will be an error message if failed
+ * @throws Exception
+ */
+ String testConnection(String connectionUrl, String username, String password) throws Exception;
+
+ /**
+ * Returns the rhq-server.properties values in a map.
+ * @return server properties
+ * @throws Exception
+ */
+ HashMap<String, String> getServerProperties() throws Exception;
+
+ /**
+ * Saves the rhq-server.properties with the given values.
+ * @param serverProperties
+ * @throws Exception
+ */
+ void saveServerProperties(HashMap<String, String> serverProperties) throws Exception;
+
+ /**
+ * Returns the version string for the app server itself (e.g. "7.1.2.Final").
+ * @return version string of app server
+ * @throws Exception
+ */
+ String getAppServerVersion() throws Exception;
+
+ /**
+ * Returns the general type of operating system the server is running on (e.g. "Linux").
+ * @return os type name
+ * @throws Exception
+ */
+ String getOperatingSystem() throws Exception;
+}
diff --git a/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/client/shared/ServerDetails.java b/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/client/shared/ServerDetails.java
new file mode 100644
index 0000000..b54e380
--- /dev/null
+++ b/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/client/shared/ServerDetails.java
@@ -0,0 +1,115 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2012 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.gui.installer.client.shared;
+
+import java.io.Serializable;
+
+public class ServerDetails implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ public static final String DEFAULT_AFFINITY_GROUP = "";
+ public static final int DEFAULT_ENDPOINT_PORT = 7080;
+ public static final int DEFAULT_ENDPOINT_SECURE_PORT = 7443;
+
+ private String name;
+ private String endpointAddress;
+ private int endpointPort;
+ private int endpointSecurePort;
+ private String affinityGroup;
+
+ protected ServerDetails() {
+ // for GWT
+ }
+
+ public ServerDetails(String name, String endpointAddress, int port, int securePort, String affinityGroup) {
+ this.name = name;
+ this.endpointAddress = endpointAddress;
+ this.endpointPort = port;
+ this.endpointSecurePort = securePort;
+ this.affinityGroup = affinityGroup;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ if ((null != name) && (!"".equals(name.trim()))) {
+ this.name = name;
+ }
+ }
+
+ public String getEndpointAddress() {
+ return endpointAddress;
+ }
+
+ public void setEndpointAddress(String endpointAddress) {
+ if ((null != endpointAddress) && (!"".equals(endpointAddress.trim()))) {
+ this.endpointAddress = endpointAddress;
+ }
+ }
+
+ public int getEndpointPort() {
+ return endpointPort;
+ }
+
+ public void setEndpointPort(int endpointPort) {
+ this.endpointPort = endpointPort;
+ }
+
+ public String getEndpointPortString() {
+ return (String.valueOf(endpointPort));
+ }
+
+ public void setEndpointPortString(String endpointPort) {
+ this.endpointPort = Integer.valueOf(endpointPort).intValue();
+ }
+
+ public int getEndpointSecurePort() {
+ return endpointSecurePort;
+ }
+
+ public void setEndpointSecurePort(int endpointSecurePort) {
+ this.endpointSecurePort = endpointSecurePort;
+ }
+
+ public String getEndpointSecurePortString() {
+ return (String.valueOf(endpointSecurePort));
+ }
+
+ public void setEndpointSecurePortString(String endpointSecurePort) {
+ this.endpointSecurePort = Integer.valueOf(endpointSecurePort).intValue();
+ }
+
+ public String getAffinityGroup() {
+ return affinityGroup;
+ }
+
+ public void setAffinityGroup(String affinityGroup) {
+ if ((null != affinityGroup) && (!"".equals(affinityGroup.trim()))) {
+ this.affinityGroup = affinityGroup;
+ }
+ }
+
+ @Override
+ public String toString() {
+ return "[name=" + name + " address=" + endpointAddress + " port=" + endpointPort + " secureport="
+ + endpointSecurePort + " affinitygroup=" + affinityGroup + "]";
+ }
+}
diff --git a/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/client/shared/ServerProperties.java b/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/client/shared/ServerProperties.java
new file mode 100644
index 0000000..d92d4ce
--- /dev/null
+++ b/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/client/shared/ServerProperties.java
@@ -0,0 +1,53 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2008 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.gui.installer.client.shared;
+
+/**
+ * Settings found in the rhq-server.properties file that controls the startup configuration of the server.
+ *
+ * @author John Mazzitelli
+ */
+public class ServerProperties {
+ public static final String PREFIX_PROP_DATABASE = "rhq.server.database.";
+ public static final String PROP_DATABASE_TYPE = PREFIX_PROP_DATABASE + "type-mapping";
+ public static final String PROP_DATABASE_CONNECTION_URL = PREFIX_PROP_DATABASE + "connection-url";
+ public static final String PROP_DATABASE_USERNAME = PREFIX_PROP_DATABASE + "user-name";
+ public static final String PROP_DATABASE_PASSWORD = PREFIX_PROP_DATABASE + "password";
+ public static final String PROP_DATABASE_SERVER_NAME = PREFIX_PROP_DATABASE + "server-name";
+ public static final String PROP_DATABASE_PORT = PREFIX_PROP_DATABASE + "port";
+ public static final String PROP_DATABASE_DB_NAME = PREFIX_PROP_DATABASE + "db-name";
+ public static final String PROP_DATABASE_HIBERNATE_DIALECT = "hibernate.dialect";
+ public static final String PROP_QUARTZ_DRIVER_DELEGATE_CLASS = "rhq.server.quartz.driverDelegateClass";
+ public static final String PROP_QUARTZ_SELECT_WITH_LOCK_SQL = "rhq.server.quartz.selectWithLockSQL";
+ public static final String PROP_QUARTZ_LOCK_HANDLER_CLASS = "rhq.server.quartz.lockHandlerClass";
+
+ public static final String PREFIX_PROP_WEB = "rhq.server.startup.web.";
+ public static final String PROP_WEB_HTTP_PORT = PREFIX_PROP_WEB + "http.port";
+ public static final String PROP_WEB_HTTPS_PORT = PREFIX_PROP_WEB + "https.port";
+
+ public static final String PREFIX_PROP_EMBEDDED_AGENT = "rhq.server.embedded-agent.";
+ public static final String PROP_EMBEDDED_AGENT_ENABLED = PREFIX_PROP_EMBEDDED_AGENT + "enabled";
+
+ public static final String PREFIX_PROP_EMAIL = "rhq.server.email.";
+ public static final String PROP_EMAIL_SMTP_HOST = PREFIX_PROP_EMAIL + "smtp-host";
+ public static final String PROP_EMAIL_FROM_ADDRESS = PREFIX_PROP_EMAIL + "from-address";
+
+ public static final String PROP_HIGH_AVAILABILITY_NAME = "rhq.server.high-availability.name";
+ public static final String PROP_MM_AT_START = "rhq.server.maintenance-mode-at-startup";
+}
\ No newline at end of file
diff --git a/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/service/ManagementService.java b/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/service/ManagementService.java
new file mode 100644
index 0000000..add78a6
--- /dev/null
+++ b/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/service/ManagementService.java
@@ -0,0 +1,100 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2012 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.gui.installer.server.service;
+
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ThreadFactory;
+
+import org.jboss.as.controller.ModelController;
+import org.jboss.as.controller.client.ModelControllerClient;
+import org.jboss.as.server.Services;
+import org.jboss.msc.service.Service;
+import org.jboss.msc.service.ServiceActivator;
+import org.jboss.msc.service.ServiceActivatorContext;
+import org.jboss.msc.service.ServiceName;
+import org.jboss.msc.service.ServiceRegistryException;
+import org.jboss.msc.service.StartContext;
+import org.jboss.msc.service.StartException;
+import org.jboss.msc.service.StopContext;
+import org.jboss.msc.value.InjectedValue;
+
+/**
+ * This will provide our co-located management service.
+ * This is useful because it helps us avoid performing any management
+ * over a remote connector. Since we know we are running co-located
+ * in the same app server container that we want to manage, this
+ * service will provide us with a management client that does not go
+ * over a remote connector to talk to our app server container.
+ *
+ * @author John Mazzitelli
+ */
+public class ManagementService implements ServiceActivator {
+
+ private static volatile ModelController controller;
+ private static volatile ExecutorService executor;
+
+ public static ModelControllerClient getClient() {
+ return controller.createClient(executor);
+ }
+
+ @Override
+ public void activate(ServiceActivatorContext context) throws ServiceRegistryException {
+ final GetModelControllerService service = new GetModelControllerService();
+ context
+ .getServiceTarget()
+ .addService(ServiceName.of("rhq", "installer", "management", "client", "getter"), service)
+ .addDependency(Services.JBOSS_SERVER_CONTROLLER, ModelController.class, service.modelControllerValue)
+ .install();
+ }
+
+ private class GetModelControllerService implements Service<Void> {
+ private InjectedValue<ModelController> modelControllerValue = new InjectedValue<ModelController>();
+
+ @Override
+ public Void getValue() throws IllegalStateException, IllegalArgumentException {
+ return null;
+ }
+
+ @Override
+ public void start(StartContext context) throws StartException {
+ ManagementService.executor = Executors.newFixedThreadPool(5, new ThreadFactory() {
+ @Override
+ public Thread newThread(Runnable r) {
+ Thread t = new Thread(r);
+ t.setDaemon(true);
+ t.setName("ManagementServiceModelControllerClientThread");
+ return t;
+ }
+ });
+ ManagementService.controller = modelControllerValue.getValue();
+ }
+
+ @Override
+ public void stop(StopContext context) {
+ try {
+ ManagementService.executor.shutdownNow();
+ } finally {
+ ManagementService.executor = null;
+ ManagementService.controller = null;
+ }
+ }
+
+ }
+}
diff --git a/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/servlet/InstallerGWTServiceImpl.java b/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/servlet/InstallerGWTServiceImpl.java
new file mode 100644
index 0000000..6247168
--- /dev/null
+++ b/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/servlet/InstallerGWTServiceImpl.java
@@ -0,0 +1,161 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2012 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.gui.installer.server.servlet;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+import javax.servlet.annotation.WebServlet;
+
+import com.google.gwt.user.server.rpc.RemoteServiceServlet;
+
+import org.jboss.as.controller.client.ModelControllerClient;
+
+import org.rhq.common.jbossas.client.controller.Address;
+import org.rhq.common.jbossas.client.controller.JBossASClient;
+import org.rhq.common.jbossas.client.controller.SecurityDomainJBossASClient;
+import org.rhq.core.util.PropertiesFileUpdate;
+import org.rhq.enterprise.gui.installer.client.gwt.InstallerGWTService;
+import org.rhq.enterprise.gui.installer.client.shared.ServerDetails;
+import org.rhq.enterprise.gui.installer.server.service.ManagementService;
+
+/**
+ * @author John Mazzitelli
+ */
+ at WebServlet(value = "/org.rhq.enterprise.gui.installer.Installer/InstallerGWTService")
+public class InstallerGWTServiceImpl extends RemoteServiceServlet implements InstallerGWTService {
+
+ private static final long serialVersionUID = 1L;
+
+ private static final String RHQ_SECURITY_DOMAIN = "RHQDSSecurityDomain";
+
+ @Override
+ public ArrayList<String> getServerNames(String connectionUrl, String username, String password) throws Exception {
+ try {
+ return ServerInstallUtil.getServerNames(connectionUrl, username, password);
+ } catch (Exception e) {
+ log("Could not get the list of registered server names", e);
+ return null;
+ }
+ }
+
+ @Override
+ public ServerDetails getServerDetails(String connectionUrl, String username, String password, String serverName)
+ throws Exception {
+ try {
+ return ServerInstallUtil.getServerDetails(connectionUrl, username, password, serverName);
+ } catch (Exception e) {
+ log("Could not get server details for [" + serverName + "]", e);
+ return null;
+ }
+ }
+
+ @Override
+ public boolean isDatabaseSchemaExist(String connectionUrl, String username, String password) throws Exception {
+ try {
+ return ServerInstallUtil.isDatabaseSchemaExist(connectionUrl, username, password);
+ } catch (Exception e) {
+ log("Could not determine database existence", e);
+ return false;
+ }
+ }
+
+ @Override
+ public String testConnection(String connectionUrl, String username, String password) throws Exception {
+ String results = ServerInstallUtil.testConnection(connectionUrl, username, password);
+ return results;
+ }
+
+ @Override
+ public HashMap<String, String> getServerProperties() throws Exception {
+ File serverPropertiesFile = getServerPropertiesFile();
+ PropertiesFileUpdate propsFile = new PropertiesFileUpdate(serverPropertiesFile.getAbsolutePath());
+ Properties props = propsFile.loadExistingProperties();
+
+ // GWT can't handle Properties - convert to HashMap
+ HashMap<String, String> map = new HashMap<String, String>(props.size());
+ for (Object property : props.keySet()) {
+ map.put(property.toString(), props.getProperty(property.toString()));
+ }
+ return map;
+ }
+
+ @Override
+ public void saveServerProperties(HashMap<String, String> serverProperties) throws Exception {
+ File serverPropertiesFile = getServerPropertiesFile();
+ PropertiesFileUpdate propsFile = new PropertiesFileUpdate(serverPropertiesFile.getAbsolutePath());
+
+ // GWT can't handle Properties - convert from HashMap
+ Properties props = new Properties();
+ for (Map.Entry<String, String> entry : serverProperties.entrySet()) {
+ props.setProperty(entry.getKey(), entry.getValue());
+ }
+
+ propsFile.update(props);
+
+ return;
+ }
+
+ @Override
+ public String getAppServerVersion() throws Exception {
+ JBossASClient client = new JBossASClient(getClient());
+ String version = client.getStringAttribute("release-version", Address.root());
+ return version;
+ }
+
+ @Override
+ public String getOperatingSystem() throws Exception {
+ JBossASClient client = new JBossASClient(getClient());
+ String[] address = { "core-service", "platform-mbean", "type", "operating-system" };
+ String osName = client.getStringAttribute("name", Address.root().add(address));
+ return osName;
+ }
+
+ private String getAppServerHomeDir() throws Exception {
+ JBossASClient client = new JBossASClient(getClient());
+ String[] address = { "core-service", "server-environment" };
+ String dir = client.getStringAttribute(true, "home-dir", Address.root().add(address));
+ return dir;
+ }
+
+ private File getServerPropertiesFile() throws Exception {
+ File appServerHomeDir = new File(getAppServerHomeDir());
+ File serverPropertiesFile = new File(appServerHomeDir, "../bin/rhq-server.properties");
+ return serverPropertiesFile;
+ }
+
+ private ModelControllerClient getClient() {
+ ModelControllerClient client = ManagementService.getClient();
+ return client;
+ }
+
+ private void createDatasourceSecurityDomain(String username, String password) throws Exception {
+ final SecurityDomainJBossASClient client = new SecurityDomainJBossASClient(getClient());
+ final String securityDomain = RHQ_SECURITY_DOMAIN;
+ if (!client.isSecurityDomain(securityDomain)) {
+ client.createNewSecureIdentitySecurityDomainRequest(securityDomain, username, password);
+ log("Security domain [" + securityDomain + "] created");
+ } else {
+ log("Security domain [" + securityDomain + "] already exists, skipping the creation request");
+ }
+ }
+}
diff --git a/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/servlet/ServerInstallUtil.java b/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/servlet/ServerInstallUtil.java
new file mode 100644
index 0000000..4577789
--- /dev/null
+++ b/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/servlet/ServerInstallUtil.java
@@ -0,0 +1,274 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2012 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.gui.installer.server.servlet;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.ArrayList;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.rhq.core.db.DatabaseType;
+import org.rhq.core.db.DatabaseTypeFactory;
+import org.rhq.core.db.DbUtil;
+import org.rhq.core.util.exception.ThrowableUtil;
+import org.rhq.enterprise.gui.installer.client.shared.ServerDetails;
+
+/**
+ * Provides utility methods necessary to complete the server installation.
+ *
+ * @author John Mazzitelli
+ */
+public class ServerInstallUtil {
+ private static final Log LOG = LogFactory.getLog(ServerInstallUtil.class);
+
+ public enum ExistingSchemaOption {
+ OVERWRITE, KEEP, SKIP
+ };
+
+ public static boolean isKeepExistingSchema(ExistingSchemaOption existingSchemaOption) {
+ return ExistingSchemaOption.KEEP.name().equals(existingSchemaOption)
+ || ExistingSchemaOption.SKIP.name().equals(existingSchemaOption);
+ }
+
+ /**
+ * Returns <code>true</code> if the database already has the database schema created for it. It will not be known
+ * what version of schema or if its the latest, all this method tells you is that some RHQ database schema exists.
+ *
+ * @param connectionUrl
+ * @param username
+ * @param password
+ * @return <code>true</code> if the database can be connected to
+ *
+ * @throws Exception if failed to communicate with the database
+ */
+ public static boolean isDatabaseSchemaExist(String connectionUrl, String username, String password)
+ throws Exception {
+
+ Connection conn = getDatabaseConnection(connectionUrl, username, password);
+ DatabaseType db = DatabaseTypeFactory.getDatabaseType(conn);
+
+ try {
+ return db.checkTableExists(conn, "RHQ_PRINCIPAL");
+ } catch (IllegalStateException e) {
+ return false;
+ } finally {
+ db.closeConnection(conn);
+ }
+ }
+
+ /**
+ * Get the list of existing servers from an existing schema.
+ *
+ * @param connectionUrl
+ * @param username
+ * @param password
+ * @return List of server names registered in the database. Empty list if the table does not exist or there are no entries in the table.
+ *
+ * @throws Exception if failed to communicate with the database
+ */
+ public static ArrayList<String> getServerNames(String connectionUrl, String username, String password)
+ throws Exception {
+ DatabaseType db = null;
+ Connection conn = null;
+ Statement stm = null;
+ ResultSet rs = null;
+ ArrayList<String> result = new ArrayList<String>();
+
+ try {
+ conn = getDatabaseConnection(connectionUrl, username, password);
+ db = DatabaseTypeFactory.getDatabaseType(conn);
+
+ if (db.checkTableExists(conn, "rhq_server")) {
+
+ stm = conn.createStatement();
+ rs = stm.executeQuery("SELECT name FROM rhq_server ORDER BY name asc");
+
+ while (rs.next()) {
+ result.add(rs.getString(1));
+ }
+ }
+ } catch (IllegalStateException e) {
+ // table does not exist
+ } catch (SQLException e) {
+ LOG.info("Unable to fetch existing server info: " + e.getMessage());
+ } finally {
+ if (null != db) {
+ db.closeJDBCObjects(conn, stm, rs);
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * Returns information on the server as found in the database (port numbers, affinity group, etc).
+ *
+ * @param connectionUrl
+ * @param username
+ * @param password
+ * @param serverName the server whose details are to be returned
+ * @return the information on the named server
+ */
+ public static ServerDetails getServerDetails(String connectionUrl, String username, String password,
+ String serverName) {
+
+ DatabaseType db = null;
+ Connection conn = null;
+ ServerDetails result = null;
+
+ try {
+ conn = getDatabaseConnection(connectionUrl, username, password);
+ db = DatabaseTypeFactory.getDatabaseType(conn);
+
+ result = getServerDetails(db, conn, serverName);
+
+ } catch (Exception e) {
+ LOG.info("Unable to get server detail: " + e.getMessage());
+ } finally {
+ if (null != db) {
+ db.closeConnection(conn);
+ }
+ }
+
+ return result;
+ }
+
+ private static ServerDetails getServerDetails(DatabaseType db, Connection conn, String serverName) {
+ PreparedStatement stm = null;
+ ResultSet rs = null;
+ ServerDetails result = null;
+
+ if (null == serverName) {
+ return result;
+ }
+
+ try {
+ stm = conn.prepareStatement("" //
+ + "SELECT s.address, s.port, s.secure_port, ag.name " //
+ + " FROM rhq_server s LEFT JOIN rhq_affinity_group ag ON ag.id = s.affinity_group_id " //
+ + " WHERE s.name = ?");
+ stm.setString(1, serverName.trim());
+
+ rs = stm.executeQuery();
+
+ if (rs.next()) {
+ result = new ServerDetails(serverName, rs.getString(1), rs.getInt(2), rs.getInt(3), rs.getString(4));
+ }
+
+ } catch (SQLException e) {
+ LOG.info("Unable to get affinity group name for server: " + e.getMessage());
+ } finally {
+ if (null != db) {
+ db.closeResultSet(rs);
+ db.closeStatement(stm);
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * Tests to make sure the server can be connected to with the given settings.
+ * If the test is successful, <code>null</code>. If the test fails, the returned string
+ * will be the error message to indicate the problem.
+ *
+ * @param connectionUrl
+ * @param username
+ * @param password
+ * @return error message if test failed; <code>null</code> if test succeeded
+ */
+ public static String testConnection(String connectionUrl, String username, String password) {
+
+ // its possible the JDBC URL was changed, clear the factory cache in case the DB version is different now
+ DatabaseTypeFactory.clearDatabaseTypeCache();
+
+ try {
+ ensureDatabaseIsSupported(connectionUrl, username, password);
+ return null;
+ } catch (Exception e) {
+ LOG.warn("Installer failed to test connection", e);
+ return ThrowableUtil.getAllMessages(e);
+ }
+ }
+
+ /**
+ * Call this when you need to confirm that the database is supported.
+ *
+ * @param connectionUrl
+ * @param username
+ * @param password
+ *
+ * @throws Exception if the database is not supported
+ */
+ public static void ensureDatabaseIsSupported(String connectionUrl, String username, String password)
+ throws Exception {
+ Connection conn = null;
+ DatabaseType db = null;
+
+ try {
+ conn = getDatabaseConnection(connectionUrl, username, password);
+ db = DatabaseTypeFactory.getDatabaseType(conn);
+
+ String version = db.getVersion();
+
+ if (DatabaseTypeFactory.isPostgres(db)) {
+ if (version.startsWith("7") || version.equals("8") || version.startsWith("8.0")
+ || version.startsWith("8.1")) {
+ throw new Exception("Unsupported PostgreSQL [" + db + "]");
+ }
+ } else if (DatabaseTypeFactory.isOracle(db)) {
+ if (version.startsWith("8") || version.startsWith("9")) {
+ throw new Exception("Unsupported Oracle [" + db + "]");
+ }
+ } else {
+ throw new Exception("Unsupported DB [" + db + "]");
+ }
+
+ LOG.info("Database is supported: " + db);
+ } finally {
+ if (db != null) {
+ db.closeConnection(conn);
+ }
+ }
+
+ return;
+ }
+
+ /**
+ * Returns a database connection with the given set of properties providing the settings that allow for a successful
+ * database connection. If <code>props</code> is <code>null</code>, it will use the server properties from
+ * {@link #getServerProperties()}.
+ *
+ * @param connectionUrl
+ * @param userName
+ * @param password
+ * @return the database connection
+ *
+ * @throws SQLException if cannot successfully connect to the database
+ */
+ public static Connection getDatabaseConnection(String connectionUrl, String userName, String password)
+ throws SQLException {
+ return DbUtil.getConnection(connectionUrl, userName, password);
+ }
+}
diff --git a/modules/enterprise/gui/installer/src/main/resources/org/rhq/enterprise/gui/installer/Installer.gwt.xml b/modules/enterprise/gui/installer/src/main/resources/org/rhq/enterprise/gui/installer/Installer.gwt.xml
new file mode 100644
index 0000000..164e94a
--- /dev/null
+++ b/modules/enterprise/gui/installer/src/main/resources/org/rhq/enterprise/gui/installer/Installer.gwt.xml
@@ -0,0 +1,35 @@
+<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.4.0//EN"
+ "http://google-web-toolkit.googlecode.com/svn/tags/2.4.0/distro-source/core/src/gwt-module.dtd">
+
+<module>
+
+ <inherits name='com.google.gwt.user.User'/>
+ <inherits name='com.google.gwt.i18n.I18N'/>
+ <inherits name="com.google.gwt.logging.Logging"/>
+
+ <inherits name='com.smartgwt.SmartGwt' />
+ <inherits name="com.smartgwt.tools.SmartGwtTools"/>
+
+ <!-- ============================ gwt logging ============================= -->
+ <set-property name="gwt.logging.enabled" value="TRUE"/>
+ <!-- FINE ~= DEBUG in gwt-log -->
+ <set-property name="gwt.logging.logLevel" value="FINE"/>
+ <set-property name="gwt.logging.consoleHandler" value="ENABLED" />
+ <set-property name="gwt.logging.developmentModeHandler" value="ENABLED" />
+ <set-property name="gwt.logging.firebugHandler" value="ENABLED" />
+ <set-property name="gwt.logging.hasWidgetsHandler" value="DISABLED" />
+ <set-property name="gwt.logging.popupHandler" value="DISABLED" />
+ <set-property name="gwt.logging.systemHandler" value="ENABLED" />
+ <set-property name="gwt.logging.simpleRemoteHandler" value="DISABLED" />
+
+ <set-property name="user.agent" value="${gwt.userAgent}"/>
+ <extend-property name="locale" values="${gwt.locale}" />
+
+ <set-configuration-property name="locale.usemeta" value="Y"/>
+ <set-configuration-property name="locale.useragent" value="Y"/>
+ <set-configuration-property name="locale.searchorder" value="queryparam,meta,useragent,cookie"/>
+ <set-property-fallback name="locale" value="${gwt.fallback.locale}"/>
+
+ <entry-point class='org.rhq.enterprise.gui.installer.client.Installer'/>
+
+</module>
diff --git a/modules/enterprise/gui/installer/src/main/resources/org/rhq/enterprise/gui/installer/client/Messages.properties b/modules/enterprise/gui/installer/src/main/resources/org/rhq/enterprise/gui/installer/client/Messages.properties
new file mode 100644
index 0000000..5915f40
--- /dev/null
+++ b/modules/enterprise/gui/installer/src/main/resources/org/rhq/enterprise/gui/installer/client/Messages.properties
@@ -0,0 +1,21 @@
+button_reset = Reset
+button_save = Save
+button_startInstallation = Press To Start The Installation Now
+button_testConnection = Test Connection
+help_registeredServers = If you are performing an upgrade or a re-installation then you should select a server from this list of registered servers. If you want to install a new server into the system, select the *New Server* option. (Note that if you are going to overwrite your existing schema, you cannot select an existing registered server since they will be deleted when the overwrite is performed.)
+property_name_label = Property
+property_value_label = Value
+schema_update_keep = Keep (Maintain Existing Data)
+schema_update_overwrite = Overwrite (Lose Existing Data!)
+schema_update_question = A database schema already exists. What do you want to do?
+schema_update_skip = Skip (Leave Database As-Is)
+tab_advancedView = Advanced View
+tab_simpleView = Simple View
+tab_simpleView_database = Database Settings
+tab_simpleView_serverSettings = Server Settings
+tab_simpleView_serverSettings_publicAddress = Server Public Address
+tab_simpleView_serverSettings_registeredServers = Registered Server Names
+tab_simpleView_serverSettings_registeredServers_newServer = *New Server*
+tab_welcome = Welcome
+tab_welcome_content = <h1>Welcome to the new GWT Installer</h1>\nThis is the <b>new</b> installer.\nAny HTML can go in here.
+welcome_title = Installing the Server
diff --git a/modules/enterprise/gui/installer/src/main/resources/org/rhq/enterprise/gui/installer/client/ServerPropertiesMessages.properties b/modules/enterprise/gui/installer/src/main/resources/org/rhq/enterprise/gui/installer/client/ServerPropertiesMessages.properties
new file mode 100644
index 0000000..6c53445
--- /dev/null
+++ b/modules/enterprise/gui/installer/src/main/resources/org/rhq/enterprise/gui/installer/client/ServerPropertiesMessages.properties
@@ -0,0 +1,23 @@
+### RHQ Server Configuration Properties
+### These should match the actual property names in rhq-server.properties.
+
+# Database
+rhq.server.database.connection-url=Database Connection URL
+rhq.server.database.user-name=Database Username
+rhq.server.database.password=Database Password
+rhq.server.database.type-mapping=Database Type
+
+# High Availability (HA)
+rhq.server.high-availability.name=Server Name
+rhq.server.maintenance-mode-at-startup=Maintenance Mode At Startup
+
+# General Properties
+rhq.server.startup.web.http.port=HTTP Port
+rhq.server.startup.web.https.port=Secure HTTP Port
+
+# Embedded RHQ Agent
+rhq.server.embedded-agent.enabled=Embedded Agent Enabled
+
+# Email
+rhq.server.email.smtp-host=Email SMTP Host
+rhq.server.email.from-address=Email From Address
\ No newline at end of file
diff --git a/modules/enterprise/gui/installer/src/main/webapp/WEB-INF/classes/META-INF/services/org.jboss.msc.service.ServiceActivator b/modules/enterprise/gui/installer/src/main/webapp/WEB-INF/classes/META-INF/services/org.jboss.msc.service.ServiceActivator
new file mode 100644
index 0000000..c64cc21
--- /dev/null
+++ b/modules/enterprise/gui/installer/src/main/webapp/WEB-INF/classes/META-INF/services/org.jboss.msc.service.ServiceActivator
@@ -0,0 +1 @@
+org.rhq.enterprise.gui.installer.server.service.ManagementService
\ No newline at end of file
diff --git a/modules/enterprise/gui/installer/src/main/webapp/WEB-INF/web.xml b/modules/enterprise/gui/installer/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..b970eb3
--- /dev/null
+++ b/modules/enterprise/gui/installer/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,9 @@
+<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
+
+ <welcome-file-list>
+ <welcome-file>index.html</welcome-file>
+ </welcome-file-list>
+
+</web-app>
diff --git a/modules/enterprise/gui/installer/src/main/webapp/index.html b/modules/enterprise/gui/installer/src/main/webapp/index.html
new file mode 100644
index 0000000..cb9016e
--- /dev/null
+++ b/modules/enterprise/gui/installer/src/main/webapp/index.html
@@ -0,0 +1,45 @@
+<html>
+<head>
+ <!-- this forces us to emulate IE8 "quirks" mode regardless of IE browser version. It:
+ 1) Follows the SmartGWT recommendation of not declaring a DOCTYPE and instead using these meta elements.
+ http://forums.smartclient.com/showthread.php?t=15973
+ 2) solves initial app load issues that we experienced on some XP and Vista/Windows7 flavors.
+ -->
+ <meta http-equiv="X-UA-Compatible" content="IE=8" />
+
+ <!-- support internationalized characters -->
+ <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
+
+ <script>
+ var search = location.search;
+ // only do this if you have not specified locale as query param
+ if(search.indexOf("locale") == -1){
+ // IE uses browserLanguage
+ var lang = navigator.language!=null ? navigator.language : navigator.browserLanguage;
+ var lang = lang.replace("-", "_");
+ document.write("<meta name='gwt:property' content='locale="+lang +"'>");
+ }
+ </script>
+
+ <title>RHQ Installer</title>
+
+ <script type="text/javascript">
+ var isomorphicDir = "org.rhq.enterprise.gui.installer.Installer/sc/";
+ </script>
+
+</head>
+<body>
+
+ <script type="text/javascript" language="javascript"
+ src="org.rhq.enterprise.gui.installer.Installer/org.rhq.enterprise.gui.installer.Installer.nocache.js"></script>
+
+ <div id="Loading-Panel" style="width: 214px; height: 90px; margin-top: 300px; margin-left: 40%; margin-right: 40%;">
+ <div style="text-align: center; border: 3px solid lightgray;">
+ Loading Installer...
+ </div>
+ </div>
+
+ <iframe src="javascript:''" id="__gwt_historyFrame" style="width:0;height:0;border:0"></iframe>
+
+</body>
+</html>
diff --git a/modules/enterprise/gui/pom.xml b/modules/enterprise/gui/pom.xml
index ae67384..b9ca5f5 100644
--- a/modules/enterprise/gui/pom.xml
+++ b/modules/enterprise/gui/pom.xml
@@ -28,7 +28,7 @@
</activation>
<modules>
<module>portal-war</module>
- <module>installer-war</module>
+ <module>installer</module>
<module>base-perspective-jar</module>
<module>base-perspective-war</module>
<!--<module>webdav-war</module>-->
diff --git a/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml b/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml
index 5cb56a5..50566a2 100644
--- a/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml
+++ b/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml
@@ -237,10 +237,10 @@
<touch file="${jboss.deploy.dir}/${rhq.earName}.skipdeploy" />
<echo>Deploying installer webapp ...</echo>
- <mkdir dir="${jboss.deploy.dir}/rhq-gwt-installer-war.war" />
- <unwar src="${settings.localRepository}/org/rhq/rhq-gwt-installer-war/${rhq.version}/rhq-gwt-installer-war-${rhq.version}.war"
- dest="${jboss.deploy.dir}/rhq-gwt-installer-war.war" />
- <touch file="${jboss.deploy.dir}/rhq-gwt-installer-war.war.dodeploy" />
+ <mkdir dir="${jboss.deploy.dir}/rhq-installer.war" />
+ <unwar src="${settings.localRepository}/org/rhq/rhq-installer/${rhq.version}/rhq-installer-${rhq.version}.war"
+ dest="${jboss.deploy.dir}/rhq-installer.war" />
+ <touch file="${jboss.deploy.dir}/rhq-installer.war.dodeploy" />
<!-- TODO: deploy embedded agent sar -->
<!--
More information about the rhq-commits
mailing list