This commit is contained in:
Shinsuke Sugaya 2013-11-30 22:35:42 +09:00
parent 41ab30560d
commit 85ceb6e37f
5 changed files with 91 additions and 52 deletions

View file

@ -31,7 +31,6 @@ import jp.sf.fess.db.exentity.ScheduledJob;
import jp.sf.fess.form.admin.SystemForm;
import jp.sf.fess.helper.SystemHelper;
import jp.sf.fess.helper.WebManagementHelper;
import jp.sf.fess.job.TriggeredJob;
import jp.sf.fess.service.ScheduledJobService;
import org.codelibs.core.util.DynamicProperties;
@ -221,12 +220,7 @@ public class SystemAction implements Serializable {
final List<ScheduledJob> scheduledJobList = scheduledJobService
.getCrawloerJobList();
for (final ScheduledJob scheduledJob : scheduledJobList) {
new Thread(new Runnable() {
@Override
public void run() {
new TriggeredJob().execute(scheduledJob);
}
}).start();
scheduledJob.start();
}
SAStrutsUtil.addSessionMessage("success.start_crawl_process");
} else {
@ -244,8 +238,13 @@ public class SystemAction implements Serializable {
@Execute(validator = true, input = "index")
public String stop() {
if (systemHelper.isCrawlProcessRunning()) {
for (final String sessionId : systemHelper.getRunningSessionIdSet()) {
systemHelper.destroyCrawlerProcess(sessionId);
if (StringUtil.isNotBlank(systemForm.sessionId)) {
systemHelper.destroyCrawlerProcess(systemForm.sessionId);
} else {
for (final String sessionId : systemHelper
.getRunningSessionIdSet()) {
systemHelper.destroyCrawlerProcess(sessionId);
}
}
SAStrutsUtil.addSessionMessage("success.stopping_crawl_process");
} else {
@ -316,8 +315,9 @@ public class SystemAction implements Serializable {
return systemHelper.isCrawlProcessRunning();
}
public Set<String> getRunningSessionIdSet() {
return systemHelper.getRunningSessionIdSet();
public String[] getRunningSessionIds() {
final Set<String> idSet = systemHelper.getRunningSessionIdSet();
return idSet.toArray(new String[idSet.size()]);
}
}

View file

@ -19,6 +19,7 @@ package jp.sf.fess.db.exentity;
import jp.sf.fess.Constants;
import jp.sf.fess.db.bsentity.BsScheduledJob;
import jp.sf.fess.helper.SystemHelper;
import jp.sf.fess.job.TriggeredJob;
import org.seasar.framework.container.SingletonS2Container;
@ -51,4 +52,14 @@ public class ScheduledJob extends BsScheduledJob {
return SingletonS2Container.getComponent(SystemHelper.class)
.getJobExecutoer(getId()) != null;
}
public void start() {
final ScheduledJob scheduledJob = this;
new Thread(new Runnable() {
@Override
public void run() {
new TriggeredJob().execute(scheduledJob);
}
}).start();
}
}

View file

@ -712,16 +712,17 @@ labels.solr_current_select_server=Current Select Server
labels.solr_current_update_server=Current Update Server
labels.solr_title_action=Solr Action
labels.solr_title_delete=Delete
labels.solr_process_running=Crawler Process
labels.solr_running=Running
labels.solr_stopped=Stopped
labels.crawler_process_running=Crawler Process
labels.crawler_running=Running
labels.crawler_stopped=Stopped
labels.crawler_process_action=Action
labels.solr_document_title=Added Documents
labels.solr_group_name=Server Group
labels.session_name=Session
labels.solr_num_of_docs=Num of Docs
labels.solr_title_edit=Solr Status
labels.solr_button_start=Start Crawler
labels.solr_button_stop=Stop Crawker
labels.crawler_button_start=Start Crawler
labels.crawler_button_stop=Stop Crawker
labels.solr_management_title=Solr Instance
labels.solr_instance_name=Name
labels.solr_instance_status=Status
@ -734,6 +735,8 @@ labels.system_document_all=All
labels.system_group_server_name=Group : Server
labels.system_server_status=Server Status
labels.system_index_status=Index Status
labels.crawler_status_title=Crawler Status
labels.crawler_sessionid_all=All
# view/admin/crawlingSession/confirm.jsp
#labels.path_mapping_configuration=

View file

@ -710,16 +710,17 @@ labels.solr_current_select_server=\u73fe\u5728\u306e\u691c\u7d22\u7528\u30b5\u30
labels.solr_current_update_server=\u73fe\u5728\u306e\u66f4\u65b0\u7528\u30b5\u30fc\u30d0\u30fc
labels.solr_title_action=Solr \u30a2\u30af\u30b7\u30e7\u30f3
labels.solr_title_delete=\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u524a\u9664
labels.solr_process_running=\u30af\u30ed\u30fc\u30e9\u30fc\u30d7\u30ed\u30bb\u30b9
labels.solr_running=\u5b9f\u884c\u4e2d
labels.solr_stopped=\u505c\u6b62\u4e2d
labels.crawler_process_running=\u30af\u30ed\u30fc\u30e9\u30fc\u30d7\u30ed\u30bb\u30b9
labels.crawler_running=\u5b9f\u884c\u4e2d
labels.crawler_stopped=\u505c\u6b62\u4e2d
labels.crawler_process_action=\u30a2\u30af\u30b7\u30e7\u30f3
labels.solr_document_title=\u8ffd\u52a0\u3055\u308c\u305f\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8
labels.solr_group_name=\u30b5\u30fc\u30d0\u30fc\u30b0\u30eb\u30fc\u30d7
labels.session_name=\u30bb\u30c3\u30b7\u30e7\u30f3
labels.solr_num_of_docs=\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u6570
labels.solr_title_edit=Solr \u72b6\u614b\u8a2d\u5b9a
labels.solr_button_start=\u30af\u30ed\u30fc\u30eb\u306e\u958b\u59cb
labels.solr_button_stop=\u30af\u30ed\u30fc\u30eb\u306e\u505c\u6b62
labels.crawler_button_start=\u30af\u30ed\u30fc\u30eb\u306e\u958b\u59cb
labels.crawler_button_stop=\u30af\u30ed\u30fc\u30eb\u306e\u505c\u6b62
labels.solr_management_title=Solr\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9
labels.solr_instance_name=\u540d\u524d
labels.solr_instance_status=\u72b6\u614b
@ -732,6 +733,8 @@ labels.system_document_all=\u3059\u3079\u3066
labels.system_group_server_name=\u30b0\u30eb\u30fc\u30d7 : \u30b5\u30fc\u30d0\u30fc
labels.system_server_status=\u30b5\u30fc\u30d0\u30fc\u72b6\u614b
labels.system_index_status=\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u72b6\u614b
labels.crawler_status_title=\u30af\u30ed\u30fc\u30e9\u30fc\u72b6\u614b
labels.crawler_sessionid_all=\u3059\u3079\u3066
# view/admin/crawlingSession/confirm.jsp
#labels.path_mapping_configuration=

View file

@ -20,54 +20,76 @@
</div>
<%-- Message: END --%>
<div>
<h3>
<bean:message key="labels.system_title_system_status" />
</h3>
<table class="bordered-table zebra-striped">
<tbody>
<tr>
<th><bean:message key="labels.solr_current_select_server" />
</th>
<td>${f:h(currentServerForSelect)} (<c:if
test="${currentServerStatusForSelect=='ACTIVE'}">
<bean:message key="labels.solr_active" />
</c:if> <c:if test="${currentServerStatusForSelect!='ACTIVE'}">
<bean:message key="labels.solr_inactive" />
</c:if>)
</td>
</tr>
<tr>
<th><bean:message key="labels.solr_current_update_server" />
</th>
<td>${f:h(currentServerForUpdate)} (<c:if
test="${currentServerStatusForUpdate=='ACTIVE'}">
<bean:message key="labels.solr_active" />
</c:if> <c:if test="${currentServerStatusForUpdate!='ACTIVE'}">
<bean:message key="labels.solr_inactive" />
</c:if>)
</td>
</tr>
</tbody>
</table>
</div>
<s:form>
<div>
<h3>
<bean:message key="labels.system_title_system_status" />
<bean:message key="labels.crawler_status_title" />
</h3>
<table class="bordered-table zebra-striped">
<tbody>
<tr>
<th style="width: 200px;"><bean:message
key="labels.solr_process_running" /></th>
key="labels.crawler_process_running" /></th>
<td>
<span style="margin-right:20px;">
<c:if test="${crawlerRunning}">
<bean:message key="labels.solr_running" />
<c:if test="${runningSessionId!=null}">(${f:h(runningSessionId)})</c:if>
<bean:message key="labels.crawler_running" />
</c:if><c:if test="${!crawlerRunning}">
<bean:message key="labels.solr_stopped" />
<bean:message key="labels.crawler_stopped" />
</c:if>
</span>
<c:if test="${crawlerRunning}">
<input type="submit" class="btn" name="stop"
value="<bean:message key="labels.solr_button_stop"/>" />
</c:if> <c:if test="${!crawlerRunning}">
<input type="submit" class="btn" name="start"
value="<bean:message key="labels.solr_button_start"/>" />
</c:if>
</td>
</tr>
<tr>
<th><bean:message key="labels.solr_current_select_server" />
</th>
<td>${f:h(currentServerForSelect)} (<c:if
test="${currentServerStatusForSelect=='ACTIVE'}">
<bean:message key="labels.solr_active" />
</c:if> <c:if test="${currentServerStatusForSelect!='ACTIVE'}">
<bean:message key="labels.solr_inactive" />
</c:if>)
</td>
</tr>
<tr>
<th><bean:message key="labels.solr_current_update_server" />
</th>
<td>${f:h(currentServerForUpdate)} (<c:if
test="${currentServerStatusForUpdate=='ACTIVE'}">
<bean:message key="labels.solr_active" />
</c:if> <c:if test="${currentServerStatusForUpdate!='ACTIVE'}">
<bean:message key="labels.solr_inactive" />
</c:if>)
<th style="width: 200px;"><bean:message
key="labels.crawler_process_action" /></th>
<td>
<c:if test="${!crawlerRunning}">
<input type="submit" class="btn" name="start"
value="<bean:message key="labels.crawler_button_start"/>" />
</c:if>
<c:if test="${crawlerRunning}">
<html:select property="sessionId" style="width:100px">
<option value=""><bean:message key="labels.crawler_sessionid_all"/></option>
<c:forEach var="runningSessionId" items="${runningSessionIds}">
<option value="${f:h(runningSessionId)}">${f:h(runningSessionId)}</option>
</c:forEach>
</html:select>
<input type="submit" class="btn" name="stop"
value="<bean:message key="labels.crawler_button_stop"/>" />
</c:if>
</td>
</tr>
</tbody>