diff --git a/config/alfresco/messages/webclient.properties b/config/alfresco/messages/webclient.properties index db6df5af57..c5a8a9df79 100644 --- a/config/alfresco/messages/webclient.properties +++ b/config/alfresco/messages/webclient.properties @@ -1554,6 +1554,15 @@ repoadmin_last_command=Last command: repoadmin_duration=Duration: 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 show=Show diff --git a/source/java/org/alfresco/web/app/ResourceBundleWrapper.java b/source/java/org/alfresco/web/app/ResourceBundleWrapper.java index 9810486877..fd58c2f8cb 100644 --- a/source/java/org/alfresco/web/app/ResourceBundleWrapper.java +++ b/source/java/org/alfresco/web/app/ResourceBundleWrapper.java @@ -200,8 +200,11 @@ public final class ResourceBundleWrapper extends ResourceBundle // Note: path here is XPath for selectNodes query path = PATH + "/cm:" + customName; InputStream is = messageService.getRepoResourceBundle(Repository.getStoreRef(), path, locale); - customBundle = new PropertyResourceBundle(is); - is.close(); + if (is != null) + { + customBundle = new PropertyResourceBundle(is); + is.close(); + } } catch (Throwable t) { diff --git a/source/java/org/alfresco/web/bean/repository/tenant/TenantAdminConsoleBean.java b/source/java/org/alfresco/web/bean/repository/tenant/TenantAdminConsoleBean.java new file mode 100755 index 0000000000..7eeeb022a9 --- /dev/null +++ b/source/java/org/alfresco/web/bean/repository/tenant/TenantAdminConsoleBean.java @@ -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()); + } + } + +} diff --git a/source/web/WEB-INF/faces-config-beans.xml b/source/web/WEB-INF/faces-config-beans.xml index ca93c5a5b9..c49f61b183 100644 --- a/source/web/WEB-INF/faces-config-beans.xml +++ b/source/web/WEB-INF/faces-config-beans.xml @@ -2374,8 +2374,19 @@ repoAdminInterpreter #{repoAdminInterpreter} - + + + Backing bean used for the Tenant Admin Console + TenantAdminConsoleBean + org.alfresco.web.bean.repository.tenant.TenantAdminConsoleBean + session + + tenantInterpreter + #{tenantInterpreter} + + + The bean that backs up the Email Space Users Dialog diff --git a/source/web/jsp/admin/tenantadmin-console.jsp b/source/web/jsp/admin/tenantadmin-console.jsp new file mode 100755 index 0000000000..63dbcbc0d1 --- /dev/null +++ b/source/web/jsp/admin/tenantadmin-console.jsp @@ -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" %> + + + + + + <%-- load a bundle of properties with I18N strings --%> + + + + + + + + + + +
+ + + + + +
+ +
+ +
+ + + + + + + +
User:
+ +
+ + + + + + + + + +
+ + + +
+
+ + + + + + + + +
+
+
+ ----- +
+
+
+ +
+ +
+ +