org.rhq.enterprise.server.system
Class SystemManagerBean

java.lang.Object
  extended by org.rhq.enterprise.server.system.SystemManagerBean
All Implemented Interfaces:
SystemManagerLocal, SystemManagerRemote

public class SystemManagerBean
extends java.lang.Object
implements SystemManagerLocal, SystemManagerRemote


Constructor Summary
SystemManagerBean()
           
 
Method Summary
 long analyze(Subject whoami)
          Run analyze command on PostgreSQL databases.
 void enableHibernateStatistics()
          Creates and registers the Hibernate Statistics MBean.
 DatabaseType getDatabaseType()
          Returns the DatabaseType that corresponds to the database the JON Server uses for its backend.
 java.util.Date getExpiration()
           
 License getLicense()
          Retrieves the currently active license.
 ServerVersion getServerVersion(Subject subject)
          Provides version information of the server processing the request.
 java.util.Properties getSystemConfiguration()
          Get the server cloud configuration.
 void initialize()
           
 boolean isMonitoringEnabled()
          See if monitoring feature is enabled for product.
 void loadSystemConfigurationCache()
          Grabs the current system configuration from the database and reloads the cache with it.
 void loadSystemConfigurationCacheInNewTx()
          Grabs the current system configuration from the database and reloads the cache with it.
 void reconfigureSystem(Subject whoami)
          Performs some reconfiguration things on the server where we are running.
 long reindex(Subject whoami)
          Reindexes all tables that need to be periodically reindexed.
 void reloadConfigCache(javax.ejb.Timer timer)
           
 void scheduleConfigCacheReloader()
          Schedules the internal timer job that periodically refreshes the configuration cache.
 void setSystemConfiguration(Subject subject, java.util.Properties properties, boolean skipValidation)
          Set the server cloud configuration.
 void undeployInstaller()
          Ensures the installer is no longer deployed.
 void updateLicense(Subject subject, byte[] licenseData)
          Update the deployed license file by writing it to disk and reinitializing the LicenseManager static singleton.
 long vacuum(Subject whoami)
          Run database-specific cleanup routines.
 long vacuum(Subject whoami, java.lang.String[] tableNames)
          Run database-specific cleanup routines for the given tables.
 long vacuumAppdef(Subject whoami)
          Run database-specific cleanup routines on appdef tables.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SystemManagerBean

public SystemManagerBean()
Method Detail

initialize

@PostConstruct
public void initialize()

scheduleConfigCacheReloader

public void scheduleConfigCacheReloader()
Description copied from interface: SystemManagerLocal
Schedules the internal timer job that periodically refreshes the configuration cache. This is needed in case a user changed the system configuration on another server in the HA cloud - this config cache reloader will load in that new configuration.

Specified by:
scheduleConfigCacheReloader in interface SystemManagerLocal

reloadConfigCache

public void reloadConfigCache(javax.ejb.Timer timer)

getDatabaseType

public DatabaseType getDatabaseType()
Description copied from interface: SystemManagerLocal
Returns the DatabaseType that corresponds to the database the JON Server uses for its backend.

This method is mainly to allow the caller to determine the kind of database in use so as to determine what syntax to use for a particular native query.

Specified by:
getDatabaseType in interface SystemManagerLocal
Returns:
the type of database

getSystemConfiguration

public java.util.Properties getSystemConfiguration()
Description copied from interface: SystemManagerLocal
Get the server cloud configuration. These are the server configurations that will be the same for all servers in the HA server cloud.

Specified by:
getSystemConfiguration in interface SystemManagerLocal
Returns:
Properties

loadSystemConfigurationCacheInNewTx

public void loadSystemConfigurationCacheInNewTx()
Description copied from interface: SystemManagerLocal
Grabs the current system configuration from the database and reloads the cache with it. This is meant for internal use only! You probably want to use SystemManagerLocal.getSystemConfiguration() instead.

Specified by:
loadSystemConfigurationCacheInNewTx in interface SystemManagerLocal

loadSystemConfigurationCache

public void loadSystemConfigurationCache()
Description copied from interface: SystemManagerLocal
Grabs the current system configuration from the database and reloads the cache with it. This is meant for internal use only! You probably want to use SystemManagerLocal.getSystemConfiguration() instead.

Specified by:
loadSystemConfigurationCache in interface SystemManagerLocal

setSystemConfiguration

public void setSystemConfiguration(Subject subject,
                                   java.util.Properties properties,
                                   boolean skipValidation)
Description copied from interface: SystemManagerLocal
Set the server cloud configuration. The given properties will be the new settings for all servers in the HA server cloud.

