[embjopr-commits] EMBJOPR SVN: r80 - trunk/core/src/main/java/org/jboss/on/embedded.

embjopr-commits at lists.jboss.org embjopr-commits at lists.jboss.org
Fri Dec 19 19:23:43 EST 2008


Author: charles.crouch at jboss.com
Date: 2008-12-19 19:23:43 -0500 (Fri, 19 Dec 2008)
New Revision: 80

Added:
   trunk/core/src/main/java/org/jboss/on/embedded/LoggingInventoryEventListener.java
Modified:
   trunk/core/src/main/java/org/jboss/on/embedded/BootstrapAction.java
Log:
Add a debugging event listener

Modified: trunk/core/src/main/java/org/jboss/on/embedded/BootstrapAction.java
===================================================================
--- trunk/core/src/main/java/org/jboss/on/embedded/BootstrapAction.java	2008-12-20 00:22:43 UTC (rev 79)
+++ trunk/core/src/main/java/org/jboss/on/embedded/BootstrapAction.java	2008-12-20 00:23:43 UTC (rev 80)
@@ -122,6 +122,7 @@
         logLoadedPlugins(pluginContainer);
         // Add our inventory listener BEFORE initiating Resource discovery.
         pluginContainer.getInventoryManager().addInventoryEventListener(this.inventoryEventListener);
+        pluginContainer.getInventoryManager().addInventoryEventListener(new LoggingInventoryEventListener());
         ResourceManager resourceManager = ResourceManagerFactory.resourceManager();
         resourceManager.discoverResources();
         LOG.info("Done bootstrapping Administration Console.");

Added: trunk/core/src/main/java/org/jboss/on/embedded/LoggingInventoryEventListener.java
===================================================================
--- trunk/core/src/main/java/org/jboss/on/embedded/LoggingInventoryEventListener.java	                        (rev 0)
+++ trunk/core/src/main/java/org/jboss/on/embedded/LoggingInventoryEventListener.java	2008-12-20 00:23:43 UTC (rev 80)
@@ -0,0 +1,64 @@
+/*
+ * 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.jboss.on.embedded;
+
+import java.util.Set;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.rhq.core.domain.resource.Resource;
+import org.rhq.core.pc.inventory.InventoryEventListener;
+
+/**
+ * @author Ian Springer
+ */
+public class LoggingInventoryEventListener implements InventoryEventListener
+{
+    private final Log log = LogFactory.getLog(this.getClass());
+
+    public void resourcesAdded(Set<Resource> resources)
+    {
+    	log.debug("The following resources have been added");
+		log(resources);
+    }
+
+    public void resourcesRemoved(Set<Resource> resources)
+    {
+    	log.debug("The following resources have been removed");
+		log(resources);
+    	return;
+    }
+
+    public void resourceActivated(Resource resource)
+    {
+    	log.debug("The following resource has been activated");
+		log(resource);
+    	return;
+    }
+	
+	private void log(Set<Resource> resources) {
+		for (Resource resource : resources) {
+			log(resource);
+		}
+	}
+	
+	private void log(Resource resource) {
+		log.debug("Resource[" + resource.getId() + "]: " + resource.getName());
+	}
+}




More information about the embjopr-commits mailing list