public class ServerInstallUtil extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
ServerInstallUtil.ExistingSchemaOption |
static class |
ServerInstallUtil.SupportedDatabaseType |
| Constructor and Description |
|---|
ServerInstallUtil() |
| Modifier and Type | Method and Description |
|---|---|
static void |
configureDeploymentScanner(org.jboss.as.controller.client.ModelControllerClient mcc)
Configure the deployment scanner.
|
static void |
configureLogging(org.jboss.as.controller.client.ModelControllerClient mcc,
HashMap<String,String> serverProperties)
Configure the logging subsystem.
|
static void |
configureTransactionManager(org.jboss.as.controller.client.ModelControllerClient mcc)
Configure the transaction manager.
|
static void |
createDatasourceSecurityDomain(org.jboss.as.controller.client.ModelControllerClient mcc,
HashMap<String,String> serverProperties)
Creates the security domain for the datasources.
|
static void |
createDefaultManagementUser(String password,
ServerDetails serverDetails,
String configDirStr)
Create an rhqadmin management user so when discovered, the AS7 plugin can use it to connect
to the RHQ Server.
|
static File |
createKeystore(ServerDetails serverDetails,
String configDirStr)
Creates a keystore whose cert has a CN of this server's public endpoint address.
|
static void |
createNewCaches(org.jboss.as.controller.client.ModelControllerClient mcc,
HashMap<String,String> serverProperties)
Creates the Infinispan caches for RHQ.
|
static void |
createNewDatabaseSchema(HashMap<String,String> props,
ServerDetails serverDetails,
String password,
String logDir)
This will create the database schema in the database.
|
static void |
createNewDatasources(org.jboss.as.controller.client.ModelControllerClient mcc,
HashMap<String,String> serverProperties)
Creates the datasources needed by the RHQ Server.
|
static void |
createNewJdbcDrivers(org.jboss.as.controller.client.ModelControllerClient mcc,
HashMap<String,String> serverProperties)
Creates JDBC driver configurations so the datasources can properly connect to the backend databases.
|
static void |
createNewJMSQueues(org.jboss.as.controller.client.ModelControllerClient mcc,
HashMap<String,String> serverProperties)
Creates the JMS Queues required for Drift and Alerting.
|
static void |
createRestSecurityDomain(org.jboss.as.controller.client.ModelControllerClient mcc)
Create a security domain for container managed security used with the rhq-rest.war
|
static void |
createUserSecurityDomain(org.jboss.as.controller.client.ModelControllerClient mcc)
Create the standard user security domain with the JDBCLogin module installed
|
static void |
ensureDatabaseIsSupported(String connectionUrl,
String username,
String password)
Call this when you need to confirm that the database is supported.
|
static Map<String,String> |
fetchStorageClusterSettings(HashMap<String,String> serverProperties,
String password) |
static Connection |
getDatabaseConnection(String connectionUrl,
String userName,
String password)
Returns a database connection with the given set of properties providing the settings that allow for a successful
database connection.
|
static ServerDetails |
getServerDetails(String connectionUrl,
String username,
String password,
String serverName)
Returns information on the server as found in the database (port numbers, affinity group, etc).
|
static ArrayList<String> |
getServerNames(String connectionUrl,
String username,
String password)
Get the list of existing servers from an existing schema.
|
static ServerInstallUtil.SupportedDatabaseType |
getSupportedDatabaseType(HashMap<String,String> serverProperties)
Give the server properties, this returns the type of database that will be connected to.
|
static ServerInstallUtil.SupportedDatabaseType |
getSupportedDatabaseType(String dbType)
Give the database type string, this returns the type of database that it refers to.
|
static boolean |
isAutoinstallEnabled(HashMap<String,String> serverProperties)
Determines if we are in auto-install mode.
|
static boolean |
isDatabaseSchemaExist(String connectionUrl,
String username,
String password)
Returns
true if the database already has the database schema created for it. |
static boolean |
isEmpty(String s)
Given a server property value string, returns true if it is not specified.
|
static void |
persistStorageClusterSettingsIfNecessary(HashMap<String,String> serverProperties,
String password) |
static void |
persistStorageNodesIfNecessary(HashMap<String,String> serverProperties,
String password,
Set<org.rhq.core.domain.cloud.StorageNode> storageNodes)
Persists the storage nodes to the database only if no storage node entities already exist.
|
static void |
setSocketBindings(org.jboss.as.controller.client.ModelControllerClient mcc,
HashMap<String,String> serverProperties) |
static void |
setupMailService(org.jboss.as.controller.client.ModelControllerClient mcc,
HashMap<String,String> serverProperties)
Prepares the mail service by configuring the SMTP settings.
|
static void |
setupWebConnectors(org.jboss.as.controller.client.ModelControllerClient mcc,
String configDirStr,
HashMap<String,String> serverProperties)
Ensures our web connectors are configured properly.
|
static void |
storeServerDetails(HashMap<String,String> serverProperties,
String password,
ServerDetails serverDetails)
Stores the server details (such as the public endpoint) in the database.
|
static String |
testConnection(String connectionUrl,
String username,
String password)
Tests to make sure the server can be connected to with the given settings.
|
static void |
upgradeExistingDatabaseSchema(HashMap<String,String> props,
ServerDetails serverDetails,
String password,
String logDir)
This will update an existing database schema so it can be upgraded to the latest schema version.
|
public static void configureLogging(org.jboss.as.controller.client.ModelControllerClient mcc,
HashMap<String,String> serverProperties)
throws Exception
mcc - JBossAS management clientserverProperties - the server properties, which includes the default log level to useExceptionpublic static void configureTransactionManager(org.jboss.as.controller.client.ModelControllerClient mcc)
throws Exception
mcc - JBossAS management clientExceptionpublic static void configureDeploymentScanner(org.jboss.as.controller.client.ModelControllerClient mcc)
throws Exception
mcc - JBossAS management clientExceptionpublic static void setupMailService(org.jboss.as.controller.client.ModelControllerClient mcc,
HashMap<String,String> serverProperties)
throws Exception
mcc - JBossAS management clientserverProperties - the server's propertiesExceptionpublic static ServerInstallUtil.SupportedDatabaseType getSupportedDatabaseType(HashMap<String,String> serverProperties)
serverProperties - public static ServerInstallUtil.SupportedDatabaseType getSupportedDatabaseType(String dbType)
dbType - the database type stringpublic static void createDatasourceSecurityDomain(org.jboss.as.controller.client.ModelControllerClient mcc,
HashMap<String,String> serverProperties)
throws Exception
mcc - the JBossAS management clientserverProperties - contains the obfuscated password to store in the security domainExceptionpublic static void createUserSecurityDomain(org.jboss.as.controller.client.ModelControllerClient mcc)
throws Exception
mcc - ModelControllerClient to talk to the underlying ASException - If anything goes wrongpublic static void createRestSecurityDomain(org.jboss.as.controller.client.ModelControllerClient mcc)
throws Exception
mcc - ModelControllerClient to talk to the underlying AS.Exception - If anything goes wrongpublic static void createNewJMSQueues(org.jboss.as.controller.client.ModelControllerClient mcc,
HashMap<String,String> serverProperties)
throws Exception
mcc - the JBossAS management clientserverProperties - contains the obfuscated password to store in the security domainExceptionpublic static void createNewCaches(org.jboss.as.controller.client.ModelControllerClient mcc,
HashMap<String,String> serverProperties)
throws Exception
mcc - the JBossAS management clientserverProperties - contains the obfuscated password to store in the security domainExceptionpublic static void createNewJdbcDrivers(org.jboss.as.controller.client.ModelControllerClient mcc,
HashMap<String,String> serverProperties)
throws Exception
mcc - serverProperties - Exceptionpublic static void createNewDatasources(org.jboss.as.controller.client.ModelControllerClient mcc,
HashMap<String,String> serverProperties)
throws Exception
mcc - the JBossAS management clientserverProperties - properties to help determine the properties of the datasources to be createdExceptionpublic static boolean isAutoinstallEnabled(HashMap<String,String> serverProperties)
serverProperties - the full set of server propertiespublic static boolean isDatabaseSchemaExist(String connectionUrl, String username, String password) throws Exception
true 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.connectionUrl - username - password - true if the database can be connected toException - if failed to communicate with the databasepublic static ArrayList<String> getServerNames(String connectionUrl, String username, String password) throws Exception
connectionUrl - username - password - Exception - if failed to communicate with the databasepublic static ServerDetails getServerDetails(String connectionUrl, String username, String password, String serverName)
connectionUrl - username - password - serverName - the server whose details are to be returnedpublic static String testConnection(String connectionUrl, String username, String password)
null. If the test fails, the returned string
will be the error message to indicate the problem.connectionUrl - username - password - null if test succeededpublic static void ensureDatabaseIsSupported(String connectionUrl, String username, String password) throws Exception
connectionUrl - username - password - Exception - if the database is not supportedpublic static Connection getDatabaseConnection(String connectionUrl, String userName, String password) throws SQLException
props is null, it will use the server properties from
#getServerProperties.connectionUrl - userName - password - SQLException - if cannot successfully connect to the databasepublic static void persistStorageNodesIfNecessary(HashMap<String,String> serverProperties, String password, Set<org.rhq.core.domain.cloud.StorageNode> storageNodes) throws Exception
rhqctl install. This ensures that any necessary cluster maintenance
tasks will be performed.serverProperties - the server propertiespassword - clear text password to connect to the databasestorageNodes - the storage nodes to persistExceptionpublic static Map<String,String> fetchStorageClusterSettings(HashMap<String,String> serverProperties, String password) throws Exception
Exceptionpublic static void persistStorageClusterSettingsIfNecessary(HashMap<String,String> serverProperties, String password) throws Exception
Exceptionpublic static void storeServerDetails(HashMap<String,String> serverProperties, String password, ServerDetails serverDetails) throws Exception
serverProperties - the server propertiespassword - clear text password to connect to the databaseserverDetails - the details of the server to put into the databaseExceptionpublic static void createNewDatabaseSchema(HashMap<String,String> props, ServerDetails serverDetails, String password, String logDir) throws Exception
props define the connection to the database -
Note that if the schema already exists, it will be purged of all
data/tables and recreated.
props - the full set of server propertiesserverDetails - additional information about the server being installedpassword - the database password in clear textlogDir - a directory where the db schema upgrade logs can be writtenException - if failed to create the new schema for some reasonpublic static void upgradeExistingDatabaseSchema(HashMap<String,String> props, ServerDetails serverDetails, String password, String logDir) throws Exception
Note that if the schema does not already exist, errors will
occur.
props - the full set of server propertiesserverDetails - additional information about the server being installedpassword - the database password in clear textlogDir - a directory where the db schema upgrade logs can be writtenException - if the upgrade failed for some reasonpublic static boolean isEmpty(String s)
s - the property string valuepublic static void setupWebConnectors(org.jboss.as.controller.client.ModelControllerClient mcc,
String configDirStr,
HashMap<String,String> serverProperties)
throws Exception
mcc - the AS clientconfigDirStr - location of a configuration directory where the keystore is to be storedserverProperties - the full set of server propertiesExceptionpublic static File createKeystore(ServerDetails serverDetails, String configDirStr)
serverDetails - details of the server being installed - must not be null and endpoint must be included in itconfigDirStr - location of a configuration directory where the keystore is to be storedpublic static void createDefaultManagementUser(String password, ServerDetails serverDetails, String configDirStr)
password - the management passwordserverDetails - details of the server being installedconfigDirStr - location of a configuration directory where the mgmt-users.properties file livesCopyright © 2008-2014 Red Hat, Inc.. All Rights Reserved.