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(ServerDetails serverDetails,
String configDirStr)
Create an rhqadmin/rhqadmin management user so when discovered, the AS7 plugin can immediately
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,
HashMap<String,String> serverProperties)
Creates the security domain for REST.
|
static String |
deobfuscatePassword(String obfuscatedPassword)
Use the internal JBossAS mechanism to de-obfuscate a password back to its
clear text form.
|
static void |
ensureDatabaseIsSupported(String connectionUrl,
String username,
String password)
Call this when you need to confirm that the database is supported.
|
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 boolean |
isSameDatasourceSecurityDomainExisting(org.jboss.as.controller.client.ModelControllerClient mcc,
HashMap<String,String> serverProperties)
This checks to see if the security domain for the datasources already exists
and has the same username/password as those found in the given properties
THIS IS ONLY HERE TO SUPPORT INSTALLER --reconfig OPTION WHICH SHOULD
GO AWAY ONCE AS7 SUPPORTS EXPRESSIONS WHERE WE NEED THEM - JIRA AS7-5321.
|
static boolean |
isSameLoggingExisting(org.jboss.as.controller.client.ModelControllerClient mcc,
HashMap<String,String> serverProperties)
This checks to see if the logging settings have the same values as those found in the given properties.
|
static boolean |
isSameMailServiceExisting(org.jboss.as.controller.client.ModelControllerClient mcc,
HashMap<String,String> serverProperties)
This checks to see if the mail service already exists
and has the same settings as those found in the given properties.
|
static boolean |
isSameWebConnectorsExisting(org.jboss.as.controller.client.ModelControllerClient mcc,
String appServerConfigDir,
HashMap<String,String> serverProperties)
This checks to see if the web connectors already exist
and have the same settings as those found in the given properties
THIS IS ONLY HERE TO SUPPORT INSTALLER --reconfig OPTION WHICH SHOULD
GO AWAY ONCE AS7 SUPPORTS EXPRESSIONS WHERE WE NEED THEM - JIRA AS7-5321.
|
static String |
obfuscatePassword(String password)
Use the internal JBossAS mechanism to obfuscate a password.
|
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 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 createRESTSecurityDomain(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 String obfuscatePassword(String password)
password - the clear text of the password to obfuscatepublic static String deobfuscatePassword(String obfuscatedPassword)
obfuscatedPasswordd - the obfuscated passwordpublic 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 installedconfigDirStr - location of a configuration directory where the keystore is to be storedpublic static void createDefaultManagementUser(ServerDetails serverDetails, String configDirStr)
serverDetails - details of the server being installedconfigDirStr - location of a configuration directory where the mgmt-users.properties file livespublic static void setSocketBindings(org.jboss.as.controller.client.ModelControllerClient mcc,
HashMap<String,String> serverProperties)
throws Exception
Exceptionpublic static boolean isSameLoggingExisting(org.jboss.as.controller.client.ModelControllerClient mcc,
HashMap<String,String> serverProperties)
mcc - the JBossAS management clientserverProperties - contains the logging settingsExceptionpublic static boolean isSameMailServiceExisting(org.jboss.as.controller.client.ModelControllerClient mcc,
HashMap<String,String> serverProperties)
throws Exception
mcc - the JBossAS management clientserverProperties - contains the mail service settingsExceptionpublic static boolean isSameDatasourceSecurityDomainExisting(org.jboss.as.controller.client.ModelControllerClient mcc,
HashMap<String,String> serverProperties)
throws Exception
mcc - the JBossAS management clientserverProperties - contains the obfuscated password and username to compareExceptionpublic static boolean isSameWebConnectorsExisting(org.jboss.as.controller.client.ModelControllerClient mcc,
String appServerConfigDir,
HashMap<String,String> serverProperties)
throws Exception
mcc - the JBossAS management clientconfigDirStr - location of a configuration directory where the keystore is to be storedserverProperties - contains the obfuscated password and username to compareExceptionCopyright © 2008-2013 Red Hat, Inc.. All Rights Reserved.