[rhq] modules/plugins
by Heiko W. Rupp
modules/plugins/irc/pom.xml | 10
modules/plugins/irc/src/main/java/org/rhq/plugins/irc/IRCChannelComponent.java | 134 ++++++++++
modules/plugins/irc/src/main/java/org/rhq/plugins/irc/IRCChannelDiscoveryComponent.java | 53 +++
modules/plugins/irc/src/main/java/org/rhq/plugins/irc/IRCRepoComponent.java | 134 ----------
modules/plugins/irc/src/main/java/org/rhq/plugins/irc/IRCRepoDiscoveryComponent.java | 53 ---
modules/plugins/irc/src/main/java/org/rhq/plugins/irc/IRCServerComponent.java | 76 ++---
modules/plugins/irc/src/main/resources/META-INF/rhq-plugin.xml | 20 -
7 files changed, 240 insertions(+), 240 deletions(-)
New commits:
commit 7b884588ee0538748eb34b24cb83fa13fe5026d8
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Tue Aug 3 20:27:41 2010 +0200
Even more channel->repo fallout fixing
diff --git a/modules/plugins/irc/pom.xml b/modules/plugins/irc/pom.xml
index def88d2..44a34b9 100644
--- a/modules/plugins/irc/pom.xml
+++ b/modules/plugins/irc/pom.xml
@@ -11,13 +11,13 @@
<groupId>org.rhq</groupId>
<version>4.0.0-SNAPSHOT</version>
</parent>
-
+
<groupId>org.rhq</groupId>
<artifactId>rhq-irc-plugin</artifactId>
<packaging>jar</packaging>
-
+
<name>RHQ IRC Server Plugin</name>
- <description>Remote monitoring of IRC repos</description>
+ <description>Remote monitoring of IRC channels</description>
<build>
<plugins>
@@ -167,12 +167,12 @@
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
-
+
<dependency>
<groupId>pircbot</groupId>
<artifactId>pircbot</artifactId>
<version>1.4.2</version>
- </dependency>
+ </dependency>
</dependencies>
</project>
diff --git a/modules/plugins/irc/src/main/java/org/rhq/plugins/irc/IRCChannelComponent.java b/modules/plugins/irc/src/main/java/org/rhq/plugins/irc/IRCChannelComponent.java
new file mode 100644
index 0000000..3475b00
--- /dev/null
+++ b/modules/plugins/irc/src/main/java/org/rhq/plugins/irc/IRCChannelComponent.java
@@ -0,0 +1,134 @@
+package org.rhq.plugins.irc;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.event.Event;
+import org.rhq.core.domain.event.EventSeverity;
+import org.rhq.core.domain.measurement.AvailabilityType;
+import org.rhq.core.domain.measurement.MeasurementDataNumeric;
+import org.rhq.core.domain.measurement.MeasurementReport;
+import org.rhq.core.domain.measurement.MeasurementScheduleRequest;
+import org.rhq.core.pluginapi.event.EventContext;
+import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException;
+import org.rhq.core.pluginapi.inventory.ResourceComponent;
+import org.rhq.core.pluginapi.inventory.ResourceContext;
+import org.rhq.core.pluginapi.measurement.MeasurementFacet;
+import org.rhq.core.pluginapi.operation.OperationContext;
+import org.rhq.core.pluginapi.operation.OperationFacet;
+import org.rhq.core.pluginapi.operation.OperationResult;
+
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicLong;
+
+
+/**
+ * @author Greg Hinkle
+ */
+public class IRCChannelComponent implements ResourceComponent<IRCServerComponent>, MeasurementFacet, OperationFacet {
+
+ private final Log log = LogFactory.getLog(this.getClass());
+
+
+ private ResourceContext<IRCServerComponent> context;
+ private EventContext eventContext;
+ private String channel;
+
+ private AtomicLong messageCount = new AtomicLong();
+
+
+
+ /**
+ * Return availability of this resource
+ *
+ * @see org.rhq.core.pluginapi.inventory.ResourceComponent#getAvailability()
+ */
+ public AvailabilityType getAvailability() {
+ if (!context.getParentResourceComponent().isInChannel(channel)) {
+ context.getParentResourceComponent().registerChannel(this);
+ }
+
+ // TODO supply real implementation
+ return AvailabilityType.UP;
+ }
+
+
+ /**
+ * Start the resource connection
+ *
+ * @see org.rhq.core.pluginapi.inventory.ResourceComponent#start(org.rhq.core.pluginapi.inventory.ResourceContext)
+ */
+ public void start(ResourceContext<IRCServerComponent> context) throws InvalidPluginConfigurationException, Exception {
+ this.context = context;
+ Configuration conf = context.getPluginConfiguration();
+ // TODO add code to start the resource / connection to it
+ channel = conf.getSimple(IRCChannelDiscoveryComponent.CONFIG_CHANNEL).getStringValue();
+
+ eventContext = context.getEventContext();
+
+ context.getParentResourceComponent().registerChannel(this);
+ }
+
+
+ /**
+ * Tear down the rescource connection
+ *
+ * @see org.rhq.core.pluginapi.inventory.ResourceComponent#stop()
+ */
+ public void stop() {
+
+ context.getParentResourceComponent().unregisterChannel(this);
+
+ }
+
+
+ /**
+ * Gather measurement data
+ *
+ * @see org.rhq.core.pluginapi.measurement.MeasurementFacet#getValues(org.rhq.core.domain.measurement.MeasurementReport, java.util.Set)
+ */
+ public void getValues(MeasurementReport report, Set<MeasurementScheduleRequest> metrics) throws Exception {
+
+ for (MeasurementScheduleRequest req : metrics) {
+ if (req.getName().equals("users")) {
+ double count = this.context.getParentResourceComponent().getUserCount(this.getChannel());
+ MeasurementDataNumeric res = new MeasurementDataNumeric(req, count);
+ report.addData(res);
+ } else if (req.getName().equals("messages")) {
+ report.addData( new MeasurementDataNumeric(req, Double.valueOf(messageCount.get())));
+ }
+ }
+ }
+
+
+
+ /**
+ * Invokes the passed operation on the managed resource
+ *
+ * @param name Name of the operation
+ * @param params The method parameters
+ * @return An operation result
+ * @see org.rhq.core.pluginapi.operation.OperationFacet
+ */
+ public OperationResult invokeOperation(String name, Configuration params) throws Exception {
+
+ OperationResult res = new OperationResult();
+ if ("sendMessage".equals(name)) {
+ String message = params.getSimple("message").getStringValue();
+ context.getParentResourceComponent().sendMessage(channel, message);
+ }
+ return res;
+ }
+
+
+ public String getChannel() {
+ return channel;
+ }
+
+ public void acceptMessage(String sender, String login, String hostname, String message) {
+ Event event = new Event("message", sender, System.currentTimeMillis(), EventSeverity.INFO, message);
+ this.eventContext.publishEvent(event);
+
+ this.messageCount.incrementAndGet();
+ }
+}
\ No newline at end of file
diff --git a/modules/plugins/irc/src/main/java/org/rhq/plugins/irc/IRCChannelDiscoveryComponent.java b/modules/plugins/irc/src/main/java/org/rhq/plugins/irc/IRCChannelDiscoveryComponent.java
new file mode 100644
index 0000000..e5a9a96
--- /dev/null
+++ b/modules/plugins/irc/src/main/java/org/rhq/plugins/irc/IRCChannelDiscoveryComponent.java
@@ -0,0 +1,53 @@
+package org.rhq.plugins.irc;
+
+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.ResourceDiscoveryComponent;
+import org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext;
+
+import java.util.HashSet;
+import java.util.Set;
+import java.util.List;
+
+
+/**
+ * Discovery class
+ * @author Greg Hinkle
+ */
+public class IRCChannelDiscoveryComponent implements ResourceDiscoveryComponent<IRCServerComponent> {
+
+ private final Log log = LogFactory.getLog(this.getClass());
+
+ public static final String CONFIG_CHANNEL = "channelName";
+
+ /**
+ * Run the discovery
+ */
+ public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext discoveryContext) throws Exception {
+
+ Set<DiscoveredResourceDetails> discoveredResources = new HashSet<DiscoveredResourceDetails>();
+
+ List<Configuration> contextPluginConfigurations = discoveryContext.getPluginConfigurations();
+ for (Configuration config : contextPluginConfigurations) {
+
+ String channel = config.getSimple(CONFIG_CHANNEL).getStringValue();
+
+ DiscoveredResourceDetails details =
+ new DiscoveredResourceDetails(
+ discoveryContext.getResourceType(),
+ channel,
+ "Channel " + channel,
+ null, null,
+ config,
+ null
+ );
+
+ discoveredResources.add(details);
+ }
+
+ return discoveredResources;
+
+ }
+}
\ No newline at end of file
diff --git a/modules/plugins/irc/src/main/java/org/rhq/plugins/irc/IRCRepoComponent.java b/modules/plugins/irc/src/main/java/org/rhq/plugins/irc/IRCRepoComponent.java
deleted file mode 100644
index e39968d..0000000
--- a/modules/plugins/irc/src/main/java/org/rhq/plugins/irc/IRCRepoComponent.java
+++ /dev/null
@@ -1,134 +0,0 @@
-package org.rhq.plugins.irc;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.rhq.core.domain.configuration.Configuration;
-import org.rhq.core.domain.event.Event;
-import org.rhq.core.domain.event.EventSeverity;
-import org.rhq.core.domain.measurement.AvailabilityType;
-import org.rhq.core.domain.measurement.MeasurementDataNumeric;
-import org.rhq.core.domain.measurement.MeasurementReport;
-import org.rhq.core.domain.measurement.MeasurementScheduleRequest;
-import org.rhq.core.pluginapi.event.EventContext;
-import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException;
-import org.rhq.core.pluginapi.inventory.ResourceComponent;
-import org.rhq.core.pluginapi.inventory.ResourceContext;
-import org.rhq.core.pluginapi.measurement.MeasurementFacet;
-import org.rhq.core.pluginapi.operation.OperationContext;
-import org.rhq.core.pluginapi.operation.OperationFacet;
-import org.rhq.core.pluginapi.operation.OperationResult;
-
-import java.util.Set;
-import java.util.concurrent.atomic.AtomicLong;
-
-
-/**
- * @author Greg Hinkle
- */
-public class IRCRepoComponent implements ResourceComponent<IRCServerComponent>, MeasurementFacet, OperationFacet {
-
- private final Log log = LogFactory.getLog(this.getClass());
-
-
- private ResourceContext<IRCServerComponent> context;
- private EventContext eventContext;
- private String repo;
-
- private AtomicLong messageCount = new AtomicLong();
-
-
-
- /**
- * Return availability of this resource
- *
- * @see org.rhq.core.pluginapi.inventory.ResourceComponent#getAvailability()
- */
- public AvailabilityType getAvailability() {
- if (!context.getParentResourceComponent().isInRepo(repo)) {
- context.getParentResourceComponent().registerRepo(this);
- }
-
- // TODO supply real implementation
- return AvailabilityType.UP;
- }
-
-
- /**
- * Start the resource connection
- *
- * @see org.rhq.core.pluginapi.inventory.ResourceComponent#start(org.rhq.core.pluginapi.inventory.ResourceContext)
- */
- public void start(ResourceContext<IRCServerComponent> context) throws InvalidPluginConfigurationException, Exception {
- this.context = context;
- Configuration conf = context.getPluginConfiguration();
- // TODO add code to start the resource / connection to it
- repo = conf.getSimple(IRCRepoDiscoveryComponent.CONFIG_REPO).getStringValue();
-
- eventContext = context.getEventContext();
-
- context.getParentResourceComponent().registerRepo(this);
- }
-
-
- /**
- * Tear down the rescource connection
- *
- * @see org.rhq.core.pluginapi.inventory.ResourceComponent#stop()
- */
- public void stop() {
-
- context.getParentResourceComponent().unregisterRepo(this);
-
- }
-
-
- /**
- * Gather measurement data
- *
- * @see org.rhq.core.pluginapi.measurement.MeasurementFacet#getValues(org.rhq.core.domain.measurement.MeasurementReport, java.util.Set)
- */
- public void getValues(MeasurementReport report, Set<MeasurementScheduleRequest> metrics) throws Exception {
-
- for (MeasurementScheduleRequest req : metrics) {
- if (req.getName().equals("users")) {
- double count = this.context.getParentResourceComponent().getUserCount(this.getRepo());
- MeasurementDataNumeric res = new MeasurementDataNumeric(req, count);
- report.addData(res);
- } else if (req.getName().equals("messages")) {
- report.addData( new MeasurementDataNumeric(req, Double.valueOf(messageCount.get())));
- }
- }
- }
-
-
-
- /**
- * Invokes the passed operation on the managed resource
- *
- * @param name Name of the operation
- * @param params The method parameters
- * @return An operation result
- * @see org.rhq.core.pluginapi.operation.OperationFacet
- */
- public OperationResult invokeOperation(String name, Configuration params) throws Exception {
-
- OperationResult res = new OperationResult();
- if ("sendMessage".equals(name)) {
- String message = params.getSimple("message").getStringValue();
- context.getParentResourceComponent().sendMessage(repo, message);
- }
- return res;
- }
-
-
- public String getRepo() {
- return repo;
- }
-
- public void acceptMessage(String sender, String login, String hostname, String message) {
- Event event = new Event("message", sender, System.currentTimeMillis(), EventSeverity.INFO, message);
- this.eventContext.publishEvent(event);
-
- this.messageCount.incrementAndGet();
- }
-}
\ No newline at end of file
diff --git a/modules/plugins/irc/src/main/java/org/rhq/plugins/irc/IRCRepoDiscoveryComponent.java b/modules/plugins/irc/src/main/java/org/rhq/plugins/irc/IRCRepoDiscoveryComponent.java
deleted file mode 100644
index a1aab8d..0000000
--- a/modules/plugins/irc/src/main/java/org/rhq/plugins/irc/IRCRepoDiscoveryComponent.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package org.rhq.plugins.irc;
-
-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.ResourceDiscoveryComponent;
-import org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext;
-
-import java.util.HashSet;
-import java.util.Set;
-import java.util.List;
-
-
-/**
- * Discovery class
- * @author Greg Hinkle
- */
-public class IRCRepoDiscoveryComponent implements ResourceDiscoveryComponent<IRCServerComponent> {
-
- private final Log log = LogFactory.getLog(this.getClass());
-
- public static final String CONFIG_REPO = "repoName";
-
- /**
- * Run the discovery
- */
- public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext discoveryContext) throws Exception {
-
- Set<DiscoveredResourceDetails> discoveredResources = new HashSet<DiscoveredResourceDetails>();
-
- List<Configuration> contextPluginConfigurations = discoveryContext.getPluginConfigurations();
- for (Configuration config : contextPluginConfigurations) {
-
- String repo = config.getSimple(CONFIG_REPO).getStringValue();
-
- DiscoveredResourceDetails details =
- new DiscoveredResourceDetails(
- discoveryContext.getResourceType(),
- repo,
- "Repo " + repo,
- null, null,
- config,
- null
- );
-
- discoveredResources.add(details);
- }
-
- return discoveredResources;
-
- }
-}
\ No newline at end of file
diff --git a/modules/plugins/irc/src/main/java/org/rhq/plugins/irc/IRCServerComponent.java b/modules/plugins/irc/src/main/java/org/rhq/plugins/irc/IRCServerComponent.java
index 2ba1b34..5f169e8 100644
--- a/modules/plugins/irc/src/main/java/org/rhq/plugins/irc/IRCServerComponent.java
+++ b/modules/plugins/irc/src/main/java/org/rhq/plugins/irc/IRCServerComponent.java
@@ -1,6 +1,5 @@
package org.rhq.plugins.irc;
-import java.util.Set;
import java.util.Map;
import java.util.HashMap;
import java.util.Arrays;
@@ -30,14 +29,14 @@ public class IRCServerComponent implements ResourceComponent, OperationFacet {
private Bot bot;
- private Map<String, IRCRepoComponent> repos = new HashMap<String, IRCRepoComponent>();
+ private Map<String, IRCChannelComponent> channels = new HashMap<String, IRCChannelComponent>();
private String host;
private String port;
private String nick;
- private List<String> activeRepos;
+ private List<String> activeChannels;
- private Map<String, RepoInfo> info = new HashMap<String, RepoInfo>();
+ private Map<String, ChannelInfo> info = new HashMap<String, ChannelInfo>();
/**
@@ -55,7 +54,7 @@ public class IRCServerComponent implements ResourceComponent, OperationFacet {
log.warn("Failure to connect to IRC server " + host + " reason: " + e.getMessage());
}
}
- activeRepos = Arrays.asList(this.bot.getChannels());
+ activeChannels = Arrays.asList(this.bot.getChannels());
return this.bot.isConnected() ? AvailabilityType.UP : AvailabilityType.DOWN;
}
@@ -81,61 +80,61 @@ public class IRCServerComponent implements ResourceComponent, OperationFacet {
}
- public void registerRepo(IRCRepoComponent repoComponent) {
- this.repos.put(repoComponent.getRepo(), repoComponent);
+ public void registerChannel(IRCChannelComponent channelComponent) {
+ this.channels.put(channelComponent.getChannel(), channelComponent);
- this.bot.joinChannel(repoComponent.getRepo());
- updateRepos();
+ this.bot.joinChannel(channelComponent.getChannel());
+ updateChannels();
}
- public void unregisterRepo(IRCRepoComponent repoComponent) {
- this.bot.partChannel(repoComponent.getRepo());
- this.repos.remove(repoComponent.getRepo());
+ public void unregisterChannel(IRCChannelComponent channelComponent) {
+ this.bot.partChannel(channelComponent.getChannel());
+ this.channels.remove(channelComponent.getChannel());
}
- public boolean isInRepo(String repo) {
- return activeRepos.contains(repo);
+ public boolean isInChannel(String channel) {
+ return activeChannels.contains(channel);
}
- public void sendMessage(String repo, String message) {
- this.bot.sendMessage(repo, message);
+ public void sendMessage(String channel, String message) {
+ this.bot.sendMessage(channel, message);
}
public OperationResult invokeOperation(String name, Configuration parameters) throws InterruptedException, Exception {
- if (name.equals("listRepos")) {
+ if (name.equals("listChannels")) {
OperationResult result = new OperationResult();
Configuration resultConfig = result.getComplexResults();
- PropertyList repoList = new PropertyList("repoList");
+ PropertyList channelList = new PropertyList("channelList");
this.bot.listChannels();
Thread.sleep(5000); // TODO is this long enough... any other way to know when the list is done?
- for (RepoInfo repoInfo : info.values()) {
- PropertyMap repoMap = new PropertyMap("repoMap");
- repoMap.put(new PropertySimple("repo", repoInfo.repo));
- repoMap.put(new PropertySimple("userCount", repoInfo.userCount));
- repoMap.put(new PropertySimple("topic", repoInfo.topic));
- repoList.add(repoMap);
+ for (ChannelInfo channelInfo : info.values()) {
+ PropertyMap channelMap = new PropertyMap("channelMap");
+ channelMap.put(new PropertySimple("channel", channelInfo.channel));
+ channelMap.put(new PropertySimple("userCount", channelInfo.userCount));
+ channelMap.put(new PropertySimple("topic", channelInfo.topic));
+ channelList.add(channelMap);
}
- resultConfig.put(repoList);
+ resultConfig.put(channelList);
return result;
}
return null;
}
- public int getUserCount(String repo) {
- return this.bot.getUsers(repo).length;
+ public int getUserCount(String channel) {
+ return this.bot.getUsers(channel).length;
}
- public static class RepoInfo {
- String repo;
+ public static class ChannelInfo {
+ String channel;
int userCount;
String topic;
- public RepoInfo(String repo, int userCount, String topic) {
- this.repo = repo;
+ public ChannelInfo(String channel, int userCount, String topic) {
+ this.channel = channel;
this.userCount = userCount;
this.topic = topic;
}
@@ -147,19 +146,20 @@ public class IRCServerComponent implements ResourceComponent, OperationFacet {
this.setName(nick);
}
- protected void onRepoInfo(String repo, int userCount, String topic) {
- info.put(repo, new RepoInfo(repo, userCount, topic));
+ @Override
+ protected void onChannelInfo(String channel, int userCount, String topic) {
+ info.put(channel, new ChannelInfo(channel, userCount, topic));
}
- public void onMessage(String repo, String sender, String login, String hostname, String message) {
+ public void onMessage(String channel, String sender, String login, String hostname, String message) {
- IRCRepoComponent component = IRCServerComponent.this.repos.get(repo);
+ IRCChannelComponent component = IRCServerComponent.this.channels.get(channel);
if (component != null) {
component.acceptMessage(sender, login, hostname, message);
}
if (message.contains(getName()) && sender.contains("ghinkle")) {
- sendMessage(repo, "monitoring " + repos.size() + " repos");
+ sendMessage(channel, "monitoring " + channels.size() + " channels");
}
}
}
@@ -175,8 +175,8 @@ public class IRCServerComponent implements ResourceComponent, OperationFacet {
}
- private void updateRepos() {
- activeRepos = Arrays.asList(this.bot.getChannels());
+ private void updateChannels() {
+ activeChannels = Arrays.asList(this.bot.getChannels());
}
}
\ No newline at end of file
diff --git a/modules/plugins/irc/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/irc/src/main/resources/META-INF/rhq-plugin.xml
index 7376907..f4dcbc5 100644
--- a/modules/plugins/irc/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/irc/src/main/resources/META-INF/rhq-plugin.xml
@@ -20,11 +20,11 @@
</plugin-configuration>
- <operation name="listRepos" description="List out all repos">
+ <operation name="listChannels" description="List out all channels">
<results>
- <c:list-property name="repoList">
- <c:map-property name="repoMap">
- <c:simple-property name="repo"/>
+ <c:list-property name="channelList">
+ <c:map-property name="channelMap">
+ <c:simple-property name="channel"/>
<c:simple-property name="userCount"/>
<c:simple-property name="topic"/>
</c:map-property>
@@ -33,19 +33,19 @@
</operation>
<service
- name="IRC Repo"
- discovery="IRCRepoDiscoveryComponent"
- class="IRCRepoComponent"
+ name="IRC Channel"
+ discovery="IRCChannelDiscoveryComponent"
+ class="IRCChannelComponent"
supportsManualAdd="true">
<plugin-configuration>
- <c:simple-property name="repoName"/>
+ <c:simple-property name="channelName"/>
</plugin-configuration>
- <operation name="sendMessage" description="Send a message to the repo">
+ <operation name="sendMessage" description="Send a message to the channel">
<parameters>
- <c:simple-property name="message" description="The message to send to the repo" required="true"/>
+ <c:simple-property name="message" description="The message to send to the channel" required="true"/>
</parameters>
</operation>
13 years, 9 months
[rhq] modules/plugins
by Heiko W. Rupp
modules/plugins/irc/src/main/java/org/rhq/plugins/irc/IRCServerComponent.java | 14 +++-------
modules/plugins/pom.xml | 1
2 files changed, 6 insertions(+), 9 deletions(-)
New commits:
commit ccd97968320c1142f06ec6e0aa6d72d7a638c1e3
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Tue Aug 3 20:05:39 2010 +0200
More channel->repo fallout fixing
diff --git a/modules/plugins/irc/src/main/java/org/rhq/plugins/irc/IRCServerComponent.java b/modules/plugins/irc/src/main/java/org/rhq/plugins/irc/IRCServerComponent.java
index e8176a1..2ba1b34 100644
--- a/modules/plugins/irc/src/main/java/org/rhq/plugins/irc/IRCServerComponent.java
+++ b/modules/plugins/irc/src/main/java/org/rhq/plugins/irc/IRCServerComponent.java
@@ -1,12 +1,10 @@
package org.rhq.plugins.irc;
-import java.util.HashSet;
import java.util.Set;
import java.util.Map;
import java.util.HashMap;
import java.util.Arrays;
import java.util.List;
-import java.io.IOException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -22,7 +20,6 @@ import org.rhq.core.pluginapi.inventory.ResourceContext;
import org.rhq.core.pluginapi.operation.OperationFacet;
import org.rhq.core.pluginapi.operation.OperationResult;
import org.jibble.pircbot.PircBot;
-import org.jibble.pircbot.IrcException;
/**
@@ -58,7 +55,7 @@ public class IRCServerComponent implements ResourceComponent, OperationFacet {
log.warn("Failure to connect to IRC server " + host + " reason: " + e.getMessage());
}
}
- activeRepos = Arrays.asList(this.bot.getRepos());
+ activeRepos = Arrays.asList(this.bot.getChannels());
return this.bot.isConnected() ? AvailabilityType.UP : AvailabilityType.DOWN;
}
@@ -87,12 +84,12 @@ public class IRCServerComponent implements ResourceComponent, OperationFacet {
public void registerRepo(IRCRepoComponent repoComponent) {
this.repos.put(repoComponent.getRepo(), repoComponent);
- this.bot.joinRepo(repoComponent.getRepo());
+ this.bot.joinChannel(repoComponent.getRepo());
updateRepos();
}
public void unregisterRepo(IRCRepoComponent repoComponent) {
- this.bot.partRepo(repoComponent.getRepo());
+ this.bot.partChannel(repoComponent.getRepo());
this.repos.remove(repoComponent.getRepo());
}
@@ -111,7 +108,7 @@ public class IRCServerComponent implements ResourceComponent, OperationFacet {
Configuration resultConfig = result.getComplexResults();
PropertyList repoList = new PropertyList("repoList");
- this.bot.listRepos();
+ this.bot.listChannels();
Thread.sleep(5000); // TODO is this long enough... any other way to know when the list is done?
@@ -150,7 +147,6 @@ public class IRCServerComponent implements ResourceComponent, OperationFacet {
this.setName(nick);
}
- @Override
protected void onRepoInfo(String repo, int userCount, String topic) {
info.put(repo, new RepoInfo(repo, userCount, topic));
}
@@ -180,7 +176,7 @@ public class IRCServerComponent implements ResourceComponent, OperationFacet {
private void updateRepos() {
- activeRepos = Arrays.asList(this.bot.getRepos());
+ activeRepos = Arrays.asList(this.bot.getChannels());
}
}
\ No newline at end of file
diff --git a/modules/plugins/pom.xml b/modules/plugins/pom.xml
index 4d439cf..880254c 100644
--- a/modules/plugins/pom.xml
+++ b/modules/plugins/pom.xml
@@ -164,6 +164,7 @@
<modules>
<module>byteman</module>
+ <module>irc</module>
<module>iis</module>
<module>database</module>
13 years, 9 months
[rhq] .classpath
by mazz
.classpath | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
New commits:
commit 0b56da2b0dc06bdc76552196c541ff8dd22302c5
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Tue Aug 3 11:43:33 2010 -0400
- taking out iptables and services plugins from eclipse .classpath:
iptables plugin is not functional nor compilable.
services plugins is half-baked and needs its dependencies reworked so its buildable via maven in a proper way
- making sure EMS is at the 1.2.13 level as well
diff --git a/.classpath b/.classpath
index 15da9c3..35714ec 100644
--- a/.classpath
+++ b/.classpath
@@ -2,9 +2,6 @@
<classpath>
<classpathentry kind="src" path="modules/common/jboss-as/src/main/java"/>
<classpathentry kind="src" path="modules/plugins/irc/src/main/java"/>
- <classpathentry kind="src" path="modules/plugins/services/src/main/java"/>
- <classpathentry kind="src" path="modules/plugins/iptables/src/main/java"/>
- <classpathentry kind="src" path="modules/plugins/iptables/src/test/java"/>
<classpathentry kind="src" path="modules/plugins/hadoop/src/main/java"/>
<classpathentry kind="src" path="modules/enterprise/remoting/webservices/src/test/java"/>
<classpathentry kind="src" path="modules/common/ant-bundle/src/main/java"/>
@@ -205,7 +202,7 @@
<classpathentry exported="true" kind="var" path="M2_REPO/javax/faces/jsf-impl/1.2_14/jsf-impl-1.2_14.jar" sourcepath="/M2_REPO/javax/faces/jsf-impl/1.2_14/jsf-impl-1.2_14-sources.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/javax/el/el-api/1.0/el-api-1.0.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/com/sun/facelets/jsf-facelets/1.1.15.B1/jsf-facelets-1.1.15.B1.jar" sourcepath="/M2_REPO/com/sun/facelets/jsf-facelets/1.1.15.B1/jsf-facelets-1.1.15.B1-sources.jar"/>
- <classpathentry exported="true" kind="var" path="M2_REPO/mc4j/org-mc4j-ems/1.2.11/org-mc4j-ems-1.2.11.jar" sourcepath="/M2_REPO/mc4j/org-mc4j-ems/1.2.11/org-mc4j-ems-1.2.11-sources.jar"/>
+ <classpathentry exported="true" kind="var" path="M2_REPO/mc4j/org-mc4j-ems/1.2.13/org-mc4j-ems-1.2.13.jar" sourcepath="/M2_REPO/mc4j/org-mc4j-ems/1.2.13/org-mc4j-ems-1.2.13-sources.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/org/opensymphony/quartz/quartz/1.6.5/quartz-1.6.5.jar" sourcepath="/M2_REPO/org/opensymphony/quartz/quartz/1.6.5/quartz-1.6.5-sources.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/javax/mail/mail/1.4.2/mail-1.4.2.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/commons-fileupload/commons-fileupload/1.2/commons-fileupload-1.2.jar"/>
13 years, 9 months
[rhq] modules/plugins
by mazz
modules/plugins/services/pom.xml | 23 -----------------------
1 file changed, 23 deletions(-)
New commits:
commit b6b636bdd795c192b4cb5f74ce7fb4a1d2d404e1
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Tue Aug 3 11:39:34 2010 -0400
looks like a copy-n-paste error - i don't think the services plugin REALLY wants the twitter4j library
diff --git a/modules/plugins/services/pom.xml b/modules/plugins/services/pom.xml
index 0f84fe1..f6b8556 100644
--- a/modules/plugins/services/pom.xml
+++ b/modules/plugins/services/pom.xml
@@ -111,29 +111,6 @@
</executions>
</plugin>
- <plugin>
- <artifactId>maven-dependency-plugin</artifactId>
- <version>2.0</version>
- <executions>
- <execution>
- <id>copy-twitter4j-jar</id>
- <phase>process-resources</phase>
- <goals>
- <goal>copy</goal>
- </goals>
- <configuration>
- <artifactItems>
- <artifactItem>
- <groupId>net.homeip.yusuke</groupId>
- <artifactId>twitter4j</artifactId>
- <version>2.0.8</version>
- </artifactItem>
- </artifactItems>
- <outputDirectory>${project.build.outputDirectory}/lib</outputDirectory>
- </configuration>
- </execution>
- </executions>
- </plugin>
</plugins>
</build>
13 years, 9 months
[rhq] modules/enterprise pom.xml
by ips
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/engine/internal/AbstractConditionCache.java | 4 ++--
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/engine/jms/CachedConditionProducerBean.java | 3 +--
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/engine/jms/CachedConditionProducerLocal.java | 2 +-
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SubjectException.java | 4 ++++
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationUpdateStillInProgressException.java | 4 ++++
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/RepoException.java | 1 +
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/exception/ScheduleException.java | 4 ++++
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/exception/UnscheduleException.java | 4 ++++
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceNotFoundException.java | 4 ++++
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/ResourceGroupNotFoundException.java | 4 ++++
pom.xml | 4 +++-
11 files changed, 32 insertions(+), 6 deletions(-)
New commits:
commit f0e1602b9f1577774b03022bd7c6c9f191a9ea94
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Mon Aug 2 18:30:05 2010 -0400
changes to get build running w/ JDK7, including upgrading to EMS 1.2.14, which is compiled w/ "-target 1.5", rather than "-target jsr14" like earlier versions of EMS
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/engine/internal/AbstractConditionCache.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/engine/internal/AbstractConditionCache.java
index 74f59f0..9f8726a 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/engine/internal/AbstractConditionCache.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/engine/internal/AbstractConditionCache.java
@@ -66,8 +66,8 @@ abstract class AbstractConditionCache {
*/
cacheElement.setActive(true); // no harm to always set active (though, technically, STATELESS operators don't need it)
cachedConditionProducer.sendActivateAlertConditionMessage(
- cacheElement.getAlertConditionTriggerId(), timestamp, cacheElement
- .convertValueToString(providedValue), extraParams);
+ cacheElement.getAlertConditionTriggerId(), timestamp,
+ cacheElement.convertValueToString(providedValue), extraParams);
stats.matched++;
} catch (Exception e) {
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 bc901d4..f74663a 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
@@ -32,7 +32,6 @@ import javax.jms.Session;
import org.rhq.enterprise.server.alert.engine.jms.model.ActiveAlertConditionMessage;
import org.rhq.enterprise.server.alert.engine.jms.model.InactiveAlertConditionMessage;
-import org.rhq.enterprise.server.alert.engine.model.AbstractCacheElement;
/**
* A convenience class that will be used by the AlertConditionCacheManager to send messages to a JMS queue for
@@ -54,7 +53,7 @@ public class CachedConditionProducerBean implements CachedConditionProducerLocal
private Queue alertConditionQueue;
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
- public <T extends AbstractCacheElement<S>, S> void sendActivateAlertConditionMessage(int alertConditionId,
+ public <S> void sendActivateAlertConditionMessage(int alertConditionId,
long timestamp, S value, Object... extraParams) throws JMSException {
Connection connection = factory.createConnection();
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/engine/jms/CachedConditionProducerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/engine/jms/CachedConditionProducerLocal.java
index d2b4fb5..f431dd4 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/engine/jms/CachedConditionProducerLocal.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/engine/jms/CachedConditionProducerLocal.java
@@ -33,7 +33,7 @@ public interface CachedConditionProducerLocal {
* Send a message to the appropriate JMS destination for processing. This destination handles creating and
* persisting entities corresponding to triggered alert conditions.
*/
- <T extends AbstractCacheElement<S>, S> void sendActivateAlertConditionMessage(int alertConditionId, long timestamp,
+ <S> void sendActivateAlertConditionMessage(int alertConditionId, long timestamp,
S value, Object... extraParams) throws JMSException;
void sendDeactivateAlertConditionMessage(int alertConditionId, long timestamp) throws JMSException;
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SubjectException.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SubjectException.java
index c4cc491..71856f5 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SubjectException.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SubjectException.java
@@ -20,6 +20,10 @@ package org.rhq.enterprise.server.auth;
public class SubjectException extends RuntimeException {
+ // Default no-arg constructor required by JAXB
+ public SubjectException() {
+ }
+
public SubjectException(String message) {
super(message);
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationUpdateStillInProgressException.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationUpdateStillInProgressException.java
index 775f599..56abd94 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationUpdateStillInProgressException.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationUpdateStillInProgressException.java
@@ -31,6 +31,10 @@ import javax.ejb.ApplicationException;
public class ConfigurationUpdateStillInProgressException extends RuntimeException {
private static final long serialVersionUID = 1L;
+ // Default no-arg constructor required by JAXB
+ public ConfigurationUpdateStillInProgressException() {
+ }
+
public ConfigurationUpdateStillInProgressException(String message) {
super(message);
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/RepoException.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/RepoException.java
index 7b9ae57..3ee5c58 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/RepoException.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/RepoException.java
@@ -30,6 +30,7 @@ public class RepoException extends ContentException {
private RepoExceptionType type = RepoExceptionType.GENERAL;
+ // Default no-arg constructor required by JAXB
public RepoException() {
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/exception/ScheduleException.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/exception/ScheduleException.java
index 4d502bd..cb97f40 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/exception/ScheduleException.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/exception/ScheduleException.java
@@ -29,6 +29,10 @@ package org.rhq.enterprise.server.exception;
public class ScheduleException extends RuntimeException {
private static final long serialVersionUID = 1L;
+ // Default no-arg constructor required by JAXB
+ public ScheduleException() {
+ }
+
public ScheduleException(String message) {
super(message);
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/exception/UnscheduleException.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/exception/UnscheduleException.java
index 887998e..1b0f03a 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/exception/UnscheduleException.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/exception/UnscheduleException.java
@@ -30,6 +30,10 @@ package org.rhq.enterprise.server.exception;
public class UnscheduleException extends RuntimeException {
private static final long serialVersionUID = 1L;
+ // Default no-arg constructor required by JAXB
+ public UnscheduleException() {
+ }
+
public UnscheduleException(String message) {
super(message);
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceNotFoundException.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceNotFoundException.java
index 6ad8885..7c31d96 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceNotFoundException.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceNotFoundException.java
@@ -25,6 +25,10 @@ package org.rhq.enterprise.server.resource;
public class ResourceNotFoundException extends RuntimeException {
private static final long serialVersionUID = 1L;
+ // Default no-arg constructor required by JAXB
+ public ResourceNotFoundException() {
+ }
+
/**
* Create an exception indicating the resource with the specified id was not found.
*
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/ResourceGroupNotFoundException.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/ResourceGroupNotFoundException.java
index 66ffa32..0d64c1e 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/ResourceGroupNotFoundException.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/ResourceGroupNotFoundException.java
@@ -21,6 +21,10 @@ package org.rhq.enterprise.server.resource.group;
public class ResourceGroupNotFoundException extends RuntimeException {
private static final long serialVersionUID = 1L;
+ // Default no-arg constructor required by JAXB
+ public ResourceGroupNotFoundException() {
+ }
+
public ResourceGroupNotFoundException(int groupId) {
super("A group with id " + groupId + " does not exist.");
}
diff --git a/pom.xml b/pom.xml
index f3c48ed..521bc40 100644
--- a/pom.xml
+++ b/pom.xml
@@ -85,7 +85,7 @@
<jsf-api.version>1.2_14</jsf-api.version>
<jsf-impl.version>1.2_14</jsf-impl.version>
<ojdbc5.version>11.2.0.1.0</ojdbc5.version>
- <ems.version>1.2.13</ems.version>
+ <ems.version>1.2.14</ems.version>
<postgresql.version>8.4-701.jdbc3</postgresql.version>
<h2.version>1.1.117</h2.version>
<jtds.version>1.2.2</jtds.version>
@@ -708,6 +708,8 @@
<source>1.6</source>
<target>1.6</target>
<optimize>false</optimize>
+ <verbose>true</verbose>
+ <compilerArgument>-Xlint</compilerArgument>
</configuration>
</plugin>
13 years, 9 months
[rhq] 7 commits - modules/core modules/plugins pom.xml
by mazz
modules/core/plugin-container/src/main/java/org/rhq/core/pc/PluginContainer.java | 6 -
modules/plugins/jmx/src/main/java/org/rhq/plugins/jmx/JMXPluginLifecycleListener.java | 52 ++++++++++
modules/plugins/jmx/src/main/resources/META-INF/rhq-plugin.xml | 1
pom.xml | 2
4 files changed, 59 insertions(+), 2 deletions(-)
New commits:
commit 5911f8751eeea86072ab6c524a2e7bdc1f58166e
Merge: 4ae53d1... cc33d33...
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Mon Aug 2 14:49:33 2010 -0400
Merge branch 'master' into permgen-leak
commit 4ae53d12b5b30aafe5362ad5435b0fbe548962b6
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Mon Aug 2 13:45:07 2010 -0400
clean up some things that we forgot to clean up at shutdown - to help GC
diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/PluginContainer.java b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/PluginContainer.java
index c9c1d54..081e067 100644
--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/PluginContainer.java
+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/PluginContainer.java
@@ -78,7 +78,7 @@ import org.rhq.core.pluginapi.util.FileUtils;
public class PluginContainer implements ContainerService {
private static final PluginContainer INSTANCE = new PluginContainer();
- private static final Log log = LogFactory.getLog(PluginContainer.class);
+ private final Log log = LogFactory.getLog(PluginContainer.class);
// our management interface
private PluginContainerMBeanImpl mbean;
@@ -303,7 +303,9 @@ public class PluginContainer implements ContainerService {
pluginManager.shutdown();
agentServiceListeners.clear();
+ agentServiceListeners = new LinkedHashSet<AgentServiceLifecycleListener>();
agentServiceStreamRemoter = null;
+ agentRegistrar = null;
purgeTmpDirectoryContents();
@@ -321,6 +323,8 @@ public class PluginContainer implements ContainerService {
pluginComponentFactory = null;
pluginManager = null;
+ configuration = null;
+
started = false;
log.info("Plugin container is now shutdown.");
commit 6afb470d31be3c71c9e16544267d74a45e809da0
Merge: 774ed67... 724682f...
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Mon Aug 2 10:44:24 2010 -0400
Merge branch 'master' into permgen-leak
commit 774ed6788f6d14ec7b14f169b2181fbcf20e5302
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Sat Jul 31 11:35:10 2010 -0400
BZ 615377 - use a new feature in EMS 1.2.13 that lets us clear the EMS classloader factory cache of classloaders and jar files.
we now do this in the jmx plugin lifecycle listener.
diff --git a/modules/plugins/jmx/src/main/java/org/rhq/plugins/jmx/JMXPluginLifecycleListener.java b/modules/plugins/jmx/src/main/java/org/rhq/plugins/jmx/JMXPluginLifecycleListener.java
new file mode 100644
index 0000000..3b4984e
--- /dev/null
+++ b/modules/plugins/jmx/src/main/java/org/rhq/plugins/jmx/JMXPluginLifecycleListener.java
@@ -0,0 +1,52 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 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, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * 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 and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+package org.rhq.plugins.jmx;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.mc4j.ems.connection.support.classloader.ClassLoaderFactory;
+
+import org.rhq.core.pluginapi.plugin.PluginContext;
+import org.rhq.core.pluginapi.plugin.PluginLifecycleListener;
+
+public class JMXPluginLifecycleListener implements PluginLifecycleListener {
+ private final Log log = LogFactory.getLog(JMXPluginLifecycleListener.class);
+
+ @Override
+ public void initialize(PluginContext context) throws Exception {
+ // no-op
+ }
+
+ @Override
+ public void shutdown() {
+ // so we do not cause EMS classloaders to leak perm gen, we need to clear
+ // out all caches from the EMS ClassLoaderFactory
+ try {
+ ClassLoaderFactory.clearCaches();
+ log.debug("Cleared EMS ClassLoaderFactory caches");
+ } catch (Exception e) {
+ log.error("Failed to clear EMS ClassLoaderFactory caches - perm gen may leak", e);
+ }
+ }
+}
diff --git a/modules/plugins/jmx/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/jmx/src/main/resources/META-INF/rhq-plugin.xml
index 258caee..2c7ca1d 100644
--- a/modules/plugins/jmx/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/jmx/src/main/resources/META-INF/rhq-plugin.xml
@@ -4,6 +4,7 @@
displayName="Generic JMX"
package="org.rhq.plugins.jmx"
description="Supports management of JMX MBean Servers via various remoting systems."
+ pluginLifecycleListener="JMXPluginLifecycleListener"
ampsVersion="2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="urn:xmlns:rhq-plugin"
diff --git a/pom.xml b/pom.xml
index 306bbff..e743278 100644
--- a/pom.xml
+++ b/pom.xml
@@ -85,7 +85,7 @@
<jsf-api.version>1.2_14</jsf-api.version>
<jsf-impl.version>1.2_14</jsf-impl.version>
<ojdbc5.version>11.2.0.1.0</ojdbc5.version>
- <ems.version>1.2.11</ems.version>
+ <ems.version>1.2.13</ems.version>
<postgresql.version>8.4-701.jdbc3</postgresql.version>
<h2.version>1.1.117</h2.version>
<jtds.version>1.2.2</jtds.version>
commit c1e8353c8ef155fe286658694540bf3e69619737
Merge: 433cafa... 69c6da3...
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Sat Jul 31 11:15:09 2010 -0400
Merge branch 'master' into permgen-leak
commit 433cafa05dc1871710813875d5c21923f716d9a5
Merge: b13693f... 483a1e8...
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Jul 30 17:44:21 2010 -0400
Merge branch 'master' into permgen-leak
commit b13693f2a55c24422be11d38bf23361ed1db3950
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Jul 23 11:00:46 2010 -0400
BZ 615377 workaround sun bug http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6727821
diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/PluginContainer.java b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/PluginContainer.java
index d6546a2..c9c1d54 100644
--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/PluginContainer.java
+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/PluginContainer.java
@@ -31,6 +31,8 @@ import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
+import javax.security.auth.login.Configuration;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -114,6 +116,11 @@ public class PluginContainer implements ContainerService {
}
private PluginContainer() {
+ // for why we need to do this, see http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6727821
+ try {
+ Configuration.getConfiguration();
+ } catch (Throwable t) {
+ }
}
/**
@@ -337,6 +344,13 @@ public class PluginContainer implements ContainerService {
private void cleanMemory() {
Introspector.flushCaches();
LogFactory.releaseAll();
+
+ // for why we need to do this, see http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6727821
+ try {
+ Configuration.setConfiguration(null);
+ } catch (Throwable t) {
+ }
+
System.gc();
}
@@ -563,4 +577,4 @@ public class PluginContainer implements ContainerService {
public boolean isInsideAgent() {
return (this.configuration != null && this.configuration.isInsideAgent());
}
-}
\ No newline at end of file
+}
13 years, 9 months
[rhq] 2 commits - etc/cli-scripts
by John Sanda
etc/cli-scripts/reset_apache_props.js | 102 ++++++++++
etc/cli-scripts/reset_conn_props.js | 287 -----------------------------
etc/cli-scripts/reset_jboss_agent_props.js | 110 +++++++++++
3 files changed, 212 insertions(+), 287 deletions(-)
New commits:
commit cc33d336fa0e253f16ff2669375b840b5b32fc96
Merge: cd68889... 724682f...
Author: John Sanda <jsanda(a)redhat.com>
Date: Mon Aug 2 13:17:29 2010 -0400
Merge branch 'master' of ssh://git.fedorahosted.org/git/rhq/rhq
commit cd688890537687233af414fbdf785707a98f8718
Author: John Sanda <jsanda(a)redhat.com>
Date: Mon Aug 2 13:11:39 2010 -0400
Cleaning up logic in script for resetting connection properties, adding script for apache
I have renamed reset_conn_props.js to reset_jboss_agent_prop.js. Most of the logic in
that script has been removed. There was logic for retrieving default values from the
default template; however, I discovered through further testing that the snapshot report
properties do not even exist in the default template when upgrading 2.2.0 --> 2.3.1.
Consequently, I need to simply hard code the properties that need to be added to the plugin
configurations.
Adding a similar script for apache to handle properties added in the 2.4.0 release.
diff --git a/etc/cli-scripts/reset_apache_props.js b/etc/cli-scripts/reset_apache_props.js
new file mode 100644
index 0000000..becdc50
--- /dev/null
+++ b/etc/cli-scripts/reset_apache_props.js
@@ -0,0 +1,102 @@
+/*
+ * 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, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * 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 and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+/**
+ * This CLI script resets/restores apache connection properties that are not set to their
+ * default values during plugin upgrade. This script is only intended to be run once. If
+ * run subsequent times, the script will reset these properties to their defaults,
+ * overriding whatever the current values might be.
+ */
+
+
+function iterate(iterable, callback) {
+ var iterator = iterable.iterator();
+ while (iterator.hasNext()) {
+ callback(iterator.next());
+ }
+}
+
+function filter(iterable, predicate) {
+ var matches = java.util.ArrayList();
+ iterate(iterable, function(obj) {
+ if (predicate(obj)) {
+ matches.add(obj);
+ }
+ });
+ return matches;
+}
+
+function log(msg) {
+ println("DEBUG " + msg);
+}
+
+function loadPluginConfiguration(resource) {
+ log("Loading plugin configuration for " + resource);
+ return ConfigurationManager.getPluginConfiguration(resource.id);
+}
+
+function findResourcesByTypeAndPlugin(resourceType, plugin) {
+ var criteria = ResourceCriteria();
+ criteria.addFilterResourceTypeName(resourceType);
+ criteria.addFilterPluginName(plugin);
+ criteria.fetchResourceType(true);
+ criteria.fetchPluginConfiguration(true);
+ criteria.caseSensitive = true;
+ criteria.strict = true;
+
+ var resources = ResourceManager.findResourcesByCriteria(criteria);
+
+ log("Found " + resources.size() + " " + resourceType + " resources ");
+
+ iterate(resources, function(resource) {
+ resource.pluginConfiguration = loadPluginConfiguration(resource);
+ });
+
+ return resources;
+}
+
+function updatePluginConfigs(resources, applyDefaults) {
+ iterate(resources, function(resource) {
+ log("Preparing to update plugin configuration for " + resource)
+ applyDefaults(resource.pluginConfiguration);
+ ConfigurationManager.updatePluginConfiguration(resource.id, resource.pluginConfiguration);
+ log("Updated plugin configuration for " + resource);
+ });
+}
+
+functionr resetApachePluginConfigProps() {
+ var resourceTypeName = 'Apache HTTP Server';
+ var pluginName = 'Apache';
+ var servers = findResourcesByTypeAndPlugin(resourceTypeName, pluginName);
+
+ updatePluginConfigs(servers, function(pluginConfig) {
+ pluginConfig.put(PropertySimple('augeasEnabled', 'no'));
+ pluginConfig.put(PropertySimple('configurationFilesInclusionPatterns', '/etc/httpd/conf/httpd.conf'));
+ pluginConfig.put(PropertySimple('vhostCreationPolicy', 'vhost-per-file'));
+ });
+}
+
+//////////////
+// main //
+//////////////
+resetApachePluginConfigProps();
diff --git a/etc/cli-scripts/reset_conn_props.js b/etc/cli-scripts/reset_conn_props.js
deleted file mode 100644
index 274bc5c..0000000
--- a/etc/cli-scripts/reset_conn_props.js
+++ /dev/null
@@ -1,287 +0,0 @@
-/**
- * This is a CLI script to be used for https://bugzilla.redhat.com/show_bug.cgi?id=573034.
- * The script resets the snapshot report plugin configuration properties for JBoss servers
- * and agents to their default values. This is a one-off script intended only to be run
- * once to assign values to required plugin properties that are unset.
- *
- * NOTE: This script can probably be refactored and generalized a bit to support
- * resetting any specified plugin configuration properties to their default values.
- * And specifying candidate properties could be done via a callback function to
- * allow for arbitrarily complex logic in determining the properties.
- */
-
-function iterate(iterable, callback) {
- var iterator = iterable.iterator();
- while (iterator.hasNext()) {
- callback(iterator.next());
- }
-}
-
-function filter(iterable, predicate) {
- var matches = java.util.ArrayList();
- iterate(iterable, function(obj) {
- if (predicate(obj)) {
- matches.add(obj);
- }
- });
- return matches;
-}
-
-function log(msg) {
- println("DEBUG " + msg);
-}
-
-function loadPluginConfiguration(resource) {
- log("Loading plugin configuration for " + resource);
- return ConfigurationManager.getPluginConfiguration(resource.id);
-}
-
-function loadPluginConfigDef(resourceTypeName, pluginName) {
- log("Loading plugin configuration definition for [resourceType=" + resourceTypeName + ", plugin=" +
- pluginName + "]");
- var resourceType = ResourceTypeManager.getResourceTypeByNameAndPlugin(resourceTypeName,
- pluginName);
-
- if (resourceType == null) {
- throw "Failed to find resource type '" + resourceTypeName + "'";
- }
-
- configDef = ConfigurationManager.getPluginConfigurationDefinitionForResourceType(resourceType.id);
-
- if (configDef == null) {
- throw "Failed to load plugin configuration for [resourceType=" + resourceTypeName +
- ", plugin=" + pluginName + "]";
- }
-
- return configDef;
-}
-
-function findResourcesByTypeAndPlugin(resourceType, plugin) {
- var criteria = ResourceCriteria();
- criteria.addFilterResourceTypeName(resourceType);
- criteria.addFilterPluginName(plugin);
- criteria.fetchResourceType(true);
- criteria.fetchPluginConfiguration(true);
- criteria.caseSensitive = true;
- criteria.strict = true;
-
- var resources = ResourceManager.findResourcesByCriteria(criteria);
-
- log("Found " + resources.size() + " " + resourceType + " resources ");
-
- iterate(resources, function(resource) {
- resource.pluginConfiguration = loadPluginConfiguration(resource);
- });
-
- return resources;
-}
-
-/**
- * This function takes a Configuration object and "flattens" its properties into a list of
- * all simple (i.e., PropertySimple) objects contained in the configuration. This includes
- * nested properties. The properties are returned as a java.util.List.
- *
- * param: configuration The Configuration object from which the property list will be built
- *
- * return: A List object of all PropertySimple objects, including those nested in complex
- * properties
- */
-function flattenProperties(configuration) {
- var simpleProperties = java.util.ArrayList();
-
- iterate(configuration.map.values(), function(property) {
- if (property instanceof PropertySimple) {
- simpleProperties.add(property);
- }
- else if (property instanceof PropertyList) {
- simpleProperties.addAll(flattenPropertyList(property));
- }
- });
-
- return simpleProperties;
-}
-
-function flattenPropertyList(propertyList) {
- var simpleProperties = java.util.ArrayList();
-
- iterate(propertyList.list, function(property) {
- if (property instanceof PropertySimple) {
- simpleProperty.add(property);
- }
- else if (property instanceof PropertyMap) {
- simpleProperties.addAll(flattenPropertyMap(property));
- }
- else if (property instanceof PropertyList) {
- simpleProperties.addAll(flattenPropertyList(property));
- }
- });
-
- return simpleProperties;
-}
-
-function flattenPropertyMap(propertyMap) {
- var simpleProperties = java.util.ArrayList();
-
- iterate(propertyMap.map.values(), function(property) {
- if (property instanceof PropertySimple) {
- simpleProperties.add(property);
- }
- else if (property instanceof PropertyMap) {
- simpleProperties.addAll(flattenPropertyMap(property));
- }
- else if (property instanceof PropertyList) {
- simpleProperties.addAll(flattPropertyList(property));
- }
- });
-
- return simpleProperties;
-}
-
-/**
- * Loads the specified default plugin properties for a given plugin configuration definition.
- * The defaults are stored in and retrieved from the default template of the plugin
- * configuration.
- *
- * param: pluginConfigDef A ConfigurationDefinition object which is the plugin config def
- * from which to retrieve the defaults
- *
- * param: defaultPropertyNames A java.util.Collection of the property names to include
- *
- * return: A java.util.Map of the default properties. Property names as strings are mapped
- * to the PropertySimple objects.
- */
-function loadSnapshotDefaults(pluginConfigDef, defaultPropertyNames) {
- var snapshotDefaultsMap = java.util.HashMap();
- var defaults = flattenProperties(pluginConfigDef.defaultTemplate.configuration);
-
- var isSnapshotProperty = function(property) {
- return defaultPropertyNames.contains(property.name);
- }
-
- var snapshotDefaults = filter(defaults, isSnapshotProperty);
-
- iterate(snapshotDefaults, function(property) {
- snapshotDefaultsMap.put(property.name, property);
- });
-
- return snapshotDefaultsMap;
-}
-
-function getJBossSnapshotPropertyNames() {
- var set = java.util.HashSet();
- set.add('snapshotConfigEnabled');
- set.add('snapshotConfigDirectory');
- set.add('snapshotConfigRecursive');
- set.add('snapshotLogEnabled');
- set.add('snapshotLogDirectory');
- set.add('snapshotLogRecursive');
- set.add('snapshotDataEnabled');
- set.add('snapshotDataDirectory');
- set.add('snapshotDataRecursive');
- set.add('snapshotAdditionalFilesEnabled');
- set.add('snapshotAdditionalFilesDirectory');
- set.add('snapshotAdditionalFilesRecursive');
-
- return set;
-}
-
-function getAgentSnapshotPropertyNames() {
- var set = java.util.HashSet();
- set.add('snapshotConfigEnabled');
- set.add('snapshotLogEnabled');
- set.add('snapshotDataEnabled');
-
- return set;
-}
-
-/**
- * Resets the values of specified plugin configuration properties back to their default values.
- * The configuration is modified locally, in memory and then a request is sent to
- * ConfigurationManager.
- *
- * param: resources The resources whose plugin configurations are to be updated. This is
- * expected to be a java.util.Collection.
- *
- * param: snapshotDefaults: The names of the plugin configuration properties to reset. This
- * is expected to be a java.util.Collection.
- */
-function resetPluginConfigPropsFromTemplate(pluginConfigDef, resources, snapshotDefaults) {
- iterate(resources, function(resource) {
- log("Preparing to reset plugin configuration properties for " + resource);
- var simpleProperties = flattenProperties(resource.pluginConfiguration);
- var snapshotProperties = filter(simpleProperties, function(property) {
- return snapshotDefaults.containsKey(property.name);
- });
-
- iterate(snapshotProperties, function(property) {
- var defaultProperty = snapshotDefaults.get(property.name);
- property.stringValue = defaultProperty.stringValue;
- log("Set property " + property.name + " to " + property.stringValue);
- });
-
- ConfigurationManager.updatePluginConfiguration(resource.id, resource.pluginConfiguration);
- log("Updated plugin configuration for " + resource);
- });
-}
-
-function resetPluginConfigProps(resources, applyDefaults) {
- iterate(resources, function(resource) {
- applyDefaults(resource.pluginConfiguration);
- ConfigurationManager.updatePluginConfiguration(resource.id, resource.pluginConfiguration);
- log("Updated plugin configuration for " + resource);
- });
-}
-
-function resetJBossPluginConfigProps() {
- var jbossResourceTypeName = 'JBossAS Server';
- var jbossPluginName = 'JBossAS';
- var jbossServers = findResourcesByTypeAndPlugin(jbossResourceTypeName, jbossPluginName);
- var jbossPluginConfigDef = loadPluginConfigDef(jbossResourceTypeName, jbossPluginName);
-
- //resetPluginConfigProps(jbossServers, loadSnapshotDefaults(jbossPluginConfigDef,
- // getJBossSnapshotPropertyNames()));
-
- resetPluginConfigProps(jbossServers, function(pluginConfig) {
- pluginConfig.put(PropertySimple('snapshotConfigEnabled', true));
- pluginConfig.put(PropertySimple('snapshotConfigDirectory', 'config'));
- pluginConfig.put(PropertySimple('snapshotConfigRecursive', true));
- pluginConfig.put(PropertySimple('snapshotLogEnabled', true));
- pluginConfig.put(PropertySimple('snapshotLogDirectory', 'log'));
- pluginConfig.put(PropertySimple('snapshotLogRecursive', false));
- pluginConfig.put(PropertySimple('snapshotDataEnabled', false));
- pluginConfig.put(PropertySimple('snapshotDataDirectory', 'data'));
- pluginConfig.put(PropertySimple('snapshotDataRecursive', true));
-
- var propertyMap = PropertyMap('snapshotAdditionalFilesMap');
- propertyMap.put(PropertySimple('snapshotAdditionalFilesEnabled', true));
- propertyMap.put(PropertySimple('snapshotAdditionalFilesDirectory', ''));
- propertyMap.put(PropertySimple('snapshotAdditionalFilesRecursive', true));
-
- var propertyList = PropertyList('snapshotAdditionalFilesList');
- propertyList.list.add(propertyMap);
-
- pluginConfig.put(propertyList);
- });
-}
-
-function resetAgentPluginConfigProps() {
- var agentResourceTypeName = 'RHQ Agent';
- var agentPluginName = 'RHQAgent';
- var agents = findResourcesByTypeAndPlugin(agentResourceTypeName, agentPluginName);
- var agentPluginConfigDef = loadPluginConfigDef(agentResourceTypeName, agentPluginName);
-
- //resetPluginConfigProps(agents, loadSnapshotDefaults(agentPluginConfigDef,
- // getAgentSnapshotPropertyNames()));
-
- resetPluginConfigProps(agents, function(pluginConfig) {
- pluginConfig.put(PropertySimple('snapshotConfigEnabled', true));
- pluginConfig.put(PropertySimple('snapshotLogEnabled', true));
- pluginConfig.put(PropertySimple('snapshotDataEnabled', true));
- });
-}
-
-//////////////
-// main //
-//////////////
-resetJBossPluginConfigProps();
-resetAgentPluginConfigProps();
diff --git a/etc/cli-scripts/reset_jboss_agent_props.js b/etc/cli-scripts/reset_jboss_agent_props.js
new file mode 100644
index 0000000..51fdb99
--- /dev/null
+++ b/etc/cli-scripts/reset_jboss_agent_props.js
@@ -0,0 +1,110 @@
+/**
+ * This is a CLI script to be used for https://bugzilla.redhat.com/show_bug.cgi?id=573034.
+ * The script resets/restores the snapshot report plugin configuration properties for JBoss servers
+ * and agents to their default values. This is a one-off script intended only to be run
+ * once to assign values to required plugin properties that are unset. Running it subsequent times
+ * cause the current connection settings for the snapshot report properties to be overridden and
+ * reset to their default vales
+ */
+
+function iterate(iterable, callback) {
+ var iterator = iterable.iterator();
+ while (iterator.hasNext()) {
+ callback(iterator.next());
+ }
+}
+
+function filter(iterable, predicate) {
+ var matches = java.util.ArrayList();
+ iterate(iterable, function(obj) {
+ if (predicate(obj)) {
+ matches.add(obj);
+ }
+ });
+ return matches;
+}
+
+function log(msg) {
+ println("DEBUG " + msg);
+}
+
+function loadPluginConfiguration(resource) {
+ log("Loading plugin configuration for " + resource);
+ return ConfigurationManager.getPluginConfiguration(resource.id);
+}
+
+function findResourcesByTypeAndPlugin(resourceType, plugin) {
+ var criteria = ResourceCriteria();
+ criteria.addFilterResourceTypeName(resourceType);
+ criteria.addFilterPluginName(plugin);
+ criteria.fetchResourceType(true);
+ criteria.fetchPluginConfiguration(true);
+ criteria.caseSensitive = true;
+ criteria.strict = true;
+
+ var resources = ResourceManager.findResourcesByCriteria(criteria);
+
+ log("Found " + resources.size() + " " + resourceType + " resources ");
+
+ iterate(resources, function(resource) {
+ resource.pluginConfiguration = loadPluginConfiguration(resource);
+ });
+
+ return resources;
+}
+
+function updatePluginConfigs(resources, applyDefaults) {
+ iterate(resources, function(resource) {
+ log("Preparing to update plugin configuration for " + resource)
+ applyDefaults(resource.pluginConfiguration);
+ ConfigurationManager.updatePluginConfiguration(resource.id, resource.pluginConfiguration);
+ log("Updated plugin configuration for " + resource);
+ });
+}
+
+function resetJBossPluginConfigProps() {
+ var jbossResourceTypeName = 'JBossAS Server';
+ var jbossPluginName = 'JBossAS';
+ var jbossServers = findResourcesByTypeAndPlugin(jbossResourceTypeName, jbossPluginName);
+
+ updatePluginConfigs(jbossServers, function(pluginConfig) {
+ pluginConfig.put(PropertySimple('snapshotConfigEnabled', true));
+ pluginConfig.put(PropertySimple('snapshotConfigDirectory', 'config'));
+ pluginConfig.put(PropertySimple('snapshotConfigRecursive', true));
+ pluginConfig.put(PropertySimple('snapshotLogEnabled', true));
+ pluginConfig.put(PropertySimple('snapshotLogDirectory', 'log'));
+ pluginConfig.put(PropertySimple('snapshotLogRecursive', false));
+ pluginConfig.put(PropertySimple('snapshotDataEnabled', false));
+ pluginConfig.put(PropertySimple('snapshotDataDirectory', 'data'));
+ pluginConfig.put(PropertySimple('snapshotDataRecursive', true));
+
+ var propertyMap = PropertyMap('snapshotAdditionalFilesMap');
+ propertyMap.put(PropertySimple('snapshotAdditionalFilesEnabled', true));
+ propertyMap.put(PropertySimple('snapshotAdditionalFilesDirectory', ''));
+ propertyMap.put(PropertySimple('snapshotAdditionalFilesRecursive', true));
+
+ var propertyList = PropertyList('snapshotAdditionalFilesList');
+ propertyList.list.add(propertyMap);
+
+ pluginConfig.put(propertyList);
+ });
+}
+
+function resetAgentPluginConfigProps() {
+ var agentResourceTypeName = 'RHQ Agent';
+ var agentPluginName = 'RHQAgent';
+ var agents = findResourcesByTypeAndPlugin(agentResourceTypeName, agentPluginName);
+
+ updatePluginConfigs(agents, function(pluginConfig) {
+ pluginConfig.put(PropertySimple('snapshotConfigEnabled', true));
+ pluginConfig.put(PropertySimple('snapshotLogEnabled', true));
+ pluginConfig.put(PropertySimple('snapshotDataEnabled', true));
+ });
+}
+
+//////////////
+// main //
+//////////////
+exec -f
+resetJBossPluginConfigProps();
+resetAgentPluginConfigProps();
13 years, 9 months
[rhq] modules/plugins
by mazz
modules/plugins/jboss-as/src/main/java/org/rhq/plugins/jbossas/JBossASServerComponent.java | 14 ++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
New commits:
commit 724682f8e03a5f804774559a97a70298dc402a43
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Mon Aug 2 10:43:43 2010 -0400
paranoia - we might hit sun bug http://bugs.sun.com/view_bug.do?bug_id=6735255 so we explicitly close the input stream prior to closing the jar file
diff --git a/modules/plugins/jboss-as/src/main/java/org/rhq/plugins/jbossas/JBossASServerComponent.java b/modules/plugins/jboss-as/src/main/java/org/rhq/plugins/jbossas/JBossASServerComponent.java
index 4dc7a41..5fac37b 100644
--- a/modules/plugins/jboss-as/src/main/java/org/rhq/plugins/jbossas/JBossASServerComponent.java
+++ b/modules/plugins/jboss-as/src/main/java/org/rhq/plugins/jbossas/JBossASServerComponent.java
@@ -946,11 +946,12 @@ public class JBossASServerComponent implements MeasurementFacet, OperationFacet,
private String getVhostFromWarFile(File warFile) {
JarFile jfile = null;
+ InputStream is = null;
try {
jfile = new JarFile(warFile);
JarEntry entry = jfile.getJarEntry("WEB-INF/jboss-web.xml");
if (entry != null) {
- InputStream is = jfile.getInputStream(entry);
+ is = jfile.getInputStream(entry);
SAXBuilder saxBuilder = new SAXBuilder();
Document doc = saxBuilder.build(is);
Element root = doc.getRootElement(); // <jboss-web>
@@ -968,12 +969,21 @@ public class JBossASServerComponent implements MeasurementFacet, OperationFacet,
} catch (Exception ioe) {
log.warn("Exception when getting vhost from war file : " + ioe.getMessage());
} finally {
- if (jfile != null)
+ if (jfile != null) {
+ if (is != null) {
+ try {
+ // see http://bugs.sun.com/view_bug.do?bug_id=6735255 for why we do this
+ is.close();
+ } catch (IOException e) {
+ log.info("Exception when trying to close the war file stream: " + e.getMessage());
+ }
+ }
try {
jfile.close();
} catch (IOException e) {
log.info("Exception when trying to close the war file: " + e.getMessage());
}
+ }
}
// We're not able to determine a vhost, so return localhost
13 years, 9 months
[rhq] 4 commits - modules/core modules/enterprise pom.xml
by ips
modules/core/dbutils/pom.xml | 5 +++++
modules/core/util/pom.xml | 7 ++++++-
modules/enterprise/agent/pom.xml | 5 +++++
modules/enterprise/comm/pom.xml | 5 +++++
modules/enterprise/gui/installer-war/pom.xml | 6 +++++-
modules/enterprise/gui/portal-war/pom.xml | 5 +++++
modules/enterprise/remoting/cli/pom.xml | 5 +++++
modules/enterprise/server/jar/pom.xml | 5 +++++
pom.xml | 12 ++++++------
9 files changed, 47 insertions(+), 8 deletions(-)
New commits:
commit b8685a6877b0fad4e7f9b305db673fd2cab3e2aa
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Mon Aug 2 10:33:46 2010 -0400
add explicit i18nlog dep to poms of modules that depend on it
diff --git a/modules/core/dbutils/pom.xml b/modules/core/dbutils/pom.xml
index 8769bfc..09703ee 100644
--- a/modules/core/dbutils/pom.xml
+++ b/modules/core/dbutils/pom.xml
@@ -43,6 +43,11 @@
</dependency>
<dependency>
+ <groupId>i18nlog</groupId>
+ <artifactId>i18nlog</artifactId>
+ </dependency>
+
+ <dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
<!-- NOTE: The version is defined in the root POM's dependencyManagement section. -->
diff --git a/modules/core/util/pom.xml b/modules/core/util/pom.xml
index 405eaed..458c635 100644
--- a/modules/core/util/pom.xml
+++ b/modules/core/util/pom.xml
@@ -33,6 +33,11 @@
<version>1.0</version>
</dependency>
+ <dependency>
+ <groupId>i18nlog</groupId>
+ <artifactId>i18nlog</artifactId>
+ </dependency>
+
</dependencies>
<build>
@@ -125,4 +130,4 @@
</profiles>
-</project>
\ No newline at end of file
+</project>
diff --git a/modules/enterprise/agent/pom.xml b/modules/enterprise/agent/pom.xml
index 03f3932..7187dbe 100644
--- a/modules/enterprise/agent/pom.xml
+++ b/modules/enterprise/agent/pom.xml
@@ -84,6 +84,11 @@
<!-- NOTE: The version is defined in the root POM's dependencyManagement section. -->
</dependency>
+ <dependency>
+ <groupId>i18nlog</groupId>
+ <artifactId>i18nlog</artifactId>
+ </dependency>
+
<!-- TODO: This is a fix for the Javac bug requiring annotations to be
available when compiling dependent classes. It is fixed in JDK 6 -->
<dependency>
diff --git a/modules/enterprise/comm/pom.xml b/modules/enterprise/comm/pom.xml
index 93931da..dcd5bed 100644
--- a/modules/enterprise/comm/pom.xml
+++ b/modules/enterprise/comm/pom.xml
@@ -64,6 +64,11 @@
</dependency>
<dependency>
+ <groupId>i18nlog</groupId>
+ <artifactId>i18nlog</artifactId>
+ </dependency>
+
+ <dependency>
<groupId>jboss</groupId>
<artifactId>jboss-common</artifactId>
<!-- NOTE: The version is defined in the root POM's dependencyManagement section. -->
diff --git a/modules/enterprise/gui/installer-war/pom.xml b/modules/enterprise/gui/installer-war/pom.xml
index 9a29f14..b3ccdca 100644
--- a/modules/enterprise/gui/installer-war/pom.xml
+++ b/modules/enterprise/gui/installer-war/pom.xml
@@ -76,6 +76,11 @@
</dependency>
<dependency>
+ <groupId>i18nlog</groupId>
+ <artifactId>i18nlog</artifactId>
+ </dependency>
+
+ <dependency>
<groupId>jboss</groupId>
<artifactId>jboss-jmx</artifactId>
<version>${jboss.version}</version>
@@ -103,7 +108,6 @@
<scope>provided</scope> <!-- by JBossAS -->
</dependency>
-
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
diff --git a/modules/enterprise/gui/portal-war/pom.xml b/modules/enterprise/gui/portal-war/pom.xml
index 880cc16..f802053 100644
--- a/modules/enterprise/gui/portal-war/pom.xml
+++ b/modules/enterprise/gui/portal-war/pom.xml
@@ -149,6 +149,11 @@
</dependency>
<dependency>
+ <groupId>i18nlog</groupId>
+ <artifactId>i18nlog</artifactId>
+ </dependency>
+
+ <dependency>
<groupId>javax.el</groupId>
<artifactId>el-api</artifactId>
<version>${el.version}</version>
diff --git a/modules/enterprise/remoting/cli/pom.xml b/modules/enterprise/remoting/cli/pom.xml
index 5453a41..b118a9e 100644
--- a/modules/enterprise/remoting/cli/pom.xml
+++ b/modules/enterprise/remoting/cli/pom.xml
@@ -51,6 +51,11 @@
</dependency>
<dependency>
+ <groupId>i18nlog</groupId>
+ <artifactId>i18nlog</artifactId>
+ </dependency>
+
+ <dependency>
<groupId>jline</groupId>
<artifactId>jline</artifactId>
<version>${jline.version}</version>
diff --git a/modules/enterprise/server/jar/pom.xml b/modules/enterprise/server/jar/pom.xml
index a897a53..b0b3484 100644
--- a/modules/enterprise/server/jar/pom.xml
+++ b/modules/enterprise/server/jar/pom.xml
@@ -153,6 +153,11 @@
</dependency>
<dependency>
+ <groupId>i18nlog</groupId>
+ <artifactId>i18nlog</artifactId>
+ </dependency>
+
+ <dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-javamail_1.3.1_spec</artifactId>
<!-- The Sun javamail jar isn't available from a public repo due to licensing issues,
commit d8e467b5ab9fd98bb3196e0a5e6c19a671135dbb
Merge: 08ea91d... 0807fc7...
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Mon Aug 2 09:57:08 2010 -0400
Merge branch 'master' of ssh://git.fedorahosted.org/git/rhq/rhq
commit 08ea91d04e4c61dfc41295262f2cac7af869d54e
Merge: c3a4115... dbd7dc1...
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Fri Jul 30 10:38:32 2010 -0400
Merge branch 'master' of ssh://git.fedorahosted.org/git/rhq/rhq
commit c3a411545c18e5efa8b5889416398d8bb8a1b5ae
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Thu Jul 29 15:58:07 2010 -0400
move i18nlog dep from deps section to depMgmt section
diff --git a/pom.xml b/pom.xml
index 306bbff..6bc9e4e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -278,6 +278,12 @@
</dependency>
<dependency>
+ <groupId>i18nlog</groupId>
+ <artifactId>i18nlog</artifactId>
+ <version>${i18nlog.version}</version>
+ </dependency>
+
+ <dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>${jaxb-api.version}</version>
@@ -420,12 +426,6 @@
<scope>provided</scope>
</dependency>
- <dependency>
- <groupId>i18nlog</groupId>
- <artifactId>i18nlog</artifactId>
- <version>${i18nlog.version}</version>
- </dependency>
-
<!-- for the JAXB annotations -->
<dependency>
<groupId>javax.xml.bind</groupId>
13 years, 9 months
[rhq] .classpath
by Joseph Marques
.classpath | 5 +++++
1 file changed, 5 insertions(+)
New commits:
commit 0807fc7979b0cf42c1e0e5b1a746776221533a08
Author: Joseph Marques <joseph(a)redhat.com>
Date: Mon Aug 2 01:18:59 2010 -0400
add more plugins to the eclipse build path
diff --git a/.classpath b/.classpath
index ac5cafd..15da9c3 100644
--- a/.classpath
+++ b/.classpath
@@ -1,6 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="modules/common/jboss-as/src/main/java"/>
+ <classpathentry kind="src" path="modules/plugins/irc/src/main/java"/>
+ <classpathentry kind="src" path="modules/plugins/services/src/main/java"/>
+ <classpathentry kind="src" path="modules/plugins/iptables/src/main/java"/>
+ <classpathentry kind="src" path="modules/plugins/iptables/src/test/java"/>
+ <classpathentry kind="src" path="modules/plugins/hadoop/src/main/java"/>
<classpathentry kind="src" path="modules/enterprise/remoting/webservices/src/test/java"/>
<classpathentry kind="src" path="modules/common/ant-bundle/src/main/java"/>
<classpathentry kind="src" path="modules/common/ant-bundle/src/test/java"/>
13 years, 9 months