This commit is contained in:
Jan Vonka
2007-09-14 11:22:26 +00:00
parent 3515f388ff
commit 4c3222257e
5 changed files with 318 additions and 3 deletions

View File

@@ -1554,6 +1554,15 @@ repoadmin_last_command=Last command:
repoadmin_duration=Duration: repoadmin_duration=Duration:
repoadmin_duration_ms=ms repoadmin_duration_ms=ms
# Tenant Admin Console messages
title_tenantadmin_console=Tenant Admin Console
tenantadmin_context=Context
tenantadmin_command=Command (type help for help)
tenantadmin_command_submit=Submit
tenantadmin_last_command=Last command:
tenantadmin_duration=Duration:
tenantadmin_duration_ms=ms
# OpenSearch messages # OpenSearch messages
show=Show show=Show

View File

@@ -200,8 +200,11 @@ public final class ResourceBundleWrapper extends ResourceBundle
// Note: path here is XPath for selectNodes query // Note: path here is XPath for selectNodes query
path = PATH + "/cm:" + customName; path = PATH + "/cm:" + customName;
InputStream is = messageService.getRepoResourceBundle(Repository.getStoreRef(), path, locale); InputStream is = messageService.getRepoResourceBundle(Repository.getStoreRef(), path, locale);
customBundle = new PropertyResourceBundle(is); if (is != null)
is.close(); {
customBundle = new PropertyResourceBundle(is);
is.close();
}
} }
catch (Throwable t) catch (Throwable t)
{ {

View File

@@ -0,0 +1,185 @@
/*
* Copyright (C) 2005-2007 Alfresco Software Limited.
*
* 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; either version 2
* of the License, or (at your option) any later version.
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* As a special exception to the terms and conditions of version 2.0 of
* the GPL, you may redistribute this Program in connection with Free/Libre
* and Open Source Software ("FLOSS") applications as described in Alfresco's
* FLOSS exception. You should have recieved a copy of the text describing
* the FLOSS exception, and it is also available here:
* http://www.alfresco.com/legal/licensing"
*/
package org.alfresco.web.bean.repository.tenant;
import java.io.PrintWriter;
import java.io.StringWriter;
import org.alfresco.repo.tenant.TenantInterpreter;
/**
* Backing bean to support the Tenant Admin Console
*/
public class TenantAdminConsoleBean
{
// command
private String command = "";
private String submittedCommand = "none";
private long duration = 0L;
private String result = null;
// supporting repository services
private TenantInterpreter tenantInterpreter;
/**
* @param tenantInterpreter tenant admin interpreter
*/
public void setTenantInterpreter(TenantInterpreter tenantInterpreter)
{
this.tenantInterpreter = tenantInterpreter;
}
/**
* Gets the command result
*
* @return result
*/
public String getResult()
{
if (result == null)
{
interpretCommand("help");
}
return result;
}
/**
* Sets the command result
*
* @param result
*/
public void setResult(String result)
{
this.result = result;
}
/**
* Gets the current query
*
* @return query statement
*/
public String getCommand()
{
return command;
}
/**
* Set the current command
*
* @param command command
*/
public void setCommand(String command)
{
this.command = command;
}
/**
* Gets the submitted command
*
* @return submitted command
*/
public String getSubmittedCommand()
{
return submittedCommand;
}
/**
* Set the submitted command
*
* @param submittedCommand The submitted command
*/
public void setSubmittedCommand(String submittedCommand)
{
this.submittedCommand = submittedCommand;
}
/**
* Gets the last command duration
*
* @return command duration
*/
public long getDuration()
{
return duration;
}
/**
* Set the duration
*
* @param duration The duration
*/
public void setDuration(long duration)
{
this.duration = duration;
}
/**
* Action to submit command
*
* @return next action
*/
public String submitCommand()
{
interpretCommand(command);
return "success";
}
/**
* Gets the current user name
*
* @return user name
*/
public String getCurrentUserName()
{
return tenantInterpreter.getCurrentUserName();
}
/**
* Interpret tenant admin console command
*
* @param command command
*/
private void interpretCommand(String command)
{
try
{
long startms = System.currentTimeMillis();
String result = tenantInterpreter.interpretCommand(command);
setDuration(System.currentTimeMillis() - startms);
setResult(result);
setCommand("");
setSubmittedCommand(command);
}
catch (Exception e)
{
StringWriter stackTrace = new StringWriter();
e.printStackTrace(new PrintWriter(stackTrace));
setResult(stackTrace.toString());
}
}
}

View File

@@ -2374,8 +2374,19 @@
<property-name>repoAdminInterpreter</property-name> <property-name>repoAdminInterpreter</property-name>
<value>#{repoAdminInterpreter}</value> <value>#{repoAdminInterpreter}</value>
</managed-property> </managed-property>
</managed-bean> </managed-bean>
<managed-bean>
<description>Backing bean used for the Tenant Admin Console</description>
<managed-bean-name>TenantAdminConsoleBean</managed-bean-name>
<managed-bean-class>org.alfresco.web.bean.repository.tenant.TenantAdminConsoleBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
<managed-property>
<property-name>tenantInterpreter</property-name>
<value>#{tenantInterpreter}</value>
</managed-property>
</managed-bean>
<managed-bean> <managed-bean>
<description> <description>
The bean that backs up the Email Space Users Dialog The bean that backs up the Email Space Users Dialog

View File

@@ -0,0 +1,107 @@
<%--
* Copyright (C) 2005-2007 Alfresco Software Limited.
* 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; either version 2
* of the License, or (at your option) any later version.
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* As a special exception to the terms and conditions of version 2.0 of
* the GPL, you may redistribute this Program in connection with Free/Libre
* and Open Source Software ("FLOSS") applications as described in Alfresco's
* FLOSS exception. You should have recieved a copy of the text describing
* the FLOSS exception, and it is also available here:
* http://www.alfresco.com/legal/licensing"
--%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %>
<%@ page buffer="32kb" contentType="text/html;charset=UTF-8" %>
<%@ page isELIgnored="false" %>
<%@ page import="org.alfresco.web.ui.common.PanelGenerator" %>
<r:page titleId="title_tenantadmin_console">
<f:view>
<%-- load a bundle of properties with I18N strings --%>
<f:loadBundle basename="alfresco.messages.webclient" var="msg"/>
<h:form id="TenantAdmin-console-title">
<table width="100%">
<tr>
<td>
<h:graphicImage value="/images/logo/AlfrescoLogo32.png" alt="Alfresco" />
</td>
<td>
<nobr><h:outputText id="titleTenantAdminConsole" styleClass="mainTitle" value="#{msg.title_tenantadmin_console}"/></nobr>
</td>
<td width="100%" align="right">
<h:commandButton value="#{msg.close}" action="adminConsole" />
</td>
</tr>
</table>
</h:form>
<br>
<h:outputText id="contextTitle" styleClass="mainTitle" value="#{msg.tenantadmin_context}"/>
<table>
<tr>
<td><b>User:</b></td><td><h:outputText id="userName" value="#{TenantAdminConsoleBean.currentUserName}"/></td>
</tr>
</table>
<br>
<h:outputText id="commandTitle" styleClass="mainTitle" value="#{msg.tenantadmin_command}"/>
<h:form id="searchForm">
<table>
<tr>
<td>
<h:inputText id="command" size="100" value="#{TenantAdminConsoleBean.command}"/>
</td>
<td>
<h:commandButton id="submitCommand" action="#{TenantAdminConsoleBean.submitCommand}" value="#{msg.tenantadmin_command_submit}"/>
</td>
</tr>
</table>
</h:form>
<table>
<tr>
<td>
<h:outputText id="submittedCommandLabel" value="#{msg.tenantadmin_last_command}"/> <h:outputText id="submittedCommand" value="#{TenantAdminConsoleBean.submittedCommand}"/><br>
<h:outputText id="durationLabel" value="#{msg.tenantadmin_duration}"/> <h:outputText id="duration" value="#{TenantAdminConsoleBean.duration}"/><h:outputText id="durationMsLabel" value="#{msg.tenantadmin_duration_ms}"/><br>
-----
</td>
</tr>
<tr>
<td>
<pre><h:outputText id="result" value="#{TenantAdminConsoleBean.result}"/></pre>
</td>
</tr>
</table>
</f:view>
</r:page>
<script>
document.getElementById("searchForm:command").focus();
</script>