提交 7a7b3558 编写于 作者: K kohsuke

recording the progress.

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@13741 71c3de6d-444a-0410-be80-ed276b4c234a
上级 b763dcc9
......@@ -329,6 +329,10 @@ public final class Hudson extends View implements ItemGroup<TopLevelItem>, Node,
*/
public transient volatile ProxyConfiguration proxy;
/**
* {@link LogRecorder}s.
*/
public transient final Map<String,LogRecorder> logRecorders = new CopyOnWriteMap.Hash<String,LogRecorder>();
public Hudson(File root, ServletContext context) throws IOException {
this.root = root;
......@@ -1238,6 +1242,14 @@ public final class Hudson extends View implements ItemGroup<TopLevelItem>, Node,
return items.get(name);
}
/**
* Exposes {@link LogRecorder}s to URL.
*/
public LogRecorder getLog(String name) {
checkPermission(ADMINISTER);
return logRecorders.get(name);
}
public File getRootDirFor(TopLevelItem child) {
return getRootDirFor(child.getName());
}
......
......@@ -13,8 +13,13 @@ import java.util.logging.ErrorManager;
import java.util.logging.Logger;
import java.lang.ref.WeakReference;
import java.io.UnsupportedEncodingException;
import java.io.IOException;
import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerResponse;
import javax.servlet.ServletException;
/**
* Records a selected set of logs so that the system administrator
......@@ -22,6 +27,10 @@ import org.kohsuke.stapler.DataBoundConstructor;
*
* TODO: still a work in progress.
*
* <h3>Access Control</h3>
* {@link LogRecorder} is only visible for administrators, and this access control happens at
* {@link Hudson#getLog(String)}, the sole entry point for binding {@link LogRecorder} to URL.
*
* @author Kohsuke Kawaguchi
*/
public class LogRecorder extends AbstractModelObject {
......@@ -88,10 +97,18 @@ public class LogRecorder extends AbstractModelObject {
return name;
}
public void doConfigure() {
// TODO
/**
* Accepts submission from the configuration page.
*/
public synchronized void doConfigSubmit( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException {
}
/**
* Gets a view of the log records.
*/
public List<LogRecord> getLogRecords() {
return handler.getView();
}
/**
......
<!--
Config page
-->
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">
<l:layout norefresh="true">
<st:include page="sidepanel.jelly" />
<l:main-panel xmlns:local="local">
<f:form method="post" name="config" action="configSubmit">
<f:entry title="${%Home directory}" help="/help/system-config/homeDirectory.html">
${it.rootDir}
</f:entry>
<f:entry title="${%System Message}" help="/help/system-config/systemMessage.html">
<f:textarea name="system_message" value="${it.systemMessage}" />
</f:entry>
<f:entry title="${%Quiet period}" help="/help/project-config/quietPeriod.html">
<input class="setting-input number" name="quiet_period"
type="text" value="${it.quietPeriod}"/>
</f:entry>
<f:optionalBlock name="use_security" title="${%Enable security}"
checked="${it.useSecurity}" help="/help/system-config/enableSecurity.html">
<f:entry title="${%TCP port for JNLP slave agents}"
help="/help/system-config/master-slave/slave-agent-port.html">
<f:radio name="slaveAgentPortType" value="fixed" id="sat.fixed"
checked="${it.slaveAgentPort &gt; 0}" onclick="$('sat.port').disabled=false"/>
<label for="sat.fixed">${%Fixed}</label> :
<input type="text" class="number" name="slaveAgentPort" id="sat.port"
value="${h.ifThenElse(it.slaveAgentPort &gt; 0, it.slaveAgentPort, null)}"
disabled="${h.ifThenElse(it.slaveAgentPort &gt; 0, null, 'true')}"/>
<st:nbsp />
<f:radio name="slaveAgentPortType" value="random" id="sat.random"
checked="${it.slaveAgentPort==0}" onclick="$('sat.port').disabled=true" />
<label for="sat.random">${%Random}</label>
<st:nbsp />
<f:radio name="slaveAgentPortType" value="disable" id="sat.disabled"
checked="${it.slaveAgentPort==-1}" onclick="$('sat.port').disabled=true" />
<label for="sat.disabled">${%Disable}</label>
</f:entry>
<f:entry title="${%Access Control}">
<table style="width:100%">
<f:descriptorRadioList title="${%Security Realm}" varName="realm"
instance="${it.securityRealm}"
descriptors="${h.securityRealmDescriptors}"/>
<f:descriptorRadioList title="${%Authorization}" varName="authorization"
instance="${it.authorizationStrategy}"
descriptors="${h.authorizationStrategyDescriptors}"/>
</table>
</f:entry>
</f:optionalBlock>
<f:optionalBlock name="usageStatisticsCollected" checked="${it.usageStatisticsCollected}"
title="${%statsBlurb}"
help="/help/system-config/usage-statistics.html" />
<f:section title="${%JDKs}">
<f:entry title="${%JDK installations}"
description="${%List of JDK installations on this system}">
<f:repeatable var="inst" items="${it.JDKs}" name="jdks">
<table width="100%">
<f:entry title="${%name}">
<input class="setting-input" name="jdk_name"
type="text" value="${inst.name}" />
</f:entry>
<j:set var="status" value="${null}" />
<j:if test="${inst!=null and !inst.exists and inst.name!=''}">
<j:set var="status" value="${%no.such.JDK}" />
</j:if>
<f:entry title="JAVA_HOME" description="${status}">
<input class="setting-input validated" name="jdk_home"
type="text" value="${inst.javaHome}"
checkUrl="'javaHomeCheck?value='+escape(this.value)"/>
</f:entry>
<f:entry title="">
<div align="right">
<f:repeatableDeleteButton />
</div>
</f:entry>
</table>
</f:repeatable>
</f:entry>
</f:section>
<!-- list config pages from plugins, if any -->
<j:forEach var="p" items="${it.pluginManager.plugins}">
<j:if test="${h.hasView(p.plugin,'config.jelly')}">
<f:rowSet name="plugin">
<tr><td>
<input type="hidden" name="name" value="${p.shortName}"/>
</td></tr>
<st:include page="config.jelly" it="${p.plugin}" optional="true"/>
</f:rowSet>
</j:if>
</j:forEach>
<d:taglib uri="local">
<!-- display global config pages for the given descriptors -->
<d:tag name="globalConfig">
<j:getStatic var="descriptors" className="${className}" field="${field}" />
<j:forEach var="idx" begin="0" end="${size(descriptors)-1}">
<j:set var="descriptor" value="${descriptors[idx]}" />
<j:set var="instance" value="${descriptor}" /><!-- this makes the <f:textbox field=.../> work -->
<f:rowSet name="${descriptor.jsonSafeClassName}">
<st:include page="${descriptor.globalConfigPage}" from="${descriptor}" optional="true"/>
</f:rowSet>
</j:forEach>
</d:tag>
</d:taglib>
<local:globalConfig className="hudson.triggers.Triggers" field="TRIGGERS" />
<local:globalConfig className="hudson.tasks.BuildWrappers" field="WRAPPERS" />
<local:globalConfig className="hudson.tasks.BuildStep" field="BUILDERS" />
<local:globalConfig className="hudson.scm.SCMS" field="SCMS" />
<local:globalConfig className="hudson.tasks.BuildStep" field="PUBLISHERS" />
<local:globalConfig className="hudson.model.Jobs" field="PROPERTIES" />
<local:globalConfig className="hudson.model.PageDecorator" field="ALL" />
<f:block>
<f:submit value="${%Save}" />
</f:block>
</f:form>
</l:main-panel>
</l:layout>
</j:jelly>
<!--
Log view
-->
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">
<l:layout title="Log" permission="${app.ADMINISTER}">
<st:include page="sidepanel.jelly" />
<l:main-panel>
<h1><img src="images/48x48/clipboard.gif" alt=""/>${it.displayName}</h1>
<j:forEach var="log" items="${it.logRecords}">
<pre>${h.printLogRecord(log)}</pre>
</j:forEach>
</l:main-panel>
</l:layout>
</j:jelly>
<!--
Side panel for the log recorder
-->
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form" xmlns:i="jelly:fmt">
<l:header />
<l:side-panel>
<l:tasks>
<l:task icon="images/24x24/up.gif" href=".." title="${%Back to Dashboard}" />
<l:task icon="images/24x24/notepad.gif" href="." title="${%Log records}" />
<l:task icon="images/24x24/setting.gif" href="configure" title="${%Configure}" />
</l:tasks>
</l:side-panel>
</j:jelly>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册