[rhq] Branch 'rhq-on-as7' - modules/enterprise
by Jay Shaughnessy
modules/enterprise/gui/installer/src/main/java/org/rhq/common/jbossas/client/controller/JMSJBossASClient.java | 110 ++++++++++
modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/servlet/InstallerGWTServiceImpl.java | 3
modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/servlet/ServerInstallUtil.java | 65 +++++
3 files changed, 178 insertions(+)
New commits:
commit cd654490665f405bc9c32e0be33b6dcde8ae0931
Author: Jay Shaughnessy <jshaughn(a)jshaughn.csb>
Date: Mon Sep 10 21:23:25 2012 -0400
Add RHQ Queue creation support for standalone-fulle.xml
diff --git a/modules/enterprise/gui/installer/src/main/java/org/rhq/common/jbossas/client/controller/JMSJBossASClient.java b/modules/enterprise/gui/installer/src/main/java/org/rhq/common/jbossas/client/controller/JMSJBossASClient.java
new file mode 100644
index 0000000..b9e42c1
--- /dev/null
+++ b/modules/enterprise/gui/installer/src/main/java/org/rhq/common/jbossas/client/controller/JMSJBossASClient.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 convenience methods associated with JMS management.
+ *
+ * @author Jay Shaughnessy
+ * @author John Mazzitelli
+ */
+public class JMSJBossASClient extends JBossASClient {
+
+ public static final String SUBSYSTEM_MESSAGING = "messaging";
+ public static final String HORNETQ_SERVER = "hornetq-server";
+ public static final String JMS_QUEUE = "jms-queue";
+ public static final String OP_ENABLE = "enable";
+
+ public JMSJBossASClient(ModelControllerClient client) {
+ super(client);
+ }
+
+ public boolean isQueueEnabled(String queueName) throws Exception {
+ Address addr = Address.root().add(SUBSYSTEM, SUBSYSTEM_MESSAGING, HORNETQ_SERVER, "default", JMS_QUEUE,
+ queueName);
+ ModelNode results = readResource(addr);
+ boolean enabledFlag = false;
+ if (results.hasDefined("enabled")) {
+ ModelNode enabled = results.get("enabled");
+ enabledFlag = enabled.asBoolean(false);
+ }
+ return enabledFlag;
+ }
+
+ public void enableQueue(String queueName) throws Exception {
+ if (isQueueEnabled(queueName)) {
+ return; // nothing to do - it's already enabled
+ }
+
+ Address addr = Address.root().add(SUBSYSTEM, SUBSYSTEM_MESSAGING, HORNETQ_SERVER, "default", JMS_QUEUE,
+ queueName);
+ ModelNode request = createRequest(OP_ENABLE, addr);
+ request.get(PERSISTENT).set(true);
+ ModelNode results = execute(request);
+ if (!isSuccess(results)) {
+ throw new FailureException(results);
+ }
+ return; // everything is OK
+ }
+
+ /**
+ * Checks to see if there is already a queue with the given name.
+ *
+ * @param queueName the name to check
+ * @return true if there is a queue with the given name already in existence
+ */
+ public boolean isQueue(String queueName) throws Exception {
+ Address addr = Address.root().add(SUBSYSTEM, SUBSYSTEM_MESSAGING, HORNETQ_SERVER, "default");
+ String haystack = JMS_QUEUE;
+ return null != findNodeInList(addr, haystack, queueName);
+ }
+
+ /**
+ * Returns a ModelNode that can be used to create a queue.
+ * Callers are free to tweak the queue request that is returned,
+ * if they so choose, before asking the client to execute the request.
+ *
+ * @param name the queue name
+ * @param entryNames the jndiNames, each is prefixed with 'java:/'. Only supports one entry currently.
+ *
+ * @return the request that can be used to create the queue
+ */
+ public ModelNode createNewQueueRequest(String name, List<String> entryNames) {
+
+ String dmrTemplate = "" //
+ + "{" //
+ + "\"entries\" => [\"%s\"] " //
+ + "}";
+
+ String dmr = String.format(dmrTemplate, entryNames.get(0));
+
+ Address addr = Address.root().add(SUBSYSTEM, SUBSYSTEM_MESSAGING, HORNETQ_SERVER, "default", JMS_QUEUE, name);
+ final ModelNode request = ModelNode.fromString(dmr);
+ request.get(OPERATION).set(ADD);
+ request.get(ADDRESS).set(addr.getAddressNode());
+
+ return request;
+ }
+
+}
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
index a39009f..ac7df1b 100644
--- 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
@@ -580,6 +580,9 @@ public class InstallerGWTServiceImpl extends RemoteServiceServlet implements Ins
// create the datasources
ServerInstallUtil.createNewDatasources(client, serverProperties);
+ // create the JMS queues
+ ServerInstallUtil.createNewJMSQueues(client, serverProperties);
+
// setup the email service
ServerInstallUtil.setupMailService(client, serverProperties);
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
index e03bf87..8ee46cb 100644
--- 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
@@ -34,6 +34,7 @@ import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import java.util.Properties;
@@ -50,6 +51,7 @@ import org.rhq.common.jbossas.client.controller.CoreJBossASClient;
import org.rhq.common.jbossas.client.controller.DatasourceJBossASClient;
import org.rhq.common.jbossas.client.controller.FailureException;
import org.rhq.common.jbossas.client.controller.JBossASClient;
+import org.rhq.common.jbossas.client.controller.JMSJBossASClient;
import org.rhq.common.jbossas.client.controller.SecurityDomainJBossASClient;
import org.rhq.core.db.DatabaseType;
import org.rhq.core.db.DatabaseTypeFactory;
@@ -99,6 +101,9 @@ public class ServerInstallUtil {
private static final String RHQ_REST_SECURITY_DOMAIN = "RHQRESTSecurityDomain";
private static final String JDBC_DRIVER_POSTGRES = "postgres";
private static final String JDBC_DRIVER_ORACLE = "oracle";
+ private static final String JMS_ALERT_CONDITION_QUEUE = "AlertConditionQueue";
+ private static final String JMS_DRIFT_CHANGESET_QUEUE = "DriftChangesetQueue";
+ private static final String JMS_DRIFT_FILE_QUEUE = "DriftFileQueue";
/**
* Configure the deployment scanner to get ready to deploy the application.
@@ -217,6 +222,66 @@ public class ServerInstallUtil {
}
/**
+ * Creates the JMS Queues required for Drift and Alerting.
+ *
+ * @param mcc the JBossAS management client
+ * @param serverProperties contains the obfuscated password to store in the security domain
+ * @throws Exception
+ */
+ public static void createNewJMSQueues(ModelControllerClient mcc, HashMap<String, String> serverProperties)
+ throws Exception {
+
+ final JMSJBossASClient client = new JMSJBossASClient(mcc);
+ final List<String> entryNames = new ArrayList<String>();
+
+ String queue = JMS_ALERT_CONDITION_QUEUE;
+ if (!client.isQueue(queue)) {
+ entryNames.clear();
+ entryNames.add("queue/" + queue);
+ ModelNode request = client.createNewQueueRequest(queue, entryNames);
+ ModelNode results = client.execute(request);
+ if (!JMSJBossASClient.isSuccess(results)) {
+ throw new FailureException(results, "Failed to create JMS Queue [" + queue + "]");
+ } else {
+ LOG.info("JMS queue [" + queue + "] created");
+ }
+ } else {
+ LOG.info("JMS Queue [" + queue + "] already exists, skipping the creation request");
+ }
+
+ queue = JMS_DRIFT_CHANGESET_QUEUE;
+ if (!client.isQueue(queue)) {
+ entryNames.clear();
+ entryNames.add("queue/" + queue);
+ ModelNode request = client.createNewQueueRequest(queue, entryNames);
+ ModelNode results = client.execute(request);
+ if (!JMSJBossASClient.isSuccess(results)) {
+ throw new FailureException(results, "Failed to create JMS Queue [" + queue + "]");
+ } else {
+ LOG.info("JMS queue [" + queue + "] created");
+ }
+ } else {
+ LOG.info("JMS Queue [" + queue + "] already exists, skipping the creation request");
+ }
+
+ queue = JMS_DRIFT_FILE_QUEUE;
+ if (!client.isQueue(queue)) {
+ entryNames.clear();
+ entryNames.add("queue/" + queue);
+ ModelNode request = client.createNewQueueRequest(queue, entryNames);
+ ModelNode results = client.execute(request);
+ if (!JMSJBossASClient.isSuccess(results)) {
+ throw new FailureException(results, "Failed to create JMS Queue [" + queue + "]");
+ } else {
+ LOG.info("JMS queue [" + queue + "] created");
+ }
+ } else {
+ LOG.info("JMS Queue [" + queue + "] already exists, skipping the creation request");
+ }
+
+ }
+
+ /**
* Creates the security domain for REST.
*
* @param mcc the JBossAS management client
11 years, 9 months
[rhq] modules/plugins
by mazz
modules/plugins/oracle/src/main/java/org/rhq/plugins/oracle/OracleAsmDiskGroupComponent.java | 117 ++++++++++
modules/plugins/oracle/src/main/java/org/rhq/plugins/oracle/OracleAsmDiskGroupDiscoveryComponent.java | 92 +++++++
modules/plugins/oracle/src/main/resources/META-INF/rhq-plugin.xml | 27 ++
3 files changed, 236 insertions(+)
New commits:
commit fadd80c00b33dc206e751cfee6473322a831eb35
Author: Richard Hensman <richard(a)onevisionconsulting.co.uk>
Date: Wed Aug 29 20:54:06 2012 +0100
Added Oracle ASM Disk Group Component to Oracle Plugin
diff --git a/modules/plugins/oracle/src/main/java/org/rhq/plugins/oracle/OracleAsmDiskGroupComponent.java b/modules/plugins/oracle/src/main/java/org/rhq/plugins/oracle/OracleAsmDiskGroupComponent.java
new file mode 100644
index 0000000..09e1a80
--- /dev/null
+++ b/modules/plugins/oracle/src/main/java/org/rhq/plugins/oracle/OracleAsmDiskGroupComponent.java
@@ -0,0 +1,117 @@
+/*
+ * 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.plugins.oracle;
+
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.Locale;
+import java.util.Set;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.rhq.core.domain.measurement.AvailabilityType;
+import org.rhq.core.domain.measurement.DataType;
+import org.rhq.core.domain.measurement.MeasurementDataNumeric;
+import org.rhq.core.domain.measurement.MeasurementDataTrait;
+import org.rhq.core.domain.measurement.MeasurementReport;
+import org.rhq.core.domain.measurement.MeasurementScheduleRequest;
+import org.rhq.core.pluginapi.measurement.MeasurementFacet;
+import org.rhq.core.util.jdbc.JDBCUtil;
+import org.rhq.plugins.database.AbstractDatabaseComponent;
+import org.rhq.plugins.database.DatabaseQueryUtility;
+
+/**
+ * Oracle ASM Disk Group Component.
+ *
+ * @author Richard Hensman
+ */
+@SuppressWarnings("rawtypes")
+public class OracleAsmDiskGroupComponent extends AbstractDatabaseComponent
+ implements MeasurementFacet {
+
+ private static final String SQL_AVAILABLE = "SELECT COUNT(*) FROM v$asm_diskgroup WHERE group_number = ? and STATE <> 'BROKEN'";
+
+ private static final String SQL_VALUES = "SELECT GROUP_NUMBER, " + "NAME, "
+ + "SECTOR_SIZE sectorSize, " + "BLOCK_SIZE blockSize, "
+ + "ALLOCATION_UNIT_SIZE allocationUnitSize, " + "STATE state, "
+ + "TYPE type, " + "TOTAL_MB totalMb, " + "FREE_MB freeMb, "
+ + "((TOTAL_MB-FREE_MB)/TOTAL_MB) usedPercent, "
+ + "REQUIRED_MIRROR_FREE_MB requiredMirrorFreeMb, "
+ + "USABLE_FILE_MB usableFileMb, " + "OFFLINE_DISKS offlineDisks, "
+ + "COMPATIBILITY compatibility, "
+ + "DATABASE_COMPATIBILITY databaseCompatibility "
+ + "FROM v$asm_diskgroup WHERE group_number = ?";
+
+ private static Log log = LogFactory
+ .getLog(OracleAsmDiskGroupComponent.class);
+
+ public AvailabilityType getAvailability() {
+ PreparedStatement statement = null;
+ ResultSet resultSet = null;
+ try {
+ statement = getConnection().prepareStatement(SQL_AVAILABLE);
+ statement.setString(1, this.resourceContext.getResourceKey());
+ resultSet = statement.executeQuery();
+ if (resultSet.next() && (resultSet.getInt(1) == 1)) {
+ return AvailabilityType.UP;
+ }
+ } catch (SQLException e) {
+ log.debug("unable to query", e);
+ } finally {
+ JDBCUtil.safeClose(statement, resultSet);
+ }
+
+ return AvailabilityType.DOWN;
+ }
+
+ public void getValues(MeasurementReport report,
+ Set<MeasurementScheduleRequest> metrics) throws Exception {
+ PreparedStatement statement = null;
+ ResultSet resultSet = null;
+ try {
+ statement = this.getConnection().prepareStatement(SQL_VALUES);
+ statement.setString(1, this.resourceContext.getResourceKey());
+ resultSet = statement.executeQuery();
+ if (resultSet.next()) {
+ for (MeasurementScheduleRequest request : metrics) {
+ String name = request.getName().toUpperCase(Locale.US);
+ if (request.getDataType().equals(DataType.TRAIT)) {
+ report.addData(new MeasurementDataTrait(request,
+ resultSet.getString(name)));
+ } else {
+ try {
+ report.addData(new MeasurementDataNumeric(request,
+ resultSet.getDouble(name)));
+ } catch (SQLException e) {
+ // Ignoring metrics that cannot be read as a double
+ log.warn("Ignoring metric " + name
+ + " as it cannot be read as a double");
+ }
+ }
+ }
+ }
+ } catch (SQLException e) {
+ log.debug("Unable to read value", e);
+ removeConnection();
+ } finally {
+ DatabaseQueryUtility.close(statement, resultSet);
+ }
+ }
+}
\ No newline at end of file
diff --git a/modules/plugins/oracle/src/main/java/org/rhq/plugins/oracle/OracleAsmDiskGroupDiscoveryComponent.java b/modules/plugins/oracle/src/main/java/org/rhq/plugins/oracle/OracleAsmDiskGroupDiscoveryComponent.java
new file mode 100644
index 0000000..c023b1b
--- /dev/null
+++ b/modules/plugins/oracle/src/main/java/org/rhq/plugins/oracle/OracleAsmDiskGroupDiscoveryComponent.java
@@ -0,0 +1,92 @@
+/*
+ * 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.plugins.oracle;
+
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.pluginapi.inventory.DiscoveredResourceDetails;
+import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException;
+import org.rhq.core.pluginapi.inventory.ResourceDiscoveryComponent;
+import org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext;
+import org.rhq.core.util.jdbc.JDBCUtil;
+import org.rhq.plugins.database.DatabaseComponent;
+
+/**
+ * Discovery Oracle ASM Disk Groups.
+ *
+ * @author Richard Hensman
+ */
+public class OracleAsmDiskGroupDiscoveryComponent implements ResourceDiscoveryComponent<DatabaseComponent<?>> {
+
+ private final Log log = LogFactory.getLog(getClass());
+
+ public Set<DiscoveredResourceDetails> discoverResources(
+ ResourceDiscoveryContext<DatabaseComponent<?>> resourceDiscoveryContext)
+ throws InvalidPluginConfigurationException, Exception {
+ Statement statement = null;
+ ResultSet resultSet = null;
+
+ String table = "V$ASM_DISKGROUP";
+ String keyColumn = "GROUP_NUMBER";
+ String nameColumn = "NAME";
+ String description = "Oracle ASM Disk Groups";
+
+ try {
+ Connection conn = resourceDiscoveryContext.getParentResourceComponent().getConnection();
+
+ statement = conn.createStatement();
+ resultSet = statement.executeQuery("SELECT * FROM " + table);
+
+ Configuration config = null;
+ Set<DiscoveredResourceDetails> found = new HashSet<DiscoveredResourceDetails>();
+ while (resultSet.next()) {
+ config = resourceDiscoveryContext.getDefaultPluginConfiguration();
+ String key = resultSet.getString(keyColumn);
+ String name = resultSet.getString(nameColumn);
+ DiscoveredResourceDetails details =
+ new DiscoveredResourceDetails(
+ resourceDiscoveryContext.getResourceType(),
+ key,
+ name,
+ null,
+ description, config, null);
+ found.add(details);
+ }
+
+ return found;
+ } catch (SQLException e) {
+ log.debug("table " + table + " column " + keyColumn, e);
+ } finally {
+ JDBCUtil.safeClose(resultSet);
+ JDBCUtil.safeClose(statement);
+ }
+
+ return Collections.emptySet();
+ }
+
+}
\ No newline at end of file
diff --git a/modules/plugins/oracle/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/oracle/src/main/resources/META-INF/rhq-plugin.xml
index d8606e1..2174918 100644
--- a/modules/plugins/oracle/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/oracle/src/main/resources/META-INF/rhq-plugin.xml
@@ -635,6 +635,33 @@
<metric property="usedPercent" displayName="Used Percent" description="Percentage of the Flash Recovery Area used" displayType="summary" units="percentage"/>
</service>
+
+ <service name="Oracle ASM Disk Groups"
+ discovery="org.rhq.plugins.oracle.OracleAsmDiskGroupDiscoveryComponent"
+ class="org.rhq.plugins.oracle.OracleAsmDiskGroupComponent">
+
+ <!--plugin-configuration>
+ <c:simple-property name="table" default="V$ASM_DISKGROUP"/>
+ <c:simple-property name="metricQuery" default="SELECT {key} FROM V$ASM_DISKGROUP"/>
+ <c:simple-property name="keyColumn" default="GROUP_NUMBER"/>
+ <c:simple-property name="name" default="NAME"/>
+ <c:simple-property name="description" default="Oracle ASM Disk Groups"/>
+ </plugin-configuration -->
+
+ <metric property="sectorSize" displayName="Sector Size" description="Physical block size (in bytes)" units="bytes" dataType="trait"/>
+ <metric property="blockSize" displayName="Block Size" description="Automatic Storage Management metadata block size (in bytes)" units="bytes" dataType="trait"/>
+ <metric property="allocationUnitSize" displayName="Allocation Unit Size" description="Size of the allocation unit (in bytes)" units="bytes" dataType="trait"/>
+ <metric property="state" displayName="State" description="State of the disk group relative to the instance" dataType="trait"/>
+ <metric property="type" displayName="Type" description="Redundancy type for the disk group" dataType="trait"/>
+ <metric property="totalMb" displayName="Total Size" description="Total capacity of the disk group (in megabytes)" units="megabytes" displayType="summary"/>
+ <metric property="freeMb" displayName="Free Space" description="Unused capacity of the disk group (in megabytes)" units="megabytes" displayType="summary"/>
+ <metric property="usedPercent" displayName="Used Percent" description="Percentage of the disk group used" units="percentage" displayType="summary"/>
+ <metric property="requiredMirrorFreeMb" displayName="Space Required to Mirror" description="Amount of space that is required to be available in a given disk group in order to restore redundancy after one or more disk failures" units="megabytes"/>
+ <metric property="usableFileMb" displayName="Usable Space" description="Amount of free space that can be safely utilized taking mirroring into account and yet be able to restore redundancy after a disk failure" units="megabytes"/>
+ <metric property="offlineDisks" displayName="Offline Disks" description="Number of disks in the disk group that are currently offline" dataType="trait"/>
+ <metric property="compatibility" displayName="Compatibility" description="Minimum software version required for an ASM instance to mount this disk group" dataType="trait"/>
+ <metric property="databaseCompatibility" displayName="Database Compatibility" description="Minimum software version required for a database instance to use files in this disk group" dataType="trait"/>
+ </service>
</server>
11 years, 9 months
[rhq] Branch 'rhq-on-as7' - modules/enterprise
by Jay Shaughnessy
modules/enterprise/gui/installer/src/main/java/org/rhq/common/jbossas/client/controller/SecurityDomainJBossASClient.java | 53 +++++++++-
modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/servlet/InstallerGWTServiceImpl.java | 3
modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/servlet/ServerInstallUtil.java | 46 ++++++--
modules/enterprise/gui/rest-war/src/main/webapp/WEB-INF/jboss-web.xml | 2
4 files changed, 88 insertions(+), 16 deletions(-)
New commits:
commit 7a16d557311c811c97abc96a26ba2b454f7d2b1e
Author: Jay Shaughnessy <jshaughn(a)jshaughn.csb>
Date: Mon Sep 10 16:24:25 2012 -0400
Add REST security domain def to the installer.
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
index b1e8782..723a295 100644
--- 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
@@ -22,7 +22,7 @@ import org.jboss.as.controller.client.ModelControllerClient;
import org.jboss.dmr.ModelNode;
/**
- * Provides convienence methods associated with security domain management.
+ * Provides convenience methods associated with security domain management.
*
* @author John Mazzitelli
*/
@@ -39,6 +39,11 @@ public class SecurityDomainJBossASClient extends JBossASClient {
public static final String MODULE_OPTIONS = "module-options";
public static final String USERNAME = "username";
public static final String PASSWORD = "password";
+ public static final String DS_JNDI_NAME = "dsJndiName";
+ public static final String PRINCIPALS_QUERY = "principalsQuery";
+ public static final String ROLES_QUERY = "rolesQuery";
+ public static final String HASH_ALGORITHM = "hashAlgorithm";
+ public static final String HASH_ENCODING = "hashEncoding";
public SecurityDomainJBossASClient(ModelControllerClient client) {
super(client);
@@ -57,7 +62,7 @@ public class SecurityDomainJBossASClient extends JBossASClient {
}
/**
- * Convienence method that builds a request which can create a new security-domain
+ * Convenience 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.
*
@@ -96,4 +101,48 @@ public class SecurityDomainJBossASClient extends JBossASClient {
return;
}
+
+ /**
+ * Convenience method that builds a request which can create a new security domain
+ * using the database server authentication method. This is used when you want to directly
+ * authenticate against a db entry.
+ *
+ * @param securityDomainName the name of the new security domain
+ * @param dsJndiName the jndi name for the datasource to query against
+ * @param principalsQuery the SQL query for selecting password info for a principal
+ * @param rolesQuery the SQL query for selecting role info for a principal
+ * @param hashAlgorithm if null defaults to "MD5"
+ * @param hashEncoding if null defaults to "base64"
+ * @throws Exception if failed to create security domain
+ */
+ public void createNewDatabaseServerSecurityDomainRequest(String securityDomainName, String dsJndiName,
+ String principalsQuery, String rolesQuery, String hashAlgorithm, String hashEncoding) 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("DatabaseServer");
+ loginModule.get(FLAG).set("required");
+ ModelNode moduleOptions = loginModule.get(MODULE_OPTIONS);
+ moduleOptions.setEmptyList();
+ moduleOptions.add(DS_JNDI_NAME, dsJndiName);
+ moduleOptions.add(PRINCIPALS_QUERY, principalsQuery);
+ moduleOptions.add(ROLES_QUERY, rolesQuery);
+ moduleOptions.add(HASH_ALGORITHM, (null == hashAlgorithm ? "MD5" : hashAlgorithm));
+ moduleOptions.add(HASH_ENCODING, (null == hashEncoding ? "base64" : hashEncoding));
+ 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/server/servlet/InstallerGWTServiceImpl.java b/modules/enterprise/gui/installer/src/main/java/org/rhq/enterprise/gui/installer/server/servlet/InstallerGWTServiceImpl.java
index ecda87c..a39009f 100644
--- 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
@@ -571,6 +571,9 @@ public class InstallerGWTServiceImpl extends RemoteServiceServlet implements Ins
// create the security domain needed by the datasources
ServerInstallUtil.createDatasourceSecurityDomain(client, serverProperties);
+ // create the security domain needed by REST
+ ServerInstallUtil.createRESTSecurityDomain(client, serverProperties);
+
// create the JDBC driver configurations for use by datasources
ServerInstallUtil.createNewJdbcDrivers(client, serverProperties);
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
index aa0b27c..e03bf87 100644
--- 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
@@ -95,7 +95,8 @@ public class ServerInstallUtil {
private static final String RHQ_DATASOURCE_NAME_NOTX = "NoTxRHQDS";
private static final String RHQ_DATASOURCE_NAME_XA = "RHQDS";
- private static final String RHQ_SECURITY_DOMAIN = "RHQDSSecurityDomain";
+ private static final String RHQ_DS_SECURITY_DOMAIN = "RHQDSSecurityDomain";
+ private static final String RHQ_REST_SECURITY_DOMAIN = "RHQRESTSecurityDomain";
private static final String JDBC_DRIVER_POSTGRES = "postgres";
private static final String JDBC_DRIVER_ORACLE = "oracle";
@@ -127,7 +128,7 @@ public class ServerInstallUtil {
throws Exception {
String fromAddressExpr = "${" + ServerProperties.PROP_EMAIL_FROM_ADDRESS + ":rhqadmin@localhost.com}";
- String smtpHostExpr = "${" + ServerProperties.PROP_EMAIL_SMTP_HOST + ":localhost}";
+ //String smtpHostExpr = "${" + ServerProperties.PROP_EMAIL_SMTP_HOST + ":localhost}";
String smtpPortExpr = "${" + ServerProperties.PROP_EMAIL_SMTP_PORT + ":25}";
// Tweek the mail configuration that comes out of box. Setup a batch request to write the proper attributes.
@@ -206,7 +207,7 @@ public class ServerInstallUtil {
final String dbUsername = serverProperties.get(ServerProperties.PROP_DATABASE_USERNAME);
final String obfuscatedPassword = serverProperties.get(ServerProperties.PROP_DATABASE_PASSWORD);
final SecurityDomainJBossASClient client = new SecurityDomainJBossASClient(mcc);
- final String securityDomain = RHQ_SECURITY_DOMAIN;
+ final String securityDomain = RHQ_DS_SECURITY_DOMAIN;
if (!client.isSecurityDomain(securityDomain)) {
client.createNewSecureIdentitySecurityDomainRequest(securityDomain, dbUsername, obfuscatedPassword);
LOG.info("Security domain [" + securityDomain + "] created");
@@ -216,6 +217,28 @@ public class ServerInstallUtil {
}
/**
+ * Creates the security domain for REST.
+ *
+ * @param mcc the JBossAS management client
+ * @param serverProperties contains the obfuscated password to store in the security domain
+ * @throws Exception
+ */
+ public static void createRESTSecurityDomain(ModelControllerClient mcc, HashMap<String, String> serverProperties)
+ throws Exception {
+
+ final SecurityDomainJBossASClient client = new SecurityDomainJBossASClient(mcc);
+ final String securityDomain = RHQ_REST_SECURITY_DOMAIN;
+ if (!client.isSecurityDomain(securityDomain)) {
+ client.createNewDatabaseServerSecurityDomainRequest(securityDomain, "java:jboss/datasources/RHQDS",
+ "SELECT PASSWORD FROM RHQ_PRINCIPAL WHERE principal=?",
+ "SELECT 'all', 'Roles' FROM RHQ_PRINCIPAL WHERE principal=?", null, null);
+ LOG.info("Security domain [" + securityDomain + "] created");
+ } else {
+ LOG.info("Security domain [" + securityDomain + "] already exists, skipping the creation request");
+ }
+ }
+
+ /**
* Creates JDBC driver configurations so the datasources can properly connect to the backend databases.
* This will attempt to create drivers for all supported databases, not just for the database type that
* is currently configured.
@@ -342,7 +365,7 @@ public class ServerInstallUtil {
noTxDsRequest = client.createNewDatasourceRequest(RHQ_DATASOURCE_NAME_NOTX, 30000,
"${rhq.server.database.connection-url:jdbc:postgres://127.0.0.1:5432/rhq}", JDBC_DRIVER_POSTGRES,
"org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLExceptionSorter", 15, false, 2, 5, 75,
- RHQ_SECURITY_DOMAIN, "-unused-stale-conn-checker-", "TRANSACTION_READ_COMMITTED",
+ RHQ_DS_SECURITY_DOMAIN, "-unused-stale-conn-checker-", "TRANSACTION_READ_COMMITTED",
"org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLValidConnectionChecker", props);
noTxDsRequest.get("steps").get(0).remove("stale-connection-checker-class-name"); // we don't have one of these for postgres
} else {
@@ -357,7 +380,7 @@ public class ServerInstallUtil {
xaDsRequest = client.createNewXADatasourceRequest(RHQ_DATASOURCE_NAME_XA, 30000, JDBC_DRIVER_POSTGRES,
"org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLExceptionSorter", 15, 5, 50, 75,
- RHQ_SECURITY_DOMAIN, "-unused-stale-conn-checker-", "TRANSACTION_READ_COMMITTED",
+ RHQ_DS_SECURITY_DOMAIN, "-unused-stale-conn-checker-", "TRANSACTION_READ_COMMITTED",
"org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLValidConnectionChecker", props);
xaDsRequest.get("steps").get(0).remove("stale-connection-checker-class-name"); // we don't have one of these for postgres
} else {
@@ -387,7 +410,7 @@ public class ServerInstallUtil {
noTxDsRequest = client.createNewDatasourceRequest(RHQ_DATASOURCE_NAME_NOTX, 30000,
"${rhq.server.database.connection-url:jdbc:oracle:thin:@127.0.0.1:1521:rhq}", JDBC_DRIVER_ORACLE,
"org.jboss.jca.adapters.jdbc.extensions.oracle.OracleExceptionSorter", 15, false, 2, 5, 75,
- RHQ_SECURITY_DOMAIN, "org.jboss.jca.adapters.jdbc.extensions.oracle.OracleStaleConnectionChecker",
+ RHQ_DS_SECURITY_DOMAIN, "org.jboss.jca.adapters.jdbc.extensions.oracle.OracleStaleConnectionChecker",
"TRANSACTION_READ_COMMITTED",
"org.jboss.jca.adapters.jdbc.extensions.oracle.OracleValidConnectionChecker", props);
} else {
@@ -401,7 +424,7 @@ public class ServerInstallUtil {
xaDsRequest = client.createNewXADatasourceRequest(RHQ_DATASOURCE_NAME_XA, 30000, JDBC_DRIVER_ORACLE,
"org.jboss.jca.adapters.jdbc.extensions.oracle.OracleExceptionSorter", 15, 5, 50, 75,
- RHQ_SECURITY_DOMAIN, "org.jboss.jca.adapters.jdbc.extensions.oracle.OracleStaleConnectionChecker",
+ RHQ_DS_SECURITY_DOMAIN, "org.jboss.jca.adapters.jdbc.extensions.oracle.OracleStaleConnectionChecker",
"TRANSACTION_READ_COMMITTED",
"org.jboss.jca.adapters.jdbc.extensions.oracle.OracleValidConnectionChecker", props);
} else {
@@ -799,8 +822,7 @@ public class ServerInstallUtil {
* @throws Exception if failed to create the new schema for some reason
*/
public static void createNewDatabaseSchema(HashMap<String, String> props, ServerDetails serverDetails,
- String password, String logDir)
- throws Exception {
+ String password, String logDir) throws Exception {
String dbUrl = props.get(ServerProperties.PROP_DATABASE_CONNECTION_URL);
String userName = props.get(ServerProperties.PROP_DATABASE_USERNAME);
@@ -836,8 +858,7 @@ public class ServerInstallUtil {
* @throws Exception if the upgrade failed for some reason
*/
public static void upgradeExistingDatabaseSchema(HashMap<String, String> props, ServerDetails serverDetails,
- String password, String logDir)
- throws Exception {
+ String password, String logDir) throws Exception {
String dbUrl = props.get(ServerProperties.PROP_DATABASE_CONNECTION_URL);
String userName = props.get(ServerProperties.PROP_DATABASE_USERNAME);
@@ -889,8 +910,7 @@ public class ServerInstallUtil {
* @throws IOException if failed to extract the file to the log directory
*/
private static String extractDatabaseXmlFile(String xmlFileName, HashMap<String, String> props,
- ServerDetails serverDetails, String logDir)
- throws IOException {
+ ServerDetails serverDetails, String logDir) throws IOException {
// first slurp the file contents in memory
InputStream resourceInStream = ServerInstallUtil.class.getClassLoader().getResourceAsStream(xmlFileName);
diff --git a/modules/enterprise/gui/rest-war/src/main/webapp/WEB-INF/jboss-web.xml b/modules/enterprise/gui/rest-war/src/main/webapp/WEB-INF/jboss-web.xml
index 45759fd..1ef5880 100644
--- a/modules/enterprise/gui/rest-war/src/main/webapp/WEB-INF/jboss-web.xml
+++ b/modules/enterprise/gui/rest-war/src/main/webapp/WEB-INF/jboss-web.xml
@@ -2,5 +2,5 @@
<jboss-web>
<context-root>rest</context-root>
- <security-domain>REST</security-domain>
+ <security-domain>RHQRESTSecurityDomain</security-domain>
</jboss-web>
11 years, 9 months
[rhq] Branch 'rhq-on-as7' - .classpath .settings/org.eclipse.jdt.core.prefs
by mazz
.classpath | 20 ++++++--------------
.settings/org.eclipse.jdt.core.prefs | 17 ++++++++++++-----
2 files changed, 18 insertions(+), 19 deletions(-)
New commits:
commit fefbb61f7540a41141f46163734bae83c094fbb0
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Mon Sep 10 16:25:22 2012 -0400
fix eclipse setup so it uses jdk1.7
diff --git a/.classpath b/.classpath
index 1767cf3..4b106da 100644
--- a/.classpath
+++ b/.classpath
@@ -171,14 +171,7 @@
<classpathentry excluding="**" kind="src" path="modules/enterprise/comm/src/test/resources"/>
<classpathentry excluding="**" kind="src" path="modules/enterprise/agent/src/main/resources"/>
<classpathentry excluding="**" kind="src" path="modules/enterprise/agent/src/test/resources"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
- <accessrules>
- <accessrule kind="accessible" pattern="sun/misc/**"/>
- <accessrule kind="accessible" pattern="sun/security/**"/>
- <accessrule kind="accessible" pattern="com/sun/java_cup/internal/**"/>
- <accessrule kind="accessible" pattern="com/sun/org/apache/bcel/internal/generic/**"/>
- </accessrules>
- </classpathentry>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/integration/jboss-profileservice-spi/5.1.0.SP1/jboss-profileservice-spi-5.1.0.SP1.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/man/jboss-managed/2.1.1.GA/jboss-managed-2.1.1.GA.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/man/jboss-metatype/2.1.1.GA/jboss-metatype-2.1.1.GA.jar"/>
@@ -280,10 +273,10 @@
<classpathentry exported="true" kind="var" path="M2_REPO/org/mongodb/mongo-java-driver/2.6.5/mongo-java-driver-2.6.5.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/com/googlecode/java-diff-utils/diffutils/1.2.1/diffutils-1.2.1.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/com/google/code/morphia/morphia/0.99/morphia-0.99.jar"/>
- <classpathentry exported="true" kind="var" path="M2_REPO/org/hibernate/hibernate-annotations/3.5.6-Final/hibernate-annotations-3.5.6-Final.jar"/>
- <classpathentry exported="true" kind="var" path="M2_REPO/org/hibernate/hibernate-core/4.0.1.Final/hibernate-core-4.0.1.Final.jar"/>
+ <classpathentry exported="true" kind="var" path="M2_REPO/org/hibernate/hibernate-annotations/3.5.6-Final/hibernate-annotations-3.5.6-Final.jar"/>
+ <classpathentry exported="true" kind="var" path="M2_REPO/org/hibernate/hibernate-core/4.0.1.Final/hibernate-core-4.0.1.Final.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/org/hibernate/hibernate-entitymanager/4.0.1.Final/hibernate-entitymanager-4.0.1.Final.jar"/>
- <classpathentry exported="true" kind="var" path="M2_REPO/org/hibernate/hibernate-validator/4.2.0.Final/hibernate-validator-4.2.0.Final.jar"/>
+ <classpathentry exported="true" kind="var" path="M2_REPO/org/hibernate/hibernate-validator/4.2.0.Final/hibernate-validator-4.2.0.Final.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/org/hibernate/javax/persistence/hibernate-jpa-2.0-api/1.0.1.Final/hibernate-jpa-2.0-api-1.0.1.Final.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/spec/javax/servlet/jboss-servlet-api_3.0_spec/1.0.1.Final/jboss-servlet-api_3.0_spec-1.0.1.Final.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/msc/jboss-msc/1.0.2.GA/jboss-msc-1.0.2.GA.jar"/>
@@ -319,8 +312,7 @@
<classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/arquillian/testng/arquillian-testng-core/1.0.1.Final/arquillian-testng-core-1.0.1.Final.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/com/wordnik/swagger-annotations_2.9.1/1.1-SNAPSHOT/swagger-annotations_2.9.1-1.1-20120531.064118-1.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/byteman/byteman/1.2.1/byteman-1.2.1.jar"/>
- <classpathentry exported="true" kind="var" path="M2_REPO/org/infinispan/infinispan-core/5.1.2.FINAL/infinispan-core-5.1.2.FINAL.jar"/>
- <classpathentry exported="true" kind="var" path="JDK_HOME/lib/tools.jar"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry exported="true" kind="var" path="M2_REPO/org/infinispan/infinispan-core/5.1.2.FINAL/infinispan-core-5.1.2.FINAL.jar"/>
+ <classpathentry exported="true" kind="var" path="JDK_HOME/lib/tools.jar"/>
<classpathentry kind="output" path="eclipse-classes"/>
</classpath>
diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs
index af00df0..63fa05c 100644
--- a/.settings/org.eclipse.jdt.core.prefs
+++ b/.settings/org.eclipse.jdt.core.prefs
@@ -1,4 +1,4 @@
-#Mon Mar 12 11:15:00 GMT-05:00 2012
+#Mon Sep 10 16:18:44 EDT 2012
eclipse.preferences.version=1
org.eclipse.jdt.core.codeComplete.argumentPrefixes=
org.eclipse.jdt.core.codeComplete.argumentSuffixes=
@@ -10,7 +10,12 @@ org.eclipse.jdt.core.codeComplete.staticFieldPrefixes=
org.eclipse.jdt.core.codeComplete.staticFieldSuffixes=
org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes=
org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes=
-org.eclipse.jdt.core.compiler.source=1.6
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
+org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.7
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
@@ -82,10 +87,12 @@ org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
org.eclipse.jdt.core.formatter.indentation.size=8
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
11 years, 9 months
[rhq] Branch 'rhq-on-as7' - 3 commits - modules/enterprise
by mazz
modules/enterprise/gui/installer/pom.xml | 6
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/startup/ExternalizableStrategyCommandListener.java | 104 -
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/startup/StartupServlet.java | 733 ----------
modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/web.xml | 13
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/ExternalizableStrategyCommandListener.java | 104 +
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/StartupServlet.java | 722 +++++++++
6 files changed, 832 insertions(+), 850 deletions(-)
New commits:
commit 72f185200fc8aaf0a666845d72c15a68959624a7
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Mon Sep 10 15:16:46 2012 -0400
add core-util as an explicit dep to installer
diff --git a/modules/enterprise/gui/installer/pom.xml b/modules/enterprise/gui/installer/pom.xml
index a48d2b9..6291ba7 100644
--- a/modules/enterprise/gui/installer/pom.xml
+++ b/modules/enterprise/gui/installer/pom.xml
@@ -62,6 +62,12 @@
<dependencies>
<dependency>
<groupId>org.rhq</groupId>
+ <artifactId>rhq-core-util</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.rhq</groupId>
<artifactId>rhq-core-dbutils</artifactId>
<version>${project.version}</version>
</dependency>
commit 0360c1f242ee9bc820dfb99e79641c9b5b27933c
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Mon Sep 10 15:16:32 2012 -0400
get StartupServlet to at least compile - but it doesn't do anything since its not an EJB 3.1. singleton EJB yet
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/StartupServlet.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/StartupServlet.java
index f0856d1..49e92bb 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/StartupServlet.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/StartupServlet.java
@@ -19,6 +19,7 @@
package org.rhq.enterprise.server.core;
import java.io.IOException;
+import java.lang.management.ManagementFactory;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.sql.Connection;
@@ -30,10 +31,6 @@ import javax.management.Attribute;
import javax.management.MBeanServer;
import javax.management.MBeanServerInvocationHandler;
import javax.management.ObjectName;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
import javax.sql.DataSource;
import org.apache.commons.logging.Log;
@@ -47,14 +44,10 @@ import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.cloud.Server;
import org.rhq.core.domain.cloud.Server.OperationMode;
import org.rhq.core.domain.common.ProductInfo;
-import org.rhq.core.domain.configuration.PropertyDynamicType;
import org.rhq.core.domain.resource.Agent;
-import org.rhq.core.gui.configuration.helper.PropertyRenderingUtility;
import org.rhq.core.util.ObjectNameFactory;
import org.rhq.enterprise.communications.ServiceContainerConfigurationConstants;
import org.rhq.enterprise.communications.util.SecurityUtil;
-import org.rhq.enterprise.gui.configuration.DatabaseDynamicPropertyRetriever;
-import org.rhq.enterprise.gui.startup.ShutdownListener;
import org.rhq.enterprise.server.alert.engine.internal.AlertConditionCacheCoordinator;
import org.rhq.enterprise.server.auth.SessionManager;
import org.rhq.enterprise.server.auth.prefs.SubjectPreferencesCache;
@@ -88,7 +81,7 @@ import org.rhq.enterprise.server.util.concurrent.AvailabilityReportSerializer;
*
* This also accepts requests and responds with information regarding the state of the startup.
*/
-public class StartupServlet extends HttpServlet {
+public class StartupServlet {
private static final long serialVersionUID = 1L;
@@ -100,22 +93,20 @@ public class StartupServlet extends HttpServlet {
* This merely returns an HTTP status code to indicate the status of the startup.
* Under normal conditions, this will always return a 200 status code.
*/
- @Override
- protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
- resp.setHeader("Cache-Control", "no-cache, no-store");
- resp.setHeader("Expires", "-1");
- resp.setHeader("Pragma", "no-cache");
- // as opposed to SC_OK (200), return a special value due to https://issues.jboss.org/browse/JBWEB-188.
- resp.setStatus(initialized ? 288 : HttpServletResponse.SC_SERVICE_UNAVAILABLE);
+ protected void service(Object req, Object resp) throws RuntimeException, IOException {
+ // resp.setHeader("Cache-Control", "no-cache, no-store");
+ // resp.setHeader("Expires", "-1");
+ // resp.setHeader("Pragma", "no-cache");
+ // // as opposed to SC_OK (200), return a special value due to https://issues.jboss.org/browse/JBWEB-188.
+ // resp.setStatus(initialized ? 288 : HttpServletResponse.SC_SERVICE_UNAVAILABLE);
}
/**
* Performs the final RHQ Server initialization work that needs to talk place. EJBs are available in this method.
*
- * @throws ServletException
+ * @throws RuntimeException
*/
- @Override
- public void init() throws ServletException {
+ public void init() throws RuntimeException {
initialized = false;
log.info("All business tier deployments are complete - finishing the startup...");
@@ -163,10 +154,6 @@ public class StartupServlet extends HttpServlet {
startEmbeddedAgent();
registerShutdownListener();
- // Configures the configuration rendering to be able to support database backed dynamic configuration properties
- PropertyRenderingUtility.putDynamicPropertyRetriever(PropertyDynamicType.DATABASE,
- new DatabaseDynamicPropertyRetriever());
-
logServerStartedMessage();
initialized = true;
@@ -251,14 +238,14 @@ public class StartupServlet extends HttpServlet {
/**
* Starts monitoring hibernate by attaching a statistics mbean to the entity manager injected by ejb3.
*
- * @throws ServletException
+ * @throws RuntimeException
*/
- private void startHibernateStatistics() throws ServletException {
+ private void startHibernateStatistics() throws RuntimeException {
log.info("Starting hibernate statistics monitoring...");
try {
LookupUtil.getSystemManager().enableHibernateStatistics();
} catch (Exception e) {
- throw new ServletException("Cannot start hibernate statistics monitoring!", e);
+ throw new RuntimeException("Cannot start hibernate statistics monitoring!", e);
}
}
@@ -269,57 +256,57 @@ public class StartupServlet extends HttpServlet {
* Because this will scan and register the initial plugins right now, make sure this is called prior
* to starting the master plugin container; otherwise, the master PC will not have any plugins to start.
*
- * @throws ServletException
+ * @throws RuntimeException
*/
- private void startPluginDeployer() throws ServletException {
+ private void startPluginDeployer() throws RuntimeException {
log.info("Starting the agent/server plugin deployer...");
try {
PluginDeploymentScannerMBean deployer_mbean;
- MBeanServer mbs = MBeanServerLocator.locateJBoss();
+ MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
ObjectName name = PluginDeploymentScannerMBean.OBJECT_NAME;
Class<?> iface = PluginDeploymentScannerMBean.class;
deployer_mbean = (PluginDeploymentScannerMBean) MBeanServerInvocationHandler.newProxyInstance(mbs, name,
iface, false);
deployer_mbean.startDeployment();
} catch (Exception e) {
- throw new ServletException("Cannot start the agent/server plugin deployer!", e);
+ throw new RuntimeException("Cannot start the agent/server plugin deployer!", e);
}
}
/**
* Installs the JAAS login modules so our users can login.
*
- * @throws ServletException
+ * @throws RuntimeException
*/
- private void installJaasModules() throws ServletException {
+ private void installJaasModules() throws RuntimeException {
log.info("Installing JAAS login modules...");
try {
CustomJaasDeploymentServiceMBean jaas_mbean;
- MBeanServer mbs = MBeanServerLocator.locateJBoss();
+ MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
ObjectName name = CustomJaasDeploymentServiceMBean.OBJECT_NAME;
Class<?> iface = CustomJaasDeploymentServiceMBean.class;
jaas_mbean = (CustomJaasDeploymentServiceMBean) MBeanServerInvocationHandler.newProxyInstance(mbs, name,
iface, false);
jaas_mbean.installJaasModules();
} catch (Exception e) {
- throw new ServletException("Cannot install JAAS login modules!", e);
+ throw new RuntimeException("Cannot install JAAS login modules!", e);
}
}
/**
* Initializes, but doesn't start, the Quartz scheduler now.
*
- * @throws ServletException
+ * @throws RuntimeException
*/
- private void initScheduler() throws ServletException {
+ private void initScheduler() throws RuntimeException {
log.info("Initializing the scheduler....");
try {
LookupUtil.getSchedulerBean().initQuartzScheduler();
} catch (SchedulerException e) {
- throw new ServletException("Cannot initialize the scheduler!", e);
+ throw new RuntimeException("Cannot initialize the scheduler!", e);
}
}
@@ -327,24 +314,24 @@ public class StartupServlet extends HttpServlet {
* Starts the Quartz scheduler now. We are assured that all EJBs are deployed now, so any jobs that have to be
* executed now will have those EJBs available.
*
- * @throws ServletException
+ * @throws RuntimeException
*/
- private void startScheduler() throws ServletException {
+ private void startScheduler() throws RuntimeException {
log.info("Starting the scheduler...");
try {
LookupUtil.getSchedulerBean().startQuartzScheduler();
} catch (SchedulerException e) {
- throw new ServletException("Cannot start the scheduler!", e);
+ throw new RuntimeException("Cannot start the scheduler!", e);
}
}
/**
* Initializes the server-side communications services. Once complete, agents can talk to the server.
*
- * @throws ServletException
+ * @throws RuntimeException
*/
- private void startServerCommunicationServices() throws ServletException {
+ private void startServerCommunicationServices() throws RuntimeException {
// under a rare case, if the server starts up really fast as soon as it dies, any connected
// agents will not realize the server has bounced and will not know to re-connect. When this
@@ -378,16 +365,16 @@ public class StartupServlet extends HttpServlet {
new ExternalizableStrategyCommandListener(
org.rhq.core.domain.server.ExternalizableStrategy.Subsystem.AGENT));
} catch (Exception e) {
- throw new ServletException("Cannot start the server-side communications services.", e);
+ throw new RuntimeException("Cannot start the server-side communications services.", e);
}
}
/**
* This will make sure all jobs that need to periodically run are scheduled.
*
- * @throws ServletException if unable to schedule a job
+ * @throws RuntimeException if unable to schedule a job
*/
- private void scheduleJobs() throws ServletException {
+ private void scheduleJobs() throws RuntimeException {
log.info("Scheduling asynchronous jobs...");
/*
@@ -563,16 +550,16 @@ public class StartupServlet extends HttpServlet {
/**
* Starts the embedded agent, but only if the embedded agent is installed and it is enabled.
*
- * @throws ServletException if the agent is installed and enabled but failed to start
+ * @throws RuntimeException if the agent is installed and enabled but failed to start
*/
- private void startEmbeddedAgent() throws ServletException {
+ private void startEmbeddedAgent() throws RuntimeException {
// we can't use EmbeddedAgentBootstrapServiceMBean because if the embedded agent
// isn't installed, that class will not be available; we must use JMX API
final ObjectName agentBootstrapMBean = ObjectNameFactory.create("rhq:service=EmbeddedAgentBootstrap");
final String agentEnabledAttribute = "AgentEnabled";
final String startAgentMethod = "startAgent";
final String configurationOverridesAttribute = "ConfigurationOverrides";
- final MBeanServer mbs = MBeanServerLocator.locateJBoss();
+ final MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
try {
// this will fail if the embedded agent isn't installed
@@ -658,9 +645,9 @@ public class StartupServlet extends HttpServlet {
log.debug("The embedded Agent is not enabled, so it will not be started.");
}
} catch (Throwable t) {
- throw new ServletException("Failed to start the embedded Agent.", t);
+ throw new RuntimeException("Failed to start the embedded Agent.", t);
}
- } catch (ServletException se) {
+ } catch (RuntimeException se) {
throw se;
} catch (Throwable t) {
log.info("The embedded Agent is not installed, so it will not be started (" + t + ").");
@@ -672,16 +659,16 @@ public class StartupServlet extends HttpServlet {
/**
* Starts the server-side plugin container.
*
- * @throws ServletException
+ * @throws RuntimeException
*/
- private void startServerPluginContainer() throws ServletException {
+ private void startServerPluginContainer() throws RuntimeException {
log.info("Starting the master server plugin container...");
try {
ServerPluginServiceManagement mbean = LookupUtil.getServerPluginService();
mbean.startMasterPluginContainerWithoutSchedulingJobs();
} catch (Exception e) {
- throw new ServletException("Cannot start the master server plugin container!", e);
+ throw new RuntimeException("Cannot start the master server plugin container!", e);
}
}
@@ -689,24 +676,27 @@ public class StartupServlet extends HttpServlet {
* Registers a listener to the JBoss server's shutdown notification so some components can be cleaned up in an
* orderly fashion when the server is shutdown.
*
- * @throws ServletException if cannot register this service as a shutdown listener
+ * @throws RuntimeException if cannot register this service as a shutdown listener
*/
- private void registerShutdownListener() throws ServletException {
+ private void registerShutdownListener() throws RuntimeException {
// as of JBossAS 4.0.5, this is the known MBean name of the service that notifies when the server is shutting down
+ // TODO: find out how AS7 can notify us when its going down - right now, this code won't work on AS7
+ /*
try {
ObjectName jbossServerName = new ObjectName("jboss.system:type=Server");
- MBeanServer jbossServer = MBeanServerLocator.locateJBoss();
+ MBeanServer jbossServer = ManagementFactory.getPlatformMBeanServer();
jbossServer.addNotificationListener(jbossServerName, new ShutdownListener(), null, null);
} catch (Exception e) {
- throw new ServletException("Failed to register the Server Shutdown Listener", e);
+ throw new RuntimeException("Failed to register the Server Shutdown Listener", e);
}
+ */
}
/**
* Gets the number of milliseconds since the time when the server was started.
* @return elapsed time since server started, 0 if not known
*/
- private long getElapsedTimeSinceStartup() throws ServletException {
+ private long getElapsedTimeSinceStartup() throws RuntimeException {
long elapsed;
try {
ObjectName jbossServerName = new ObjectName("jboss.system:type=Server");
commit 210c403c0be5ffa995aefc52350f52663d050aa5
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Mon Sep 10 15:16:04 2012 -0400
move StartupServlet to server/jar - it will be converted to an EJB 3.1 singleton startup bean
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/startup/ExternalizableStrategyCommandListener.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/startup/ExternalizableStrategyCommandListener.java
deleted file mode 100644
index 2833c9e..0000000
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/startup/ExternalizableStrategyCommandListener.java
+++ /dev/null
@@ -1,104 +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.startup;
-
-import org.rhq.core.domain.server.ExternalizableStrategy;
-import org.rhq.enterprise.communications.command.Command;
-import org.rhq.enterprise.communications.command.CommandResponse;
-import org.rhq.enterprise.communications.command.client.CommandPreprocessor;
-import org.rhq.enterprise.communications.command.server.CommandListener;
-import org.rhq.enterprise.server.safeinvoker.HibernateDetachUtility;
-
-/**
- * This is a listener for commands coming into the {@link ServiceContainer}'s {@link CommandPreprocessor} and will
- * set the ExternalizableStratagy for the command processing thread. This ensures that the proper strategy is applied to
- * the Return value serialization.
- *
- * @author Jay Shaughnessy
- */
-public class ExternalizableStrategyCommandListener implements CommandListener {
-
- private final String CMDCONFIG_PROP_EXTERNALIZABLE_STRATEGY = "rhq.externalizable-strategy";
-
- private final ExternalizableStrategy.Subsystem defaultSubsystem;
-
- public ExternalizableStrategyCommandListener(ExternalizableStrategy.Subsystem defaultSubsystem) {
- this.defaultSubsystem = (null != defaultSubsystem) ? defaultSubsystem : ExternalizableStrategy.Subsystem.AGENT;
- }
-
- /**
- * This will be called for every command coming in. Set the correct strategy based on the command config. This will
- * be applied to the return serialization.
- *
- * @see CommandListener#receivedCommand(Command)
- */
- public void receivedCommand(Command command) {
- ExternalizableStrategy.Subsystem subsystem = null;
-
- try {
- subsystem = ExternalizableStrategy.Subsystem.valueOf(command.getConfiguration().getProperty(
- this.CMDCONFIG_PROP_EXTERNALIZABLE_STRATEGY));
- } catch (Exception e) {
- // set to the default if property is not set or invalid
- subsystem = defaultSubsystem;
- }
-
- ExternalizableStrategy.setStrategy(subsystem);
- }
-
- /**
- * This is called for every command that finished. It does nothing since the serialization is complete.
- *
- * @see CommandListener#processedCommand(Command, CommandResponse)
- */
- public void processedCommand(Command command, CommandResponse response) {
- // nothing to do
- //long start = System.currentTimeMillis();
- try {
- HibernateDetachUtility.nullOutUninitializedFields(response, HibernateDetachUtility.SerializationType.SERIALIZATION);
- //System.out.println("HDU: " + (System.currentTimeMillis() - start));
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
-
- if (!(obj instanceof ExternalizableStrategyCommandListener)) {
- return false;
- }
-
- ExternalizableStrategyCommandListener listener = (ExternalizableStrategyCommandListener) obj;
-
- return (this.defaultSubsystem == listener.defaultSubsystem);
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((this.defaultSubsystem == null) ? 0 : this.defaultSubsystem.hashCode());
- return result;
- }
-
-}
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/startup/StartupServlet.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/startup/StartupServlet.java
deleted file mode 100644
index c0bd233..0000000
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/startup/StartupServlet.java
+++ /dev/null
@@ -1,733 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2011 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.startup;
-
-import java.io.IOException;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.sql.Connection;
-import java.util.Date;
-import java.util.List;
-import java.util.Properties;
-
-import javax.management.Attribute;
-import javax.management.MBeanServer;
-import javax.management.MBeanServerInvocationHandler;
-import javax.management.ObjectName;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.sql.DataSource;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.quartz.SchedulerException;
-
-import org.jboss.mx.util.MBeanServerLocator;
-
-import org.rhq.core.db.DatabaseTypeFactory;
-import org.rhq.core.domain.auth.Subject;
-import org.rhq.core.domain.cloud.Server;
-import org.rhq.core.domain.cloud.Server.OperationMode;
-import org.rhq.core.domain.common.ProductInfo;
-import org.rhq.core.domain.configuration.PropertyDynamicType;
-import org.rhq.core.domain.resource.Agent;
-import org.rhq.core.gui.configuration.helper.PropertyRenderingUtility;
-import org.rhq.core.util.ObjectNameFactory;
-import org.rhq.enterprise.communications.ServiceContainerConfigurationConstants;
-import org.rhq.enterprise.communications.util.SecurityUtil;
-import org.rhq.enterprise.gui.configuration.DatabaseDynamicPropertyRetriever;
-import org.rhq.enterprise.server.alert.engine.internal.AlertConditionCacheCoordinator;
-import org.rhq.enterprise.server.auth.SessionManager;
-import org.rhq.enterprise.server.auth.prefs.SubjectPreferencesCache;
-import org.rhq.enterprise.server.cloud.instance.ServerManagerLocal;
-import org.rhq.enterprise.server.cloud.instance.SyncEndpointAddressException;
-import org.rhq.enterprise.server.core.AgentManagerLocal;
-import org.rhq.enterprise.server.core.CustomJaasDeploymentServiceMBean;
-import org.rhq.enterprise.server.core.comm.ServerCommunicationsServiceUtil;
-import org.rhq.enterprise.server.core.plugin.PluginDeploymentScannerMBean;
-import org.rhq.enterprise.server.plugin.pc.MasterServerPluginContainer;
-import org.rhq.enterprise.server.plugin.pc.ServerPluginServiceManagement;
-import org.rhq.enterprise.server.resource.ResourceTypeManagerLocal;
-import org.rhq.enterprise.server.scheduler.SchedulerLocal;
-import org.rhq.enterprise.server.scheduler.jobs.AlertAvailabilityDurationJob;
-import org.rhq.enterprise.server.scheduler.jobs.AsyncResourceDeleteJob;
-import org.rhq.enterprise.server.scheduler.jobs.CheckForSuspectedAgentsJob;
-import org.rhq.enterprise.server.scheduler.jobs.CheckForTimedOutConfigUpdatesJob;
-import org.rhq.enterprise.server.scheduler.jobs.CheckForTimedOutContentRequestsJob;
-import org.rhq.enterprise.server.scheduler.jobs.CheckForTimedOutOperationsJob;
-import org.rhq.enterprise.server.scheduler.jobs.CloudManagerJob;
-import org.rhq.enterprise.server.scheduler.jobs.DataPurgeJob;
-import org.rhq.enterprise.server.scheduler.jobs.DynaGroupAutoRecalculationJob;
-import org.rhq.enterprise.server.scheduler.jobs.PurgePluginsJob;
-import org.rhq.enterprise.server.scheduler.jobs.PurgeResourceTypesJob;
-import org.rhq.enterprise.server.scheduler.jobs.SavedSearchResultCountRecalculationJob;
-import org.rhq.enterprise.server.util.LookupUtil;
-import org.rhq.enterprise.server.util.concurrent.AlertSerializer;
-import org.rhq.enterprise.server.util.concurrent.AvailabilityReportSerializer;
-
-/**
- * This servlet is ensured to be initialized after the rest of the RHQ Server has been deployed and started.
- * Specifically, we know that at {@link #init()} time, all EJBs have been deployed and available.
- *
- * This also accepts requests and responds with information regarding the state of the startup.
- */
-public class StartupServlet extends HttpServlet {
-
- private static final long serialVersionUID = 1L;
-
- private Log log = LogFactory.getLog(this.getClass());
-
- private boolean initialized = false;
-
- /**
- * This merely returns an HTTP status code to indicate the status of the startup.
- * Under normal conditions, this will always return a 200 status code.
- */
- @Override
- protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
- resp.setHeader("Cache-Control", "no-cache, no-store");
- resp.setHeader("Expires", "-1");
- resp.setHeader("Pragma", "no-cache");
- // as opposed to SC_OK (200), return a special value due to https://issues.jboss.org/browse/JBWEB-188.
- resp.setStatus(initialized ? 288 : HttpServletResponse.SC_SERVICE_UNAVAILABLE);
- }
-
- /**
- * Performs the final RHQ Server initialization work that needs to talk place. EJBs are available in this method.
- *
- * @throws ServletException
- */
- @Override
- public void init() throws ServletException {
- initialized = false;
-
- log.info("All business tier deployments are complete - finishing the startup...");
-
- // As a security measure, make sure the installer has been undeployed
- LookupUtil.getSystemManager().undeployInstaller();
-
- // get singletons right now so we load the classes immediately into our classloader
- AlertConditionCacheCoordinator.getInstance();
- SessionManager.getInstance();
- SubjectPreferencesCache.getInstance();
- AlertSerializer.getSingleton();
- AvailabilityReportSerializer.getSingleton();
-
- // load resource facets cache
- try {
- ResourceTypeManagerLocal typeManager = LookupUtil.getResourceTypeManager();
- typeManager.reloadResourceFacetsCache();
- } catch (Throwable t) {
- log.error("Could not load ResourceFacets cache.", t);
- }
-
- // Before starting determine the operating mode of this server and
- // take any necessary initialization action. Must happen before comm startup since listeners
- // may be added.
- initializeServer();
-
- // The order here is important!!!
- // IF YOU WANT TO CHANGE THE ORDER YOU MUST GET THE CHANGE PEER-REVIEWED FIRST BEFORE COMMITTING IT!!!
- //
- // If we start the scheduler before the comm layer, what happens if a stored job needs to send a message?
- // But if we start the comm layer before the scheduler, what happens if a message is received that needs
- // a job scheduled for it? I think the former is more likely to happen than the latter
- // (that is, a scheduled job would more likely need to send a message; as opposed to an incoming message
- // causing a job to be scheduled), so that explains the ordering of the comm layer and the scheduler.
- startHibernateStatistics();
- initScheduler(); // make sure this is initialized before starting the plugin deployer
- startPluginDeployer(); // make sure this is initialized before starting the server plugin container
- startServerPluginContainer(); // before comm in case an agent wants to talk to it
- installJaasModules();
- startServerCommunicationServices();
- startScheduler();
- scheduleJobs();
- startAgentClients();
- startEmbeddedAgent();
- registerShutdownListener();
-
- // Configures the configuration rendering to be able to support database backed dynamic configuration properties
- PropertyRenderingUtility.putDynamicPropertyRetriever(PropertyDynamicType.DATABASE,
- new DatabaseDynamicPropertyRetriever());
-
- logServerStartedMessage();
-
- initialized = true;
- return;
- }
-
- private void initializeServer() {
- // Ensure the class is loaded and the dbType is set for our current db
- Connection conn = null;
- try {
- DataSource ds = LookupUtil.getDataSource();
- conn = ds.getConnection();
- DatabaseTypeFactory.setDefaultDatabaseType(DatabaseTypeFactory.getDatabaseType(conn));
- } catch (Exception e) {
- log.error("Could not initialize server.", e);
- } finally {
- if (conn != null) {
- try {
- conn.close();
- } catch (Exception e) {
- log.error("Failed to close temporary connection used for server initialization.", e);
- }
- }
- }
-
- // Ensure that this server is registered in the database.
- createDefaultServerIfNecessary();
-
- ServerManagerLocal serverManager = LookupUtil.getServerManager();
-
- // immediately put the server into MM if configured to do so
- if (ServerCommunicationsServiceUtil.getService().getMaintenanceModeAtStartup()) {
- log.info("Server is configured to start up in MAINTENANCE mode.");
- Server server = serverManager.getServer();
- Integer[] serverId = new Integer[] { server.getId() };
- LookupUtil.getCloudManager().updateServerMode(serverId, OperationMode.MAINTENANCE);
- }
-
- // Establish the current server mode for the server. This will move the server to NORMAL
- // mode from DOWN if necessary. This can also affect comm layer behavior.
- serverManager.establishCurrentServerMode();
- if ("true".equals(System.getProperty("rhq.sync.endpoint-address", "false"))) {
- try {
- serverManager.syncEndpointAddress();
- } catch (SyncEndpointAddressException e) {
- log.error("Failed to sync server endpoint address.", e);
- }
- }
- }
-
- /**
- * For developer builds that don't use the HA installer to write a localhost entry into the {@link Server}
- * table, we will create a default one here. Then, if the "rhq.high-availability.name" property is missing, the
- * {@link ServerManagerLocal} will return this localhost entry.
- *
- * If the installer was already run, then this method should be a no-op because a row would already exist
- * in the {@link Server} table
- */
- private void createDefaultServerIfNecessary() {
- String identity = LookupUtil.getServerManager().getIdentity();
- Server server = LookupUtil.getCloudManager().getServerByName(identity);
- if (server == null) {
- server = new Server();
- server.setName(identity);
-
- String address;
- try {
- address = InetAddress.getLocalHost().getCanonicalHostName();
- } catch (UnknownHostException e) {
- address = "localhost";
- }
- server.setAddress(address);
- server.setPort(7080);
- server.setSecurePort(7443);
- server.setComputePower(1);
- server.setOperationMode(Server.OperationMode.INSTALLED);
- LookupUtil.getServerManager().create(server);
- log.info("Default HA server created: " + server);
- }
- }
-
- /**
- * Starts monitoring hibernate by attaching a statistics mbean to the entity manager injected by ejb3.
- *
- * @throws ServletException
- */
- private void startHibernateStatistics() throws ServletException {
- log.info("Starting hibernate statistics monitoring...");
- try {
- LookupUtil.getSystemManager().enableHibernateStatistics();
- } catch (Exception e) {
- throw new ServletException("Cannot start hibernate statistics monitoring!", e);
- }
- }
-
- /**
- * Starts the plugin deployer which will effectively ask the plugin deployer to persist information about all
- * detected agent and server plugins.
- *
- * Because this will scan and register the initial plugins right now, make sure this is called prior
- * to starting the master plugin container; otherwise, the master PC will not have any plugins to start.
- *
- * @throws ServletException
- */
- private void startPluginDeployer() throws ServletException {
- log.info("Starting the agent/server plugin deployer...");
-
- try {
- PluginDeploymentScannerMBean deployer_mbean;
- MBeanServer mbs = MBeanServerLocator.locateJBoss();
- ObjectName name = PluginDeploymentScannerMBean.OBJECT_NAME;
- Class<?> iface = PluginDeploymentScannerMBean.class;
- deployer_mbean = (PluginDeploymentScannerMBean) MBeanServerInvocationHandler.newProxyInstance(mbs, name,
- iface, false);
- deployer_mbean.startDeployment();
- } catch (Exception e) {
- throw new ServletException("Cannot start the agent/server plugin deployer!", e);
- }
- }
-
- /**
- * Installs the JAAS login modules so our users can login.
- *
- * @throws ServletException
- */
- private void installJaasModules() throws ServletException {
- log.info("Installing JAAS login modules...");
-
- try {
- CustomJaasDeploymentServiceMBean jaas_mbean;
- MBeanServer mbs = MBeanServerLocator.locateJBoss();
- ObjectName name = CustomJaasDeploymentServiceMBean.OBJECT_NAME;
- Class<?> iface = CustomJaasDeploymentServiceMBean.class;
- jaas_mbean = (CustomJaasDeploymentServiceMBean) MBeanServerInvocationHandler.newProxyInstance(mbs, name,
- iface, false);
- jaas_mbean.installJaasModules();
- } catch (Exception e) {
- throw new ServletException("Cannot install JAAS login modules!", e);
- }
- }
-
- /**
- * Initializes, but doesn't start, the Quartz scheduler now.
- *
- * @throws ServletException
- */
- private void initScheduler() throws ServletException {
- log.info("Initializing the scheduler....");
-
- try {
- LookupUtil.getSchedulerBean().initQuartzScheduler();
- } catch (SchedulerException e) {
- throw new ServletException("Cannot initialize the scheduler!", e);
- }
- }
-
- /**
- * Starts the Quartz scheduler now. We are assured that all EJBs are deployed now, so any jobs that have to be
- * executed now will have those EJBs available.
- *
- * @throws ServletException
- */
- private void startScheduler() throws ServletException {
- log.info("Starting the scheduler...");
-
- try {
- LookupUtil.getSchedulerBean().startQuartzScheduler();
- } catch (SchedulerException e) {
- throw new ServletException("Cannot start the scheduler!", e);
- }
- }
-
- /**
- * Initializes the server-side communications services. Once complete, agents can talk to the server.
- *
- * @throws ServletException
- */
- private void startServerCommunicationServices() throws ServletException {
-
- // under a rare case, if the server starts up really fast as soon as it dies, any connected
- // agents will not realize the server has bounced and will not know to re-connect. When this
- // happens the server's caches will not be refreshed and bad things will happen (e.g. alerts not firing).
- // make sure we are down for a certain amount of time to ensure the agent's know the server was down.
- long ensureDownTimeSecs;
- try {
- ensureDownTimeSecs = Long.parseLong(System.getProperty("rhq.server.ensure-down-time-secs", "70"));
- } catch (Exception e) {
- ensureDownTimeSecs = 70;
- }
- long elapsed = getElapsedTimeSinceStartup();
- long sleepTime = (ensureDownTimeSecs * 1000L) - elapsed;
- if (sleepTime > 0) {
- try {
- log.info("Forcing the server to wait [" + sleepTime + "]ms to ensure agents know we went down...");
- Thread.sleep(sleepTime);
- } catch (InterruptedException ignore) {
- }
- }
-
- // now start our comm layer
- log.info("Starting the server-agent communications services...");
-
- try {
- ServerCommunicationsServiceUtil.getService().startCommunicationServices();
- ServerCommunicationsServiceUtil
- .getService()
- .getServiceContainer()
- .addCommandListener(
- new ExternalizableStrategyCommandListener(
- org.rhq.core.domain.server.ExternalizableStrategy.Subsystem.AGENT));
- } catch (Exception e) {
- throw new ServletException("Cannot start the server-side communications services.", e);
- }
- }
-
- /**
- * This will make sure all jobs that need to periodically run are scheduled.
- *
- * @throws ServletException if unable to schedule a job
- */
- private void scheduleJobs() throws ServletException {
- log.info("Scheduling asynchronous jobs...");
-
- /*
- * All jobs need to be set as non-volatile since a volatile job in a clustered environment is effectively
- * non-volatile;
- */
-
- SchedulerLocal scheduler = LookupUtil.getSchedulerBean();
-
- // TODO [mazz]: make all of the intervals here configurable via something like SystemManagerBean
-
- LookupUtil.getServerManager().scheduleServerHeartbeat();
- LookupUtil.getCacheConsistenyManager().scheduleServerCacheReloader();
- LookupUtil.getSystemManager().scheduleConfigCacheReloader();
-
- try {
- // Do not check until we are up at least 1 min, and every minute thereafter.
- final long initialDelay = 1000L * 60;
- final long interval = 1000L * 60;
- scheduler.scheduleSimpleRepeatingJob(SavedSearchResultCountRecalculationJob.class, true, false,
- initialDelay, interval);
- } catch (Exception e) {
- log.error("Cannot schedule asynchronous resource deletion job.", e);
- }
-
- try {
- // Do not check until we are up at least 1 min, and every 5 minutes thereafter.
- final long initialDelay = 1000L * 60;
- final long interval = 1000L * 60 * 5;
- scheduler.scheduleSimpleRepeatingJob(AsyncResourceDeleteJob.class, true, false, initialDelay, interval);
- } catch (Exception e) {
- log.error("Cannot schedule asynchronous resource deletion job.", e);
- }
-
- try {
- // Do not check until we are up at least 1 min, and every 5 minutes thereafter.
- final long initialDelay = 1000L * 60;
- final long interval = 1000L * 60 * 5;
- scheduler.scheduleSimpleRepeatingJob(PurgeResourceTypesJob.class, true, false, initialDelay, interval);
- } catch (Exception e) {
- log.error("Cannot schedule purge resource types job.", e);
- }
-
- try {
- // Do not check until we are up at least 1 min, and every 5 minutes thereafter.
- final long initialDelay = 1000L * 60;
- final long interval = 1000L * 60 * 5;
- scheduler.scheduleSimpleRepeatingJob(PurgePluginsJob.class, true, false, initialDelay, interval);
- } catch (Exception e) {
- log.error("Cannot schedule purge plugins job.", e);
- }
-
- // DynaGroup Auto-Recalculation Job
- try {
- // Do not check until we are up at least 1 min, and every minute thereafter.
- final long initialDelay = 1000L * 60;
- final long interval = 1000L * 60;
- scheduler.scheduleSimpleRepeatingJob(DynaGroupAutoRecalculationJob.class, true, false, initialDelay,
- interval);
- } catch (Exception e) {
- log.error("Cannot schedule DynaGroup auto-recalculation job.", e);
- }
-
- // Cluster Manager Job
- try {
- String oldJobName = "org.rhq.enterprise.server.scheduler.jobs.ClusterManagerJob";
- boolean foundAndDeleted = scheduler.deleteJob(oldJobName, oldJobName);
- if (foundAndDeleted) {
- log.info("Unscheduling deprecated job references for " + oldJobName + "...");
- } else {
- log.debug("No deprecated job references found for " + oldJobName + ".");
- }
-
- // Wait long enough to allow the Server instance jobs to start executing first.
- final long initialDelay = 1000L * 60 * 2; // 2 mins
- final long interval = 1000L * 30; // 30 secs
- scheduler.scheduleSimpleRepeatingJob(CloudManagerJob.class, true, false, initialDelay, interval);
- } catch (Exception e) {
- log.error("Cannot schedule cloud management job.", e);
- }
-
- // Suspected Agents Job
- try {
- // Do not check until we are up at least 10 mins, but check every 60 secs thereafter.
- final long initialDelay = 1000L * 60 * 10; // 10 mins
- final long interval = 1000L * 60; // 60 secs
- scheduler.scheduleSimpleRepeatingJob(CheckForSuspectedAgentsJob.class, true, false, initialDelay, interval);
- } catch (Exception e) {
- log.error("Cannot schedule suspected Agents job.", e);
- }
-
- // Timed Out Operations Job
- try {
- final long initialDelay = 1000L * 60 * 3; // 3 min
- final long interval = 1000L * 60 * 10; // 10 minutes
- scheduler.scheduleSimpleRepeatingJob(CheckForTimedOutOperationsJob.class, true, false, initialDelay,
- interval);
- } catch (Exception e) {
- log.error("Cannot schedule check-for-timed-out-operations job.", e);
- }
-
- // Timed Out Resource Configuration Update Requests Job
- // (NOTE: We don't need to check for timed out plugin Cofiguration updates, since those are executed synchronously.)
- try {
- final long initialDelay = 1000L * 60 * 4; // 4 mins
- final long interval = 1000L * 60 * 10; // 10 mins
- scheduler.scheduleSimpleRepeatingJob(CheckForTimedOutConfigUpdatesJob.class, true, false, initialDelay,
- interval);
- } catch (Exception e) {
- log.error("Cannot schedule check-for-timed-out-configuration-update-requests job.", e);
- }
-
- // Timed Out Content Requests Job
- try {
- final long initialDelay = 1000L * 60 * 5; // 5 mins
- final long interval = 1000L * 60 * 15; // 15 mins
- scheduler.scheduleSimpleRepeatingJob(CheckForTimedOutContentRequestsJob.class, true, false, initialDelay,
- interval);
- } catch (Exception e) {
- log.error("Cannot schedule check-for-timed-out-artifact-requests job.", e);
- }
-
- // Data Purge Job
- try {
- // TODO [mazz]: make the data purge job's cron string configurable via SystemManagerBean
- // For Quartz cron syntax, see: http://www.quartz-scheduler.org/documentation/quartz-2.1.x/tutorials/cron...
- String cronString = "0 0 * * * ?"; // every hour, on the hour
- scheduler.scheduleSimpleCronJob(DataPurgeJob.class, true, false, cronString);
- } catch (Exception e) {
- log.error("Cannot schedule data purge job.", e);
- }
-
- // Server Plugin Jobs
- try {
- ServerPluginServiceManagement mbean = LookupUtil.getServerPluginService();
- MasterServerPluginContainer masterPC = mbean.getMasterPluginContainer();
- masterPC.scheduleAllPluginJobs();
- } catch (Exception e) {
- log.error("Cannot schedule server plugin jobs.", e);
- }
-
- // Alerting Availability Duration Job (create only, nothing actually scheduled here)
- try {
- scheduler.scheduleTriggeredJob(AlertAvailabilityDurationJob.class, false, null);
- } catch (Exception e) {
- log.error("Cannot create alert availability duration job.", e);
- }
-
- return;
- }
-
- /**
- * This seeds the agent clients cache with clients for all known agents. These clients will be started so they can
- * immediately begin to send any persisted guaranteed messages that might already exist. This method must be called
- * at a time when the server is ready to accept messages from agents because any guaranteed messages that are
- * delivered might trigger the agents to send messages back to the server.
- */
- private void startAgentClients() {
- log.info("Starting agent clients - any persisted messages with guaranteed delivery will be sent...");
-
- AgentManagerLocal agentManager = LookupUtil.getAgentManager();
- List<Agent> agents = agentManager.getAllAgents();
-
- if (agents != null) {
- for (Agent agent : agents) {
- agentManager.getAgentClient(agent); // this caches and starts the client
- }
- }
-
- return;
- }
-
- /**
- * Starts the embedded agent, but only if the embedded agent is installed and it is enabled.
- *
- * @throws ServletException if the agent is installed and enabled but failed to start
- */
- private void startEmbeddedAgent() throws ServletException {
- // we can't use EmbeddedAgentBootstrapServiceMBean because if the embedded agent
- // isn't installed, that class will not be available; we must use JMX API
- final ObjectName agentBootstrapMBean = ObjectNameFactory.create("rhq:service=EmbeddedAgentBootstrap");
- final String agentEnabledAttribute = "AgentEnabled";
- final String startAgentMethod = "startAgent";
- final String configurationOverridesAttribute = "ConfigurationOverrides";
- final MBeanServer mbs = MBeanServerLocator.locateJBoss();
-
- try {
- // this will fail if the embedded agent isn't installed
- String enabled = (String) mbs.getAttribute(agentBootstrapMBean, agentEnabledAttribute);
-
- // if we got this far, the embedded agent is at least installed
- // now check to see if its enabled - if so start it; any startup exceptions now are thrown
- try {
- if (Boolean.valueOf(enabled)) {
- log.info("The embedded Agent is installed and enabled - it will now be started...");
-
- // NOTE: we cannot directly import AgentConfigurationConstants, so we hardcode the
- // actual constant values here - need to keep an eye on these in the unlikely event
- // the constant values change.
- String AgentConfigurationConstants_SERVER_TRANSPORT = "rhq.agent.server.transport";
- String AgentConfigurationConstants_SERVER_BIND_ADDRESS = "rhq.agent.server.bind-address";
- String AgentConfigurationConstants_SERVER_BIND_PORT = "rhq.agent.server.bind-port";
-
- // Get the configuration overrides as set in the configuration file.
- // If the agent's bind address isn't overridden with a non-empty value,
- // then we need to get the Server bind address and use it for the agent's bind address.
- // If the agent's server endpoint address/port are empty, we again use the values
- // appropriate for the Server this agent is embedded in.
- // Note that we don't look for the values in persisted preferences - we assume they
- // are always present in the configuration overrides (which they should always be);
- Properties overrides;
- String serverTransport;
- String serverAddress;
- String serverPort;
- String agentAddress;
-
- overrides = (Properties) mbs.getAttribute(agentBootstrapMBean, configurationOverridesAttribute);
-
- serverTransport = overrides.getProperty(AgentConfigurationConstants_SERVER_TRANSPORT);
- serverAddress = overrides.getProperty(AgentConfigurationConstants_SERVER_BIND_ADDRESS);
- serverPort = overrides.getProperty(AgentConfigurationConstants_SERVER_BIND_PORT);
- agentAddress = overrides.getProperty(ServiceContainerConfigurationConstants.CONNECTOR_BIND_ADDRESS);
-
- Server server = LookupUtil.getServerManager().getServer();
-
- if (agentAddress == null || agentAddress.trim().equals("")) {
- overrides.setProperty(ServiceContainerConfigurationConstants.CONNECTOR_BIND_ADDRESS,
- server.getAddress());
- }
- if (serverAddress == null || serverAddress.trim().equals("")) {
- overrides.setProperty(AgentConfigurationConstants_SERVER_BIND_ADDRESS, server.getAddress());
- }
- if (serverPort == null || serverPort.trim().equals("")) {
- if (SecurityUtil.isTransportSecure(serverTransport)) {
- overrides.setProperty(AgentConfigurationConstants_SERVER_BIND_PORT,
- Integer.toString(server.getSecurePort()));
- } else {
- overrides.setProperty(AgentConfigurationConstants_SERVER_BIND_PORT,
- Integer.toString(server.getPort()));
- }
- }
-
- mbs.setAttribute(agentBootstrapMBean, new Attribute(configurationOverridesAttribute, overrides));
-
- // We need to do the agent startup in a separate thread so we do not hang
- // this startup servlet. JBossAS 4.2 will not begin accepting HTTP requests
- // until this startup servlet has finished (this is different from JBossAS 4.0).
- // The agent needs to submit an HTTP request in order to complete its startup
- // (it needs to register with the server).
- // The side effect of this is the RHQ Server will still start even if the embedded
- // agent fails to start - this may not be a bad thing. We probably do not want
- // the entire RHQ Server to go down if its agent fails to start.
- Runnable agentStartRunnable = new Runnable() {
- public void run() {
- // this returns only when the agent has started and is registered (sends HTTP request)
- try {
- mbs.invoke(agentBootstrapMBean, startAgentMethod, new Object[0], new String[0]);
- } catch (Throwable t) {
- log.error("Failed to start the embedded Agent - it will not be available!", t);
- }
- }
- };
-
- Thread agentStartThread = new Thread(agentStartRunnable, "Embedded Agent Startup");
- agentStartThread.setDaemon(true);
- agentStartThread.start();
- } else {
- log.debug("The embedded Agent is not enabled, so it will not be started.");
- }
- } catch (Throwable t) {
- throw new ServletException("Failed to start the embedded Agent.", t);
- }
- } catch (ServletException se) {
- throw se;
- } catch (Throwable t) {
- log.info("The embedded Agent is not installed, so it will not be started (" + t + ").");
- }
-
- return;
- }
-
- /**
- * Starts the server-side plugin container.
- *
- * @throws ServletException
- */
- private void startServerPluginContainer() throws ServletException {
- log.info("Starting the master server plugin container...");
-
- try {
- ServerPluginServiceManagement mbean = LookupUtil.getServerPluginService();
- mbean.startMasterPluginContainerWithoutSchedulingJobs();
- } catch (Exception e) {
- throw new ServletException("Cannot start the master server plugin container!", e);
- }
- }
-
- /**
- * Registers a listener to the JBoss server's shutdown notification so some components can be cleaned up in an
- * orderly fashion when the server is shutdown.
- *
- * @throws ServletException if cannot register this service as a shutdown listener
- */
- private void registerShutdownListener() throws ServletException {
- // as of JBossAS 4.0.5, this is the known MBean name of the service that notifies when the server is shutting down
- try {
- ObjectName jbossServerName = new ObjectName("jboss.system:type=Server");
- MBeanServer jbossServer = MBeanServerLocator.locateJBoss();
- jbossServer.addNotificationListener(jbossServerName, new ShutdownListener(), null, null);
- } catch (Exception e) {
- throw new ServletException("Failed to register the Server Shutdown Listener", e);
- }
- }
-
- /**
- * Gets the number of milliseconds since the time when the server was started.
- * @return elapsed time since server started, 0 if not known
- */
- private long getElapsedTimeSinceStartup() throws ServletException {
- long elapsed;
- try {
- ObjectName jbossServerName = new ObjectName("jboss.system:type=Server");
- MBeanServer jbossServer = MBeanServerLocator.locateJBoss();
- Date startTime = (Date) jbossServer.getAttribute(jbossServerName, "StartDate");
- long currentTime = System.currentTimeMillis();
- elapsed = currentTime - startTime.getTime();
- } catch (Exception e) {
- elapsed = 0;
- }
- return elapsed;
- }
-
- private void logServerStartedMessage() {
- Subject overlord = LookupUtil.getSubjectManager().getOverlord();
- ProductInfo productInfo = LookupUtil.getSystemManager().getProductInfo(overlord);
- log.info("--------------------------------------------------"); // 50 dashes
- log.info(productInfo.getFullName() + " " + productInfo.getVersion() + " (build " + productInfo.getBuildNumber()
- + ") Server started.");
- log.info("--------------------------------------------------"); // 50 dashes
- }
-
-}
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/web.xml b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/web.xml
index 06220bf..a56d1bb 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/web.xml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/web.xml
@@ -287,13 +287,6 @@
<listener-class>org.rhq.enterprise.gui.startup.SessionCacheListener</listener-class>
</listener>
- <!-- This is the object that finishes the RHQ Server startup initialization. -->
- <servlet>
- <servlet-name>initializer</servlet-name>
- <servlet-class>org.rhq.enterprise.gui.startup.StartupServlet</servlet-class>
- <load-on-startup>1</load-on-startup>
- </servlet>
-
<servlet>
<servlet-name>sessionAccess</servlet-name>
<servlet-class>org.rhq.enterprise.gui.authentication.SessionAccessServlet</servlet-class>
@@ -409,12 +402,6 @@
<url-pattern>/client/download</url-pattern>
</servlet-mapping>
- <!-- provides startup progress information (mainly for the installer) -->
- <servlet-mapping>
- <servlet-name>initializer</servlet-name>
- <url-pattern>/startupstatus</url-pattern>
- </servlet-mapping>
-
<!-- TODO what is this for? -->
<servlet-mapping>
<servlet-name>sessionAccess</servlet-name>
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/ExternalizableStrategyCommandListener.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/ExternalizableStrategyCommandListener.java
new file mode 100644
index 0000000..6e0f7a1
--- /dev/null
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/ExternalizableStrategyCommandListener.java
@@ -0,0 +1,104 @@
+/*
+ * 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.server.core;
+
+import org.rhq.core.domain.server.ExternalizableStrategy;
+import org.rhq.enterprise.communications.command.Command;
+import org.rhq.enterprise.communications.command.CommandResponse;
+import org.rhq.enterprise.communications.command.client.CommandPreprocessor;
+import org.rhq.enterprise.communications.command.server.CommandListener;
+import org.rhq.enterprise.server.safeinvoker.HibernateDetachUtility;
+
+/**
+ * This is a listener for commands coming into the {@link ServiceContainer}'s {@link CommandPreprocessor} and will
+ * set the ExternalizableStratagy for the command processing thread. This ensures that the proper strategy is applied to
+ * the Return value serialization.
+ *
+ * @author Jay Shaughnessy
+ */
+public class ExternalizableStrategyCommandListener implements CommandListener {
+
+ private final String CMDCONFIG_PROP_EXTERNALIZABLE_STRATEGY = "rhq.externalizable-strategy";
+
+ private final ExternalizableStrategy.Subsystem defaultSubsystem;
+
+ public ExternalizableStrategyCommandListener(ExternalizableStrategy.Subsystem defaultSubsystem) {
+ this.defaultSubsystem = (null != defaultSubsystem) ? defaultSubsystem : ExternalizableStrategy.Subsystem.AGENT;
+ }
+
+ /**
+ * This will be called for every command coming in. Set the correct strategy based on the command config. This will
+ * be applied to the return serialization.
+ *
+ * @see CommandListener#receivedCommand(Command)
+ */
+ public void receivedCommand(Command command) {
+ ExternalizableStrategy.Subsystem subsystem = null;
+
+ try {
+ subsystem = ExternalizableStrategy.Subsystem.valueOf(command.getConfiguration().getProperty(
+ this.CMDCONFIG_PROP_EXTERNALIZABLE_STRATEGY));
+ } catch (Exception e) {
+ // set to the default if property is not set or invalid
+ subsystem = defaultSubsystem;
+ }
+
+ ExternalizableStrategy.setStrategy(subsystem);
+ }
+
+ /**
+ * This is called for every command that finished. It does nothing since the serialization is complete.
+ *
+ * @see CommandListener#processedCommand(Command, CommandResponse)
+ */
+ public void processedCommand(Command command, CommandResponse response) {
+ // nothing to do
+ //long start = System.currentTimeMillis();
+ try {
+ HibernateDetachUtility.nullOutUninitializedFields(response, HibernateDetachUtility.SerializationType.SERIALIZATION);
+ //System.out.println("HDU: " + (System.currentTimeMillis() - start));
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+
+ if (!(obj instanceof ExternalizableStrategyCommandListener)) {
+ return false;
+ }
+
+ ExternalizableStrategyCommandListener listener = (ExternalizableStrategyCommandListener) obj;
+
+ return (this.defaultSubsystem == listener.defaultSubsystem);
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((this.defaultSubsystem == null) ? 0 : this.defaultSubsystem.hashCode());
+ return result;
+ }
+
+}
\ No newline at end of file
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/StartupServlet.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/StartupServlet.java
new file mode 100644
index 0000000..f0856d1
--- /dev/null
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/StartupServlet.java
@@ -0,0 +1,732 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2011 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.server.core;
+
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.sql.Connection;
+import java.util.Date;
+import java.util.List;
+import java.util.Properties;
+
+import javax.management.Attribute;
+import javax.management.MBeanServer;
+import javax.management.MBeanServerInvocationHandler;
+import javax.management.ObjectName;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.sql.DataSource;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.quartz.SchedulerException;
+
+import org.jboss.mx.util.MBeanServerLocator;
+
+import org.rhq.core.db.DatabaseTypeFactory;
+import org.rhq.core.domain.auth.Subject;
+import org.rhq.core.domain.cloud.Server;
+import org.rhq.core.domain.cloud.Server.OperationMode;
+import org.rhq.core.domain.common.ProductInfo;
+import org.rhq.core.domain.configuration.PropertyDynamicType;
+import org.rhq.core.domain.resource.Agent;
+import org.rhq.core.gui.configuration.helper.PropertyRenderingUtility;
+import org.rhq.core.util.ObjectNameFactory;
+import org.rhq.enterprise.communications.ServiceContainerConfigurationConstants;
+import org.rhq.enterprise.communications.util.SecurityUtil;
+import org.rhq.enterprise.gui.configuration.DatabaseDynamicPropertyRetriever;
+import org.rhq.enterprise.gui.startup.ShutdownListener;
+import org.rhq.enterprise.server.alert.engine.internal.AlertConditionCacheCoordinator;
+import org.rhq.enterprise.server.auth.SessionManager;
+import org.rhq.enterprise.server.auth.prefs.SubjectPreferencesCache;
+import org.rhq.enterprise.server.cloud.instance.ServerManagerLocal;
+import org.rhq.enterprise.server.cloud.instance.SyncEndpointAddressException;
+import org.rhq.enterprise.server.core.comm.ServerCommunicationsServiceUtil;
+import org.rhq.enterprise.server.core.plugin.PluginDeploymentScannerMBean;
+import org.rhq.enterprise.server.plugin.pc.MasterServerPluginContainer;
+import org.rhq.enterprise.server.plugin.pc.ServerPluginServiceManagement;
+import org.rhq.enterprise.server.resource.ResourceTypeManagerLocal;
+import org.rhq.enterprise.server.scheduler.SchedulerLocal;
+import org.rhq.enterprise.server.scheduler.jobs.AlertAvailabilityDurationJob;
+import org.rhq.enterprise.server.scheduler.jobs.AsyncResourceDeleteJob;
+import org.rhq.enterprise.server.scheduler.jobs.CheckForSuspectedAgentsJob;
+import org.rhq.enterprise.server.scheduler.jobs.CheckForTimedOutConfigUpdatesJob;
+import org.rhq.enterprise.server.scheduler.jobs.CheckForTimedOutContentRequestsJob;
+import org.rhq.enterprise.server.scheduler.jobs.CheckForTimedOutOperationsJob;
+import org.rhq.enterprise.server.scheduler.jobs.CloudManagerJob;
+import org.rhq.enterprise.server.scheduler.jobs.DataPurgeJob;
+import org.rhq.enterprise.server.scheduler.jobs.DynaGroupAutoRecalculationJob;
+import org.rhq.enterprise.server.scheduler.jobs.PurgePluginsJob;
+import org.rhq.enterprise.server.scheduler.jobs.PurgeResourceTypesJob;
+import org.rhq.enterprise.server.scheduler.jobs.SavedSearchResultCountRecalculationJob;
+import org.rhq.enterprise.server.util.LookupUtil;
+import org.rhq.enterprise.server.util.concurrent.AlertSerializer;
+import org.rhq.enterprise.server.util.concurrent.AvailabilityReportSerializer;
+
+/**
+ * This servlet is ensured to be initialized after the rest of the RHQ Server has been deployed and started.
+ * Specifically, we know that at {@link #init()} time, all EJBs have been deployed and available.
+ *
+ * This also accepts requests and responds with information regarding the state of the startup.
+ */
+public class StartupServlet extends HttpServlet {
+
+ private static final long serialVersionUID = 1L;
+
+ private Log log = LogFactory.getLog(this.getClass());
+
+ private boolean initialized = false;
+
+ /**
+ * This merely returns an HTTP status code to indicate the status of the startup.
+ * Under normal conditions, this will always return a 200 status code.
+ */
+ @Override
+ protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
+ resp.setHeader("Cache-Control", "no-cache, no-store");
+ resp.setHeader("Expires", "-1");
+ resp.setHeader("Pragma", "no-cache");
+ // as opposed to SC_OK (200), return a special value due to https://issues.jboss.org/browse/JBWEB-188.
+ resp.setStatus(initialized ? 288 : HttpServletResponse.SC_SERVICE_UNAVAILABLE);
+ }
+
+ /**
+ * Performs the final RHQ Server initialization work that needs to talk place. EJBs are available in this method.
+ *
+ * @throws ServletException
+ */
+ @Override
+ public void init() throws ServletException {
+ initialized = false;
+
+ log.info("All business tier deployments are complete - finishing the startup...");
+
+ // As a security measure, make sure the installer has been undeployed
+ LookupUtil.getSystemManager().undeployInstaller();
+
+ // get singletons right now so we load the classes immediately into our classloader
+ AlertConditionCacheCoordinator.getInstance();
+ SessionManager.getInstance();
+ SubjectPreferencesCache.getInstance();
+ AlertSerializer.getSingleton();
+ AvailabilityReportSerializer.getSingleton();
+
+ // load resource facets cache
+ try {
+ ResourceTypeManagerLocal typeManager = LookupUtil.getResourceTypeManager();
+ typeManager.reloadResourceFacetsCache();
+ } catch (Throwable t) {
+ log.error("Could not load ResourceFacets cache.", t);
+ }
+
+ // Before starting determine the operating mode of this server and
+ // take any necessary initialization action. Must happen before comm startup since listeners
+ // may be added.
+ initializeServer();
+
+ // The order here is important!!!
+ // IF YOU WANT TO CHANGE THE ORDER YOU MUST GET THE CHANGE PEER-REVIEWED FIRST BEFORE COMMITTING IT!!!
+ //
+ // If we start the scheduler before the comm layer, what happens if a stored job needs to send a message?
+ // But if we start the comm layer before the scheduler, what happens if a message is received that needs
+ // a job scheduled for it? I think the former is more likely to happen than the latter
+ // (that is, a scheduled job would more likely need to send a message; as opposed to an incoming message
+ // causing a job to be scheduled), so that explains the ordering of the comm layer and the scheduler.
+ startHibernateStatistics();
+ initScheduler(); // make sure this is initialized before starting the plugin deployer
+ startPluginDeployer(); // make sure this is initialized before starting the server plugin container
+ startServerPluginContainer(); // before comm in case an agent wants to talk to it
+ installJaasModules();
+ startServerCommunicationServices();
+ startScheduler();
+ scheduleJobs();
+ startAgentClients();
+ startEmbeddedAgent();
+ registerShutdownListener();
+
+ // Configures the configuration rendering to be able to support database backed dynamic configuration properties
+ PropertyRenderingUtility.putDynamicPropertyRetriever(PropertyDynamicType.DATABASE,
+ new DatabaseDynamicPropertyRetriever());
+
+ logServerStartedMessage();
+
+ initialized = true;
+ return;
+ }
+
+ private void initializeServer() {
+ // Ensure the class is loaded and the dbType is set for our current db
+ Connection conn = null;
+ try {
+ DataSource ds = LookupUtil.getDataSource();
+ conn = ds.getConnection();
+ DatabaseTypeFactory.setDefaultDatabaseType(DatabaseTypeFactory.getDatabaseType(conn));
+ } catch (Exception e) {
+ log.error("Could not initialize server.", e);
+ } finally {
+ if (conn != null) {
+ try {
+ conn.close();
+ } catch (Exception e) {
+ log.error("Failed to close temporary connection used for server initialization.", e);
+ }
+ }
+ }
+
+ // Ensure that this server is registered in the database.
+ createDefaultServerIfNecessary();
+
+ ServerManagerLocal serverManager = LookupUtil.getServerManager();
+
+ // immediately put the server into MM if configured to do so
+ if (ServerCommunicationsServiceUtil.getService().getMaintenanceModeAtStartup()) {
+ log.info("Server is configured to start up in MAINTENANCE mode.");
+ Server server = serverManager.getServer();
+ Integer[] serverId = new Integer[] { server.getId() };
+ LookupUtil.getCloudManager().updateServerMode(serverId, OperationMode.MAINTENANCE);
+ }
+
+ // Establish the current server mode for the server. This will move the server to NORMAL
+ // mode from DOWN if necessary. This can also affect comm layer behavior.
+ serverManager.establishCurrentServerMode();
+ if ("true".equals(System.getProperty("rhq.sync.endpoint-address", "false"))) {
+ try {
+ serverManager.syncEndpointAddress();
+ } catch (SyncEndpointAddressException e) {
+ log.error("Failed to sync server endpoint address.", e);
+ }
+ }
+ }
+
+ /**
+ * For developer builds that don't use the HA installer to write a localhost entry into the {@link Server}
+ * table, we will create a default one here. Then, if the "rhq.high-availability.name" property is missing, the
+ * {@link ServerManagerLocal} will return this localhost entry.
+ *
+ * If the installer was already run, then this method should be a no-op because a row would already exist
+ * in the {@link Server} table
+ */
+ private void createDefaultServerIfNecessary() {
+ String identity = LookupUtil.getServerManager().getIdentity();
+ Server server = LookupUtil.getCloudManager().getServerByName(identity);
+ if (server == null) {
+ server = new Server();
+ server.setName(identity);
+
+ String address;
+ try {
+ address = InetAddress.getLocalHost().getCanonicalHostName();
+ } catch (UnknownHostException e) {
+ address = "localhost";
+ }
+ server.setAddress(address);
+ server.setPort(7080);
+ server.setSecurePort(7443);
+ server.setComputePower(1);
+ server.setOperationMode(Server.OperationMode.INSTALLED);
+ LookupUtil.getServerManager().create(server);
+ log.info("Default HA server created: " + server);
+ }
+ }
+
+ /**
+ * Starts monitoring hibernate by attaching a statistics mbean to the entity manager injected by ejb3.
+ *
+ * @throws ServletException
+ */
+ private void startHibernateStatistics() throws ServletException {
+ log.info("Starting hibernate statistics monitoring...");
+ try {
+ LookupUtil.getSystemManager().enableHibernateStatistics();
+ } catch (Exception e) {
+ throw new ServletException("Cannot start hibernate statistics monitoring!", e);
+ }
+ }
+
+ /**
+ * Starts the plugin deployer which will effectively ask the plugin deployer to persist information about all
+ * detected agent and server plugins.
+ *
+ * Because this will scan and register the initial plugins right now, make sure this is called prior
+ * to starting the master plugin container; otherwise, the master PC will not have any plugins to start.
+ *
+ * @throws ServletException
+ */
+ private void startPluginDeployer() throws ServletException {
+ log.info("Starting the agent/server plugin deployer...");
+
+ try {
+ PluginDeploymentScannerMBean deployer_mbean;
+ MBeanServer mbs = MBeanServerLocator.locateJBoss();
+ ObjectName name = PluginDeploymentScannerMBean.OBJECT_NAME;
+ Class<?> iface = PluginDeploymentScannerMBean.class;
+ deployer_mbean = (PluginDeploymentScannerMBean) MBeanServerInvocationHandler.newProxyInstance(mbs, name,
+ iface, false);
+ deployer_mbean.startDeployment();
+ } catch (Exception e) {
+ throw new ServletException("Cannot start the agent/server plugin deployer!", e);
+ }
+ }
+
+ /**
+ * Installs the JAAS login modules so our users can login.
+ *
+ * @throws ServletException
+ */
+ private void installJaasModules() throws ServletException {
+ log.info("Installing JAAS login modules...");
+
+ try {
+ CustomJaasDeploymentServiceMBean jaas_mbean;
+ MBeanServer mbs = MBeanServerLocator.locateJBoss();
+ ObjectName name = CustomJaasDeploymentServiceMBean.OBJECT_NAME;
+ Class<?> iface = CustomJaasDeploymentServiceMBean.class;
+ jaas_mbean = (CustomJaasDeploymentServiceMBean) MBeanServerInvocationHandler.newProxyInstance(mbs, name,
+ iface, false);
+ jaas_mbean.installJaasModules();
+ } catch (Exception e) {
+ throw new ServletException("Cannot install JAAS login modules!", e);
+ }
+ }
+
+ /**
+ * Initializes, but doesn't start, the Quartz scheduler now.
+ *
+ * @throws ServletException
+ */
+ private void initScheduler() throws ServletException {
+ log.info("Initializing the scheduler....");
+
+ try {
+ LookupUtil.getSchedulerBean().initQuartzScheduler();
+ } catch (SchedulerException e) {
+ throw new ServletException("Cannot initialize the scheduler!", e);
+ }
+ }
+
+ /**
+ * Starts the Quartz scheduler now. We are assured that all EJBs are deployed now, so any jobs that have to be
+ * executed now will have those EJBs available.
+ *
+ * @throws ServletException
+ */
+ private void startScheduler() throws ServletException {
+ log.info("Starting the scheduler...");
+
+ try {
+ LookupUtil.getSchedulerBean().startQuartzScheduler();
+ } catch (SchedulerException e) {
+ throw new ServletException("Cannot start the scheduler!", e);
+ }
+ }
+
+ /**
+ * Initializes the server-side communications services. Once complete, agents can talk to the server.
+ *
+ * @throws ServletException
+ */
+ private void startServerCommunicationServices() throws ServletException {
+
+ // under a rare case, if the server starts up really fast as soon as it dies, any connected
+ // agents will not realize the server has bounced and will not know to re-connect. When this
+ // happens the server's caches will not be refreshed and bad things will happen (e.g. alerts not firing).
+ // make sure we are down for a certain amount of time to ensure the agent's know the server was down.
+ long ensureDownTimeSecs;
+ try {
+ ensureDownTimeSecs = Long.parseLong(System.getProperty("rhq.server.ensure-down-time-secs", "70"));
+ } catch (Exception e) {
+ ensureDownTimeSecs = 70;
+ }
+ long elapsed = getElapsedTimeSinceStartup();
+ long sleepTime = (ensureDownTimeSecs * 1000L) - elapsed;
+ if (sleepTime > 0) {
+ try {
+ log.info("Forcing the server to wait [" + sleepTime + "]ms to ensure agents know we went down...");
+ Thread.sleep(sleepTime);
+ } catch (InterruptedException ignore) {
+ }
+ }
+
+ // now start our comm layer
+ log.info("Starting the server-agent communications services...");
+
+ try {
+ ServerCommunicationsServiceUtil.getService().startCommunicationServices();
+ ServerCommunicationsServiceUtil
+ .getService()
+ .getServiceContainer()
+ .addCommandListener(
+ new ExternalizableStrategyCommandListener(
+ org.rhq.core.domain.server.ExternalizableStrategy.Subsystem.AGENT));
+ } catch (Exception e) {
+ throw new ServletException("Cannot start the server-side communications services.", e);
+ }
+ }
+
+ /**
+ * This will make sure all jobs that need to periodically run are scheduled.
+ *
+ * @throws ServletException if unable to schedule a job
+ */
+ private void scheduleJobs() throws ServletException {
+ log.info("Scheduling asynchronous jobs...");
+
+ /*
+ * All jobs need to be set as non-volatile since a volatile job in a clustered environment is effectively
+ * non-volatile;
+ */
+
+ SchedulerLocal scheduler = LookupUtil.getSchedulerBean();
+
+ // TODO [mazz]: make all of the intervals here configurable via something like SystemManagerBean
+
+ LookupUtil.getServerManager().scheduleServerHeartbeat();
+ LookupUtil.getCacheConsistenyManager().scheduleServerCacheReloader();
+ LookupUtil.getSystemManager().scheduleConfigCacheReloader();
+
+ try {
+ // Do not check until we are up at least 1 min, and every minute thereafter.
+ final long initialDelay = 1000L * 60;
+ final long interval = 1000L * 60;
+ scheduler.scheduleSimpleRepeatingJob(SavedSearchResultCountRecalculationJob.class, true, false,
+ initialDelay, interval);
+ } catch (Exception e) {
+ log.error("Cannot schedule asynchronous resource deletion job.", e);
+ }
+
+ try {
+ // Do not check until we are up at least 1 min, and every 5 minutes thereafter.
+ final long initialDelay = 1000L * 60;
+ final long interval = 1000L * 60 * 5;
+ scheduler.scheduleSimpleRepeatingJob(AsyncResourceDeleteJob.class, true, false, initialDelay, interval);
+ } catch (Exception e) {
+ log.error("Cannot schedule asynchronous resource deletion job.", e);
+ }
+
+ try {
+ // Do not check until we are up at least 1 min, and every 5 minutes thereafter.
+ final long initialDelay = 1000L * 60;
+ final long interval = 1000L * 60 * 5;
+ scheduler.scheduleSimpleRepeatingJob(PurgeResourceTypesJob.class, true, false, initialDelay, interval);
+ } catch (Exception e) {
+ log.error("Cannot schedule purge resource types job.", e);
+ }
+
+ try {
+ // Do not check until we are up at least 1 min, and every 5 minutes thereafter.
+ final long initialDelay = 1000L * 60;
+ final long interval = 1000L * 60 * 5;
+ scheduler.scheduleSimpleRepeatingJob(PurgePluginsJob.class, true, false, initialDelay, interval);
+ } catch (Exception e) {
+ log.error("Cannot schedule purge plugins job.", e);
+ }
+
+ // DynaGroup Auto-Recalculation Job
+ try {
+ // Do not check until we are up at least 1 min, and every minute thereafter.
+ final long initialDelay = 1000L * 60;
+ final long interval = 1000L * 60;
+ scheduler.scheduleSimpleRepeatingJob(DynaGroupAutoRecalculationJob.class, true, false, initialDelay,
+ interval);
+ } catch (Exception e) {
+ log.error("Cannot schedule DynaGroup auto-recalculation job.", e);
+ }
+
+ // Cluster Manager Job
+ try {
+ String oldJobName = "org.rhq.enterprise.server.scheduler.jobs.ClusterManagerJob";
+ boolean foundAndDeleted = scheduler.deleteJob(oldJobName, oldJobName);
+ if (foundAndDeleted) {
+ log.info("Unscheduling deprecated job references for " + oldJobName + "...");
+ } else {
+ log.debug("No deprecated job references found for " + oldJobName + ".");
+ }
+
+ // Wait long enough to allow the Server instance jobs to start executing first.
+ final long initialDelay = 1000L * 60 * 2; // 2 mins
+ final long interval = 1000L * 30; // 30 secs
+ scheduler.scheduleSimpleRepeatingJob(CloudManagerJob.class, true, false, initialDelay, interval);
+ } catch (Exception e) {
+ log.error("Cannot schedule cloud management job.", e);
+ }
+
+ // Suspected Agents Job
+ try {
+ // Do not check until we are up at least 10 mins, but check every 60 secs thereafter.
+ final long initialDelay = 1000L * 60 * 10; // 10 mins
+ final long interval = 1000L * 60; // 60 secs
+ scheduler.scheduleSimpleRepeatingJob(CheckForSuspectedAgentsJob.class, true, false, initialDelay, interval);
+ } catch (Exception e) {
+ log.error("Cannot schedule suspected Agents job.", e);
+ }
+
+ // Timed Out Operations Job
+ try {
+ final long initialDelay = 1000L * 60 * 3; // 3 min
+ final long interval = 1000L * 60 * 10; // 10 minutes
+ scheduler.scheduleSimpleRepeatingJob(CheckForTimedOutOperationsJob.class, true, false, initialDelay,
+ interval);
+ } catch (Exception e) {
+ log.error("Cannot schedule check-for-timed-out-operations job.", e);
+ }
+
+ // Timed Out Resource Configuration Update Requests Job
+ // (NOTE: We don't need to check for timed out plugin Cofiguration updates, since those are executed synchronously.)
+ try {
+ final long initialDelay = 1000L * 60 * 4; // 4 mins
+ final long interval = 1000L * 60 * 10; // 10 mins
+ scheduler.scheduleSimpleRepeatingJob(CheckForTimedOutConfigUpdatesJob.class, true, false, initialDelay,
+ interval);
+ } catch (Exception e) {
+ log.error("Cannot schedule check-for-timed-out-configuration-update-requests job.", e);
+ }
+
+ // Timed Out Content Requests Job
+ try {
+ final long initialDelay = 1000L * 60 * 5; // 5 mins
+ final long interval = 1000L * 60 * 15; // 15 mins
+ scheduler.scheduleSimpleRepeatingJob(CheckForTimedOutContentRequestsJob.class, true, false, initialDelay,
+ interval);
+ } catch (Exception e) {
+ log.error("Cannot schedule check-for-timed-out-artifact-requests job.", e);
+ }
+
+ // Data Purge Job
+ try {
+ // TODO [mazz]: make the data purge job's cron string configurable via SystemManagerBean
+ // For Quartz cron syntax, see: http://www.quartz-scheduler.org/documentation/quartz-2.1.x/tutorials/cron...
+ String cronString = "0 0 * * * ?"; // every hour, on the hour
+ scheduler.scheduleSimpleCronJob(DataPurgeJob.class, true, false, cronString);
+ } catch (Exception e) {
+ log.error("Cannot schedule data purge job.", e);
+ }
+
+ // Server Plugin Jobs
+ try {
+ ServerPluginServiceManagement mbean = LookupUtil.getServerPluginService();
+ MasterServerPluginContainer masterPC = mbean.getMasterPluginContainer();
+ masterPC.scheduleAllPluginJobs();
+ } catch (Exception e) {
+ log.error("Cannot schedule server plugin jobs.", e);
+ }
+
+ // Alerting Availability Duration Job (create only, nothing actually scheduled here)
+ try {
+ scheduler.scheduleTriggeredJob(AlertAvailabilityDurationJob.class, false, null);
+ } catch (Exception e) {
+ log.error("Cannot create alert availability duration job.", e);
+ }
+
+ return;
+ }
+
+ /**
+ * This seeds the agent clients cache with clients for all known agents. These clients will be started so they can
+ * immediately begin to send any persisted guaranteed messages that might already exist. This method must be called
+ * at a time when the server is ready to accept messages from agents because any guaranteed messages that are
+ * delivered might trigger the agents to send messages back to the server.
+ */
+ private void startAgentClients() {
+ log.info("Starting agent clients - any persisted messages with guaranteed delivery will be sent...");
+
+ AgentManagerLocal agentManager = LookupUtil.getAgentManager();
+ List<Agent> agents = agentManager.getAllAgents();
+
+ if (agents != null) {
+ for (Agent agent : agents) {
+ agentManager.getAgentClient(agent); // this caches and starts the client
+ }
+ }
+
+ return;
+ }
+
+ /**
+ * Starts the embedded agent, but only if the embedded agent is installed and it is enabled.
+ *
+ * @throws ServletException if the agent is installed and enabled but failed to start
+ */
+ private void startEmbeddedAgent() throws ServletException {
+ // we can't use EmbeddedAgentBootstrapServiceMBean because if the embedded agent
+ // isn't installed, that class will not be available; we must use JMX API
+ final ObjectName agentBootstrapMBean = ObjectNameFactory.create("rhq:service=EmbeddedAgentBootstrap");
+ final String agentEnabledAttribute = "AgentEnabled";
+ final String startAgentMethod = "startAgent";
+ final String configurationOverridesAttribute = "ConfigurationOverrides";
+ final MBeanServer mbs = MBeanServerLocator.locateJBoss();
+
+ try {
+ // this will fail if the embedded agent isn't installed
+ String enabled = (String) mbs.getAttribute(agentBootstrapMBean, agentEnabledAttribute);
+
+ // if we got this far, the embedded agent is at least installed
+ // now check to see if its enabled - if so start it; any startup exceptions now are thrown
+ try {
+ if (Boolean.valueOf(enabled)) {
+ log.info("The embedded Agent is installed and enabled - it will now be started...");
+
+ // NOTE: we cannot directly import AgentConfigurationConstants, so we hardcode the
+ // actual constant values here - need to keep an eye on these in the unlikely event
+ // the constant values change.
+ String AgentConfigurationConstants_SERVER_TRANSPORT = "rhq.agent.server.transport";
+ String AgentConfigurationConstants_SERVER_BIND_ADDRESS = "rhq.agent.server.bind-address";
+ String AgentConfigurationConstants_SERVER_BIND_PORT = "rhq.agent.server.bind-port";
+
+ // Get the configuration overrides as set in the configuration file.
+ // If the agent's bind address isn't overridden with a non-empty value,
+ // then we need to get the Server bind address and use it for the agent's bind address.
+ // If the agent's server endpoint address/port are empty, we again use the values
+ // appropriate for the Server this agent is embedded in.
+ // Note that we don't look for the values in persisted preferences - we assume they
+ // are always present in the configuration overrides (which they should always be);
+ Properties overrides;
+ String serverTransport;
+ String serverAddress;
+ String serverPort;
+ String agentAddress;
+
+ overrides = (Properties) mbs.getAttribute(agentBootstrapMBean, configurationOverridesAttribute);
+
+ serverTransport = overrides.getProperty(AgentConfigurationConstants_SERVER_TRANSPORT);
+ serverAddress = overrides.getProperty(AgentConfigurationConstants_SERVER_BIND_ADDRESS);
+ serverPort = overrides.getProperty(AgentConfigurationConstants_SERVER_BIND_PORT);
+ agentAddress = overrides.getProperty(ServiceContainerConfigurationConstants.CONNECTOR_BIND_ADDRESS);
+
+ Server server = LookupUtil.getServerManager().getServer();
+
+ if (agentAddress == null || agentAddress.trim().equals("")) {
+ overrides.setProperty(ServiceContainerConfigurationConstants.CONNECTOR_BIND_ADDRESS,
+ server.getAddress());
+ }
+ if (serverAddress == null || serverAddress.trim().equals("")) {
+ overrides.setProperty(AgentConfigurationConstants_SERVER_BIND_ADDRESS, server.getAddress());
+ }
+ if (serverPort == null || serverPort.trim().equals("")) {
+ if (SecurityUtil.isTransportSecure(serverTransport)) {
+ overrides.setProperty(AgentConfigurationConstants_SERVER_BIND_PORT,
+ Integer.toString(server.getSecurePort()));
+ } else {
+ overrides.setProperty(AgentConfigurationConstants_SERVER_BIND_PORT,
+ Integer.toString(server.getPort()));
+ }
+ }
+
+ mbs.setAttribute(agentBootstrapMBean, new Attribute(configurationOverridesAttribute, overrides));
+
+ // We need to do the agent startup in a separate thread so we do not hang
+ // this startup servlet. JBossAS 4.2 will not begin accepting HTTP requests
+ // until this startup servlet has finished (this is different from JBossAS 4.0).
+ // The agent needs to submit an HTTP request in order to complete its startup
+ // (it needs to register with the server).
+ // The side effect of this is the RHQ Server will still start even if the embedded
+ // agent fails to start - this may not be a bad thing. We probably do not want
+ // the entire RHQ Server to go down if its agent fails to start.
+ Runnable agentStartRunnable = new Runnable() {
+ public void run() {
+ // this returns only when the agent has started and is registered (sends HTTP request)
+ try {
+ mbs.invoke(agentBootstrapMBean, startAgentMethod, new Object[0], new String[0]);
+ } catch (Throwable t) {
+ log.error("Failed to start the embedded Agent - it will not be available!", t);
+ }
+ }
+ };
+
+ Thread agentStartThread = new Thread(agentStartRunnable, "Embedded Agent Startup");
+ agentStartThread.setDaemon(true);
+ agentStartThread.start();
+ } else {
+ log.debug("The embedded Agent is not enabled, so it will not be started.");
+ }
+ } catch (Throwable t) {
+ throw new ServletException("Failed to start the embedded Agent.", t);
+ }
+ } catch (ServletException se) {
+ throw se;
+ } catch (Throwable t) {
+ log.info("The embedded Agent is not installed, so it will not be started (" + t + ").");
+ }
+
+ return;
+ }
+
+ /**
+ * Starts the server-side plugin container.
+ *
+ * @throws ServletException
+ */
+ private void startServerPluginContainer() throws ServletException {
+ log.info("Starting the master server plugin container...");
+
+ try {
+ ServerPluginServiceManagement mbean = LookupUtil.getServerPluginService();
+ mbean.startMasterPluginContainerWithoutSchedulingJobs();
+ } catch (Exception e) {
+ throw new ServletException("Cannot start the master server plugin container!", e);
+ }
+ }
+
+ /**
+ * Registers a listener to the JBoss server's shutdown notification so some components can be cleaned up in an
+ * orderly fashion when the server is shutdown.
+ *
+ * @throws ServletException if cannot register this service as a shutdown listener
+ */
+ private void registerShutdownListener() throws ServletException {
+ // as of JBossAS 4.0.5, this is the known MBean name of the service that notifies when the server is shutting down
+ try {
+ ObjectName jbossServerName = new ObjectName("jboss.system:type=Server");
+ MBeanServer jbossServer = MBeanServerLocator.locateJBoss();
+ jbossServer.addNotificationListener(jbossServerName, new ShutdownListener(), null, null);
+ } catch (Exception e) {
+ throw new ServletException("Failed to register the Server Shutdown Listener", e);
+ }
+ }
+
+ /**
+ * Gets the number of milliseconds since the time when the server was started.
+ * @return elapsed time since server started, 0 if not known
+ */
+ private long getElapsedTimeSinceStartup() throws ServletException {
+ long elapsed;
+ try {
+ ObjectName jbossServerName = new ObjectName("jboss.system:type=Server");
+ MBeanServer jbossServer = MBeanServerLocator.locateJBoss();
+ Date startTime = (Date) jbossServer.getAttribute(jbossServerName, "StartDate");
+ long currentTime = System.currentTimeMillis();
+ elapsed = currentTime - startTime.getTime();
+ } catch (Exception e) {
+ elapsed = 0;
+ }
+ return elapsed;
+ }
+
+ private void logServerStartedMessage() {
+ Subject overlord = LookupUtil.getSubjectManager().getOverlord();
+ ProductInfo productInfo = LookupUtil.getSystemManager().getProductInfo(overlord);
+ log.info("--------------------------------------------------"); // 50 dashes
+ log.info(productInfo.getFullName() + " " + productInfo.getVersion() + " (build " + productInfo.getBuildNumber()
+ + ") Server started.");
+ log.info("--------------------------------------------------"); // 50 dashes
+ }
+
+}
11 years, 9 months
[rhq] Branch 'rhq-on-as7' - modules/enterprise
by Jay Shaughnessy
modules/enterprise/gui/rest-war/src/main/webapp/WEB-INF/jboss-web.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit 0455fb77f1a459bb24814a9b670a84650e736ad7
Author: Jay Shaughnessy <jshaughn(a)jshaughn.csb>
Date: Mon Sep 10 14:44:03 2012 -0400
Update reference for security domain. (the domain itself will move
to standalone-full.xml)
diff --git a/modules/enterprise/gui/rest-war/src/main/webapp/WEB-INF/jboss-web.xml b/modules/enterprise/gui/rest-war/src/main/webapp/WEB-INF/jboss-web.xml
index 38771c3..45759fd 100644
--- a/modules/enterprise/gui/rest-war/src/main/webapp/WEB-INF/jboss-web.xml
+++ b/modules/enterprise/gui/rest-war/src/main/webapp/WEB-INF/jboss-web.xml
@@ -2,5 +2,5 @@
<jboss-web>
<context-root>rest</context-root>
- <security-domain>java:/jaas/REST</security-domain>
+ <security-domain>REST</security-domain>
</jboss-web>
11 years, 9 months
[rhq] Branch 'rhq-on-as7' - 2 commits - modules/enterprise modules/plugins
by Jay Shaughnessy
modules/enterprise/gui/installer/src/main/java/org/rhq/common/jbossas/client/controller/DatasourceJBossASClient.java | 2 +-
modules/enterprise/gui/installer/src/main/java/org/rhq/common/jbossas/client/controller/WebJBossASClient.java | 2 +-
modules/plugins/perftest/pom.xml | 10 ++++------
3 files changed, 6 insertions(+), 8 deletions(-)
New commits:
commit 9cdba82c9b40668c927380aaee5db1ab2b25901a
Author: Jay Shaughnessy <jshaughn(a)jshaughn.csb>
Date: Mon Sep 10 13:07:15 2012 -0400
trivial - Fix jdoc typos
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
index aea69ea..b1f7a98 100644
--- 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
@@ -24,7 +24,7 @@ import org.jboss.as.controller.client.ModelControllerClient;
import org.jboss.dmr.ModelNode;
/**
- * Provides convienence methods associated with datasource management.
+ * Provides convenience methods associated with datasource management.
*
* @author John Mazzitelli
*/
diff --git a/modules/enterprise/gui/installer/src/main/java/org/rhq/common/jbossas/client/controller/WebJBossASClient.java b/modules/enterprise/gui/installer/src/main/java/org/rhq/common/jbossas/client/controller/WebJBossASClient.java
index 5424483..59ab471 100644
--- a/modules/enterprise/gui/installer/src/main/java/org/rhq/common/jbossas/client/controller/WebJBossASClient.java
+++ b/modules/enterprise/gui/installer/src/main/java/org/rhq/common/jbossas/client/controller/WebJBossASClient.java
@@ -22,7 +22,7 @@ import org.jboss.as.controller.client.ModelControllerClient;
import org.jboss.dmr.ModelNode;
/**
- * Convienence methods to access the web management API.
+ * Convenience methods to access the web management API.
*
* @author John Mazzitelli
*/
commit 44507231ea0997681557aa7a4c741728c69f49b9
Author: Jay Shaughnessy <jshaughn(a)jshaughn.csb>
Date: Mon Sep 10 13:06:34 2012 -0400
Fix dep issue in misc (perftest) plugin
diff --git a/modules/plugins/perftest/pom.xml b/modules/plugins/perftest/pom.xml
index 653766d..3bf63db 100644
--- a/modules/plugins/perftest/pom.xml
+++ b/modules/plugins/perftest/pom.xml
@@ -18,15 +18,13 @@
<dependencies>
<dependency>
- <groupId>javax.xml.bind</groupId>
- <artifactId>jaxb-api</artifactId>
- <!-- NOTE: The version is defined in the root POM's dependencyManagement section. -->
+ <groupId>org.jboss.spec.javax.xml.bind</groupId>
+ <artifactId>jboss-jaxb-api_2.2_spec</artifactId>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
- <!-- NOTE: The version is defined in the root POM's dependencyManagement section. -->
</dependency>
</dependencies>
@@ -61,8 +59,8 @@
<configuration>
<artifactItems>
<artifactItem>
- <groupId>javax.xml.bind</groupId>
- <artifactId>jaxb-api</artifactId>
+ <groupId>org.jboss.spec.javax.xml.bind</groupId>
+ <artifactId>jboss-jaxb-api_2.2_spec</artifactId>
</artifactItem>
<artifactItem>
<groupId>com.sun.xml.bind</groupId>
11 years, 9 months
[rhq] modules/enterprise
by snegrea
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java | 30 ++++++----
1 file changed, 20 insertions(+), 10 deletions(-)
New commits:
commit d2047949ff60a8fb2ed84ebdc676eac4a49f1487
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Mon Sep 10 11:38:33 2012 -0500
[BZ 851186] Updated the way default values are applied to fields on unset change.
Behaviour after update:
1) If the field is unset then disable field and set value to null
2) If the field is set then enable field and load saved value
3) On unset change from true to false, enable field and load default value if not null
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
index aec7274..5687ded 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
@@ -1293,6 +1293,11 @@ public class ConfigurationEditor extends LocatableVLayout {
protected FormItem buildSimpleField(final PropertyDefinitionSimple propertyDefinitionSimple,
final PropertySimple propertySimple) {
+ String value = propertySimple.getStringValue();
+ if (null == value && null != propertyDefinitionSimple.getDefaultValue()) {
+ value = propertyDefinitionSimple.getDefaultValue();
+ }
+
FormItem valueItem = null;
boolean propertyIsReadOnly = isReadOnly(propertyDefinitionSimple, propertySimple);
@@ -1302,6 +1307,7 @@ public class ConfigurationEditor extends LocatableVLayout {
// to wait until we implement masking/unmasking of PASSWORD props at the SLSB layer first.
if (propertyIsReadOnly && propertyDefinitionSimple.getType() != PropertySimpleType.PASSWORD) {
valueItem = new StaticTextItem();
+ valueItem.setValue(StringUtility.escapeHtml(value));
} else {
List<PropertyDefinitionEnumeration> enumeratedValues = propertyDefinitionSimple.getEnumeratedValues();
if (enumeratedValues != null && !enumeratedValues.isEmpty()) {
@@ -1361,6 +1367,12 @@ public class ConfigurationEditor extends LocatableVLayout {
List<Validator> validators = buildValidators(propertyDefinitionSimple, propertySimple);
valueItem.setValidators(validators.toArray(new Validator[validators.size()]));
+ if (isUnset(propertyDefinitionSimple, propertySimple)) {
+ setValue(valueItem, null);
+ } else {
+ valueItem.setValue(value);
+ }
+
if ((propertySimple.getConfiguration() != null) || (propertySimple.getParentMap() != null)
|| (propertySimple.getParentList() != null)) {
valueItem.addChangedHandler(new ChangedHandler() {
@@ -1403,16 +1415,6 @@ public class ConfigurationEditor extends LocatableVLayout {
valueItem.setTitle("none");
valueItem.setShowTitle(false);
- String value = propertySimple.getStringValue();
- if (null == value && null != propertyDefinitionSimple.getDefaultValue()) {
- value = propertyDefinitionSimple.getDefaultValue();
- }
- if (valueItem instanceof StaticTextItem) {
- // Property values are user-editable, so escape HTML when displayed as static text, to prevent XSS attacks.
- value = StringUtility.escapeHtml(value);
- }
- valueItem.setValue(value);
-
setValueAsTooltipIfAppropriate(valueItem, value);
valueItem.setRequired(propertyDefinitionSimple.isRequired());
@@ -1514,6 +1516,14 @@ public class ConfigurationEditor extends LocatableVLayout {
firePropertyChangedEvent(propertySimple, propertyDefinitionSimple, true);
}
} else {
+ String defaultValue = propertyDefinitionSimple.getDefaultValue();
+ if (defaultValue != null) {
+ setValue(valueItem, defaultValue);
+ updatePropertySimpleValue(unsetItem, defaultValue, propertySimple, propertyDefinitionSimple);
+ boolean isValid = valueItem.validate();
+ firePropertyChangedEvent(propertySimple, propertyDefinitionSimple, isValid);
+ }
+
valueItem.focusInItem();
}
11 years, 9 months
[rhq] Branch 'rhq-on-as7' - 5 commits - .classpath modules/core modules/enterprise modules/helpers modules/integration-tests modules/jopr modules/plugins modules/pom.xml pom.xml .project
by Jay Shaughnessy
.classpath | 1
.project | 11
modules/core/arquillian-integration/container/pom.xml | 2
modules/core/client-api/pom.xml | 13
modules/core/domain/pom.xml | 21
modules/core/plugin-api/pom.xml | 12
modules/core/plugin-container/pom.xml | 14
modules/enterprise/agent/pom.xml | 7
modules/enterprise/binding/pom.xml | 2
modules/enterprise/comm/pom.xml | 8
modules/enterprise/gui/content_http-war/pom.xml | 15
modules/enterprise/gui/portal-war/pom.xml | 33
modules/enterprise/gui/rest-war/pom.xml | 8
modules/enterprise/pom.xml | 4
modules/enterprise/remoting/cli/pom.xml | 2
modules/enterprise/remoting/client-api/pom.xml | 2
modules/enterprise/server/appserver/pom.xml | 2
modules/enterprise/server/container-lib/pom.xml | 5
modules/enterprise/server/container/pom.xml | 2
modules/enterprise/server/ear/pom.xml | 6
modules/enterprise/server/ear/src/main/application/META-INF/jboss-deployment-structure.xml | 2
modules/enterprise/server/itests/pom.xml | 19
modules/enterprise/server/jar/pom.xml | 72 --
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/engine/jms/AlertConditionConsumerBean.java | 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/engine/jms/CachedConditionProducerBean.java | 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftChangesetBean.java | 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftFileBean.java | 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftManagerBean.java | 4
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/AbstractRestBean.java | 356 ++++++----
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/MetricHandlerBean.java | 17
modules/enterprise/server/plugins/groovy-script/pom.xml | 4
modules/enterprise/server/xml-schemas/pom.xml | 13
modules/helpers/inventory-serializer/pom.xml | 4
modules/integration-tests/jndi-access/jndi-access-test/pom.xml | 2
modules/integration-tests/mod_cluster-plugin-test/pom.xml | 2
modules/jopr/etc/jbas5-ejb-client/pom.xml | 2
modules/jopr/etc/jbas5-ejb2-mdb-test/pom.xml | 2
modules/jopr/etc/jbas5-jnp-client/pom.xml | 2
modules/jopr/tools/jbas5-plugin-descriptor-gen/pom.xml | 2
modules/plugins/jboss-as/pom.xml | 8
modules/plugins/jboss-cache-v3/pom.xml | 2
modules/pom.xml | 2
pom.xml | 123 +--
43 files changed, 386 insertions(+), 430 deletions(-)
New commits:
commit f818a10ce05d19174ebd717022e4b00498f8ab87
Author: Jay Shaughnessy <jshaughn(a)jshaughn.csb>
Date: Mon Sep 10 10:33:02 2012 -0400
Update Resource JNDI names to required AS7 formats
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/engine/jms/AlertConditionConsumerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/engine/jms/AlertConditionConsumerBean.java
index 71af1f2..ae84721 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/engine/jms/AlertConditionConsumerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/engine/jms/AlertConditionConsumerBean.java
@@ -41,7 +41,7 @@ import org.rhq.enterprise.server.util.concurrent.AlertSerializer;
*/
@MessageDriven(activationConfig = {
@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
- @ActivationConfigProperty(propertyName = "destination", propertyValue = "queue/AlertConditionQueue"),
+ @ActivationConfigProperty(propertyName = "destination", propertyValue = "java:/queue/AlertConditionQueue"),
@ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge"),
@ActivationConfigProperty(propertyName = "subscriptionDurability", propertyValue = "NonDurable") })
public class AlertConditionConsumerBean implements MessageListener {
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/engine/jms/CachedConditionProducerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/engine/jms/CachedConditionProducerBean.java
index f74663a..6a53d47 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/engine/jms/CachedConditionProducerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/engine/jms/CachedConditionProducerBean.java
@@ -49,7 +49,7 @@ public class CachedConditionProducerBean implements CachedConditionProducerLocal
@Resource(mappedName = "java:/JmsXA")
private ConnectionFactory factory;
- @Resource(mappedName = "queue/AlertConditionQueue")
+ @Resource(mappedName = "java:/queue/AlertConditionQueue")
private Queue alertConditionQueue;
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftChangesetBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftChangesetBean.java
index 00c7370..bfe265f 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftChangesetBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftChangesetBean.java
@@ -41,7 +41,7 @@ import org.rhq.enterprise.server.auth.SubjectManagerLocal;
@MessageDriven(activationConfig = {
@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
- @ActivationConfigProperty(propertyName = "destination", propertyValue = "queue/DriftChangesetQueue"),
+ @ActivationConfigProperty(propertyName = "destination", propertyValue = "java:/queue/DriftChangesetQueue"),
@ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge"),
// this is just declarative, I think it's unnecessary
@ActivationConfigProperty(propertyName = "subscriptionDurability", propertyValue = "NonDurable") })
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftFileBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftFileBean.java
index 15a2135..a0772bc 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftFileBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftFileBean.java
@@ -41,7 +41,7 @@ import org.rhq.enterprise.server.auth.SubjectManagerLocal;
@MessageDriven(activationConfig = {
@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
- @ActivationConfigProperty(propertyName = "destination", propertyValue = "queue/DriftFileQueue"),
+ @ActivationConfigProperty(propertyName = "destination", propertyValue = "java:/queue/DriftFileQueue"),
@ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge"),
// this is just declarative, I think it's unnecessary
@ActivationConfigProperty(propertyName = "subscriptionDurability", propertyValue = "NonDurable") })
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftManagerBean.java
index 4f8bc15..776f236 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftManagerBean.java
@@ -132,10 +132,10 @@ public class DriftManagerBean implements DriftManagerLocal, DriftManagerRemote {
@javax.annotation.Resource(mappedName = "java:/JmsXA")
private ConnectionFactory factory;
- @javax.annotation.Resource(mappedName = "queue/DriftChangesetQueue")
+ @javax.annotation.Resource(mappedName = "java:/queue/DriftChangesetQueue")
private Queue changesetQueue;
- @javax.annotation.Resource(mappedName = "queue/DriftFileQueue")
+ @javax.annotation.Resource(mappedName = "java:/queue/DriftFileQueue")
private Queue fileQueue;
@PersistenceContext(unitName = RHQConstants.PERSISTENCE_UNIT_NAME)
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/AbstractRestBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/AbstractRestBean.java
index 7d07311..dd21f15 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/AbstractRestBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/AbstractRestBean.java
@@ -33,6 +33,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
+import javax.annotation.PostConstruct;
import javax.ejb.EJB;
import javax.ws.rs.core.UriBuilder;
import javax.ws.rs.core.UriInfo;
@@ -47,6 +48,7 @@ import freemarker.template.TemplateException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.infinispan.Cache;
+import org.infinispan.manager.CacheContainer;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.resource.Resource;
@@ -68,24 +70,29 @@ import org.rhq.enterprise.server.rest.domain.ResourceWithType;
* @author Jay Shaughnessy
*/
@SuppressWarnings("unchecked")
-//(a)javax.annotation.Resource(lookup = "java:jboss/infinispan/RhqCache")
public class AbstractRestBean {
Log log = LogFactory.getLog(getClass().getName());
static private final CacheKey META_KEY = new CacheKey("rhq.rest.resourceMeta", 0);
+ @javax.annotation.Resource(lookup = "java:jboss/infinispan/rhq")
+ protected CacheContainer container;
+ protected Cache<CacheKey, Object> cache;
+
/** Subject of the caller that gets injected via {@link SetCallerInterceptor} */
protected Subject caller;
- /** The cache to use */
- @javax.annotation.Resource(lookup = "java:jboss/infinispan/RhqCache")
- Cache<CacheKey, Object> cache;
@EJB
ResourceManagerLocal resMgr;
@EJB
ResourceGroupManagerLocal resourceGroupManager;
+ @PostConstruct
+ public void start() {
+ this.cache = this.container.getCache();
+ }
+
/**
* Renders the passed object with the help of a freemarker template into a string. Freemarket templates
* are searched in the class path in a directory called "/rest_templates". In the usual Maven tree structure,
commit 5e83a42f15a029f66b0411b54c7bda6782735331
Author: Jay Shaughnessy <jshaughn(a)jshaughn.csb>
Date: Mon Sep 10 10:32:34 2012 -0400
Move EAR dependency declarations to jboss-deployment-structure.xml.
diff --git a/modules/enterprise/server/ear/pom.xml b/modules/enterprise/server/ear/pom.xml
index c0abedd..974185d 100644
--- a/modules/enterprise/server/ear/pom.xml
+++ b/modules/enterprise/server/ear/pom.xml
@@ -212,7 +212,7 @@
<plugin>
<artifactId>maven-ear-plugin</artifactId>
<configuration>
- <version>6</version>
+ <version>6</version> <!-- version of the generated application.xml -->
<displayName>RHQ</displayName>
<workDirectory>${earDirectory}</workDirectory>
<filtering>true</filtering>
diff --git a/modules/enterprise/server/ear/src/main/application/META-INF/jboss-deployment-structure.xml b/modules/enterprise/server/ear/src/main/application/META-INF/jboss-deployment-structure.xml
index 46b9cf7..0457911 100644
--- a/modules/enterprise/server/ear/src/main/application/META-INF/jboss-deployment-structure.xml
+++ b/modules/enterprise/server/ear/src/main/application/META-INF/jboss-deployment-structure.xml
@@ -27,4 +27,4 @@
</dependencies>
</sub-deployment>
-</jboss-deployment-structure>
\ No newline at end of file
+</jboss-deployment-structure>
commit 41398865f3ce0bb68da4f8238db124f69c83b93c
Author: Jay Shaughnessy <jshaughn(a)jshaughn.csb>
Date: Thu Sep 6 09:52:43 2012 -0400
Migrate RhqCache from TreeCache to Inifinispan
diff --git a/.classpath b/.classpath
index 89d8a42..1767cf3 100644
--- a/.classpath
+++ b/.classpath
@@ -319,6 +319,7 @@
<classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/arquillian/testng/arquillian-testng-core/1.0.1.Final/arquillian-testng-core-1.0.1.Final.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/com/wordnik/swagger-annotations_2.9.1/1.1-SNAPSHOT/swagger-annotations_2.9.1-1.1-20120531.064118-1.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/byteman/byteman/1.2.1/byteman-1.2.1.jar"/>
+ <classpathentry exported="true" kind="var" path="M2_REPO/org/infinispan/infinispan-core/5.1.2.FINAL/infinispan-core-5.1.2.FINAL.jar"/>
<classpathentry exported="true" kind="var" path="JDK_HOME/lib/tools.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="eclipse-classes"/>
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/AbstractRestBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/AbstractRestBean.java
index 615ba6c..7d07311 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/AbstractRestBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/AbstractRestBean.java
@@ -46,11 +46,7 @@ import freemarker.template.TemplateException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-
-import org.jboss.cache.CacheException;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.Node;
-import org.jboss.cache.TreeCacheMBean;
+import org.infinispan.Cache;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.resource.Resource;
@@ -64,21 +60,27 @@ import org.rhq.enterprise.server.rest.domain.ResourceWithType;
/**
* Abstract base class for EJB classes that implement REST methods.
- * For the cache and its evicion policies see rhq-cache-service.xml
+ * For the cache and its eviction policies see standalone-full.xml (in
+ * the RHQ Server's AS7/standalone/configuration directory, as modified
+ * by the installer.)
+ *
* @author Heiko W. Rupp
+ * @author Jay Shaughnessy
*/
@SuppressWarnings("unchecked")
-(a)javax.annotation.Resource(name="cache",type= TreeCacheMBean.class,mappedName = "RhqCache")
+//(a)javax.annotation.Resource(lookup = "java:jboss/infinispan/RhqCache")
public class AbstractRestBean {
Log log = LogFactory.getLog(getClass().getName());
+ static private final CacheKey META_KEY = new CacheKey("rhq.rest.resourceMeta", 0);
+
/** Subject of the caller that gets injected via {@link SetCallerInterceptor} */
protected Subject caller;
/** The cache to use */
- @javax.annotation.Resource(name="cache")
- TreeCacheMBean treeCache;
+ @javax.annotation.Resource(lookup = "java:jboss/infinispan/RhqCache")
+ Cache<CacheKey, Object> cache;
@EJB
ResourceManagerLocal resMgr;
@EJB
@@ -115,8 +117,7 @@ public class AbstractRestBean {
root.put("var", objectToRender);
template.process(root, out);
return out.toString();
- }
- finally {
+ } finally {
out.close();
}
} catch (IOException ioe) {
@@ -134,41 +135,59 @@ public class AbstractRestBean {
* @return Object if found and the caller has access to it.
* @see #getFqn(int, Class)
*/
- protected <T>T getFromCache(int id,Class<T> clazz) {
- Fqn fqn = getFqn(id, clazz);
- return getFromCache(fqn,clazz);
+ protected <T> T getFromCache(int id, Class<T> clazz) {
+ CacheKey key = new CacheKey(clazz, id);
+ return getFromCache(key, clazz);
}
-
/**
* Retrieve an object from the cache if present or null otherwise.
* We need to be careful here as we must not return objects the current
* caller has no access to. We do this by checking the "readers" attribute
* of the selected node to see if the caller has put the object there
- * @param fqn FullyQualified name (=path in cache) ot the object to retrieve
+ * @param fqn FullyQualified name (=path in cache) of the object to retrieve
* @param clazz Return type
* @return The desired object if found and valid for the current caller. Null otherwise.
* @see #putToCache(org.jboss.cache.Fqn, Object)
*/
- @SuppressWarnings("unchecked")
- protected <T>T getFromCache(Fqn fqn,Class<T> clazz) {
- Object o=null;
- if (treeCache.exists(fqn)) {
- log.debug("Hit for " + fqn.toString());
- try{
- Node n = treeCache.get(fqn);
- Set<Integer> readers= (Set<Integer>) n.get("readers");
- if (readers.contains(caller.getId())) {
- o = n.get("item");
- }
- else {
- log.debug("No object for caller " +caller.toString() + " found");
+ protected <T> T getFromCache(CacheKey key, Class<T> clazz) {
+ Object o = null;
+
+ CacheValue value = (CacheValue) cache.get(key);
+
+ if (null != value) {
+ if (log.isDebugEnabled()) {
+ log.debug("Cache Hit for " + key);
+ }
+
+ if (value.getReaders().contains(caller.getId())) {
+ o = value.getValue();
+
+ } else {
+ if (log.isDebugEnabled()) {
+ log.debug("Cache Hit ignored, caller " + caller.toString() + " not found");
}
- } catch (CacheException e) {
- log.debug("Miss for " + fqn.toString());
+ }
+ } else {
+ if (log.isDebugEnabled()) {
+ log.debug("Cache Miss for " + key);
}
}
- return (T)o;
+
+ return (T) o;
+ }
+
+ /**
+ * Put an object into the cache identified by its type and id
+ * @param id Id of the object to put
+ * @param clazz Type to put in
+ * @param o Object to put
+ * @return true if put was successful
+ * @see #putToCache(org.jboss.cache.Fqn, Object)
+ */
+ protected <T> boolean putToCache(int id, Class<T> clazz, T o) {
+ CacheKey key = new CacheKey(clazz, id);
+ return putToCache(key, o);
}
/**
@@ -180,68 +199,58 @@ public class AbstractRestBean {
* @see #getFromCache(org.jboss.cache.Fqn, Class)
*/
@SuppressWarnings("unchecked")
- protected <T>boolean putToCache(Fqn fqn,T o) {
- boolean success = false;
+ protected <T> boolean putToCache(CacheKey key, T o) {
+ boolean result = false;
+
+ CacheValue value = (CacheValue) cache.get(key);
+ if (null != value) {
+ value.getReaders().add(caller.getId());
+ value.setValue(o);
+ } else {
+ value = new CacheValue(o, caller.getId());
+ }
try {
- Set<Integer> readers;
- if (treeCache.exists(fqn)) {
- Node n = treeCache.get(fqn);
- readers = (Set<Integer>) n.get("readers");
- } else {
- readers = new HashSet<Integer>();
+ cache.put(key, value);
+
+ if (log.isDebugEnabled()) {
+ log.debug("Cache Put " + key);
}
- readers.add(caller.getId());
- treeCache.put(fqn,"readers",readers);
- treeCache.put(fqn,"item",o);
- success = true;
- log.debug("Put " + fqn);
- } catch (CacheException e) {
+
+ result = true;
+ }
+
+ catch (Exception e) {
log.warn(e.getMessage());
}
- return success;
- }
- /**
- * Put an object into the cache identified by its type and id
- * @param id Id of the object to put
- * @param clazz Type to put in
- * @param o Object to put
- * @return true if put was successful
- * @see #putToCache(org.jboss.cache.Fqn, Object)
- */
- protected <T>boolean putToCache(int id,Class<T> clazz,T o) {
- Fqn fqn = getFqn(id, clazz);
- return putToCache(fqn,o);
+ return result;
}
protected void putResourceToCache(Resource res) {
- putToCache(res.getId(),Resource.class,res);
+ putToCache(res.getId(), Resource.class, res);
+
+ CacheKey callerKey = new CacheKey("rhq.rest.caller", caller.getId());
- Fqn callerFqn = new Fqn(new String[]{"user", String.valueOf(caller.getId()),"resources"});
- Set<Integer> visibleResources;
try {
- if (treeCache.exists(callerFqn)) {
- Node n = treeCache.get(callerFqn);
- visibleResources = (Set<Integer>) n.get("visibleResources");
- }
- else {
+ Set<Integer> visibleResources = (Set<Integer>) cache.get(callerKey);
+
+ if (null == visibleResources) {
visibleResources = new HashSet<Integer>();
}
+
visibleResources.add(res.getId());
- treeCache.put(callerFqn,"visibleResources",visibleResources);
+ cache.put(callerKey, visibleResources);
- Fqn resourceMeta = new Fqn(new String[] { "resourceMeta"});
- Map<Integer,Integer> childParentMap;
- if (treeCache.exists(resourceMeta)) {
- childParentMap = (Map<Integer, Integer>) treeCache.get(resourceMeta,"childParentMap");
- }
- else {
- childParentMap = new HashMap<Integer,Integer>();
+ Map<Integer, Integer> childParentMap = (Map<Integer, Integer>) cache.get(META_KEY);
+
+ if (null == childParentMap) {
+ childParentMap = new HashMap<Integer, Integer>();
}
int pid = res.getParentResource() == null ? 0 : res.getParentResource().getId();
childParentMap.put(res.getId(), pid);
- treeCache.put(resourceMeta,"childParentMap",childParentMap);
- } catch (CacheException e) {
+ cache.put(META_KEY, childParentMap);
+
+ } catch (Exception e) {
log.warn(e.getMessage());
}
}
@@ -251,18 +260,17 @@ public class AbstractRestBean {
List<Resource> ret = new ArrayList<Resource>();
// First determine candidate children
- Map<Integer,Integer> childParentMap;
- Fqn resourceMeta = new Fqn(new String[] { "resourceMeta"});
- if (treeCache.exists(resourceMeta)) {
+ Map<Integer, Integer> childParentMap = (Map<Integer, Integer>) cache.get(META_KEY);
+
+ if (null != childParentMap) {
try {
- childParentMap = (Map<Integer, Integer>) treeCache.get(resourceMeta,"childParentMap");
- for (Map.Entry<Integer,Integer> entry : childParentMap.entrySet()) {
+ for (Map.Entry<Integer, Integer> entry : childParentMap.entrySet()) {
if (entry.getValue() == pid)
candidateIds.add(entry.getKey());
}
// then see if the current user can see them
- Fqn callerFqn = new Fqn(new String[]{"user", String.valueOf(caller.getId()),"resources"});
- Set<Integer> visibleResources = (Set<Integer>) treeCache.get(callerFqn,"visibleResources");
+ CacheKey callerKey = new CacheKey("rhq.rest.caller", caller.getId());
+ Set<Integer> visibleResources = (Set<Integer>) cache.get(callerKey);
Iterator<Integer> iter = candidateIds.iterator();
while (iter.hasNext()) {
Integer resId = iter.next();
@@ -275,7 +283,7 @@ public class AbstractRestBean {
for (Integer resId : candidateIds) {
ret.add(getFromCache(resId, Resource.class));
}
- } catch (CacheException e) {
+ } catch (Exception e) {
log.warn(e.getMessage());
}
@@ -287,13 +295,14 @@ public class AbstractRestBean {
Resource res = null;
// check if the current user can see the resource
- Fqn callerFqn = new Fqn(new String[]{"user", String.valueOf(caller.getId()),"resources"});
- if (treeCache.exists(callerFqn)) {
+ CacheKey callerKey = new CacheKey("rhq.rest.caller", caller.getId());
+ Set<Integer> visibleResources = (Set<Integer>) cache.get(callerKey);
+ if (null != visibleResources) {
try {
- Set<Integer> visibleResources = (Set<Integer>) treeCache.get(callerFqn,"visibleResources");
- if (visibleResources.contains(resourceid))
- res = getFromCache(resourceid,Resource.class);
- } catch (CacheException e) {
+ if (visibleResources.contains(resourceid)) {
+ res = getFromCache(resourceid, Resource.class);
+ }
+ } catch (Exception e) {
log.warn(e.getMessage());
}
}
@@ -301,84 +310,68 @@ public class AbstractRestBean {
return res;
}
-
- /**
- * Construct a Fqn object from the passed data
- * @param id Id of the target object
- * @param clazz Type of object for that node
- * @return Fqn object
- */
- protected <T> Fqn getFqn(int id, Class<T> clazz) {
- return new Fqn(new Object[]{clazz.getName(), String.valueOf(id)});
- }
-
/**
* Remove an item from the cache
- * @param operationId Id of the item
+ * @param id Id of the item
* @param clazz Type of object for that node
* @return true if object is no longer in cache
*/
- protected <T> boolean removeFromCache(int operationId, Class<T> clazz) {
- Fqn fqn = getFqn(operationId,clazz);
- if (treeCache.exists(fqn)) {
- try {
- treeCache.remove(fqn);
- log.debug("Cancel " + fqn);
- return true;
- } catch (CacheException e) {
- return false;
- }
+ protected <T> boolean removeFromCache(int id, Class<T> clazz) {
+ CacheKey key = new CacheKey(clazz, id);
+ Object cacheValue = cache.remove(key);
+ if (null != cacheValue) {
+ log.debug("Cache Remove " + key);
}
+
return true;
}
public ResourceWithType fillRWT(Resource res, UriInfo uriInfo) {
ResourceType resourceType = res.getResourceType();
- ResourceWithType rwt = new ResourceWithType(res.getName(),res.getId());
+ ResourceWithType rwt = new ResourceWithType(res.getName(), res.getId());
rwt.setTypeName(resourceType.getName());
rwt.setTypeId(resourceType.getId());
rwt.setPluginName(resourceType.getPlugin());
Resource parent = res.getParentResource();
- if (parent!=null) {
+ if (parent != null) {
rwt.setParentId(parent.getId());
- }
- else
+ } else
rwt.setParentId(0);
rwt.setAncestry(res.getAncestry());
UriBuilder uriBuilder = uriInfo.getBaseUriBuilder();
uriBuilder.path("/operation/definitions");
- uriBuilder.queryParam("resourceId",res.getId());
+ uriBuilder.queryParam("resourceId", res.getId());
URI uri = uriBuilder.build();
- Link link = new Link("operationDefinitions",uri.toString());
+ Link link = new Link("operationDefinitions", uri.toString());
rwt.addLink(link);
uriBuilder = uriInfo.getBaseUriBuilder();
uriBuilder.path("/resource/{id}");
uri = uriBuilder.build(res.getId());
- link = new Link("self",uri.toString());
+ link = new Link("self", uri.toString());
rwt.addLink(link);
uriBuilder = uriInfo.getBaseUriBuilder();
uriBuilder.path("/resource/{id}/schedules");
uri = uriBuilder.build(res.getId());
- link = new Link("schedules",uri.toString());
+ link = new Link("schedules", uri.toString());
rwt.addLink(link);
uriBuilder = uriInfo.getBaseUriBuilder();
uriBuilder.path("/resource/{id}/availability");
uri = uriBuilder.build(res.getId());
- link = new Link("availability",uri.toString());
+ link = new Link("availability", uri.toString());
rwt.addLink(link);
uriBuilder = uriInfo.getBaseUriBuilder();
uriBuilder.path("/resource/{id}/children");
uri = uriBuilder.build(res.getId());
- link = new Link("children",uri.toString());
+ link = new Link("children", uri.toString());
rwt.addLink(link);
- if (parent!=null) {
+ if (parent != null) {
uriBuilder = uriInfo.getBaseUriBuilder();
uriBuilder.path("/resource/{id}/");
uri = uriBuilder.build(parent.getId());
- link = new Link("parent",uri.toString());
+ link = new Link("parent", uri.toString());
rwt.addLink(link);
}
@@ -388,18 +381,18 @@ public class AbstractRestBean {
protected Resource fetchResource(int resourceId) {
Resource res;
res = resMgr.getResource(caller, resourceId);
- if (res==null)
+ if (res == null)
throw new StuffNotFoundException("Resource with id " + resourceId);
-/*
- res = getFromCache(resourceId, Resource.class);
- if (res == null) {
- res = resMgr.getResource(caller, resourceId);
- if (res != null)
- putToCache(resourceId, Resource.class, res);
- else
- throw new StuffNotFoundException("Resource with id " + resourceId);
- }
-*/
+ /*
+ res = getFromCache(resourceId, Resource.class);
+ if (res == null) {
+ res = resMgr.getResource(caller, resourceId);
+ if (res != null)
+ putToCache(resourceId, Resource.class, res);
+ else
+ throw new StuffNotFoundException("Resource with id " + resourceId);
+ }
+ */
return res;
}
@@ -424,4 +417,86 @@ public class AbstractRestBean {
}
return resourceGroup;
}
+
+ private static class CacheKey {
+ private String namespace;
+ private int id;
+
+ /**
+ * @param clazz The class name will be used as the namespace for the id.
+ * @param id
+ */
+ public CacheKey(Class<?> clazz, int id) {
+ this(clazz.getName(), id);
+ }
+
+ public CacheKey(String namespace, int id) {
+ this.namespace = namespace;
+ this.id = id;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((namespace == null) ? 0 : namespace.hashCode());
+ result = prime * result + id;
+
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ CacheKey other = (CacheKey) obj;
+ if (namespace == null) {
+ if (other.namespace != null) {
+ return false;
+ }
+ } else if (!namespace.equals(other.namespace)) {
+ return false;
+ }
+ if (id != other.id) {
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "CacheKey [namespace=" + namespace + ", id=" + id + "]";
+ }
+ }
+
+ private static class CacheValue {
+ private Object value;
+ private Set<Integer> readers;
+
+ public CacheValue(Object value, int readerId) {
+ this.readers = new HashSet<Integer>();
+ this.readers.add(readerId);
+ this.value = value;
+ }
+
+ public Object getValue() {
+ return value;
+ }
+
+ public void setValue(Object value) {
+ this.value = value;
+ }
+
+ public Set<Integer> getReaders() {
+ return readers;
+ }
+ }
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/MetricHandlerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/MetricHandlerBean.java
index cb7cc5c..c757911 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/MetricHandlerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/MetricHandlerBean.java
@@ -60,8 +60,6 @@ import javax.ws.rs.core.StreamingOutput;
import javax.ws.rs.core.UriBuilder;
import javax.ws.rs.core.UriInfo;
-import org.jboss.cache.Fqn;
-
import org.rhq.core.domain.common.EntityContext;
import org.rhq.core.domain.measurement.DataType;
import org.rhq.core.domain.measurement.MeasurementBaseline;
@@ -74,16 +72,16 @@ import org.rhq.core.domain.measurement.composite.MeasurementDataNumericHighLowCo
import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.core.util.jdbc.JDBCUtil;
import org.rhq.enterprise.server.RHQConstants;
+import org.rhq.enterprise.server.measurement.MeasurementAggregate;
+import org.rhq.enterprise.server.measurement.MeasurementDataManagerLocal;
import org.rhq.enterprise.server.measurement.MeasurementDefinitionManagerLocal;
+import org.rhq.enterprise.server.measurement.MeasurementScheduleManagerLocal;
import org.rhq.enterprise.server.measurement.util.MeasurementDataManagerUtility;
import org.rhq.enterprise.server.resource.ResourceManagerLocal;
import org.rhq.enterprise.server.resource.group.ResourceGroupManagerLocal;
import org.rhq.enterprise.server.rest.domain.Baseline;
import org.rhq.enterprise.server.rest.domain.Link;
import org.rhq.enterprise.server.rest.domain.MetricAggregate;
-import org.rhq.enterprise.server.measurement.MeasurementAggregate;
-import org.rhq.enterprise.server.measurement.MeasurementDataManagerLocal;
-import org.rhq.enterprise.server.measurement.MeasurementScheduleManagerLocal;
import org.rhq.enterprise.server.rest.domain.MetricSchedule;
import org.rhq.enterprise.server.rest.domain.NumericDataPoint;
import org.rhq.enterprise.server.rest.domain.StringValue;
@@ -368,9 +366,7 @@ public class MetricHandlerBean extends AbstractRestBean implements MetricHandle
cc.setMaxAge(300); // Schedules are valid for 5 mins
cc.setPrivate(false); // Proxies may cache this
-
- Fqn fqn = getFqn(scheduleId,MeasurementSchedule.class);
- schedule = getFromCache(fqn,MeasurementSchedule.class);
+ schedule = getFromCache(scheduleId, MeasurementSchedule.class);
if (schedule!=null) {
// If it is on cache, quickly return if match
long tim = schedule.getMtime() != null ? schedule.getMtime() : 0;
@@ -388,7 +384,7 @@ public class MetricHandlerBean extends AbstractRestBean implements MetricHandle
if (schedule==null)
throw new StuffNotFoundException("Schedule with id " + scheduleId);
else
- putToCache(fqn,schedule);
+ putToCache(scheduleId, MeasurementSchedule.class, schedule);
}
MeasurementDefinition definition = schedule.getDefinition();
@@ -519,8 +515,7 @@ public class MetricHandlerBean extends AbstractRestBean implements MetricHandle
scheduleManager.updateSchedule(caller, schedule);
schedule = scheduleManager.getScheduleById(caller,scheduleId);
- Fqn fqn = getFqn(scheduleId,MeasurementSchedule.class);
- putToCache(fqn,schedule);
+ putToCache(scheduleId, MeasurementSchedule.class, schedule);
MeasurementDefinition def = schedule.getDefinition();
MetricSchedule ret = new MetricSchedule(scheduleId,def.getName(),def.getDisplayName(),
commit ec7aae12219bb7671b311d211e66090f070dcc3a
Author: Jay Shaughnessy <jshaughn(a)jshaughn.csb>
Date: Thu Sep 6 09:52:13 2012 -0400
Update more dep versions to those provided with AS7
- comment out container-lib module from build
- call out in the root pom which deps are using AS7 provided versions and
which are not.
diff --git a/modules/core/arquillian-integration/container/pom.xml b/modules/core/arquillian-integration/container/pom.xml
index 583047e..209eb37 100644
--- a/modules/core/arquillian-integration/container/pom.xml
+++ b/modules/core/arquillian-integration/container/pom.xml
@@ -84,7 +84,7 @@
<!-- 3rd party -->
<dependency>
- <groupId>javassist</groupId>
+ <groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
</dependency>
diff --git a/modules/core/client-api/pom.xml b/modules/core/client-api/pom.xml
index 819cbff..ddf24d5 100644
--- a/modules/core/client-api/pom.xml
+++ b/modules/core/client-api/pom.xml
@@ -45,19 +45,6 @@
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
-
- <dependency>
- <groupId>javax.xml.bind</groupId>
- <artifactId>jaxb-api</artifactId>
- <!-- NOTE: The version is defined in the root POM's dependencyManagement section. -->
- </dependency>
-
- <dependency>
- <groupId>com.sun.xml.bind</groupId>
- <artifactId>jaxb-impl</artifactId>
- <!-- NOTE: The version is defined in the root POM's dependencyManagement section. -->
- <!--<scope>test</scope> not sure about this -->
- </dependency>
<dependency>
<groupId>commons-jxpath</groupId>
diff --git a/modules/core/domain/pom.xml b/modules/core/domain/pom.xml
index 4850a68..2bef60e 100644
--- a/modules/core/domain/pom.xml
+++ b/modules/core/domain/pom.xml
@@ -50,19 +50,13 @@
<scope>provided</scope>
</dependency>
- <dependency>
- <groupId>javax.xml.bind</groupId>
- <artifactId>jaxb-api</artifactId>
- <!-- NOTE: The version is defined in the root POM's dependencyManagement section. -->
+ <!-- provided by AS7 -->
+ <dependency>
+ <groupId>org.jboss.spec.javax.ejb</groupId>
+ <artifactId>jboss-ejb-api_3.1_spec</artifactId>
+ <scope>provided</scope>
</dependency>
-
- <dependency>
- <groupId>jboss</groupId>
- <artifactId>jboss-ejb3x</artifactId>
- <!-- NOTE: The version is defined in the root POM's dependencyManagement section. -->
- <scope>provided</scope> <!-- by JBossAS -->
- </dependency>
-
+
<!-- needed if you want to use the logging JDBC wrapper
<dependency>
<groupId>org.rhq</groupId>
@@ -80,9 +74,8 @@
</dependency>
<dependency>
- <groupId>javassist</groupId>
+ <groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
- <version>${jboss-javassist.version}</version>
<scope>test</scope>
</dependency>
diff --git a/modules/core/plugin-api/pom.xml b/modules/core/plugin-api/pom.xml
index 049efd3..4181e18 100644
--- a/modules/core/plugin-api/pom.xml
+++ b/modules/core/plugin-api/pom.xml
@@ -33,20 +33,12 @@
</dependency>
<!-- 3rd Party Deps -->
-
- <dependency>
- <groupId>javax.xml.bind</groupId>
- <artifactId>jaxb-api</artifactId>
- <!-- NOTE: The version is defined in the root POM's dependencyManagement section. -->
- </dependency>
-
+
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
- <!-- NOTE: The version is defined in the root POM's dependencyManagement section. -->
- <!--<scope>test</scope> not sure about this -->
</dependency>
-
+
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-testng</artifactId>
diff --git a/modules/core/plugin-container/pom.xml b/modules/core/plugin-container/pom.xml
index a2ff73c..288b05f 100644
--- a/modules/core/plugin-container/pom.xml
+++ b/modules/core/plugin-container/pom.xml
@@ -56,20 +56,6 @@
</dependency>
<!-- 3rd Party Deps -->
-
- <dependency>
- <groupId>javax.xml.bind</groupId>
- <artifactId>jaxb-api</artifactId>
- <!-- NOTE: The version is defined in the root POM's dependencyManagement section. -->
- </dependency>
-
- <dependency>
- <groupId>com.sun.xml.bind</groupId>
- <artifactId>jaxb-impl</artifactId>
- <!-- NOTE: The version is defined in the root POM's dependencyManagement section. -->
- <!--<scope>test</scope> not sure about this -->
- </dependency>
-
<dependency>
<groupId>org.hyperic</groupId>
<artifactId>sigar</artifactId>
diff --git a/modules/enterprise/agent/pom.xml b/modules/enterprise/agent/pom.xml
index 7c1ce7d..0804a68 100644
--- a/modules/enterprise/agent/pom.xml
+++ b/modules/enterprise/agent/pom.xml
@@ -93,7 +93,12 @@
<dependency>
<groupId>jboss</groupId>
<artifactId>jboss-remoting</artifactId>
- <!-- NOTE: The version is defined in the root POM's dependencyManagement section. -->
+ </dependency>
+
+ <!-- I think we are taking this whole jar for a single util method -->
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-common-core</artifactId>
</dependency>
</dependencies>
diff --git a/modules/enterprise/binding/pom.xml b/modules/enterprise/binding/pom.xml
index cd97310..2638cef 100644
--- a/modules/enterprise/binding/pom.xml
+++ b/modules/enterprise/binding/pom.xml
@@ -206,7 +206,7 @@
</dependency>
<dependency>
- <groupId>javassist</groupId>
+ <groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
</dependency>
diff --git a/modules/enterprise/comm/pom.xml b/modules/enterprise/comm/pom.xml
index b890e39..1ec2055 100644
--- a/modules/enterprise/comm/pom.xml
+++ b/modules/enterprise/comm/pom.xml
@@ -65,27 +65,23 @@
</dependency>
<dependency>
- <groupId>jboss</groupId>
- <artifactId>jboss-common</artifactId>
- <!-- NOTE: The version is defined in the root POM's dependencyManagement section. -->
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-common-core</artifactId>
</dependency>
<dependency>
<groupId>jboss</groupId>
<artifactId>jboss-jmx</artifactId>
- <!-- NOTE: The version is defined in the root POM's dependencyManagement section. -->
</dependency>
<dependency>
<groupId>jboss</groupId>
<artifactId>jboss-remoting</artifactId>
- <!-- NOTE: The version is defined in the root POM's dependencyManagement section. -->
</dependency>
<dependency>
<groupId>jboss</groupId>
<artifactId>jboss-serialization</artifactId>
- <!-- NOTE: The version is defined in the root POM's dependencyManagement section. -->
</dependency>
<dependency>
diff --git a/modules/enterprise/gui/content_http-war/pom.xml b/modules/enterprise/gui/content_http-war/pom.xml
index 93f93aa..531ebde 100644
--- a/modules/enterprise/gui/content_http-war/pom.xml
+++ b/modules/enterprise/gui/content_http-war/pom.xml
@@ -81,21 +81,6 @@
<scope>provided</scope> <!-- by JBossAS -->
</dependency>
- <!-- needed for EJB3 annotations (e.g. ApplicationException) -->
- <dependency>
- <groupId>jboss</groupId>
- <artifactId>jboss-ejb3x</artifactId>
- <!-- NOTE: The version is defined in the root POM's dependencyManagement section. -->
- <scope>provided</scope> <!-- by JBossAS -->
- </dependency>
-
- <dependency>
- <groupId>jboss</groupId>
- <artifactId>jboss-j2ee</artifactId>
- <!-- NOTE: The version is defined in the root POM's dependencyManagement section. -->
- <scope>provided</scope> <!-- by JBossAS -->
- </dependency>
-
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
diff --git a/modules/enterprise/gui/portal-war/pom.xml b/modules/enterprise/gui/portal-war/pom.xml
index ce18e68..32880fe 100644
--- a/modules/enterprise/gui/portal-war/pom.xml
+++ b/modules/enterprise/gui/portal-war/pom.xml
@@ -182,37 +182,6 @@
<version>1.1.2</version>
</dependency>
- <!-- needed for EJB3 annotations (e.g. ApplicationException) -->
- <dependency>
- <groupId>jboss</groupId>
- <artifactId>jboss-ejb3x</artifactId>
- <!-- NOTE: The version is defined in the root POM's dependencyManagement section. -->
- <scope>provided</scope> <!-- by JBossAS -->
- </dependency>
-
- <dependency>
- <groupId>jboss</groupId>
- <artifactId>jboss-j2ee</artifactId>
- <!-- NOTE: The version is defined in the root POM's dependencyManagement section. -->
- <scope>provided</scope> <!-- by JBossAS -->
- </dependency>
-
- <!-- used by org.jboss.on.enterprise.ui.servlet.startupShutdownListener -->
- <dependency>
- <groupId>jboss</groupId>
- <artifactId>jboss-system</artifactId>
- <!-- NOTE: The version is defined in the root POM's dependencyManagement section. -->
- <scope>provided</scope> <!-- by JBossAS -->
- </dependency>
-
- <!-- used by org.jboss.on.enterprise.ui.converter.MD5HashConverter -->
- <dependency>
- <groupId>jboss</groupId>
- <artifactId>jbosssx</artifactId>
- <!-- NOTE: The version is defined in the root POM's dependencyManagement section. -->
- <scope>provided</scope> <!-- by JBossAS -->
- </dependency>
-
<!-- used by DisplayTag_test.jsp -->
<dependency>
<groupId>junit</groupId>
@@ -319,7 +288,7 @@
<!-- ============ Testing ========================-->
<dependency>
- <groupId>javassist</groupId>
+ <groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
<scope>test</scope>
</dependency>
diff --git a/modules/enterprise/gui/rest-war/pom.xml b/modules/enterprise/gui/rest-war/pom.xml
index aab0638..7bd4a10 100644
--- a/modules/enterprise/gui/rest-war/pom.xml
+++ b/modules/enterprise/gui/rest-war/pom.xml
@@ -49,14 +49,6 @@
<scope>provided</scope>
</dependency>
- <!-- needed for EJB3 annotations (e.g. ApplicationException) -->
- <dependency>
- <groupId>jboss</groupId>
- <artifactId>jboss-ejb3x</artifactId>
- <!-- NOTE: The version is defined in the root POM's dependencyManagement section. -->
- <scope>provided</scope> <!-- by JBossAS -->
- </dependency>
-
</dependencies>
<build>
<finalName>rhq-rest</finalName>
diff --git a/modules/enterprise/pom.xml b/modules/enterprise/pom.xml
index 2add8fe..ae5bde0 100644
--- a/modules/enterprise/pom.xml
+++ b/modules/enterprise/pom.xml
@@ -36,7 +36,7 @@
<module>comm</module>
<module>agent</module>
<module>agentupdate</module>
- <module>server/container-lib</module>
+ <!-- <module>server/container-lib</module> We may no longer need this with AS7-->
<module>server/xml-schemas</module>
<module>server/jar</module>
<module>server/safe-invoker</module>
@@ -73,7 +73,7 @@
<module>gui</module>
<module>server/plugins</module>
<module>server/ear</module>
- <module>server/container-lib</module>
+ <!-- <module>server/container-lib</module> We may no longer need this with AS7-->
<module>server/appserver</module>
<module>server/client-api</module>
<module>server/itests</module>
diff --git a/modules/enterprise/remoting/cli/pom.xml b/modules/enterprise/remoting/cli/pom.xml
index 56544ad..2c43e8e 100644
--- a/modules/enterprise/remoting/cli/pom.xml
+++ b/modules/enterprise/remoting/cli/pom.xml
@@ -124,7 +124,7 @@
<property name="jboss-common.version" value="${jboss-common.version}" />
<property name="jboss.version" value="${jboss.version}" />
<property name="jboss-remoting.version" value="${jboss-remoting.version}" />
- <property name="jboss-javassist.version" value="${jboss-javassist.version}" />
+ <property name="jboss-javassist.version" value="${javassist.version}" />
<property name="jline.version" value="${jline.version}" />
<property name="log4j.version" value="${log4j.version}" />
<property name="testng.version" value="${testng.version}" />
diff --git a/modules/enterprise/remoting/client-api/pom.xml b/modules/enterprise/remoting/client-api/pom.xml
index 425467a..c627c84 100644
--- a/modules/enterprise/remoting/client-api/pom.xml
+++ b/modules/enterprise/remoting/client-api/pom.xml
@@ -78,7 +78,7 @@
</dependency>
<dependency>
- <groupId>javassist</groupId>
+ <groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
</dependency>
diff --git a/modules/enterprise/server/appserver/pom.xml b/modules/enterprise/server/appserver/pom.xml
index 099e649..1439e9d 100644
--- a/modules/enterprise/server/appserver/pom.xml
+++ b/modules/enterprise/server/appserver/pom.xml
@@ -144,7 +144,7 @@
<property name="jboss.zip" location="${settings.localRepository}/org/jboss/as/jboss-as-dist/${jboss.version}/jboss-as-dist-${jboss.version}.zip" />
<property name="ojdbc6.version" value="${ojdbc6.version}" />
<property name="postgresql.version" value="${postgresql.version}" />
- <property name="jboss-javassist.version" value="${jboss-javassist.version}" />
+ <property name="jboss-javassist.version" value="${javassist.version}" />
<property name="jsf-api.version" value="${jsf-api.version}" />
<property name="jsf-impl.version" value="${jsf-impl.version}" />
<property name="quartz.version" value="${quartz.version}" />
diff --git a/modules/enterprise/server/container-lib/pom.xml b/modules/enterprise/server/container-lib/pom.xml
index d3ec8c9..cb93a78 100644
--- a/modules/enterprise/server/container-lib/pom.xml
+++ b/modules/enterprise/server/container-lib/pom.xml
@@ -26,9 +26,8 @@
</dependency>
<dependency>
- <groupId>jboss</groupId>
- <artifactId>jboss-common</artifactId>
- <!-- NOTE: The version is defined in the root POM's dependencyManagement section. -->
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-common-core</artifactId>
<scope>provided</scope> <!-- by JBossAS -->
</dependency>
diff --git a/modules/enterprise/server/container/pom.xml b/modules/enterprise/server/container/pom.xml
index f59c1ea..4690600 100644
--- a/modules/enterprise/server/container/pom.xml
+++ b/modules/enterprise/server/container/pom.xml
@@ -163,7 +163,7 @@
<property name="ojdbc6.version" value="${ojdbc6.version}" />
<property name="postgresql.version" value="${postgresql.version}" />
<property name="h2.version" value="${h2.version}" />
- <property name="jboss-javassist.version" value="${jboss-javassist.version}" />
+ <property name="jboss-javassist.version" value="${javassist.version}" />
<property name="jtds.version" value="${jtds.version}" />
<property name="jsf-api.version" value="${jsf-api.version}" />
<property name="jsf-impl.version" value="${jsf-impl.version}" />
diff --git a/modules/enterprise/server/ear/pom.xml b/modules/enterprise/server/ear/pom.xml
index 1367364..c0abedd 100644
--- a/modules/enterprise/server/ear/pom.xml
+++ b/modules/enterprise/server/ear/pom.xml
@@ -97,6 +97,10 @@
<exclusion>
<groupId>javassist</groupId>
<artifactId>javassist</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.javassist</groupId>
+ <artifactId>javassist</artifactId>
</exclusion>
</exclusions>
</dependency>
diff --git a/modules/enterprise/server/itests/pom.xml b/modules/enterprise/server/itests/pom.xml
index 379b29d..d649309 100644
--- a/modules/enterprise/server/itests/pom.xml
+++ b/modules/enterprise/server/itests/pom.xml
@@ -144,7 +144,7 @@
<!-- NOTE: The remaining test deps correspond to the classes contained in hibernate-all.jar and thirdparty-all.jar. -->
<dependency>
- <groupId>javassist</groupId>
+ <groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
<scope>test</scope>
</dependency>
@@ -188,23 +188,6 @@
<scope>provided</scope> <!-- by JBossAS -->
</dependency>
- <!-- includes the org.jboss.ejb3.StrictMaxPool class, which is needed by the PoolClass annotation used on some
- of our SLSB's -->
- <dependency>
- <groupId>jboss</groupId>
- <artifactId>jboss-ejb3</artifactId>
- <!-- NOTE: The version is defined in the root POM's dependencyManagement section. -->
- <scope>provided</scope> <!-- by JBossAS -->
- </dependency>
-
- <!-- for the transaction interrupt EJB3 interceptor -->
- <dependency>
- <groupId>org.jboss.transaction</groupId>
- <artifactId>jboss-jta</artifactId>
- <!-- NOTE: The version is defined in the root POM's dependencyManagement section. -->
- <scope>provided</scope> <!-- by JBossAS -->
- </dependency>
-
<dependency>
<groupId>org.opensymphony.quartz</groupId>
<artifactId>quartz</artifactId>
diff --git a/modules/enterprise/server/jar/pom.xml b/modules/enterprise/server/jar/pom.xml
index f448206..052ad8e 100644
--- a/modules/enterprise/server/jar/pom.xml
+++ b/modules/enterprise/server/jar/pom.xml
@@ -156,9 +156,8 @@
<!-- NOTE: The remaining test deps correspond to the classes contained in hibernate-all.jar and thirdparty-all.jar. -->
<dependency>
- <groupId>javassist</groupId>
+ <groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
- <!-- NOTE: The version is defined in the root POM's dependencyManagement section. -->
<scope>test</scope>
</dependency>
@@ -216,6 +215,12 @@
<scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>org.infinispan</groupId>
+ <artifactId>infinispan-core</artifactId>
+ <version>${infinispan.version}</version>
+ </dependency>
+
<!-- Required by a couple APL and Lather classes - TODO: Remove this once APL and Lather have been excised. -->
<dependency>
<groupId>commons-beanutils</groupId>
@@ -306,82 +311,71 @@
</dependency>
<dependency>
- <groupId>jboss</groupId>
- <artifactId>jboss-annotations-ejb3</artifactId>
- <!-- NOTE: The version is defined in the root POM's dependencyManagement section. -->
- <scope>provided</scope> <!-- by JBossAS -->
+ <groupId>org.jboss.spec.javax.annotation</groupId>
+ <artifactId>jboss-annotations-api_1.1_spec</artifactId>
+ <scope>provided</scope>
</dependency>
-
+
<dependency>
<groupId>jboss</groupId>
- <artifactId>jboss-cache</artifactId>
- <!-- NOTE: The version is defined in the root POM's dependencyManagement section. -->
- <scope>compile</scope>
+ <artifactId>jboss-annotations-ejb3</artifactId>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>jboss</groupId>
- <artifactId>jboss-common</artifactId>
- <!-- NOTE: The version is defined in the root POM's dependencyManagement section. -->
- <scope>provided</scope> <!-- by JBossAS -->
+ <artifactId>jboss-cache</artifactId>
+ <scope>compile</scope>
</dependency>
<dependency>
- <groupId>jboss</groupId>
- <artifactId>jboss-ejb3x</artifactId>
- <!-- NOTE: The version is defined in the root POM's dependencyManagement section. -->
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-common-core</artifactId>
<scope>provided</scope> <!-- by JBossAS -->
</dependency>
- <!-- includes the org.jboss.ejb3.StrictMaxPool class, which is needed by the PoolClass annotation used on some
- of our SLSB's -->
<dependency>
- <groupId>jboss</groupId>
- <artifactId>jboss-ejb3</artifactId>
- <!-- NOTE: The version is defined in the root POM's dependencyManagement section. -->
- <scope>provided</scope> <!-- by JBossAS -->
+ <groupId>org.jboss.spec.javax.annotation</groupId>
+ <artifactId>jboss-annotations-api_1.1_spec</artifactId>
+ <scope>provided</scope>
</dependency>
- <dependency>
- <groupId>jboss</groupId>
- <artifactId>jboss-j2ee</artifactId>
- <!-- NOTE: The version is defined in the root POM's dependencyManagement section. -->
- <scope>provided</scope> <!-- by JBossAS -->
+ <dependency>
+ <groupId>org.jboss.spec.javax.ejb</groupId>
+ <artifactId>jboss-ejb-api_3.1_spec</artifactId>
+ <scope>provided</scope>
</dependency>
-
+
+ <dependency>
+ <groupId>org.jboss.spec.javax.jms</groupId>
+ <artifactId>jboss-jms-api_1.1_spec</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
<dependency>
<groupId>jboss</groupId>
<artifactId>jboss-jmx</artifactId>
- <!-- NOTE: The version is defined in the root POM's dependencyManagement section. -->
- <scope>provided</scope> <!-- by JBossAS -->
</dependency>
-
+
<dependency>
<groupId>jboss</groupId>
<artifactId>jboss-system</artifactId>
- <!-- NOTE: The version is defined in the root POM's dependencyManagement section. -->
- <scope>provided</scope> <!-- by JBossAS -->
</dependency>
<dependency>
<groupId>jboss</groupId>
<artifactId>jbosssx</artifactId>
- <!-- NOTE: The version is defined in the root POM's dependencyManagement section. -->
- <scope>provided</scope> <!-- by JBossAS -->
</dependency>
-
+
<dependency>
<groupId>jboss</groupId>
<artifactId>jbpm</artifactId>
<version>3.1.1</version>
</dependency>
- <!-- for the transaction interrupt EJB3 interceptor -->
<dependency>
<groupId>org.jboss.transaction</groupId>
<artifactId>jboss-jta</artifactId>
- <!-- NOTE: The version is defined in the root POM's dependencyManagement section. -->
- <scope>provided</scope> <!-- by JBossAS -->
</dependency>
<!-- TODO: remove this - tests should all be moved under the test source tree -->
diff --git a/modules/enterprise/server/plugins/groovy-script/pom.xml b/modules/enterprise/server/plugins/groovy-script/pom.xml
index 7ab7666..963b6f0 100644
--- a/modules/enterprise/server/plugins/groovy-script/pom.xml
+++ b/modules/enterprise/server/plugins/groovy-script/pom.xml
@@ -95,9 +95,9 @@
<version>1.0</version>
</artifactItem>
<artifactItem>
- <groupId>javassist</groupId>
+ <groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
- <version>3.8.0.GA</version>
+ <version>${javassist.version}</version>
</artifactItem>
</artifactItems>
<outputDirectory>${project.build.outputDirectory}/lib</outputDirectory>
diff --git a/modules/enterprise/server/xml-schemas/pom.xml b/modules/enterprise/server/xml-schemas/pom.xml
index d034e2d..8fdcb24 100644
--- a/modules/enterprise/server/xml-schemas/pom.xml
+++ b/modules/enterprise/server/xml-schemas/pom.xml
@@ -32,16 +32,9 @@
</dependency>
<dependency>
- <groupId>javax.xml.bind</groupId>
- <artifactId>jaxb-api</artifactId>
- <!-- NOTE: The version is defined in the root POM's dependencyManagement section. -->
- </dependency>
-
- <dependency>
- <groupId>com.sun.xml.bind</groupId>
- <artifactId>jaxb-impl</artifactId>
- <!-- NOTE: The version is defined in the root POM's dependencyManagement section. -->
- <!--<scope>test</scope> not sure about this -->
+ <groupId>org.jboss.spec.javax.xml.bind</groupId>
+ <artifactId>jboss-jaxb-api_2.2_spec</artifactId>
+ <scope>provided</scope>
</dependency>
</dependencies>
diff --git a/modules/helpers/inventory-serializer/pom.xml b/modules/helpers/inventory-serializer/pom.xml
index 0d2cbae..a42effa 100644
--- a/modules/helpers/inventory-serializer/pom.xml
+++ b/modules/helpers/inventory-serializer/pom.xml
@@ -30,8 +30,8 @@
</dependency>
<dependency>
<groupId>javassist</groupId>
- <artifactId>javassist</artifactId>
- <version>3.12.1.GA</version>
+ <artifactId>javassist</artifactId>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
diff --git a/modules/integration-tests/jndi-access/jndi-access-test/pom.xml b/modules/integration-tests/jndi-access/jndi-access-test/pom.xml
index 4db1540..b507652 100644
--- a/modules/integration-tests/jndi-access/jndi-access-test/pom.xml
+++ b/modules/integration-tests/jndi-access/jndi-access-test/pom.xml
@@ -126,7 +126,7 @@
in hibernate-all.jar and thirdparty-all.jar. -->
<dependency>
- <groupId>javassist</groupId>
+ <groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
<scope>test</scope>
</dependency>
diff --git a/modules/integration-tests/mod_cluster-plugin-test/pom.xml b/modules/integration-tests/mod_cluster-plugin-test/pom.xml
index 4f6f13b..ac3da68 100644
--- a/modules/integration-tests/mod_cluster-plugin-test/pom.xml
+++ b/modules/integration-tests/mod_cluster-plugin-test/pom.xml
@@ -102,7 +102,7 @@
</dependency>
<dependency>
- <groupId>javassist</groupId>
+ <groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
<scope>test</scope>
</dependency>
diff --git a/modules/jopr/etc/jbas5-ejb-client/pom.xml b/modules/jopr/etc/jbas5-ejb-client/pom.xml
index 5219c3b..c39c8a8 100644
--- a/modules/jopr/etc/jbas5-ejb-client/pom.xml
+++ b/modules/jopr/etc/jbas5-ejb-client/pom.xml
@@ -103,7 +103,7 @@
</dependency>
<dependency>
- <groupId>javassist</groupId>
+ <groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
<scope>runtime</scope>
</dependency>
diff --git a/modules/jopr/etc/jbas5-ejb2-mdb-test/pom.xml b/modules/jopr/etc/jbas5-ejb2-mdb-test/pom.xml
index e7bdaf3..abb38ef 100644
--- a/modules/jopr/etc/jbas5-ejb2-mdb-test/pom.xml
+++ b/modules/jopr/etc/jbas5-ejb2-mdb-test/pom.xml
@@ -62,7 +62,7 @@
</dependency>
<dependency>
- <groupId>javassist</groupId>
+ <groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
</dependency>
diff --git a/modules/jopr/etc/jbas5-jnp-client/pom.xml b/modules/jopr/etc/jbas5-jnp-client/pom.xml
index 0f95834..a8d7f7e 100644
--- a/modules/jopr/etc/jbas5-jnp-client/pom.xml
+++ b/modules/jopr/etc/jbas5-jnp-client/pom.xml
@@ -91,7 +91,7 @@
</dependency>
<dependency>
- <groupId>javassist</groupId>
+ <groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
<scope>runtime</scope>
</dependency>
diff --git a/modules/jopr/tools/jbas5-plugin-descriptor-gen/pom.xml b/modules/jopr/tools/jbas5-plugin-descriptor-gen/pom.xml
index ec95c4d..c1b2846 100644
--- a/modules/jopr/tools/jbas5-plugin-descriptor-gen/pom.xml
+++ b/modules/jopr/tools/jbas5-plugin-descriptor-gen/pom.xml
@@ -148,7 +148,7 @@
</dependency>
<dependency>
- <groupId>javassist</groupId>
+ <groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
<scope>runtime</scope>
</dependency>
diff --git a/modules/plugins/jboss-as/pom.xml b/modules/plugins/jboss-as/pom.xml
index 75166b9..bc19f7a 100644
--- a/modules/plugins/jboss-as/pom.xml
+++ b/modules/plugins/jboss-as/pom.xml
@@ -53,12 +53,6 @@
</dependency>
<dependency>
- <groupId>jboss</groupId>
- <artifactId>jboss-common</artifactId>
- <!-- NOTE: The version is defined in the root POM's dependencyManagement section. -->
- </dependency>
-
- <dependency>
<groupId>jdom</groupId>
<artifactId>jdom</artifactId>
<version>1.0</version>
@@ -103,10 +97,12 @@
</goals>
<configuration>
<artifactItems>
+ <!--
<artifactItem>
<groupId>jboss</groupId>
<artifactId>jboss-common</artifactId>
</artifactItem>
+ -->
<artifactItem>
<groupId>gnu-getopt</groupId>
<artifactId>getopt</artifactId>
diff --git a/modules/plugins/jboss-cache-v3/pom.xml b/modules/plugins/jboss-cache-v3/pom.xml
index eca07c1..506d37b 100644
--- a/modules/plugins/jboss-cache-v3/pom.xml
+++ b/modules/plugins/jboss-cache-v3/pom.xml
@@ -94,7 +94,7 @@
</dependency>
<dependency>
- <groupId>javassist</groupId>
+ <groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
<scope>test</scope>
</dependency>
diff --git a/modules/pom.xml b/modules/pom.xml
index fc72aa6..b11fc68 100644
--- a/modules/pom.xml
+++ b/modules/pom.xml
@@ -163,7 +163,7 @@
<module>enterprise/comm</module>
<!-- These 6 are needed for the JNDI intergration tests -->
- <module>enterprise/server/container-lib</module>
+ <!-- <module>enterprise/server/container-lib</module> We may no longer need this with AS7-->
<module>enterprise/server/xml-schemas</module>
<module>enterprise/server/safe-invoker</module>
<module>enterprise/server/jar</module>
diff --git a/pom.xml b/pom.xml
index e0f430e..3d6d217 100644
--- a/pom.xml
+++ b/pom.xml
@@ -62,26 +62,49 @@
<!-- Start: JBoss AS Dependency Versions
The dependency versions below are declared together as the versions of each are dependent on the
overall JBoss AS Server version. Meaning, the AS provides these libs. When the Server
- version is changed the versions of each of these should be validated and updated as needed. -->
- <jboss.version>4.2.3.GA</jboss.version>
- <jboss-cache.version>1.4.1.SP9</jboss-cache.version>
+ version is changed the versions of each of these should be validated and updated as needed.
+
<jboss-common.version>1.2.1.GA</jboss-common.version>
- <jboss-jta.version>4.2.3.SP7</jboss-jta.version>
<jboss-remoting.version>2.2.2.SP8</jboss-remoting.version>
<jboss-serialization.version>1.0.3.GA</jboss-serialization.version>
<jboss-javassist.version>3.9.0.GA</jboss-javassist.version>
+ -->
+ <jboss.version>7.1.1.Final</jboss.version>
+
+ <!-- Provided -->
+ <antlr.version>2.7.7</antlr.version>
+ <arquillian.version>1.0.1.Final</arquillian.version>
+ <hibernate.version>4.0.1.Final</hibernate.version>
+ <hibernate-annotations.version>3.5.6-Final</hibernate-annotations.version>
+ <hibernate-jpa-2.0-api.version>1.0.1.Final</hibernate-jpa-2.0-api.version>
+ <infinispan.version>5.1.2.FINAL</infinispan.version>
+ <javax.annotation.api.version>1.0.1.Final</javax.annotation.api.version>
+ <javax.ejb.api.version>1.0.2.Final</javax.ejb.api.version>
+ <javax.jms.api.version>1.0.0.Final</javax.jms.api.version>
+ <javassist.version>3.15.0-GA</javassist.version>
+ <jaxb-api.version>1.0.4.Final</jaxb-api.version>
+ <jaxb-impl.version>2.2.4</jaxb-impl.version>
+ <jboss-common-core.version>2.2.17.GA</jboss-common-core.version>
+ <resteasy.version>2.3.2.Final</resteasy.version>
+
+ <!-- Not Provided -->
+ <jboss-annotations.version>4.2.3.GA</jboss-annotations.version>
+ <jboss-cache.version>1.4.1.SP9</jboss-cache.version>
+ <jboss-jmx.version>4.2.3.GA</jboss-jmx.version>
+ <jboss-jta.version>4.2.3.SP7</jboss-jta.version>
+ <jboss-remoting.version>2.2.2.SP8</jboss-remoting.version>
+ <jboss-serialization.version>1.0.3.GA</jboss-serialization.version>
+ <jboss-system.version>4.2.3.GA</jboss-system.version>
+ <jbosssx.version>4.2.3.GA</jbosssx.version>
+
+
<!-- End: JBoss AS Dependency Versions -->
<commons-logging.version>1.1.0.jboss</commons-logging.version>
<concurrent.version>1.3.4-jboss-update1</concurrent.version> <!-- oswego-concurrent compatible with 4.2.3.GA -->
<findbugs.version>2.3.2</findbugs.version>
<getopt.version>1.0.13</getopt.version>
- <hibernate.version>4.0.1.Final</hibernate.version>
- <hibernate-annotations.version>3.5.6-Final</hibernate-annotations.version>
- <hibernate-jpa-2.0-api.version>1.0.1.Final</hibernate-jpa-2.0-api.version>
<i18nlog.version>1.0.10</i18nlog.version>
- <jaxb-api.version>2.1</jaxb-api.version>
- <jaxb-impl.version>2.1.9</jaxb-impl.version>
<jsf-api.version>1.2_14</jsf-api.version>
<jsf-impl.version>1.2_14</jsf-impl.version>
<log4j.version>1.2.16</log4j.version>
@@ -106,15 +129,12 @@
<augeas.zip.location>${settings.localRepository}/net/augeas/augeas-native/${augeas.version}</augeas.zip.location>
<augeas.zip.mask>*-${augeas.classifier}.zip</augeas.zip.mask>
<ant.contrib.version>1.0b3</ant.contrib.version>
- <resteasy.version>2.3.2.Final</resteasy.version>
<freemarker.version>2.3.18</freemarker.version>
<powermock.version>1.4.11</powermock.version>
- <arquillian.version>1.0.1.Final</arquillian.version>
<animal.sniffer.version>1.7</animal.sniffer.version>
<xercesImpl.version>2.9.1-jbossas-2</xercesImpl.version> <!-- see BZ-820629 and CVE-2009-2625 -->
- <antlr.version>2.7.7</antlr.version>
- <infinispan.version>5.1.2.FINAL</infinispan.version>
<opencsv.version>1.8</opencsv.version>
+
<rhq.db.admin.username>rhqadmin</rhq.db.admin.username>
<rhq.db.admin.password>rhqadmin</rhq.db.admin.password>
@@ -194,25 +214,7 @@
The dependencies below are declared together as the versions of each are dependent on the
overall JBoss AS Server version. Meaning, the AS provides these libs. When the Server
version is changed the versions of each of these should be validated and updated as needed. -->
- <dependency>
- <groupId>org.jboss.jbossas</groupId>
- <artifactId>jboss-as-dist</artifactId>
- <version>${jboss.version}</version>
- <type>zip</type>
- </dependency>
-
- <dependency>
- <groupId>jboss</groupId>
- <artifactId>jboss-all-client</artifactId>
- <version>${jboss.version}</version>
- </dependency>
-
- <dependency>
- <groupId>jboss</groupId>
- <artifactId>jboss-annotations-ejb3</artifactId>
- <version>${jboss.version}</version>
- </dependency>
-
+
<dependency>
<groupId>jboss</groupId>
<artifactId>jboss-cache</artifactId>
@@ -221,45 +223,44 @@
<dependency>
<groupId>jboss</groupId>
- <artifactId>jboss-common</artifactId>
- <version>${jboss-common.version}</version>
+ <artifactId>jboss-annotations-ejb3</artifactId>
+ <version>${jboss-annotations.version}</version>
</dependency>
<dependency>
- <groupId>jboss</groupId>
- <artifactId>jboss-ejb3x</artifactId>
- <version>${jboss.version}</version>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-common-core</artifactId>
+ <version>${jboss-common-core.version}</version>
</dependency>
<dependency>
- <groupId>jboss</groupId>
- <artifactId>jboss-ejb3</artifactId>
- <version>${jboss.version}</version>
+ <groupId>org.jboss.spec.javax.annotation</groupId>
+ <artifactId>jboss-annotations-api_1.1_spec</artifactId>
+ <version>${javax.annotation.api.version}</version>
</dependency>
- <dependency>
- <groupId>jboss</groupId>
- <artifactId>jboss-ejb3</artifactId>
- <classifier>client</classifier>
- <version>${jboss.version}</version>
+ <dependency>
+ <groupId>org.jboss.spec.javax.ejb</groupId>
+ <artifactId>jboss-ejb-api_3.1_spec</artifactId>
+ <version>${javax.ejb.api.version}</version>
</dependency>
- <dependency>
- <groupId>jboss</groupId>
- <artifactId>jboss-j2ee</artifactId>
- <version>${jboss.version}</version>
+ <dependency>
+ <groupId>org.jboss.spec.javax.jms</groupId>
+ <artifactId>jboss-jms-api_1.1_spec</artifactId>
+ <version>${javax.jms.api.version}</version>
</dependency>
-
+
<dependency>
- <groupId>javassist</groupId>
+ <groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
- <version>${jboss-javassist.version}</version>
+ <version>${javassist.version}</version>
</dependency>
<dependency>
<groupId>jboss</groupId>
<artifactId>jboss-jmx</artifactId>
- <version>${jboss.version}</version>
+ <version>${jboss-jmx.version}</version>
</dependency>
<dependency>
@@ -277,13 +278,13 @@
<dependency>
<groupId>jboss</groupId>
<artifactId>jbosssx</artifactId>
- <version>${jboss.version}</version>
+ <version>${jbosssx.version}</version>
</dependency>
<dependency>
<groupId>jboss</groupId>
<artifactId>jboss-system</artifactId>
- <version>${jboss.version}</version>
+ <version>${jboss-system.version}</version>
</dependency>
<dependency>
@@ -321,8 +322,8 @@
</dependency>
<dependency>
- <groupId>javax.xml.bind</groupId>
- <artifactId>jaxb-api</artifactId>
+ <groupId>org.jboss.spec.javax.xml.bind</groupId>
+ <artifactId>jboss-jaxb-api_2.2_spec</artifactId>
<version>${jaxb-api.version}</version>
</dependency>
@@ -536,14 +537,6 @@
<scope>provided</scope>
</dependency>
- <!-- JAXB annotations -->
- <dependency>
- <groupId>javax.xml.bind</groupId>
- <artifactId>jaxb-api</artifactId>
- <scope>provided</scope>
- </dependency>
- <!-- end of workaround -->
-
<dependency>
<groupId>net.sourceforge.cobertura</groupId>
<artifactId>cobertura</artifactId>
commit feed11e767d9dfe1780037f51fb9db5813a63adb
Author: Jay Shaughnessy <jshaughn(a)jshaughn.csb>
Date: Thu Sep 6 09:26:22 2012 -0400
Eclipse, add Resource filter on dev-container
diff --git a/.project b/.project
index 13e46c7..c397635 100644
--- a/.project
+++ b/.project
@@ -26,4 +26,15 @@
<nature>org.hibernate.eclipse.console.hibernateNature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
</natures>
+ <filteredResources>
+ <filter>
+ <id>1346851888265</id>
+ <name></name>
+ <type>26</type>
+ <matcher>
+ <id>org.eclipse.ui.ide.multiFilter</id>
+ <arguments>1.0-name-matches-false-false-dev-container</arguments>
+ </matcher>
+ </filter>
+ </filteredResources>
</projectDescription>
11 years, 9 months
[rhq] Branch 'rhq-on-as7' - 2 commits - modules/enterprise
by mazz
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/agentupdate/AgentUpdateServlet.java | 43 ++++++----
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/download/DownloadServlet.java | 3
2 files changed, 31 insertions(+), 15 deletions(-)
New commits:
commit 7fa53b1db14c6b6d11e0ce8a6fe48eca5e8de962
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Mon Sep 10 11:33:58 2012 -0400
fix the file path to match that of AS7
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/download/DownloadServlet.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/download/DownloadServlet.java
index 7d1bd84..52e17b3 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/download/DownloadServlet.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/download/DownloadServlet.java
@@ -33,6 +33,7 @@ import javax.servlet.http.HttpServletResponse;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+
import org.rhq.core.domain.cloud.Server.OperationMode;
import org.rhq.core.util.stream.StreamUtil;
import org.rhq.enterprise.server.util.LookupUtil;
@@ -231,7 +232,7 @@ public class DownloadServlet extends HttpServlet {
private File getRootDownloadsDir() throws Exception {
File serverHomeDir = LookupUtil.getCoreServer().getJBossServerHomeDir();
- File downloadDir = new File(serverHomeDir, "deploy/rhq.ear/rhq-downloads");
+ File downloadDir = new File(serverHomeDir, "deployments/rhq.ear/rhq-downloads");
if (!downloadDir.exists()) {
throw new FileNotFoundException("Missing downloads directory at [" + downloadDir + "]");
}
commit d82874f05c767afae748246dc65a4889e19e3c9d
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Mon Sep 10 11:33:38 2012 -0400
fix agent update servlet so it lazily initializes. this way, we don't require the EJBs to be deployed beforehand. only when the first request to obtain the agent binary will the servlet initialize and by then the ejbs will have been deployed
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/agentupdate/AgentUpdateServlet.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/agentupdate/AgentUpdateServlet.java
index cd64648..c4601ec 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/agentupdate/AgentUpdateServlet.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/agentupdate/AgentUpdateServlet.java
@@ -64,32 +64,47 @@ public class AgentUpdateServlet extends HttpServlet {
private AgentManagerLocal agentManager = null;
+ private boolean initialized = false;
+
@Override
public void init() throws ServletException {
- log.info("Starting the RHQ agent update servlet...");
+ log.info("Starting the RHQ agent update servlet");
+ }
- // make sure we have a agent update binary file; log its location
- try {
- log.info("Agent Update Binary File: " + getAgentUpdateBinaryFile());
- } catch (Throwable t) {
- log.error("Missing agent update binary file - agents will not be able to update", t);
- }
+ private synchronized void loadAgentUpdateBinaryInfo() throws ServletException {
+ if (!initialized) {
+ log.info("RHQ agent update servlet is looking up binary file information...");
- // make sure we create a version file if we have to by getting the version file now
- try {
- File versionFile = getAgentUpdateVersionFile();
+ // make sure we have a agent update binary file; log its location
+ try {
+ log.info("Agent Update Binary File: " + getAgentUpdateBinaryFile());
+ } catch (Throwable t) {
+ log.error("Missing agent update binary file - agents will not be able to update", t);
+ }
+
+ // make sure we create a version file if we have to by getting the version file now
+ try {
+ File versionFile = getAgentUpdateVersionFile();
- // log the version info - this also makes sure we can read it back in
- log.debug(versionFile + ": " + new String(StreamUtil.slurp(new FileInputStream(versionFile))));
+ // log the version info - this also makes sure we can read it back in
+ log.debug(versionFile + ": " + new String(StreamUtil.slurp(new FileInputStream(versionFile))));
- } catch (Throwable t) {
- log.error("Cannot determine the agent version information - agents will not be able to update.", t);
+ } catch (Throwable t) {
+ log.error("Cannot determine the agent version information - agents will not be able to update.", t);
+ }
+
+ initialized = true;
}
}
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
+ // lazily initialize the servlet - we do this because when we started deploying on AS7, our servlets
+ // init() method was being called before the agent SLSB is ready. So we don't init() this at startup,
+ // rather, we now init this servlet the first time someone requests the agent update binary file.
+ loadAgentUpdateBinaryInfo();
+
// seeing odd browser caching issues, even though we set Last-Modified. so force no caching for now
disableBrowserCache(resp);
11 years, 9 months