Title: [41035] trunk/hudson/plugins/monitoring/src/main: backup of experiment
Revision
41035
Author
evernat
Date
2013-12-22 17:02:45 -0500 (Sun, 22 Dec 2013)

Log Message

backup of experiment

Added Paths


Diff

Added: trunk/hudson/plugins/monitoring/src/main/java/net/bull/javamelody/NodesColumn.bak (0 => 41035)


--- trunk/hudson/plugins/monitoring/src/main/java/net/bull/javamelody/NodesColumn.bak	                        (rev 0)
+++ trunk/hudson/plugins/monitoring/src/main/java/net/bull/javamelody/NodesColumn.bak	2013-12-22 22:02:45 UTC (rev 41035)
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2008-2011 by Emeric Vernat
+ *
+ *     This file is part of the Monitoring plugin.
+ *
+ * The Monitoring plugin is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The Monitoring plugin 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 Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with the Monitoring plugin.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package net.bull.javamelody;
+
+import hudson.Extension;
+import hudson.model.Computer;
+import hudson.node_monitors.AbstractNodeMonitorDescriptor;
+import hudson.node_monitors.NodeMonitor;
+
+import java.io.IOException;
+
+import jenkins.model.Jenkins;
+import net.sf.json.JSONObject;
+
+import org.kohsuke.stapler.StaplerRequest;
+
+/**
+ * Add a Monitoring actions column in the nodes list.
+ * This class is currently not used: NodesMonitoringActionFactory is used instead.
+ * 
+ * @author Emeric Vernat
+ */
+public class NodesColumn extends NodeMonitor {
+	@Extension
+	public static final AbstractNodeMonitorDescriptor<String> DESCRIPTOR = new AbstractNodeMonitorDescriptor<String>() {
+		@Override
+		protected String monitor(Computer c) throws IOException, InterruptedException {
+			return c.getName();
+		}
+
+		@Override
+		public String getDisplayName() {
+			return "Monitoring";
+		}
+
+		@Override
+		public NodeMonitor newInstance(StaplerRequest req, JSONObject formData)
+				throws FormException {
+			return new NodesColumn();
+		}
+	};
+
+	/**
+	 * Constructor.
+	 */
+	public NodesColumn() {
+		super();
+		setIgnored(true);
+	}
+
+	/**
+	 * {@inheritDoc}
+	 */
+	@Override
+	public String getColumnCaption() {
+		// Hide this column from non-admins
+		return Jenkins.getInstance().hasPermission(Jenkins.ADMINISTER) ? super.getColumnCaption()
+				: null;
+	}
+}

Added: trunk/hudson/plugins/monitoring/src/main/resources/net/bull/javamelody/NodesColumn/column.jelly.bak (0 => 41035)


--- trunk/hudson/plugins/monitoring/src/main/resources/net/bull/javamelody/NodesColumn/column.jelly.bak	                        (rev 0)
+++ trunk/hudson/plugins/monitoring/src/main/resources/net/bull/javamelody/NodesColumn/column.jelly.bak	2013-12-22 22:02:45 UTC (rev 41035)
@@ -0,0 +1,75 @@
+<!--
+  This view is used to render the "Monitoring" column in the nodes page.
+-->
+
+<!-- "data" is the monitored data from the node and "from" is the NodeMonitor.
+  But in this case, data is the name of the node and the NodeMonitor is an instance of net.bull.javamelody.NodesColumn.
+-->
+
+<?jelly escape-by-default='true'?>
+<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:s="/lib/form">
+  <td align="center">
+  <j:choose>
+    <j:when test="${data=""
+      N/A
+    </j:when>
+    <j:otherwise>
+      <j:choose>
+        <j:when test="${data.length() == 0}">
+
+		<a href=""
+			<img src="" width="20" height="20" alt="View threads" title="View threads" />
+		</a>
+		<st:nbsp/>
+		<a href="" _onclick_="_javascript_:return confirm('Do you confirm execution of the garbage collector (GC) ?\n(this can take some seconds)');">
+			<img src="" width="20" height="20" alt="Execute the garbage collector" title="Execute the garbage collector" />
+		</a>
+		<st:nbsp/>
+		<a href="" _onclick_="_javascript_:return confirm('Do you confirm the generation of a heap dump of the server ?\n(this can take some minutes)');">
+			<img src="" width="20" height="20" alt="Generate a heap dump" title="Generate a heap dump" />
+		</a>
+		<st:nbsp/>
+		<a href=""
+			<img src="" width="20" height="20" alt="View memory histogram" title="View memory histogram" />
+		</a>
+		<st:nbsp/>
+		<a href=""
+			<img src="" width="20" height="20" alt="MBeans" title="MBeans" />
+		</a>
+		<st:nbsp/>
+		<a href=""
+			<img src="" width="20" height="20" alt="View OS processes" title="View OS processes" />
+		</a>
+
+        </j:when>
+        <j:otherwise>
+		<a href=""
+			<img src="" width="20" height="20" alt="View threads" title="View threads" />
+		</a>
+		<st:nbsp/>
+		<a href="" _onclick_="_javascript_:return confirm('Do you confirm execution of the garbage collector (GC) ?\n(this can take some seconds)');">
+			<img src="" width="20" height="20" alt="Execute the garbage collector" title="Execute the garbage collector" />
+		</a>
+		<st:nbsp/>
+		<a href="" _onclick_="_javascript_:return confirm('Do you confirm the generation of a heap dump of the server ?\n(this can take some minutes)');">
+			<img src="" width="20" height="20" alt="Generate a heap dump" title="Generate a heap dump" />
+		</a>
+		<st:nbsp/>
+		<a href=""
+			<img src="" width="20" height="20" alt="View memory histogram" title="View memory histogram" />
+		</a>
+		<st:nbsp/>
+		<a href=""
+			<img src="" width="20" height="20" alt="MBeans" title="MBeans" />
+		</a>
+		<st:nbsp/>
+		<a href=""
+			<img src="" width="20" height="20" alt="View OS processes" title="View OS processes" />
+		</a>
+
+		</j:otherwise>
+      </j:choose>
+    </j:otherwise>
+  </j:choose>
+  </td>
+</j:jelly>

--
You received this message because you are subscribed to the Google Groups "Jenkins Commits" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-commits+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to