Specified by:
setSystemConfiguration in interface SystemManagerLocal
Parameters:
subject - the user who wants to change the settings
properties - the new system configuration settings
skipValidation - if true, validation will not be performed on the properties

enableHibernateStatistics

public void enableHibernateStatistics()
Description copied from interface: SystemManagerLocal
Creates and registers the Hibernate Statistics MBean. This allows us to monitor our own Hibernate usage.

Specified by:
enableHibernateStatistics in interface SystemManagerLocal

reconfigureSystem

public void reconfigureSystem(Subject whoami)
Description copied from interface: SystemManagerLocal
Performs some reconfiguration things on the server where we are running. This includes redeploying the configured JAAS modules.

Specified by:
reconfigureSystem in interface SystemManagerLocal

analyze

public long analyze(Subject whoami)
Description copied from interface: SystemManagerLocal
Run analyze command on PostgreSQL databases. On non-PostgreSQL, this returns -1.

Specified by:
analyze in interface SystemManagerLocal
Parameters:
whoami - the user requesting the operation
Returns:
The time it took to analyze, in milliseconds, or -1 if the database is not PostgreSQL.

reindex

public long reindex(Subject whoami)
Description copied from interface: SystemManagerLocal
Reindexes all tables that need to be periodically reindexed. For Oracle, this "rebuilds" the indexes, for PostgreSQL, its a "reindex".

Specified by:
reindex in interface SystemManagerLocal
Parameters:
whoami - the user requesting the operation
Returns:
The time it took to reindex, in milliseconds

vacuum

public long vacuum(Subject whoami)
Description copied from interface: SystemManagerLocal
Run database-specific cleanup routines. On PostgreSQL we do a VACUUM ANALYZE on all tables. On other databases we just return -1.

Specified by:
vacuum in interface SystemManagerLocal
Parameters:
whoami - the user requesting the operation
Returns:
The time it took to vaccum, in milliseconds, or -1 if the database is not PostgreSQL.

vacuum

public long vacuum(Subject whoami,
                   java.lang.String[] tableNames)
Description copied from interface: SystemManagerLocal
Run database-specific cleanup routines for the given tables. On PostgreSQL we do a VACUUM ANALYZE on the given tables. On other databases we just return -1.

Specified by:
vacuum in interface SystemManagerLocal
Parameters:
whoami - the user requesting the operation
tableNames - names of specific tables that will be vacuumed.
Returns:
The time it took to vaccum, in milliseconds, or -1 if the database is not PostgreSQL.

vacuumAppdef

public long vacuumAppdef(Subject whoami)
Description copied from interface: SystemManagerLocal
Run database-specific cleanup routines on appdef tables. On PostgreSQL we do a VACUUM ANALYZE against the relevant tables. On other databases we just return -1.

Specified by:
vacuumAppdef in interface SystemManagerLocal
Parameters:
whoami - the user requesting the operation
Returns:
The time it took to vaccum, in milliseconds, or -1 if the database is not PostgreSQL.

undeployInstaller

public void undeployInstaller()
Ensures the installer is no longer deployed.

Specified by:
undeployInstaller in interface SystemManagerLocal

isMonitoringEnabled

public boolean isMonitoringEnabled()
See if monitoring feature is enabled for product.

Specified by:
isMonitoringEnabled in interface SystemManagerLocal

getLicense

public License getLicense()
Retrieves the currently active license. Returns null if there is no active license. Otherwise it needs to propogate the appropriate error back up to the caller, otherwise the error will be masked, and from a UI perspective the user will think no license has been installed yet.

Specified by:
getLicense in interface SystemManagerLocal
Returns:
The License object

updateLicense

public void updateLicense(Subject subject,
                          byte[] licenseData)
Update the deployed license file by writing it to disk and reinitializing the LicenseManager static singleton.

Specified by:
updateLicense in interface SystemManagerLocal
Parameters:
licenseData - a byte array of the license data

getExpiration

public java.util.Date getExpiration()
Specified by:
getExpiration in interface SystemManagerLocal
Returns:
the expiration date, or null if the product never expires.

getServerVersion

public ServerVersion getServerVersion(Subject subject)
                               throws java.lang.Exception
Description copied from interface: SystemManagerRemote
Provides version information of the server processing the request.

Specified by:
getServerVersion in interface SystemManagerLocal
Specified by:
getServerVersion in interface SystemManagerRemote
Returns:
server version information
Throws:
java.lang.Exception


Copyright © 2008-2009 Red Hat, Inc.. All Rights Reserved.