diff options
| author | Alex Rudyy <orudyy@apache.org> | 2015-04-15 09:47:28 +0000 |
|---|---|---|
| committer | Alex Rudyy <orudyy@apache.org> | 2015-04-15 09:47:28 +0000 |
| commit | 0a0baee45ebcff44635907d457c4ff6810b09c87 (patch) | |
| tree | 8bfb0f9eddbc23cff88af69be80ab3ce7d47011c /qpid/java/broker-plugins/management-http/src | |
| parent | 54aa3d7070da16ce55c28ccad3f7d0871479e461 (diff) | |
| download | qpid-python-0a0baee45ebcff44635907d457c4ff6810b09c87.tar.gz | |
QPID-6481: Move java source tree to top level
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1673693 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/broker-plugins/management-http/src')
257 files changed, 0 insertions, 31724 deletions
diff --git a/qpid/java/broker-plugins/management-http/src/main/appended-resources/META-INF/LICENSE.vm b/qpid/java/broker-plugins/management-http/src/main/appended-resources/META-INF/LICENSE.vm deleted file mode 100644 index 7a7430e2e3..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/appended-resources/META-INF/LICENSE.vm +++ /dev/null @@ -1,33 +0,0 @@ - - -#============================================== -# Third Party Dependency Licensing Information: -#============================================== - -resources/js/crypto-js/ - -This bundles portions of crypto-js, which is under the MIT licence: - - -Copyright (c) 2009-2013 Jeff Mott - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be - included in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -#=============================================== diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/DojoHelper.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/DojoHelper.java deleted file mode 100644 index 31a777d0bb..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/DojoHelper.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - * - */ -package org.apache.qpid.server.management.plugin; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.IOException; -import java.io.InputStream; -import java.util.Map; -import java.util.Properties; - -public class DojoHelper -{ - private static final Logger _logger = LoggerFactory.getLogger(DojoHelper.class); - - public static final String VERSION_FILE = "dojoconfig.properties"; - public static final String DOJO_VERSION_PROPERTY = "dojo-version"; - public static final String DOJO_PATH_PROPERTY = "dojo-path"; - public static final String DIJIT_PATH_PROPERTY = "dijit-path"; - public static final String DOJOX_PATH_PROPERTY = "dojox-path"; - - private static String _version = "undefined"; - private static String _dojoPath = "/dojo-undefined/dojo"; - private static String _dijitPath = "/dojo-undefined/dijit"; - private static String _dojoxPath = "/dojo-undefined/dojox"; - - // Loads the value from the properties file. - static - { - Properties props = new Properties(); - - try - { - InputStream propertyStream = DojoHelper.class.getClassLoader().getResourceAsStream(VERSION_FILE); - if (propertyStream == null) - { - _logger.warn("Unable to find resource " + VERSION_FILE + " from classloader"); - } - else - { - try - { - props.load(propertyStream); - } - finally - { - try - { - propertyStream.close(); - } - catch (IOException e) - { - _logger.warn("Exception closing InputStream for " + VERSION_FILE + " resource:", e); - } - } - - if (_logger.isDebugEnabled()) - { - _logger.debug("Dumping Dojo Config:"); - for (Map.Entry<Object, Object> entry : props.entrySet()) - { - _logger.debug("Property: " + entry.getKey() + " Value: " + entry.getValue()); - } - - _logger.debug("End of property dump"); - } - - _version = props.getProperty(DOJO_VERSION_PROPERTY, _version); - _dojoPath = props.getProperty(DOJO_PATH_PROPERTY, _dojoPath); - _dijitPath = props.getProperty(DIJIT_PATH_PROPERTY, _dijitPath); - _dojoxPath = props.getProperty(DOJOX_PATH_PROPERTY, _dojoxPath); - } - } - catch (IOException e) - { - // Log a warning about this and leave the values initialized to unknown. - _logger.error("Exception loading " + VERSION_FILE + " resource:", e); - } - } - - public static String getDojoVersion() - { - return _version; - } - - public static String getDojoPath() - { - return _dojoPath; - } - - public static String getDijitPath() - { - return _dijitPath; - } - - public static String getDojoxPath() - { - return _dojoxPath; - } -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagement.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagement.java deleted file mode 100644 index fbe9f068b9..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagement.java +++ /dev/null @@ -1,613 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.qpid.server.management.plugin; - -import java.io.IOException; -import java.io.Writer; -import java.security.GeneralSecurityException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.EnumSet; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import javax.net.ssl.KeyManager; -import javax.net.ssl.SSLContext; -import javax.net.ssl.TrustManager; -import javax.net.ssl.X509TrustManager; -import javax.servlet.DispatcherType; -import javax.servlet.MultipartConfigElement; -import javax.servlet.http.HttpServletRequest; - -import com.google.common.util.concurrent.Futures; -import com.google.common.util.concurrent.ListenableFuture; -import org.eclipse.jetty.io.EndPoint; -import org.eclipse.jetty.server.Connector; -import org.eclipse.jetty.server.Request; -import org.eclipse.jetty.server.Server; -import org.eclipse.jetty.server.SessionManager; -import org.eclipse.jetty.server.handler.ErrorHandler; -import org.eclipse.jetty.server.nio.SelectChannelConnector; -import org.eclipse.jetty.server.ssl.SslSelectChannelConnector; -import org.eclipse.jetty.servlet.FilterHolder; -import org.eclipse.jetty.servlet.ServletContextHandler; -import org.eclipse.jetty.servlet.ServletHolder; -import org.eclipse.jetty.util.ssl.SslContextFactory; -import org.eclipse.jetty.util.thread.QueuedThreadPool; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import org.apache.qpid.server.configuration.IllegalConfigurationException; -import org.apache.qpid.server.logging.messages.ManagementConsoleMessages; -import org.apache.qpid.server.management.plugin.connector.TcpAndSslSelectChannelConnector; -import org.apache.qpid.server.management.plugin.filter.ForbiddingAuthorisationFilter; -import org.apache.qpid.server.management.plugin.filter.ForbiddingTraceFilter; -import org.apache.qpid.server.management.plugin.filter.RedirectingAuthorisationFilter; -import org.apache.qpid.server.management.plugin.servlet.DefinedFileServlet; -import org.apache.qpid.server.management.plugin.servlet.FileServlet; -import org.apache.qpid.server.management.plugin.servlet.LogFileServlet; -import org.apache.qpid.server.management.plugin.servlet.rest.ApiDocsServlet; -import org.apache.qpid.server.management.plugin.servlet.rest.HelperServlet; -import org.apache.qpid.server.management.plugin.servlet.rest.LogFileListingServlet; -import org.apache.qpid.server.management.plugin.servlet.rest.LogRecordsServlet; -import org.apache.qpid.server.management.plugin.servlet.rest.LoggedOnUserPreferencesServlet; -import org.apache.qpid.server.management.plugin.servlet.rest.LogoutServlet; -import org.apache.qpid.server.management.plugin.servlet.rest.MessageContentServlet; -import org.apache.qpid.server.management.plugin.servlet.rest.MessageServlet; -import org.apache.qpid.server.management.plugin.servlet.rest.MetaDataServlet; -import org.apache.qpid.server.management.plugin.servlet.rest.QueueReportServlet; -import org.apache.qpid.server.management.plugin.servlet.rest.RestServlet; -import org.apache.qpid.server.management.plugin.servlet.rest.SaslServlet; -import org.apache.qpid.server.management.plugin.servlet.rest.StructureServlet; -import org.apache.qpid.server.management.plugin.servlet.rest.UserPreferencesServlet; -import org.apache.qpid.server.model.*; -import org.apache.qpid.server.model.adapter.AbstractPluginAdapter; -import org.apache.qpid.server.model.port.HttpPort; -import org.apache.qpid.server.model.port.PortManager; -import org.apache.qpid.server.util.ServerScopedRuntimeException; -import org.apache.qpid.transport.network.security.ssl.QpidMultipleTrustManager; -import org.apache.qpid.transport.network.security.ssl.SSLUtil; - -@ManagedObject( category = false, type = "MANAGEMENT-HTTP" ) -public class HttpManagement extends AbstractPluginAdapter<HttpManagement> implements HttpManagementConfiguration<HttpManagement>, PortManager -{ - private static final String PORT_SERVLET_ATTRIBUTE = "org.apache.qpid.server.model.Port"; - private final Logger _logger = LoggerFactory.getLogger(HttpManagement.class); - - // 10 minutes by default - public static final int DEFAULT_TIMEOUT_IN_SECONDS = 60 * 10; - public static final String TIME_OUT = "sessionTimeout"; - public static final String HTTP_BASIC_AUTHENTICATION_ENABLED = "httpBasicAuthenticationEnabled"; - public static final String HTTPS_BASIC_AUTHENTICATION_ENABLED = "httpsBasicAuthenticationEnabled"; - public static final String HTTP_SASL_AUTHENTICATION_ENABLED = "httpSaslAuthenticationEnabled"; - public static final String HTTPS_SASL_AUTHENTICATION_ENABLED = "httpsSaslAuthenticationEnabled"; - - public static final String PLUGIN_TYPE = "MANAGEMENT-HTTP"; - - private static final String OPERATIONAL_LOGGING_NAME = "Web"; - - private static final String JSESSIONID_COOKIE_PREFIX = "JSESSIONID_"; - - private Server _server; - - @ManagedAttributeField - private boolean _httpsSaslAuthenticationEnabled; - - @ManagedAttributeField - private boolean _httpSaslAuthenticationEnabled; - - @ManagedAttributeField - private boolean _httpsBasicAuthenticationEnabled; - - @ManagedAttributeField - private boolean _httpBasicAuthenticationEnabled; - - @ManagedAttributeField - private int _sessionTimeout; - - @ManagedAttributeField - private boolean _compressResponses; - - private boolean _allowPortActivation; - - @ManagedObjectFactoryConstructor - public HttpManagement(Map<String, Object> attributes, Broker broker) - { - super(attributes, broker); - } - - @StateTransition(currentState = {State.UNINITIALIZED,State.ERRORED}, desiredState = State.ACTIVE) - private ListenableFuture<Void> doStart() - { - getBroker().getEventLogger().message(ManagementConsoleMessages.STARTUP(OPERATIONAL_LOGGING_NAME)); - - Collection<Port<?>> httpPorts = getHttpPorts(getBroker().getPorts()); - _server = createServer(httpPorts); - try - { - _server.start(); - logOperationalListenMessages(httpPorts); - } - catch (Exception e) - { - throw new ServerScopedRuntimeException("Failed to start HTTP management on ports : " + httpPorts, e); - } - - getBroker().getEventLogger().message(ManagementConsoleMessages.READY(OPERATIONAL_LOGGING_NAME)); - setState(State.ACTIVE); - return Futures.immediateFuture(null); - } - - @Override - protected void onClose() - { - if (_server != null) - { - try - { - _server.stop(); - logOperationalShutdownMessage(_server); - } - catch (Exception e) - { - throw new ServerScopedRuntimeException("Failed to stop HTTP management on ports : " + getHttpPorts(getBroker().getPorts()), e); - } - } - - getBroker().getEventLogger().message(ManagementConsoleMessages.STOPPED(OPERATIONAL_LOGGING_NAME)); - } - - public int getSessionTimeout() - { - return _sessionTimeout; - } - - private Server createServer(Collection<Port<?>> ports) - { - if (_logger.isInfoEnabled()) - { - _logger.info("Starting up web server on " + ports); - } - _allowPortActivation = true; - - Server server = new Server(); - - QueuedThreadPool threadPool = new QueuedThreadPool(); - threadPool.setName("HttpManagement"); - threadPool.setMaxQueued(getContextValue(Integer.class, JETTY_THREAD_POOL_MAX_QUEUED)); - threadPool.setMaxThreads(getContextValue(Integer.class, JETTY_THREAD_POOL_MAX_THREADS)); - threadPool.setMinThreads(getContextValue(Integer.class, JETTY_THREAD_POOL_MIN_THREADS)); - - server.setThreadPool(threadPool); - - int lastPort = -1; - for (Port<?> port : ports) - { - if(port instanceof HttpPort) - { - - if (!State.ACTIVE.equals(port.getDesiredState())) - { - continue; - } - ((HttpPort<?>)port).setPortManager(this); - - if(port.getState() != State.ACTIVE) - { - - // TODO - RG - probably does nothing - port.startAsync(); - } - Connector connector = null; - - Collection<Transport> transports = port.getTransports(); - if (!transports.contains(Transport.SSL)) - { - final Port thePort = port; - connector = new SelectChannelConnector() - { - @Override - public void customize(final EndPoint endpoint, final Request request) throws IOException - { - super.customize(endpoint, request); - request.setAttribute(PORT_SERVLET_ATTRIBUTE, thePort); - } - }; - } - else if (transports.contains(Transport.SSL)) - { - connector = createSslConnector((HttpPort<?>) port); - } - else - { - throw new IllegalArgumentException("Unexpected transport on port " - + port.getName() - + ":" - + transports); - } - lastPort = port.getPort(); - String bindingAddress = ((HttpPort)port).getBindingAddress(); - if (bindingAddress != null && !bindingAddress.trim().equals("") && !bindingAddress.trim().equals("*")) - { - connector.setHost(bindingAddress.trim()); - } - connector.setPort(port.getPort()); - server.addConnector(connector); - } - else - { - throw new IllegalArgumentException("Http management can only be added to an Http port"); - } - - } - - _allowPortActivation = false; - - ServletContextHandler root = new ServletContextHandler(ServletContextHandler.SESSIONS); - root.setContextPath("/"); - root.setCompactPath(true); - server.setHandler(root); - server.setSendServerVersion(false); - final ErrorHandler errorHandler = new ErrorHandler() - { - @Override - protected void writeErrorPageBody(HttpServletRequest request, Writer writer, int code, String message, boolean showStacks) - throws IOException - { - String uri= request.getRequestURI(); - - writeErrorPageMessage(request,writer,code,message,uri); - - for (int i= 0; i < 20; i++) - writer.write("<br/> \n"); - } - }; - root.setErrorHandler(errorHandler); - - // set servlet context attributes for broker and configuration - root.getServletContext().setAttribute(HttpManagementUtil.ATTR_BROKER, getBroker()); - root.getServletContext().setAttribute(HttpManagementUtil.ATTR_MANAGEMENT_CONFIGURATION, this); - - root.addFilter(new FilterHolder(new ForbiddingTraceFilter()), "/*", EnumSet.of(DispatcherType.REQUEST)); - FilterHolder restAuthorizationFilter = new FilterHolder(new ForbiddingAuthorisationFilter()); - restAuthorizationFilter.setInitParameter(ForbiddingAuthorisationFilter.INIT_PARAM_ALLOWED, "/service/sasl"); - root.addFilter(restAuthorizationFilter, "/api/*", EnumSet.of(DispatcherType.REQUEST)); - root.addFilter(restAuthorizationFilter, "/apidocs/*", EnumSet.of(DispatcherType.REQUEST)); - root.addFilter(restAuthorizationFilter, "/service/*", EnumSet.of(DispatcherType.REQUEST)); - root.addFilter(new FilterHolder(new RedirectingAuthorisationFilter()), HttpManagementUtil.ENTRY_POINT_PATH, EnumSet.of(DispatcherType.REQUEST)); - root.addFilter(new FilterHolder(new RedirectingAuthorisationFilter()), "/index.html", EnumSet.of(DispatcherType.REQUEST)); - root.addFilter(new FilterHolder(new RedirectingAuthorisationFilter()), "/", EnumSet.of(DispatcherType.REQUEST)); - - addRestServlet(root, "broker"); - addRestServlet(root, "virtualhostnode", VirtualHostNode.class); - addRestServlet(root, "authenticationprovider", AuthenticationProvider.class); - addRestServlet(root, "accesscontrolprovider", AccessControlProvider.class); - addRestServlet(root, "user", AuthenticationProvider.class, User.class); - addRestServlet(root, "groupprovider", GroupProvider.class); - addRestServlet(root, "group", GroupProvider.class, Group.class); - addRestServlet(root, "groupmember", GroupProvider.class, Group.class, GroupMember.class); - addRestServlet(root, "port", Port.class); - addRestServlet(root, "keystore", KeyStore.class); - addRestServlet(root, "truststore", TrustStore.class); - addRestServlet(root, "plugin", Plugin.class); - addRestServlet(root, "preferencesprovider", AuthenticationProvider.class, PreferencesProvider.class); - - addRestServlet(root, "replicationnode", VirtualHostNode.class, RemoteReplicationNode.class); - - addRestServlet(root, "virtualhost", VirtualHostNode.class, VirtualHost.class); - addRestServlet(root, "exchange", VirtualHostNode.class, VirtualHost.class, Exchange.class); - addRestServlet(root, "queue", VirtualHostNode.class, VirtualHost.class, Queue.class); - addRestServlet(root, "connection", VirtualHostNode.class, VirtualHost.class, Connection.class); - addRestServlet(root, "binding", VirtualHostNode.class, VirtualHost.class, Exchange.class, Queue.class, Binding.class); - addRestServlet(root, "session", VirtualHostNode.class, VirtualHost.class, Connection.class, Session.class); - - ServletHolder apiDocsServlet = new ServletHolder(new ApiDocsServlet(getModel(), Collections.<String>emptyList())); - root.addServlet(apiDocsServlet, "/apidocs"); - root.addServlet(apiDocsServlet, "/apidocs/"); - root.addServlet(apiDocsServlet, "/apidocs/latest"); - root.addServlet(apiDocsServlet, "/apidocs/latest/"); - root.addServlet(new ServletHolder(new UserPreferencesServlet()), "/service/userpreferences/*"); - root.addServlet(new ServletHolder(new LoggedOnUserPreferencesServlet()), "/service/preferences"); - root.addServlet(new ServletHolder(new StructureServlet()), "/service/structure"); - root.addServlet(new ServletHolder(new MessageServlet()), "/service/message/*"); - root.addServlet(new ServletHolder(new MessageContentServlet()), "/service/message-content/*"); - root.addServlet(new ServletHolder(new QueueReportServlet()), "/service/queuereport/*"); - - - root.addServlet(new ServletHolder(new LogRecordsServlet()), "/service/logrecords"); - - root.addServlet(new ServletHolder(new MetaDataServlet(getModel())), "/service/metadata"); - - root.addServlet(new ServletHolder(new SaslServlet()), "/service/sasl"); - - root.addServlet(new ServletHolder(new DefinedFileServlet("index.html")), HttpManagementUtil.ENTRY_POINT_PATH); - root.addServlet(new ServletHolder(new DefinedFileServlet("index.html")), "/"); - root.addServlet(new ServletHolder(new LogoutServlet()), "/logout"); - - root.addServlet(new ServletHolder(new FileServlet(DojoHelper.getDojoPath(), true)), "/dojo/dojo/*"); - root.addServlet(new ServletHolder(new FileServlet(DojoHelper.getDijitPath(), true)), "/dojo/dijit/*"); - root.addServlet(new ServletHolder(new FileServlet(DojoHelper.getDojoxPath(), true)), "/dojo/dojox/*"); - - root.addServlet(new ServletHolder(new FileServlet()), "*.js"); - root.addServlet(new ServletHolder(new FileServlet()), "*.css"); - root.addServlet(new ServletHolder(new FileServlet()), "*.html"); - root.addServlet(new ServletHolder(new FileServlet()), "*.png"); - root.addServlet(new ServletHolder(new FileServlet()), "*.gif"); - root.addServlet(new ServletHolder(new FileServlet()), "*.jpg"); - root.addServlet(new ServletHolder(new FileServlet()), "*.jpeg"); - root.addServlet(new ServletHolder(new FileServlet()), "*.json"); - root.addServlet(new ServletHolder(new FileServlet()), "*.txt"); - root.addServlet(new ServletHolder(new FileServlet()), "*.xsl"); - root.addServlet(new ServletHolder(new HelperServlet()), "/service/helper"); - root.addServlet(new ServletHolder(new LogFileListingServlet()), "/service/logfilenames"); - root.addServlet(new ServletHolder(new LogFileServlet()), "/service/logfile"); - - final SessionManager sessionManager = root.getSessionHandler().getSessionManager(); - sessionManager.getSessionCookieConfig().setName(JSESSIONID_COOKIE_PREFIX + lastPort); - sessionManager.setMaxInactiveInterval((Integer)getAttribute(TIME_OUT)); - - return server; - } - - private Connector createSslConnector(final HttpPort<?> port) - { - final Connector connector; - KeyStore keyStore = port.getKeyStore(); - Collection<TrustStore> trustStores = port.getTrustStores(); - if (keyStore == null) - { - throw new IllegalConfigurationException("Key store is not configured. Cannot start management on HTTPS port without keystore"); - } - SslContextFactory factory = new SslContextFactory(); - factory.addExcludeProtocols(SSLUtil.SSLV3_PROTOCOL); - - if(port.getDisabledCipherSuites() != null) - { - factory.addExcludeCipherSuites(port.getDisabledCipherSuites().toArray(new String[port.getDisabledCipherSuites().size()])); - } - - if(port.getEnabledCipherSuites() != null && !port.getEnabledCipherSuites().isEmpty()) - { - factory.setIncludeCipherSuites(port.getEnabledCipherSuites().toArray(new String[port.getEnabledCipherSuites().size()])); - } - - boolean needClientCert = port.getNeedClientAuth() || port.getWantClientAuth(); - - if (needClientCert && trustStores.isEmpty()) - { - throw new IllegalConfigurationException("Client certificate authentication is enabled on AMQP port '" - + this.getName() + "' but no trust store defined"); - } - - try - { - SSLContext sslContext = SSLContext.getInstance("TLS"); - KeyManager[] keyManagers = keyStore.getKeyManagers(); - - TrustManager[] trustManagers; - if(trustStores == null || trustStores.isEmpty()) - { - trustManagers = null; - } - else if(trustStores.size() == 1) - { - trustManagers = trustStores.iterator().next().getTrustManagers(); - } - else - { - Collection<TrustManager> trustManagerList = new ArrayList<>(); - final QpidMultipleTrustManager mulTrustManager = new QpidMultipleTrustManager(); - - for(TrustStore ts : trustStores) - { - TrustManager[] managers = ts.getTrustManagers(); - if(managers != null) - { - for(TrustManager manager : managers) - { - if(manager instanceof X509TrustManager) - { - mulTrustManager.addTrustManager((X509TrustManager)manager); - } - else - { - trustManagerList.add(manager); - } - } - } - } - if(!mulTrustManager.isEmpty()) - { - trustManagerList.add(mulTrustManager); - } - trustManagers = trustManagerList.toArray(new TrustManager[trustManagerList.size()]); - } - sslContext.init(keyManagers, trustManagers, null); - - factory.setSslContext(sslContext); - if(port.getNeedClientAuth()) - { - factory.setNeedClientAuth(true); - } - else if(port.getWantClientAuth()) - { - factory.setWantClientAuth(true); - } - } - catch (GeneralSecurityException e) - { - throw new ServerScopedRuntimeException("Cannot configure port " + port.getName() + " for transport " + Transport.SSL, e); - } - connector = port.getTransports().contains(Transport.TCP) - ? new TcpAndSslSelectChannelConnector(factory) - { - @Override - public void customize(final EndPoint endpoint, final Request request) throws IOException - { - super.customize(endpoint, request); - request.setAttribute(PORT_SERVLET_ATTRIBUTE, port); - } - } - : new SslSelectChannelConnector(factory) - { - @Override - public void customize(final EndPoint endpoint, final Request request) throws IOException - { - super.customize(endpoint, request); - request.setAttribute(PORT_SERVLET_ATTRIBUTE, port); - } - }; - return connector; - } - - private void addRestServlet(ServletContextHandler root, String name, Class<? extends ConfiguredObject>... hierarchy) - { - ServletHolder servletHolder = new ServletHolder(name, new RestServlet(hierarchy)); - servletHolder.getRegistration().setMultipartConfig( - new MultipartConfigElement("", - getContextValue(Long.class, MAX_HTTP_FILE_UPLOAD_SIZE_CONTEXT_NAME), - -1l, - getContextValue(Integer.class, MAX_HTTP_FILE_UPLOAD_SIZE_CONTEXT_NAME))); - - List<String> paths = Arrays.asList("/api/latest/" + name , - "/api/v" + BrokerModel.MODEL_MAJOR_VERSION + "/" + name ); - - for(String path : paths) - { - root.addServlet(servletHolder, path + "/*"); - } - ServletHolder docServletHolder = new ServletHolder(name+"docs", new ApiDocsServlet(getModel(), - paths, - hierarchy)); - root.addServlet(docServletHolder, "/apidocs/latest/" + name + "/"); - root.addServlet(docServletHolder, "/apidocs/v" + BrokerModel.MODEL_MAJOR_VERSION + "/" + name +"/"); - root.addServlet(docServletHolder, "/apidocs/latest/" + name ); - root.addServlet(docServletHolder, "/apidocs/v" + BrokerModel.MODEL_MAJOR_VERSION + "/" + name); - - - } - - private void logOperationalListenMessages(Collection<Port<?>> ports) - { - for (Port port : ports) - { - Set<Transport> transports = port.getTransports(); - for (Transport transport: transports) - { - getBroker().getEventLogger().message(ManagementConsoleMessages.LISTENING(Protocol.HTTP.name(), transport.name(), port.getPort())); - } - } - } - - private void logOperationalShutdownMessage(Server server) - { - Connector[] connectors = server.getConnectors(); - for (Connector connector : connectors) - { - getBroker().getEventLogger().message(ManagementConsoleMessages.SHUTTING_DOWN(Protocol.HTTP.name(), connector.getPort())); - } - } - - - private Collection<Port<?>> getHttpPorts(Collection<Port<?>> ports) - { - Collection<Port<?>> httpPorts = new HashSet<>(); - for (Port<?> port : ports) - { - if (port.getProtocols().contains(Protocol.HTTP)) - { - httpPorts.add(port); - } - } - return httpPorts; - } - - @Override - public boolean isActivationAllowed(final Port<?> port) - { - return _allowPortActivation; - } - - @Override - public boolean isHttpsSaslAuthenticationEnabled() - { - return _httpsSaslAuthenticationEnabled; - } - - @Override - public boolean isHttpSaslAuthenticationEnabled() - { - return _httpSaslAuthenticationEnabled; - } - - @Override - public boolean isHttpsBasicAuthenticationEnabled() - { - return _httpsBasicAuthenticationEnabled; - } - - @Override - public boolean isHttpBasicAuthenticationEnabled() - { - return _httpBasicAuthenticationEnabled; - } - - @Override - public boolean isCompressResponses() - { - return _compressResponses; - } - - @Override - public AuthenticationProvider getAuthenticationProvider(HttpServletRequest request) - { - HttpPort<?> port = (HttpPort<?>)request.getAttribute(PORT_SERVLET_ATTRIBUTE); - return port == null ? null : port.getAuthenticationProvider(); - } - - @Override - protected void validateChange(final ConfiguredObject<?> proxyForValidation, final Set<String> changedAttributes) - { - super.validateChange(proxyForValidation, changedAttributes); - - HttpManagementConfiguration<?> updated = (HttpManagementConfiguration<?>)proxyForValidation; - if(changedAttributes.contains(HttpManagement.NAME)) - { - if(!getName().equals(updated.getName())) - { - throw new IllegalConfigurationException("Changing the name of http management plugin is not allowed"); - } - } - if (changedAttributes.contains(TIME_OUT)) - { - int value = updated.getSessionTimeout(); - if (value < 0) - { - throw new IllegalConfigurationException("Only positive integer value can be specified for the session time out attribute"); - } - } - } - -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagementConfiguration.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagementConfiguration.java deleted file mode 100644 index d3d9770912..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagementConfiguration.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.qpid.server.management.plugin; - -import java.net.SocketAddress; - -import javax.servlet.http.HttpServletRequest; - -import org.apache.qpid.server.model.AuthenticationProvider; -import org.apache.qpid.server.model.ManagedAttribute; -import org.apache.qpid.server.model.ManagedContextDefault; -import org.apache.qpid.server.model.Plugin; - -public interface HttpManagementConfiguration<X extends HttpManagementConfiguration<X>> extends Plugin<X> -{ - - @ManagedAttribute( defaultValue = "true" ) - boolean isHttpsSaslAuthenticationEnabled(); - - @ManagedAttribute( defaultValue = "true" ) - boolean isHttpSaslAuthenticationEnabled(); - - @ManagedAttribute( defaultValue = "true" ) - boolean isHttpsBasicAuthenticationEnabled(); - - @ManagedAttribute( defaultValue = "false" ) - boolean isHttpBasicAuthenticationEnabled(); - - @ManagedAttribute( defaultValue = "600" ) - public int getSessionTimeout(); - - String QPID_HELP_URL = "qpid.helpURL"; - @ManagedContextDefault(name = QPID_HELP_URL) - String DEFAULT_HELP_URL = "http://qpid.apache.org/releases/qpid-${qpid.version}/java-broker/book"; - - String HTTP_MANAGEMENT_COMPRESS_RESPONSES = "httpManagement.compressResponses"; - @ManagedContextDefault(name = HTTP_MANAGEMENT_COMPRESS_RESPONSES) - boolean DEFAULT_COMPRESS_RESPONSES = false; - - @ManagedAttribute( defaultValue = "${"+HTTP_MANAGEMENT_COMPRESS_RESPONSES+"}" ) - public boolean isCompressResponses(); - - String MAX_HTTP_FILE_UPLOAD_SIZE_CONTEXT_NAME = "maxHttpFileUploadSize"; - @ManagedContextDefault( name = MAX_HTTP_FILE_UPLOAD_SIZE_CONTEXT_NAME) - static final long DEFAULT_MAX_UPLOAD_SIZE = 100 * 1024; - - - String JETTY_THREAD_POOL_MAX_QUEUED = "jetty.threadPool.maxQueued"; - @ManagedContextDefault( name = JETTY_THREAD_POOL_MAX_QUEUED) - static final long DEFAULT_JETTY_THREAD_POOL_MAX_QUEUED = 1000; - - String JETTY_THREAD_POOL_MAX_THREADS = "jetty.threadPool.maxThreads"; - @ManagedContextDefault( name = JETTY_THREAD_POOL_MAX_THREADS) - static final long DEFAULT_JETTY_THREAD_POOL_MAX_THREADS = 50; - - - String JETTY_THREAD_POOL_MIN_THREADS = "jetty.threadPool.minThreads"; - @ManagedContextDefault( name = JETTY_THREAD_POOL_MIN_THREADS) - static final long DEFAULT_JETTY_THREAD_POOL_MIN_THREADS = 5; - - - - AuthenticationProvider getAuthenticationProvider(HttpServletRequest request); -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagementUtil.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagementUtil.java deleted file mode 100644 index 90906538d2..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/HttpManagementUtil.java +++ /dev/null @@ -1,270 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.qpid.server.management.plugin; - -import java.io.BufferedWriter; -import java.io.IOException; -import java.io.OutputStream; -import java.io.OutputStreamWriter; -import java.io.Writer; -import java.net.InetSocketAddress; -import java.net.SocketAddress; -import java.security.Principal; -import java.security.PrivilegedAction; -import java.security.cert.X509Certificate; -import java.util.Collections; -import java.util.zip.GZIPOutputStream; - -import javax.security.auth.Subject; -import javax.security.auth.x500.X500Principal; -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; - -import org.apache.commons.codec.binary.Base64; - -import org.apache.qpid.server.management.plugin.servlet.ServletConnectionPrincipal; -import org.apache.qpid.server.management.plugin.session.LoginLogoutReporter; -import org.apache.qpid.server.model.AuthenticationProvider; -import org.apache.qpid.server.model.Broker; -import org.apache.qpid.server.security.SecurityManager; -import org.apache.qpid.server.security.SubjectCreator; -import org.apache.qpid.server.security.auth.AuthenticatedPrincipal; -import org.apache.qpid.server.security.auth.AuthenticationResult.AuthenticationStatus; -import org.apache.qpid.server.security.auth.SubjectAuthenticationResult; -import org.apache.qpid.server.security.auth.UsernamePrincipal; -import org.apache.qpid.server.security.auth.manager.AnonymousAuthenticationManager; -import org.apache.qpid.server.security.auth.manager.ExternalAuthenticationManager; -import org.apache.qpid.transport.network.security.ssl.SSLUtil; - -public class HttpManagementUtil -{ - - /** - * Servlet context attribute holding a reference to a broker instance - */ - public static final String ATTR_BROKER = "Qpid.broker"; - - /** - * Servlet context attribute holding a reference to plugin configuration - */ - public static final String ATTR_MANAGEMENT_CONFIGURATION = "Qpid.managementConfiguration"; - - /** - * Default management entry URL - */ - public static final String ENTRY_POINT_PATH = "/management"; - - private static final String ATTR_LOGIN_LOGOUT_REPORTER = "Qpid.loginLogoutReporter"; - private static final String ATTR_SUBJECT = "Qpid.subject"; - private static final String ATTR_LOG_ACTOR = "Qpid.logActor"; - - private static final String ACCEPT_ENCODING_HEADER = "Accept-Encoding"; - private static final String CONTENT_ENCODING_HEADER = "Content-Encoding"; - private static final String GZIP_CONTENT_ENCODING = "gzip"; - - public static Broker<?> getBroker(ServletContext servletContext) - { - return (Broker<?>) servletContext.getAttribute(ATTR_BROKER); - } - - public static HttpManagementConfiguration getManagementConfiguration(ServletContext servletContext) - { - return (HttpManagementConfiguration) servletContext.getAttribute(ATTR_MANAGEMENT_CONFIGURATION); - } - - public static SocketAddress getSocketAddress(HttpServletRequest request) - { - return InetSocketAddress.createUnresolved(request.getServerName(), request.getServerPort()); - } - - public static Subject getAuthorisedSubject(HttpSession session) - { - return (Subject) session.getAttribute(ATTR_SUBJECT); - } - - public static void checkRequestAuthenticatedAndAccessAuthorized(HttpServletRequest request, Broker broker, - HttpManagementConfiguration managementConfig) - { - HttpSession session = request.getSession(); - Subject subject = getAuthorisedSubject(session); - if (subject == null) - { - subject = tryToAuthenticate(request, managementConfig); - if (subject == null) - { - throw new SecurityException("Only authenticated users can access the management interface"); - } - - Subject original = subject; - subject = new Subject(false, - original.getPrincipals(), - original.getPublicCredentials(), - original.getPrivateCredentials()); - subject.getPrincipals().add(new ServletConnectionPrincipal(request)); - subject.setReadOnly(); - - assertManagementAccess(broker.getSecurityManager(), subject); - - saveAuthorisedSubject(session, subject); - - - } - } - - public static void assertManagementAccess(final SecurityManager securityManager, Subject subject) - { - Subject.doAs(subject, new PrivilegedAction<Void>() - { - @Override - public Void run() - { - securityManager.accessManagement(); - return null; - } - }); - } - - public static void saveAuthorisedSubject(HttpSession session, Subject subject) - { - session.setAttribute(ATTR_SUBJECT, subject); - - // Cause the user logon to be logged. - session.setAttribute(ATTR_LOGIN_LOGOUT_REPORTER, - new LoginLogoutReporter(subject, getBroker(session.getServletContext()))); - } - - public static Subject tryToAuthenticate(HttpServletRequest request, HttpManagementConfiguration managementConfig) - { - Subject subject = null; - final AuthenticationProvider authenticationProvider = managementConfig.getAuthenticationProvider(request); - SubjectCreator subjectCreator = authenticationProvider.getSubjectCreator(request.isSecure()); - String remoteUser = request.getRemoteUser(); - - if (remoteUser != null || authenticationProvider instanceof AnonymousAuthenticationManager) - { - subject = authenticateUser(subjectCreator, remoteUser, null); - } - else if(authenticationProvider instanceof ExternalAuthenticationManager - && Collections.list(request.getAttributeNames()).contains("javax.servlet.request.X509Certificate")) - { - Principal principal = null; - X509Certificate[] certificates = - (X509Certificate[]) request.getAttribute("javax.servlet.request.X509Certificate"); - if(certificates != null && certificates.length != 0) - { - principal = certificates[0].getSubjectX500Principal(); - - if(!Boolean.valueOf(String.valueOf(authenticationProvider.getAttribute(ExternalAuthenticationManager.ATTRIBUTE_USE_FULL_DN)))) - { - String username; - String dn = ((X500Principal) principal).getName(X500Principal.RFC2253); - - - username = SSLUtil.getIdFromSubjectDN(dn); - principal = new UsernamePrincipal(username); - } - - subject = subjectCreator.createSubjectWithGroups(new AuthenticatedPrincipal(principal)); - } - } - else - { - String header = request.getHeader("Authorization"); - if (header != null) - { - String[] tokens = header.split("\\s"); - if (tokens.length >= 2 && "BASIC".equalsIgnoreCase(tokens[0])) - { - boolean isBasicAuthSupported = false; - if (request.isSecure()) - { - isBasicAuthSupported = managementConfig.isHttpsBasicAuthenticationEnabled(); - } - else - { - isBasicAuthSupported = managementConfig.isHttpBasicAuthenticationEnabled(); - } - if (isBasicAuthSupported) - { - String base64UsernameAndPassword = tokens[1]; - String[] credentials = (new String(Base64.decodeBase64(base64UsernameAndPassword.getBytes()))).split(":", 2); - if (credentials.length == 2) - { - subject = authenticateUser(subjectCreator, credentials[0], credentials[1]); - } - } - } - } - } - return subject; - } - - private static Subject authenticateUser(SubjectCreator subjectCreator, String username, String password) - { - SubjectAuthenticationResult authResult = subjectCreator.authenticate(username, password); - if (authResult.getStatus() == AuthenticationStatus.SUCCESS) - { - return authResult.getSubject(); - } - return null; - } - - public static Writer getOutputWriter(final HttpServletRequest request, final HttpServletResponse response) - throws IOException - { - return getOutputWriter(request, response, getManagementConfiguration(request.getServletContext())); - } - - public static Writer getOutputWriter(final HttpServletRequest request, final HttpServletResponse response, HttpManagementConfiguration managementConfiguration) - throws IOException - { - Writer writer; - writer = new BufferedWriter(new OutputStreamWriter(getOutputStream(request,response, managementConfiguration))); - - return writer; - } - - public static OutputStream getOutputStream(final HttpServletRequest request, final HttpServletResponse response) - throws IOException - { - return getOutputStream(request, response, getManagementConfiguration(request.getServletContext())); - } - - public static OutputStream getOutputStream(final HttpServletRequest request, final HttpServletResponse response, HttpManagementConfiguration managementConfiguration) - throws IOException - { - OutputStream outputStream; - if(managementConfiguration.isCompressResponses() - && Collections.list(request.getHeaderNames()).contains(ACCEPT_ENCODING_HEADER) - && request.getHeader(ACCEPT_ENCODING_HEADER).contains(GZIP_CONTENT_ENCODING)) - { - outputStream = new GZIPOutputStream(response.getOutputStream()); - response.setHeader(CONTENT_ENCODING_HEADER, GZIP_CONTENT_ENCODING); - } - else - { - outputStream = response.getOutputStream(); - } - return outputStream; - } -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/connector/TcpAndSslSelectChannelConnector.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/connector/TcpAndSslSelectChannelConnector.java deleted file mode 100644 index 197032398e..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/connector/TcpAndSslSelectChannelConnector.java +++ /dev/null @@ -1,378 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.qpid.server.management.plugin.connector; - -import java.io.IOException; -import java.nio.channels.SelectionKey; -import java.nio.channels.SocketChannel; - -import javax.net.ssl.SSLEngine; -import javax.net.ssl.SSLSession; - -import org.eclipse.jetty.http.HttpSchemes; -import org.eclipse.jetty.io.AsyncEndPoint; -import org.eclipse.jetty.io.Buffer; -import org.eclipse.jetty.io.Connection; -import org.eclipse.jetty.io.EndPoint; -import org.eclipse.jetty.io.nio.AsyncConnection; -import org.eclipse.jetty.io.nio.IndirectNIOBuffer; -import org.eclipse.jetty.io.nio.SelectChannelEndPoint; -import org.eclipse.jetty.io.nio.SelectorManager; -import org.eclipse.jetty.io.nio.SslConnection; -import org.eclipse.jetty.server.AsyncHttpConnection; -import org.eclipse.jetty.server.Request; -import org.eclipse.jetty.server.nio.SelectChannelConnector; -import org.eclipse.jetty.server.ssl.SslCertificates; -import org.eclipse.jetty.util.log.Log; -import org.eclipse.jetty.util.log.Logger; -import org.eclipse.jetty.util.ssl.SslContextFactory; - -public class TcpAndSslSelectChannelConnector extends SelectChannelConnector -{ - - private static final Logger LOG = Log.getLogger(TcpAndSslSelectChannelConnector.class); - - private final SslContextFactory _sslContextFactory; - - public TcpAndSslSelectChannelConnector(SslContextFactory factory) - { - _sslContextFactory = factory; - addBean(_sslContextFactory); - setUseDirectBuffers(false); - setSoLingerTime(30000); - } - - - @Override - public void customize(EndPoint endpoint, Request request) throws IOException - { - if(endpoint instanceof SslConnection.SslEndPoint) - { - request.setScheme(HttpSchemes.HTTPS); - } - - super.customize(endpoint,request); - - if(endpoint instanceof SslConnection.SslEndPoint) - { - SslConnection.SslEndPoint sslEndpoint = (SslConnection.SslEndPoint) endpoint; - SSLEngine sslEngine = sslEndpoint.getSslEngine(); - SSLSession sslSession = sslEngine.getSession(); - - SslCertificates.customize(sslSession, endpoint, request); - } - } - - @Override - protected AsyncConnection newConnection(SocketChannel channel, AsyncEndPoint endpoint) - { - return new ProtocolIdentifyingConnection((ProtocolIdentifyingEndpoint) endpoint); - } - - @Override - protected SelectChannelEndPoint newEndPoint(final SocketChannel channel, - final SelectorManager.SelectSet selectSet, - final SelectionKey key) throws IOException - { - - ProtocolIdentifyingEndpoint endpoint = new ProtocolIdentifyingEndpoint(channel,selectSet,key, getMaxIdleTime()); - endpoint.setConnection(selectSet.getManager().newConnection(channel, endpoint, key.attachment())); - return endpoint; - } - - protected SSLEngine createSSLEngine(SocketChannel channel) throws IOException - { - SSLEngine engine; - if (channel != null) - { - String peerHost = channel.socket().getInetAddress().getHostAddress(); - int peerPort = channel.socket().getPort(); - engine = _sslContextFactory.newSslEngine(peerHost, peerPort); - } - else - { - engine = _sslContextFactory.newSslEngine(); - } - - engine.setUseClientMode(false); - return engine; - } - - @Override - protected void doStart() throws Exception - { - _sslContextFactory.checkKeyStore(); - _sslContextFactory.start(); - - SSLEngine sslEngine = _sslContextFactory.newSslEngine(); - - sslEngine.setUseClientMode(false); - - SSLSession sslSession = sslEngine.getSession(); - - if (getRequestHeaderSize()<sslSession.getApplicationBufferSize()) - setRequestHeaderSize(sslSession.getApplicationBufferSize()); - if (getRequestBufferSize()<sslSession.getApplicationBufferSize()) - setRequestBufferSize(sslSession.getApplicationBufferSize()); - - super.doStart(); - } - - @Override - public boolean isConfidential(final Request request) - { - if(request.getScheme().equals(HttpSchemes.HTTPS)) - { - final int confidentialPort=getConfidentialPort(); - return confidentialPort==0||confidentialPort==request.getServerPort(); - } - return super.isConfidential(request); - } - - enum Protocol { UNKNOWN, TCP , SSL } - - private class ProtocolIdentifyingEndpoint extends SelectChannelEndPoint - { - - private Protocol _protocol = Protocol.UNKNOWN; - private Buffer _preBuffer = new IndirectNIOBuffer(6); - - public ProtocolIdentifyingEndpoint(final SocketChannel channel, - final SelectorManager.SelectSet selectSet, - final SelectionKey key, final int maxIdleTime) throws IOException - { - super(channel, selectSet, key, maxIdleTime); - } - - public Protocol getProtocol() throws IOException - { - if(_protocol == Protocol.UNKNOWN) - { - if(_preBuffer.space() != 0) - { - super.fill(_preBuffer); - _protocol = identifyFromPreBuffer(); - } - } - return _protocol; - } - - public SocketChannel getSocketChannel() - { - return (SocketChannel) getChannel(); - } - - private Protocol identifyFromPreBuffer() - { - if(_preBuffer.space() == 0) - { - byte[] helloBytes = _preBuffer.array(); - if (looksLikeSSLv2ClientHello(helloBytes) || looksLikeSSLv3ClientHello(helloBytes)) - { - return Protocol.SSL; - } - else - { - return Protocol.TCP; - } - } - return Protocol.UNKNOWN; - } - - private boolean looksLikeSSLv3ClientHello(byte[] headerBytes) - { - return headerBytes[0] == 22 && // SSL Handshake - (headerBytes[1] == 3 && // SSL 3.0 / TLS 1.x - (headerBytes[2] == 0 || // SSL 3.0 - headerBytes[2] == 1 || // TLS 1.0 - headerBytes[2] == 2 || // TLS 1.1 - headerBytes[2] == 3)) && // TLS1.2 - (headerBytes[5] == 1); // client_hello - } - - private boolean looksLikeSSLv2ClientHello(byte[] headerBytes) - { - return headerBytes[0] == -128 && - headerBytes[3] == 3 && // SSL 3.0 / TLS 1.x - (headerBytes[4] == 0 || // SSL 3.0 - headerBytes[4] == 1 || // TLS 1.0 - headerBytes[4] == 2 || // TLS 1.1 - headerBytes[4] == 3); - } - - @Override - public int fill(final Buffer buffer) throws IOException - { - int size = 0; - - if(getProtocol() != Protocol.UNKNOWN) - { - if (_preBuffer.hasContent()) - { - size = buffer.put(_preBuffer); - _preBuffer.skip(size); - } - if (buffer.space() != 0) - { - size += super.fill(buffer); - } - } - return size; - } - } - - private class ProtocolIdentifyingConnection implements AsyncConnection - { - private final ProtocolIdentifyingEndpoint _endpoint; - private AsyncConnection _delegate; - private final long _timestamp; - private IOException _exception; - - private ProtocolIdentifyingConnection(final ProtocolIdentifyingEndpoint endpoint) - { - _endpoint = endpoint; - _timestamp = System.currentTimeMillis(); - } - - @Override - public void onInputShutdown() throws IOException - { - if (_delegate == null) - { - createDelegate(true); - } - _delegate.onInputShutdown(); - } - - private boolean createDelegate(boolean createPlainWhenUnknown) throws IOException - { - if(_exception != null) - { - throw _exception; - } - Protocol protocol = _endpoint.getProtocol(); - if(protocol == Protocol.TCP || (createPlainWhenUnknown && protocol == Protocol.UNKNOWN)) - { - _delegate = new AsyncHttpConnection(TcpAndSslSelectChannelConnector.this, _endpoint, getServer()); - return true; - } - else if(protocol == Protocol.SSL) - { - SocketChannel channel = _endpoint.getSocketChannel(); - SSLEngine engine = createSSLEngine(channel); - SslConnection connection = new SslConnection(engine, _endpoint); - AsyncConnection delegate = new AsyncHttpConnection(TcpAndSslSelectChannelConnector.this, - connection.getSslEndPoint(), - getServer()); - connection.getSslEndPoint().setConnection(delegate); - connection.setAllowRenegotiate(_sslContextFactory.isAllowRenegotiate()); - - _delegate = connection; - return true; - } - return false; - } - - private boolean createDelegateNoException() - { - try - { - return createDelegate(false); - } - catch (IOException e) - { - _exception = e; - return false; - } - } - - @Override - public Connection handle() throws IOException - { - if(_delegate != null || createDelegate(false)) - { - return _delegate.handle(); - } - return this; - } - - @Override - public long getTimeStamp() - { - return _timestamp; - } - - @Override - public boolean isIdle() - { - if(_delegate != null || createDelegateNoException()) - { - return _delegate.isIdle(); - } - return false; - } - - @Override - public boolean isSuspended() - { - if(_delegate != null || createDelegateNoException()) - { - return _delegate.isSuspended(); - } - return false; - } - - @Override - public void onClose() - { - if(_delegate != null) - { - _delegate.onClose(); - } - } - - @Override - public void onIdleExpired(final long idleForMs) - { - try - { - if(_delegate != null || createDelegate(true)) - { - _delegate.onIdleExpired(idleForMs); - } - } - catch (IOException e) - { - LOG.ignore(e); - - try - { - _endpoint.close(); - } - catch(IOException e2) - { - LOG.ignore(e2); - } - } - } - } - -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/filter/ForbiddingAuthorisationFilter.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/filter/ForbiddingAuthorisationFilter.java deleted file mode 100644 index 16f85ace2c..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/filter/ForbiddingAuthorisationFilter.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.qpid.server.management.plugin.filter; - -import java.io.IOException; -import java.security.AccessControlException; - -import javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.qpid.server.management.plugin.HttpManagementConfiguration; -import org.apache.qpid.server.management.plugin.HttpManagementUtil; -import org.apache.qpid.server.model.Broker; - -public class ForbiddingAuthorisationFilter implements Filter -{ - public static String INIT_PARAM_ALLOWED = "allowed"; - private String _allowed = null; - - private Broker _broker; - private HttpManagementConfiguration _managementConfiguration; - - @Override - public void destroy() - { - } - - @Override - public void init(FilterConfig config) throws ServletException - { - String allowed = config.getInitParameter(INIT_PARAM_ALLOWED); - if (allowed != null) - { - _allowed = allowed; - } - ServletContext servletContext = config.getServletContext(); - _broker = HttpManagementUtil.getBroker(servletContext); - _managementConfiguration = HttpManagementUtil.getManagementConfiguration(servletContext); - } - - @Override - public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, - ServletException - { - HttpServletRequest httpRequest = (HttpServletRequest) request; - HttpServletResponse httpResponse = (HttpServletResponse) response; - String servletPath = httpRequest.getServletPath(); - if (_allowed == null || "".equals(_allowed) || servletPath.indexOf(_allowed) == -1) - { - try - { - HttpManagementUtil.checkRequestAuthenticatedAndAccessAuthorized(httpRequest, _broker, _managementConfiguration); - } - catch(AccessControlException e) - { - httpResponse.sendError(HttpServletResponse.SC_FORBIDDEN); - return; - } - catch(SecurityException e) - { - httpResponse.sendError(HttpServletResponse.SC_UNAUTHORIZED); - return; - } - } - chain.doFilter(request, response); - } - -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/filter/ForbiddingTraceFilter.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/filter/ForbiddingTraceFilter.java deleted file mode 100644 index c35b0df1a3..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/filter/ForbiddingTraceFilter.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.qpid.server.management.plugin.filter; - -import java.io.IOException; - -import javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -/** - * - * This {@link Filter} blocks HTTP TRACE commands from being - * processed. All TRACE requests are sent a 403 error. - * - */ -public class ForbiddingTraceFilter implements Filter -{ - private static final String METHOD_TRACE = "TRACE"; - - @Override - public void destroy() - { - } - - @Override - public void init(FilterConfig config) throws ServletException - { - } - - @Override - public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, - ServletException - { - HttpServletRequest httpRequest = (HttpServletRequest) request; - HttpServletResponse httpResponse = (HttpServletResponse) response; - if (httpRequest.getMethod().equals(METHOD_TRACE)) - { - httpResponse.sendError(HttpServletResponse.SC_FORBIDDEN); - return; - } - chain.doFilter(request, response); - } - -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/filter/RedirectingAuthorisationFilter.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/filter/RedirectingAuthorisationFilter.java deleted file mode 100644 index 184a653fa8..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/filter/RedirectingAuthorisationFilter.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.qpid.server.management.plugin.filter; - -import java.io.IOException; - -import javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.qpid.server.management.plugin.HttpManagementConfiguration; -import org.apache.qpid.server.management.plugin.HttpManagementUtil; -import org.apache.qpid.server.model.Broker; - -public class RedirectingAuthorisationFilter implements Filter -{ - public static String DEFAULT_LOGIN_URL = "login.html"; - public static String INIT_PARAM_LOGIN_URL = "login-url"; - - private String _loginUrl = DEFAULT_LOGIN_URL; - private Broker _broker; - private HttpManagementConfiguration _managementConfiguration; - - @Override - public void destroy() - { - } - - @Override - public void init(FilterConfig config) throws ServletException - { - String loginUrl = config.getInitParameter(INIT_PARAM_LOGIN_URL); - if (loginUrl != null) - { - _loginUrl = loginUrl; - } - ServletContext servletContext = config.getServletContext(); - _broker = HttpManagementUtil.getBroker(servletContext); - _managementConfiguration = HttpManagementUtil.getManagementConfiguration(servletContext); - } - - @Override - public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, - ServletException - { - HttpServletRequest httpRequest = (HttpServletRequest) request; - HttpServletResponse httpResponse = (HttpServletResponse) response; - try - { - HttpManagementUtil.checkRequestAuthenticatedAndAccessAuthorized(httpRequest, _broker, _managementConfiguration); - chain.doFilter(request, response); - } - catch(SecurityException e) - { - httpResponse.sendRedirect(_loginUrl); - } - } - -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/log/LogFileDetails.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/log/LogFileDetails.java deleted file mode 100644 index 09dabd0e73..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/log/LogFileDetails.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.qpid.server.management.plugin.log; - -import java.io.File; - -public class LogFileDetails -{ - private String _name; - private File _location; - private String _mimeType; - private long _size; - private long _lastModified; - private String _appenderName; - - public LogFileDetails(String name, String appenderName, File location, String mimeType, long fileSize, long lastUpdateTime) - { - super(); - _name = name; - _location = location; - _mimeType = mimeType; - _size = fileSize; - _lastModified = lastUpdateTime; - _appenderName = appenderName; - } - - public String getName() - { - return _name; - } - - public File getLocation() - { - return _location; - } - - public String getMimeType() - { - return _mimeType; - } - - public long getSize() - { - return _size; - } - - public long getLastModified() - { - return _lastModified; - } - - public String getAppenderName() - { - return _appenderName; - } - - @Override - public String toString() - { - return "LogFileDetails [name=" + _name + "]"; - } - -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/log/LogFileHelper.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/log/LogFileHelper.java deleted file mode 100644 index 51256ab5fa..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/log/LogFileHelper.java +++ /dev/null @@ -1,243 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.qpid.server.management.plugin.log; - -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.OutputStream; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.zip.ZipEntry; -import java.util.zip.ZipOutputStream; - -import org.apache.log4j.Appender; -import org.apache.log4j.FileAppender; -import org.apache.log4j.QpidCompositeRollingAppender; - -public class LogFileHelper -{ - public static final String GZIP_MIME_TYPE = "application/x-gzip"; - public static final String TEXT_MIME_TYPE = "text/plain"; - public static final String ZIP_MIME_TYPE = "application/zip"; - public static final String GZIP_EXTENSION = ".gz"; - private static final int BUFFER_LENGTH = 1024 * 4; - private Collection<Appender> _appenders; - - public LogFileHelper(Collection<Appender> appenders) - { - super(); - _appenders = appenders; - } - - public List<LogFileDetails> findLogFileDetails(String[] requestedFiles) - { - List<LogFileDetails> logFiles = new ArrayList<LogFileDetails>(); - Map<String, List<LogFileDetails>> cache = new HashMap<String, List<LogFileDetails>>(); - for (int i = 0; i < requestedFiles.length; i++) - { - String logFile = requestedFiles[i]; - if ("".equals(logFile)) - { - throw new IllegalArgumentException("Log file parameter is empty"); - } - int pos = logFile.indexOf("/"); - if (pos == -1) - { - throw new IllegalArgumentException("Log file parameter '" + logFile + "' does not include an appender name"); - } - if (pos == logFile.length()) - { - throw new IllegalArgumentException("Log file parameter '" + logFile + "' does not include an file name"); - } - - String appenderName = logFile.substring(0, pos); - String fileName = logFile.substring(pos + 1); - - List<LogFileDetails> appenderFiles = cache.get(appenderName); - if (appenderFiles == null) - { - Appender fileAppender = null; - for (Appender appender : _appenders) - { - if (appenderName.equals(appender.getName())) - { - fileAppender = appender; - break; - } - } - if (fileAppender == null) - { - continue; - } - appenderFiles = getAppenderFiles(fileAppender, true); - if (appenderFiles == null) - { - continue; - } - cache.put(appenderName, appenderFiles); - } - for (LogFileDetails logFileDetails : appenderFiles) - { - if (logFileDetails.getName().equals(fileName)) - { - logFiles.add(logFileDetails); - break; - } - } - } - return logFiles; - } - - public List<LogFileDetails> getLogFileDetails(boolean includeLogFileLocation) - { - List<LogFileDetails> results = new ArrayList<LogFileDetails>(); - for (Appender appender : _appenders) - { - List<LogFileDetails> appenderFiles = getAppenderFiles(appender, includeLogFileLocation); - if (appenderFiles != null) - { - results.addAll(appenderFiles); - } - } - return results; - } - - public void writeLogFiles(List<LogFileDetails> logFiles, OutputStream os) throws IOException - { - ZipOutputStream out = new ZipOutputStream(os); - try - { - addLogFileEntries(logFiles, out); - } - finally - { - out.close(); - } - } - - public void writeLogFile(File file, OutputStream os) throws IOException - { - FileInputStream fis = new FileInputStream(file); - try - { - byte[] bytes = new byte[BUFFER_LENGTH]; - int length = 1; - while ((length = fis.read(bytes)) != -1) - { - os.write(bytes, 0, length); - } - } - finally - { - fis.close(); - } - } - - private List<LogFileDetails> getAppenderFiles(Appender appender, boolean includeLogFileLocation) - { - if (appender instanceof QpidCompositeRollingAppender) - { - return listQpidCompositeRollingAppenderFiles((QpidCompositeRollingAppender) appender, includeLogFileLocation); - } - else if (appender instanceof FileAppender) - { - return listFileAppenderFiles((FileAppender) appender, includeLogFileLocation); - } - return null; - } - - private List<LogFileDetails> listFileAppenderFiles(FileAppender appender, boolean includeLogFileLocation) - { - String appenderFilePath = appender.getFile(); - File appenderFile = new File(appenderFilePath); - if (appenderFile.exists()) - { - return listLogFiles(appenderFile.getParentFile(), appenderFile.getName(), appender.getName(), "", includeLogFileLocation); - } - return Collections.emptyList(); - } - - private List<LogFileDetails> listQpidCompositeRollingAppenderFiles(QpidCompositeRollingAppender appender, boolean includeLogFileLocation) - { - List<LogFileDetails> files = listFileAppenderFiles((FileAppender) appender, includeLogFileLocation); - String appenderFilePath = appender.getFile(); - File appenderFile = new File(appenderFilePath); - File backupFolder = new File(appender.getBackupFilesToPath()); - if (backupFolder.exists()) - { - String backupFolderName = backupFolder.getName() + "/"; - List<LogFileDetails> backedUpFiles = listLogFiles(backupFolder, appenderFile.getName(), appender.getName(), - backupFolderName, includeLogFileLocation); - files.addAll(backedUpFiles); - } - return files; - } - - private List<LogFileDetails> listLogFiles(File parent, String baseFileName, String appenderName, String relativePath, - boolean includeLogFileLocation) - { - List<LogFileDetails> files = new ArrayList<LogFileDetails>(); - for (File file : parent.listFiles()) - { - String name = file.getName(); - if (name.startsWith(baseFileName)) - { - String displayPath = name; - if (!relativePath.equals("")) - { - displayPath = relativePath + name; - } - files.add(new LogFileDetails(displayPath, appenderName, includeLogFileLocation ? file : null, getMimeType(name), file.length(), - file.lastModified())); - } - } - return files; - } - - private String getMimeType(String fileName) - { - if (fileName.endsWith(GZIP_EXTENSION)) - { - return GZIP_MIME_TYPE; - } - return TEXT_MIME_TYPE; - } - - private void addLogFileEntries(List<LogFileDetails> files, ZipOutputStream out) throws IOException - { - for (LogFileDetails logFileDetails : files) - { - File file = logFileDetails.getLocation(); - if (file.exists()) - { - ZipEntry entry = new ZipEntry(logFileDetails.getAppenderName() + "/" + logFileDetails.getName()); - entry.setSize(file.length()); - out.putNextEntry(entry); - writeLogFile(file, out); - out.closeEntry(); - } - out.flush(); - } - } - -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/report/QueueBinaryReport.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/report/QueueBinaryReport.java deleted file mode 100644 index d842de3f1b..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/report/QueueBinaryReport.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.qpid.server.management.plugin.report; - -public abstract class QueueBinaryReport extends QueueReport<byte[]> -{ - public QueueBinaryReport() - { - } -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/report/QueueReport.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/report/QueueReport.java deleted file mode 100644 index 23b24aaf8d..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/report/QueueReport.java +++ /dev/null @@ -1,161 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.qpid.server.management.plugin.report; - -import org.apache.qpid.server.model.Queue; -import org.apache.qpid.server.model.VirtualHost; - -/** - * <p> - * The QueueReport class provides an extension point for installations to provide custom management reporting on - * queues through the REST API. - * </p> - * - * <p> - * A custom QueueReport must extend either {@link org.apache.qpid.server.management.plugin.report.QueueTextReport} - * or {@link org.apache.qpid.server.management.plugin.report.QueueBinaryReport}. The report implementation must - * define a {@link #getName() name} which is unique amongst all installed reports. The report class must be present - * in the classpath of the broker, and a provider-configuration file named - * org.apache.qpid.server.management.plugin.report.QueueReport must be added in the resource directory - * META-INF/services directory with the binary name of the implementation (as described in - * {@link java.util.ServiceLoader ServiceLoader}). - * </p> - * - * <h3>Running reports</h3> - * <p> - * The report can be run using the URL: - * {@code http://<broker>/service/queuereport/<virtualhost name>/<queue name>/<report name>[?param1=x¶m2=y...]} - * </p> - * - * <h4>Report Parameters</h4> - * - * <p> - * Reports can take parameters from the query string of the HTTP request. For every parameter in the query string - * the system will look for a setter on the report object with either a String or String[] parameter. Thus if - * the query string contains {@code foo=bar}, then the system will look for a setter {@code setFoo(String value)} or - * {@code setFoo(String[] value)}. If the same parameter occurs multiple times in the query string then only the - * array variant of the setter will be called. - * </p> - * <p> - * Setters for the parameters are guaranteed to be called before the first message is added to the report. - * </p> - * - * <p> - * NOTE: In order to comply with the requirements of the {@link java.util.ServiceLoader ServiceLoader} api, all - * implementations of QueueReport MUST provide a public no-args constructor. - * </p> - * @param <T> - */ -public abstract class QueueReport<T> -{ - private Queue<?> _queue; - - QueueReport() - { - - } - - /** - * Gets the name of the report. - * <p> - * The name of the report must be unique amongst all installed implementations. The name of the report - * is examined by the Qpid immediately upon construction. The name should not change during - * the lifetime of the object (the value is only meaningful to the system at the time of initial construction) - * and all instances of the same concrete implementation should have the same name. - * </p> - * @return the name of the report - */ - public abstract String getName(); - - /** - * Get the name of the queue against which the report is being run. - * - * @return the name of the queue - */ - public final String getQueueName() - { - return _queue.getName(); - } - - final void setQueue(final Queue<?> queue) - { - _queue = queue; - } - - /** - * Get the name of the virtual host against which the report is being run. - * - * @return the name of the virtual host - */ - public final String getVirtualHostName() - { - return _queue.getParent(VirtualHost.class).getName(); - } - - /** - * - * The value returned by getContentType() will be used to set the Content-Type HTTP header field - * - * @return the value to use for the content-type HTTP header field - */ - public abstract String getContentType(); - - /** - * Called by the system to add a message to the report. - * - * <p> - * The method is called by the system for every message on the queue, or until {@link #isComplete()} returns true. - * </p> - * @param reportableMessage the message to add to the report - */ - public abstract void addMessage(final ReportableMessage reportableMessage); - - /** - * Informs the system if the report is complete (i.e. does not need to report on any more messages). - * - * <p> - * This method will be called by the system after each message is {@link #addMessage(ReportableMessage) added} - * to the report. If a report is only interested in some messages, and can determine that the addition of more - * messages will not vary the content of the report, then it can return true. - * </p> - * <p> - * If this method always returns false, then all messages from the queue will be added to the report. - * </p> - * <p> - * NOTE: Retrieving content or properties of the message may require it to be reloaded from disk, and so care - * should be taken by reports to only access properties/content of the message if it is going to be required - * for the report production. - * </p> - * - * @return true if the report does not want to report on any more messages in the queue - */ - public abstract boolean isComplete(); - - /** - * Called by the system to get the content of the report to retrun to the user. - * <p> - * The system guarantees to only call this method once - * </p> - * @return the report content. - */ - public abstract T getReport(); - -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/report/QueueTextReport.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/report/QueueTextReport.java deleted file mode 100644 index 09bc5c4229..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/report/QueueTextReport.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.qpid.server.management.plugin.report; - -public abstract class QueueTextReport extends QueueReport<String> -{ - public QueueTextReport() - { - } -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/report/ReportRunner.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/report/ReportRunner.java deleted file mode 100644 index 2a05cfc9a1..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/report/ReportRunner.java +++ /dev/null @@ -1,408 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.qpid.server.management.plugin.report; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.nio.ByteBuffer; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.Date; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.ServiceLoader; -import java.util.Set; -import java.util.UUID; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import org.apache.qpid.server.message.AMQMessageHeader; -import org.apache.qpid.server.message.ServerMessage; -import org.apache.qpid.server.model.Queue; -import org.apache.qpid.server.queue.QueueEntry; -import org.apache.qpid.server.queue.QueueEntryVisitor; - -public class ReportRunner<T> -{ - private static final Logger LOGGER = LoggerFactory.getLogger(ReportRunner.class); - - private static final Set<Class> IMMUTABLE_CLASSES = new HashSet<>(Arrays.<Class>asList( - Boolean.class, - Byte.class, - Short.class, - Character.class, - Integer.class, - Long.class, - Float.class, - Double.class, - UUID.class, - Date.class, - String.class - )); - - private ReportRunner(final QueueReport<T> report) - { - _report = report; - } - - public boolean isBinaryReport() - { - return _report instanceof QueueBinaryReport; - } - - public static ReportRunner<?> createRunner(final String reportName, final Map<String, String[]> parameterMap) - { - QueueReport<?> report = getReport(reportName); - setReportParameters(report, parameterMap); - return new ReportRunner<>(report); - } - - private static void setReportParameters(final QueueReport<?> report, final Map<String, String[]> parameterMap) - { - if(parameterMap != null && !parameterMap.isEmpty()) - { - Class<? extends QueueReport> clazz = report.getClass(); - for(Map.Entry<String,String[]> entry : parameterMap.entrySet()) - { - String key = entry.getKey(); - String[] value = entry.getValue(); - if(isValidName(key)) - { - - StringBuilder setterName = new StringBuilder("set"); - setterName.append(key.substring(0,1).toUpperCase()); - if(key.length()>1) - { - setterName.append(key.substring(1)); - } - Method method = null; - try - { - - if (value == null || value.length == 0 || value.length == 1) - { - try - { - method = clazz.getMethod(setterName.toString(), String.class); - method.invoke(report, value == null || value.length == 0 ? null : value[0]); - } - catch (NoSuchMethodException | IllegalAccessException e) - { - method = null; - } - } - if (method == null) - { - try - { - method = clazz.getMethod(setterName.toString(), String[].class); - method.invoke(report, new Object[] { value }); - } - catch (NoSuchMethodException | IllegalAccessException e) - { - LOGGER.info("Unknown parameter '" - + key - + "' (no setter) for report " - + report.getName()); - } - } - } - catch (InvocationTargetException e) - { - LOGGER.info("Error setting parameter '" + key + "' for report " + report.getName(), e); - } - } - else - { - LOGGER.info("Invalid parameter name '" + key + "' running report " + report.getName()); - } - } - } - } - - private static boolean isValidName(final String key) - { - if(key != null && key.length() != 0) - { - if(Character.isJavaIdentifierStart(key.charAt(0))) - { - for(int i = 1; i < key.length(); i++) - { - if(!Character.isJavaIdentifierPart(key.charAt(i))) - { - return false; - } - } - return true; - } - - } - return false; - - } - - private static QueueReport<?> getReport(final String reportName) - { - ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); - for (final QueueReport report : ServiceLoader.load(QueueReport.class, classLoader)) - { - if (report.getName().equals(reportName)) - { - try - { - return report.getClass().newInstance(); - } - catch (InstantiationException | IllegalAccessException e) - { - // can't happen as by definition must have public noargs constructor - } - } - } - throw new IllegalArgumentException("Unknown report: " + reportName); - } - - public String getContentType() - { - return _report.getContentType(); - } - - - private static class ReportVisitor implements QueueEntryVisitor - { - - private final QueueReport _report; - - public ReportVisitor(final QueueReport report) - { - _report = report; - } - - @Override - public boolean visit(final QueueEntry entry) - { - _report.addMessage(convertMessage(entry.getMessage())); - return _report.isComplete(); - } - - - } - - - private static ReportableMessage convertMessage(final ServerMessage message) - { - return new ReportableMessage() - { - @Override - public String getInitialRoutingAddress() - { - return message.getInitialRoutingAddress(); - } - - @Override - public ReportableMessageHeader getMessageHeader() - { - return convertMessageHeader(message.getMessageHeader()); - } - - @Override - public ByteBuffer getContent() - { - ByteBuffer content = message.getContent(0, (int) getSize()); - - return content.asReadOnlyBuffer(); - } - - @Override - public boolean isPersistent() - { - return message.isPersistent(); - } - - @Override - public long getSize() - { - return message.getSize(); - } - - @Override - public long getExpiration() - { - return message.getExpiration(); - } - - @Override - public long getMessageNumber() - { - return message.getMessageNumber(); - } - - @Override - public long getArrivalTime() - { - return message.getArrivalTime(); - } - }; - } - - private static ReportableMessageHeader convertMessageHeader(final AMQMessageHeader messageHeader) - { - return new ReportableMessageHeader() - { - @Override - public String getCorrelationId() - { - return messageHeader.getCorrelationId(); - } - - @Override - public long getExpiration() - { - return messageHeader.getExpiration(); - } - - @Override - public String getUserId() - { - return messageHeader.getUserId(); - } - - @Override - public String getAppId() - { - return messageHeader.getAppId(); - } - - @Override - public String getMessageId() - { - return messageHeader.getMessageId(); - } - - @Override - public String getMimeType() - { - return messageHeader.getMimeType(); - } - - @Override - public String getEncoding() - { - return messageHeader.getEncoding(); - } - - @Override - public byte getPriority() - { - return messageHeader.getPriority(); - } - - @Override - public long getTimestamp() - { - return messageHeader.getTimestamp(); - } - - @Override - public String getType() - { - return messageHeader.getType(); - } - - @Override - public String getReplyTo() - { - return messageHeader.getReplyTo(); - } - - @Override - public Object getHeader(final String name) - { - return makeImmutable(messageHeader.getHeader(name)); - } - - @Override - public boolean containsHeaders(final Set<String> names) - { - return messageHeader.containsHeaders(names); - } - - @Override - public boolean containsHeader(final String name) - { - return messageHeader.containsHeader(name); - } - - @Override - public Collection<String> getHeaderNames() - { - return Collections.unmodifiableCollection(messageHeader.getHeaderNames()); - } - }; - } - - private static Object makeImmutable(final Object value) - { - if(value == null || IMMUTABLE_CLASSES.contains(value.getClass())) - { - return value; - } - else if(value instanceof byte[]) - { - return ByteBuffer.wrap((byte[])value).asReadOnlyBuffer(); - } - else if(value instanceof List) - { - List orig = (List) value; - List<Object> copy = new ArrayList<>(orig.size()); - for(Object element : orig) - { - copy.add(makeImmutable(element)); - } - return copy; - } - else if(value instanceof Map) - { - Map<?,?> orig = (Map<?,?>) value; - LinkedHashMap<Object,Object> copy = new LinkedHashMap<>(); - for(Map.Entry<?,?> entry : orig.entrySet()) - { - copy.put(makeImmutable(entry.getKey()),makeImmutable(entry.getValue())); - } - return copy; - } - else return null; - } - - private final QueueReport<T> _report; - - public final T runReport(Queue<?> queue) - { - _report.setQueue(queue); - ReportVisitor visitor = new ReportVisitor(_report); - queue.visit(visitor); - return _report.getReport(); - } -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/report/ReportableMessage.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/report/ReportableMessage.java deleted file mode 100644 index 00b6c4abeb..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/report/ReportableMessage.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.qpid.server.management.plugin.report; - -import java.nio.ByteBuffer; - -public interface ReportableMessage -{ - String getInitialRoutingAddress(); - - ReportableMessageHeader getMessageHeader(); - - public ByteBuffer getContent(); - - boolean isPersistent(); - - long getSize(); - - long getExpiration(); - - long getMessageNumber(); - - long getArrivalTime(); -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/report/ReportableMessageHeader.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/report/ReportableMessageHeader.java deleted file mode 100644 index e78415f8d0..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/report/ReportableMessageHeader.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.qpid.server.management.plugin.report; - -import java.util.Collection; -import java.util.Set; - -public interface ReportableMessageHeader -{ - String getCorrelationId(); - - long getExpiration(); - - String getUserId(); - - String getAppId(); - - String getMessageId(); - - String getMimeType(); - - String getEncoding(); - - byte getPriority(); - - long getTimestamp(); - - String getType(); - - String getReplyTo(); - - Object getHeader(String name); - - boolean containsHeaders(Set<String> names); - - boolean containsHeader(String name); - - Collection<String> getHeaderNames(); - -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/DefinedFileServlet.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/DefinedFileServlet.java deleted file mode 100644 index 2f6f55e042..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/DefinedFileServlet.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.qpid.server.management.plugin.servlet; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; - -import javax.servlet.ServletConfig; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.qpid.server.management.plugin.HttpManagementUtil; - -public class DefinedFileServlet extends HttpServlet -{ - - private static final String FILENAME_INIT_PARAMETER = "filename"; - - private String _filename; - - public DefinedFileServlet() - { - super(); - } - - public DefinedFileServlet(String filename) - { - _filename = filename; - } - - @Override - public void init() throws ServletException - { - ServletConfig config = getServletConfig(); - String fileName = config.getInitParameter(FILENAME_INIT_PARAMETER); - if (fileName != null && !"".equals(fileName)) - { - _filename = fileName; - } - } - - @Override - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException - { - try (OutputStream output = HttpManagementUtil.getOutputStream(request, response)) - { - try(InputStream fileInput = getClass().getResourceAsStream("/resources/" + _filename)) - { - if (fileInput != null) - { - byte[] buffer = new byte[1024]; - response.setStatus(HttpServletResponse.SC_OK); - int read = 0; - - while ((read = fileInput.read(buffer)) > 0) - { - output.write(buffer, 0, read); - } - } - else - { - response.sendError(HttpServletResponse.SC_NOT_FOUND, "unknown file: " + _filename); - } - } - } - } -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/FileServlet.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/FileServlet.java deleted file mode 100644 index 1c741d97e8..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/FileServlet.java +++ /dev/null @@ -1,127 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.qpid.server.management.plugin.servlet; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.net.URL; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.qpid.server.management.plugin.HttpManagementUtil; - -public class FileServlet extends HttpServlet -{ - private static final String RESOURCES_PREFIX = "/resources"; - private static final Map<String, String> CONTENT_TYPES; - - static - { - - Map<String, String> contentTypes = new HashMap<String, String>(); - contentTypes.put("js", "application/javascript"); - contentTypes.put("html", "text/html"); - contentTypes.put("css", "text/css"); - contentTypes.put("json", "application/json"); - contentTypes.put("jpg", "image/jpg"); - contentTypes.put("png", "image/png"); - contentTypes.put("gif", "image/gif"); - CONTENT_TYPES = Collections.unmodifiableMap(contentTypes); - } - - private final String _resourcePathPrefix; - private final boolean _usePathInfo; - - public FileServlet() - { - this(RESOURCES_PREFIX, false); - } - - public FileServlet(String resourcePathPrefix, boolean usePathInfo) - { - _resourcePathPrefix = resourcePathPrefix; - _usePathInfo = usePathInfo; - } - - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException - { - String filename = null; - if(_usePathInfo) - { - filename = request.getPathInfo(); - } - else - { - filename = request.getServletPath(); - } - - if(filename.contains(".")) - { - String suffix = filename.substring(filename.lastIndexOf('.')+1); - String contentType = CONTENT_TYPES.get(suffix); - if(contentType != null) - { - response.setContentType(contentType); - } - } - - URL resourceURL = getClass().getResource(_resourcePathPrefix + filename); - if(resourceURL != null) - { - response.setStatus(HttpServletResponse.SC_OK); - InputStream fileInput = resourceURL.openStream(); - try - { - byte[] buffer = new byte[1024]; - int read = 0; - OutputStream output = HttpManagementUtil.getOutputStream(request, response); - try - { - while((read = fileInput.read(buffer)) != -1) - { - output.write(buffer, 0, read); - } - } - finally - { - output.close(); - } - } - finally - { - fileInput.close(); - } - } - else - { - response.sendError(HttpServletResponse.SC_NOT_FOUND, "unknown file"); - } - - } - -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/LogFileServlet.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/LogFileServlet.java deleted file mode 100644 index 321cfae66c..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/LogFileServlet.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.qpid.server.management.plugin.servlet; - -import java.io.IOException; -import java.io.OutputStream; -import java.text.SimpleDateFormat; -import java.util.Collections; -import java.util.Date; -import java.util.List; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.log4j.LogManager; -import org.apache.qpid.server.management.plugin.log.LogFileDetails; -import org.apache.qpid.server.management.plugin.log.LogFileHelper; -import org.apache.qpid.server.management.plugin.servlet.rest.AbstractServlet; - -public class LogFileServlet extends AbstractServlet -{ - private static final String PARAMETER_LOG_FILE = "l"; - - private static final long serialVersionUID = 1L; - - public static final String LOGS_FILE_NAME = "qpid-logs-%s.zip"; - public static final String DATE_FORMAT = "yyyy-MM-dd-mmHHss"; - - @Override - protected void doGetWithSubjectAndActor(HttpServletRequest request, HttpServletResponse response) throws IOException, - ServletException - { - response.setHeader("Cache-Control", "no-cache"); - response.setHeader("Pragma", "no-cache"); - response.setDateHeader("Expires", 0); - - if (!getBroker().getSecurityManager().authoriseLogsAccess()) - { - response.sendError(HttpServletResponse.SC_FORBIDDEN, "Log files download is denied"); - return; - } - - String[] requestedFiles = request.getParameterValues(PARAMETER_LOG_FILE); - - if (requestedFiles == null || requestedFiles.length == 0) - { - response.setStatus(HttpServletResponse.SC_BAD_REQUEST); - return; - } - - @SuppressWarnings("unchecked") - LogFileHelper helper = new LogFileHelper(Collections.list(LogManager.getRootLogger().getAllAppenders())); - - List<LogFileDetails> logFiles = null; - - try - { - logFiles = helper.findLogFileDetails(requestedFiles); - } - catch(IllegalArgumentException e) - { - response.sendError(HttpServletResponse.SC_BAD_REQUEST); - return; - } - - if (logFiles.size() == 0) - { - response.sendError(HttpServletResponse.SC_NOT_FOUND); - return; - } - - String fileName = String.format(LOGS_FILE_NAME, new SimpleDateFormat(DATE_FORMAT).format(new Date())); - response.setStatus(HttpServletResponse.SC_OK); - response.setHeader("Content-Disposition", "attachment;filename=" + fileName); - response.setContentType(LogFileHelper.ZIP_MIME_TYPE); - - OutputStream os = response.getOutputStream(); - try - { - helper.writeLogFiles(logFiles, os); - } - finally - { - if (os != null) - { - os.close(); - } - } - } - -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/ServletConnectionPrincipal.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/ServletConnectionPrincipal.java deleted file mode 100644 index 18a026ec93..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/ServletConnectionPrincipal.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.qpid.server.management.plugin.servlet; - -import org.apache.qpid.server.security.auth.ManagementConnectionPrincipal; -import org.apache.qpid.server.security.auth.SocketConnectionPrincipal; - -import javax.servlet.ServletRequest; -import java.net.InetSocketAddress; -import java.net.SocketAddress; - -public class ServletConnectionPrincipal implements ManagementConnectionPrincipal -{ - private final InetSocketAddress _address; - - public ServletConnectionPrincipal(ServletRequest request) - { - _address = new InetSocketAddress(request.getRemoteHost(), request.getRemotePort()); - } - - @Override - public SocketAddress getRemoteAddress() - { - return _address; - } - - @Override - public String getName() - { - return _address.toString(); - } - - @Override - public boolean equals(final Object o) - { - if (this == o) - { - return true; - } - if (o == null || getClass() != o.getClass()) - { - return false; - } - - final ServletConnectionPrincipal that = (ServletConnectionPrincipal) o; - - if (!_address.equals(that._address)) - { - return false; - } - - return true; - } - - @Override - public int hashCode() - { - return _address.hashCode(); - } - - @Override - public String getType() - { - return "HTTP"; - } -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/AbstractServlet.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/AbstractServlet.java deleted file mode 100644 index ef32d352bb..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/AbstractServlet.java +++ /dev/null @@ -1,291 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.qpid.server.management.plugin.servlet.rest; - -import java.io.IOException; -import java.io.OutputStream; -import java.io.Writer; -import java.security.PrivilegedActionException; -import java.security.PrivilegedExceptionAction; - -import javax.security.auth.Subject; -import javax.servlet.ServletConfig; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.codehaus.jackson.JsonGenerationException; -import org.codehaus.jackson.map.JsonMappingException; -import org.codehaus.jackson.map.ObjectMapper; -import org.codehaus.jackson.map.SerializationConfig; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import org.apache.qpid.server.management.plugin.HttpManagementConfiguration; -import org.apache.qpid.server.management.plugin.HttpManagementUtil; -import org.apache.qpid.server.model.Broker; -import org.apache.qpid.server.util.ConnectionScopedRuntimeException; - -public abstract class AbstractServlet extends HttpServlet -{ - private static final Logger LOGGER = LoggerFactory.getLogger(AbstractServlet.class); - - private Broker<?> _broker; - private HttpManagementConfiguration _managementConfiguration; - - protected AbstractServlet() - { - super(); - } - - @Override - public void init() throws ServletException - { - ServletConfig servletConfig = getServletConfig(); - ServletContext servletContext = servletConfig.getServletContext(); - _broker = HttpManagementUtil.getBroker(servletContext); - _managementConfiguration = HttpManagementUtil.getManagementConfiguration(servletContext); - super.init(); - } - - @Override - protected final void doGet(final HttpServletRequest request, final HttpServletResponse resp) - { - doWithSubjectAndActor( - new PrivilegedExceptionAction<Void>() - { - @Override - public Void run() throws Exception - { - doGetWithSubjectAndActor(request, resp); - return null; - } - }, - request, - resp - ); - } - - /** - * Performs the GET action as the logged-in {@link Subject}. - * Subclasses commonly override this method - */ - protected void doGetWithSubjectAndActor(HttpServletRequest request, HttpServletResponse resp) throws ServletException, IOException - { - throw new UnsupportedOperationException("GET not supported by this servlet"); - } - - - @Override - protected final void doPost(final HttpServletRequest request, final HttpServletResponse resp) - { - doWithSubjectAndActor( - new PrivilegedExceptionAction<Void>() - { - @Override - public Void run() throws Exception - { - doPostWithSubjectAndActor(request, resp); - return null; - } - }, - request, - resp - ); - } - - /** - * Performs the POST action as the logged-in {@link Subject}. - * Subclasses commonly override this method - */ - protected void doPostWithSubjectAndActor(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException - { - throw new UnsupportedOperationException("POST not supported by this servlet"); - } - - @Override - protected final void doPut(final HttpServletRequest request, final HttpServletResponse resp) - { - doWithSubjectAndActor( - new PrivilegedExceptionAction<Void>() - { - @Override - public Void run() throws Exception - { - doPutWithSubjectAndActor(request, resp); - return null; - } - }, - request, - resp - ); - } - - public Writer getOutputWriter(final HttpServletRequest request, final HttpServletResponse response) - throws IOException - { - return HttpManagementUtil.getOutputWriter(request, response, _managementConfiguration); - } - - public OutputStream getOutputStream(final HttpServletRequest request, final HttpServletResponse response) - throws IOException - { - return HttpManagementUtil.getOutputStream(request, response, _managementConfiguration); - } - - /** - * Performs the PUT action as the logged-in {@link Subject}. - * Subclasses commonly override this method - */ - protected void doPutWithSubjectAndActor(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException - { - throw new UnsupportedOperationException("PUT not supported by this servlet"); - } - - @Override - protected final void doDelete(final HttpServletRequest request, final HttpServletResponse resp) - throws ServletException, IOException - { - doWithSubjectAndActor( - new PrivilegedExceptionAction<Void>() - { - @Override - public Void run() throws Exception - { - doDeleteWithSubjectAndActor(request, resp); - return null; - } - }, - request, - resp - ); - } - - /** - * Performs the PUT action as the logged-in {@link Subject}. - * Subclasses commonly override this method - */ - protected void doDeleteWithSubjectAndActor(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException - { - throw new UnsupportedOperationException("DELETE not supported by this servlet"); - } - - private void doWithSubjectAndActor( - PrivilegedExceptionAction<Void> privilegedExceptionAction, - final HttpServletRequest request, - final HttpServletResponse resp) - { - Subject subject; - try - { - subject = getAuthorisedSubject(request); - } - catch (SecurityException e) - { - sendError(resp, HttpServletResponse.SC_UNAUTHORIZED); - return; - } - - try - { - Subject.doAs(subject, privilegedExceptionAction); - } - catch(RuntimeException e) - { - LOGGER.error("Unable to perform action", e); - throw e; - } - catch (PrivilegedActionException e) - { - LOGGER.error("Unable to perform action", e); - Throwable cause = e.getCause(); - if(cause instanceof RuntimeException) - { - throw (RuntimeException)cause; - } - if(cause instanceof Error) - { - throw (Error)cause; - } - throw new ConnectionScopedRuntimeException(e.getCause()); - } - } - - protected Subject getAuthorisedSubject(HttpServletRequest request) - { - Subject subject = HttpManagementUtil.getAuthorisedSubject(request.getSession()); - if (subject == null) - { - throw new SecurityException("Access to management rest interfaces is denied for un-authorised user"); - } - return subject; - } - - protected Broker<?> getBroker() - { - return _broker; - } - - protected HttpManagementConfiguration getManagementConfiguration() - { - return _managementConfiguration; - } - - protected void sendError(final HttpServletResponse resp, int errorCode) - { - try - { - resp.sendError(errorCode); - } - catch (IOException e) - { - throw new ConnectionScopedRuntimeException("Failed to send error response code " + errorCode, e); - } - } - - protected void sendJsonResponse(Object object, HttpServletRequest request, HttpServletResponse response) throws IOException, - JsonGenerationException, JsonMappingException - { - response.setStatus(HttpServletResponse.SC_OK); - - response.setHeader("Cache-Control","no-cache"); - response.setHeader("Pragma","no-cache"); - response.setDateHeader ("Expires", 0); - response.setContentType("application/json"); - - final Writer writer = getOutputWriter(request, response); - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(SerializationConfig.Feature.INDENT_OUTPUT, true); - mapper.writeValue(writer, object); - } - - protected String[] getPathInfoElements(HttpServletRequest request) - { - String pathInfo = request.getPathInfo(); - if (pathInfo != null && pathInfo.length() > 0) - { - return pathInfo.substring(1).split("/"); - } - return null; - } -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/Action.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/Action.java deleted file mode 100644 index 3241a7560e..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/Action.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - * - */ -package org.apache.qpid.server.management.plugin.servlet.rest; - -import java.util.Map; - -import org.apache.qpid.server.model.Broker; - - -public interface Action -{ - String getName(); - Object perform(Map<String, Object> request, Broker broker); -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/ApiDocsServlet.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/ApiDocsServlet.java deleted file mode 100644 index 5c30378fc6..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/ApiDocsServlet.java +++ /dev/null @@ -1,423 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * <p/> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p/> - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.qpid.server.management.plugin.servlet.rest; - -import java.io.IOException; -import java.io.PrintWriter; -import java.io.Writer; -import java.security.AccessControlException; -import java.util.*; - -import javax.servlet.ServletConfig; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.Part; - -import org.codehaus.jackson.map.ObjectMapper; -import org.codehaus.jackson.map.SerializationConfig; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import org.apache.qpid.server.configuration.IllegalConfigurationException; -import org.apache.qpid.server.model.AbstractConfiguredObject; -import org.apache.qpid.server.model.Broker; -import org.apache.qpid.server.model.ConfiguredAutomatedAttribute; -import org.apache.qpid.server.model.ConfiguredObject; -import org.apache.qpid.server.model.ConfiguredObjectAttribute; -import org.apache.qpid.server.model.IllegalStateTransitionException; -import org.apache.qpid.server.model.IntegrityViolationException; -import org.apache.qpid.server.model.ManagedObject; -import org.apache.qpid.server.model.Model; -import org.apache.qpid.server.util.urlstreamhandler.data.Handler; -import org.apache.qpid.server.virtualhost.ExchangeExistsException; -import org.apache.qpid.server.virtualhost.QueueExistsException; -import org.apache.qpid.util.DataUrlUtils; - -public class ApiDocsServlet extends AbstractServlet -{ - private static final Logger LOGGER = LoggerFactory.getLogger(ApiDocsServlet.class); - private final Model _model; - private final List<Class<? extends ConfiguredObject>> _types; - - private Class<? extends ConfiguredObject>[] _hierarchy; - - private static final Set<Character> VOWELS = new HashSet<>(Arrays.asList('a','e','i','o','u')); - - public static final Comparator<Class<? extends ConfiguredObject>> CLASS_COMPARATOR = - new Comparator<Class<? extends ConfiguredObject>>() - { - @Override - public int compare(final Class<? extends ConfiguredObject> o1, - final Class<? extends ConfiguredObject> o2) - { - return o1.getSimpleName().compareTo(o2.getSimpleName()); - } - - }; - private static final Map<Class<? extends ConfiguredObject>, List<String>> REGISTERED_CLASSES = new TreeMap<>(CLASS_COMPARATOR); - - - public ApiDocsServlet(final Model model, final List<String> registeredPaths, Class<? extends ConfiguredObject>... hierarchy) - { - super(); - _model = model; - _hierarchy = hierarchy; - _types = hierarchy.length == 0 ? null : new ArrayList<>(_model.getTypeRegistry().getTypeSpecialisations(getConfiguredClass())); - if(_types != null) - { - Collections.sort(_types, CLASS_COMPARATOR); - } - if(_hierarchy.length != 0) - { - List<String> paths = REGISTERED_CLASSES.get(getConfiguredClass()); - if(paths == null) - { - paths = new ArrayList<>(); - REGISTERED_CLASSES.put(getConfiguredClass(), paths); - } - paths.addAll(registeredPaths); - - } - - } - - @Override - protected void doGetWithSubjectAndActor(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException - { - response.setContentType("text/html"); - response.setStatus(HttpServletResponse.SC_OK); - - - PrintWriter writer = response.getWriter(); - - writePreamble(writer); - writeHead(writer); - - if(_hierarchy.length == 0) - { - writer.println("<table class=\"api\">"); - writer.println("<thead>"); - writer.println("<tr>"); - writer.println("<th class=\"type\">Type</th>"); - writer.println("<th class=\"path\">Path</th>"); - writer.println("<th class=\"description\">Description</th>"); - writer.println("</tr>"); - writer.println("</thead>"); - writer.println("<tbody>"); - for(Map.Entry<Class<? extends ConfiguredObject>, List<String>> entry : REGISTERED_CLASSES.entrySet()) - { - List<String> paths = entry.getValue(); - Class<? extends ConfiguredObject> objClass = entry.getKey(); - writer.println("<tr>"); - writer.println("<td class=\"type\" rowspan=\""+ paths.size()+"\"><a href=\"latest/"+ objClass.getSimpleName().toLowerCase()+"\">"+objClass.getSimpleName()+"</a></td>"); - writer.println("<td class=\"path\">" + paths.get(0) + "</td>"); - writer.println("<td class=\"description\" rowspan=\""+ paths.size()+"\">"+ - objClass.getAnnotation(ManagedObject.class).description()+"</td>"); - writer.println("</tr>"); - for(int i = 1; i < paths.size(); i++) - { - writer.println("<tr>"); - writer.println("<td class=\"path\">" + paths.get(i) + "</td>"); - writer.println("</tr>"); - } - - } - writer.println("</tbody>"); - writer.println("</table>"); - - } - else - { - writeCategoryDescription(writer); - writeUsage(writer, request); - writeTypes(writer); - writeAttributes(writer); - } - - writeFoot(writer); - } - - private void writePreamble(final PrintWriter writer) - { - writer.println("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\""); - writer.println("\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">"); - writer.println("<html>"); - - - } - - private void writeHead(final PrintWriter writer) - { - writer.println("<head>"); - writer.println("<link rel=\"stylesheet\" type=\"text/css\" href=\"/css/apidocs.css\">"); - writeTitle(writer); - - writer.println("</head>"); - writer.println("<body>"); - } - - private void writeTitle(final PrintWriter writer) - { - writer.print("<title>"); - if(_hierarchy.length == 0) - { - writer.print("Qpid API"); - } - else - { - writer.print("Qpid API: " + getConfiguredClass().getSimpleName()); - } - writer.println("</title>"); - } - - private void writeCategoryDescription(PrintWriter writer) - { - writer.println("<h1>"+getConfiguredClass().getSimpleName()+"</h1>"); - writer.println(getConfiguredClass().getAnnotation(ManagedObject.class).description()); - } - - private void writeUsage(final PrintWriter writer, final HttpServletRequest request) - { - writer.println("<a name=\"usage\"><h2>Usage</h2></a>"); - writer.println("<table class=\"usage\">"); - writer.println("<tbody>"); - writer.print("<tr><th class=\"operation\">Read</th><td class=\"method\">GET</td><td class=\"path\">" + request.getServletPath() - .replace("apidocs", "api")); - - for (final Class<? extends ConfiguredObject> category : _hierarchy) - { - writer.print("[/<" + category.getSimpleName().toLowerCase() + " name or id>"); - } - for(int i = 0; i < _hierarchy.length; i++) - { - writer.print("] "); - } - writer.println("</td></tr>"); - - writer.print("<tr><th class=\"operation\">Update</th><td class=\"method\">PUT or POST</td><td class=\"path\">" - + request.getServletPath().replace("apidocs", "api")); - for (final Class<? extends ConfiguredObject> category : _hierarchy) - { - writer.print("/<" + category.getSimpleName().toLowerCase() + " name or id>"); - } - - writer.print( - "<tr><th class=\"operation\">Create</th><td class=\"method\">PUT or POST</td><td class=\"path\">" - + request.getServletPath().replace("apidocs", "api")); - for (int i = 0; i < _hierarchy.length - 1; i++) - { - writer.print("/<" + _hierarchy[i].getSimpleName().toLowerCase() + " name or id>"); - } - - writer.print("<tr><th class=\"operation\">Delete</th><td class=\"method\">DELETE</td><td class=\"path\">" - + request.getServletPath().replace("apidocs", "api")); - for (final Class<? extends ConfiguredObject> category : _hierarchy) - { - writer.print("/<" + category.getSimpleName().toLowerCase() + " name or id>"); - } - - writer.println("</tbody>"); - writer.println("</table>"); - - } - - - private void writeTypes(final PrintWriter writer) - { - if(!_types.isEmpty() && !(_types.size() == 1 && getTypeName(_types.iterator().next()).trim().equals(""))) - { - writer.println("<a name=\"types\"><h2>Types</h2></a>"); - writer.println("<table class=\"types\">"); - writer.println("<thead>"); - writer.println("<tr><th class=\"type\">Type</th><th class=\"description\">Description</th></tr>"); - writer.println("</thead>"); - - writer.println("<tbody>"); - for (Class<? extends ConfiguredObject> type : _types) - { - writer.print("<tr><td class=\"type\">"); - writer.print(getTypeName(type)); - writer.print("</td><td class=\"description\">"); - writer.print(type.getAnnotation(ManagedObject.class).description()); - writer.println("</td></tr>"); - - } - writer.println("</tbody>"); - } - - writer.println("</table>"); - } - - private String getTypeName(final Class<? extends ConfiguredObject> type) - { - return type.getAnnotation(ManagedObject.class).type() == null - ? _model.getTypeRegistry().getTypeClass(type).getSimpleName() - : type.getAnnotation(ManagedObject.class).type(); - } - - private void writeAttributes(final PrintWriter writer) - { - writer.println("<a name=\"types\"><h2>Attributes</h2></a>"); - writer.println("<h2>Common Attributes</h2>"); - - writeAttributesTable(writer, _model.getTypeRegistry().getAttributeTypes(getConfiguredClass()).values()); - - for(Class<? extends ConfiguredObject> type : _types) - { - - ManagedObject typeAnnotation = type.getAnnotation(ManagedObject.class); - String typeName = typeAnnotation.type() == null ? _model.getTypeRegistry().getTypeClass(type).getSimpleName() : typeAnnotation.type(); - Collection<ConfiguredObjectAttribute<?, ?>> typeSpecificAttributes = - _model.getTypeRegistry().getTypeSpecificAttributes(type); - if(!typeSpecificAttributes.isEmpty()) - { - writer.println("<h2><span class=\"type\">"+typeName+"</span> Specific Attributes</h2>"); - writeAttributesTable(writer, typeSpecificAttributes); - } - - - } - - } - - private void writeAttributesTable(final PrintWriter writer, - final Collection<ConfiguredObjectAttribute<?, ?>> attributeTypes) - { - writer.println("<table class=\"attributes\">"); - writer.println("<thead>"); - writer.println("<tr><th class=\"name\">Attribute Name</th><th class=\"type\">Type</th><th class=\"description\">Description</th></tr>"); - writer.println("</thead>"); - writer.println("<tbody>"); - - for(ConfiguredObjectAttribute attribute : attributeTypes) - { - if(!attribute.isDerived()) - { - writer.println("<tr><td class=\"name\">" - + attribute.getName() - + "</td><td class=\"type\">" - + renderType(attribute) - + "</td class=\"description\"><td>" - + attribute.getDescription() - + "</td></tr>"); - } - } - writer.println("</tbody>"); - - writer.println("</table>"); - - } - - private String renderType(final ConfiguredObjectAttribute attribute) - { - final Class type = attribute.getType(); - if(Enum.class.isAssignableFrom(type)) - { - return "<div class=\"restriction\" title=\"enum: " + EnumSet.allOf(type) + "\">string</div>"; - } - else if(ConfiguredObject.class.isAssignableFrom(type)) - { - return "<div class=\"restriction\" title=\"name or id of a" + (VOWELS.contains(type.getSimpleName().toLowerCase().charAt(0)) ? "n " : " ") + type.getSimpleName() + "\">string</div>"; - } - else if(UUID.class == type) - { - return "<div class=\"restriction\" title=\"must be a UUID\">string</div>"; - } - else - { - boolean hasValuesRestriction = attribute instanceof ConfiguredAutomatedAttribute - && ((ConfiguredAutomatedAttribute)attribute).hasValidValues(); - - StringBuilder returnVal = new StringBuilder(); - if(hasValuesRestriction) - { - returnVal.append("<div class=\"restricted\" title=\"Valid values: " + ((ConfiguredAutomatedAttribute)attribute).validValues() + "\">"); - } - - if(Number.class.isAssignableFrom(type)) - { - returnVal.append("number"); - } - else if(Boolean.class == type) - { - returnVal.append("boolean"); - } - else if(String.class == type) - { - returnVal.append("string"); - } - else if(Collection.class.isAssignableFrom(type)) - { - // TODO - generate a description of the type in the array - returnVal.append("array"); - } - else if(Map.class.isAssignableFrom(type)) - { - // TODO - generate a description of the type in the object - returnVal.append("object"); - } - else - { - returnVal.append(type.getSimpleName()); - } - if(hasValuesRestriction) - { - returnVal.append("</div>"); - } - return returnVal.toString(); - } - } - - private void writeFoot(final PrintWriter writer) - { - writer.println("</body>"); - writer.println("</html>"); - } - private Class<? extends ConfiguredObject> getConfiguredClass() - { - return _hierarchy.length == 0 ? Broker.class : _hierarchy[_hierarchy.length-1]; - } - - - private int getIntParameterFromRequest(final HttpServletRequest request, - final String paramName, - final int defaultValue) - { - int intValue = defaultValue; - final String stringValue = request.getParameter(paramName); - if(stringValue!=null) - { - try - { - intValue = Integer.parseInt(stringValue); - } - catch (NumberFormatException e) - { - LOGGER.warn("Could not parse " + stringValue + " as integer for parameter " + paramName); - } - } - return intValue; - } - - private boolean getBooleanParameterFromRequest(HttpServletRequest request, final String paramName) - { - return Boolean.parseBoolean(request.getParameter(paramName)); - } - - -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/ConfiguredObjectToMapConverter.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/ConfiguredObjectToMapConverter.java deleted file mode 100644 index 0f1b7d03e9..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/ConfiguredObjectToMapConverter.java +++ /dev/null @@ -1,314 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.qpid.server.management.plugin.servlet.rest; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.Comparator; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.TreeMap; - -import org.apache.qpid.server.model.ConfiguredObject; -import org.apache.qpid.server.model.ConfiguredObjectAttribute; -import org.apache.qpid.server.model.Model; - -public class ConfiguredObjectToMapConverter -{ - /** Name of the key used for the statistics map */ - public static final String STATISTICS_MAP_KEY = "statistics"; - - private static Set<String> CONFIG_EXCLUDED_ATTRIBUTES = - new HashSet<>(Arrays.asList(ConfiguredObject.ID, - ConfiguredObject.DURABLE, - ConfiguredObject.CREATED_BY, - ConfiguredObject.CREATED_TIME, - ConfiguredObject.LAST_UPDATED_BY, - ConfiguredObject.LAST_UPDATED_TIME)); - - public Map<String, Object> convertObjectToMap(final ConfiguredObject<?> confObject, - Class<? extends ConfiguredObject> clazz, - int depth, - final boolean useActualValues, - final boolean inheritedActuals, - final boolean includeSystemContext, - final boolean extractAsConfig, - final int oversizeThreshold, - final boolean isSecureTransport - ) - { - Map<String, Object> object = new LinkedHashMap<>(); - - incorporateAttributesIntoMap(confObject, object, useActualValues, inheritedActuals, includeSystemContext, - extractAsConfig, oversizeThreshold, isSecureTransport); - if(!extractAsConfig) - { - incorporateStatisticsIntoMap(confObject, object); - } - - if(depth > 0) - { - incorporateChildrenIntoMap(confObject, clazz, depth, object, useActualValues, inheritedActuals, - includeSystemContext, extractAsConfig, oversizeThreshold, isSecureTransport); - } - return object; - } - - - private void incorporateAttributesIntoMap( - final ConfiguredObject<?> confObject, - Map<String, Object> object, - final boolean useActualValues, - final boolean inheritedActuals, - final boolean includeSystemContext, - final boolean extractAsConfig, - final int oversizeThreshold, - final boolean isSecureTransport) - { - // if extracting as config add a fake attribute for each secondary parent - if(extractAsConfig && confObject.getModel().getParentTypes(confObject.getCategoryClass()).size()>1) - { - Iterator<Class<? extends ConfiguredObject>> parentClasses = - confObject.getModel().getParentTypes(confObject.getCategoryClass()).iterator(); - - // ignore the first parent which is supplied by structure - parentClasses.next(); - - while(parentClasses.hasNext()) - { - Class<? extends ConfiguredObject> parentClass = parentClasses.next(); - ConfiguredObject parent = confObject.getParent(parentClass); - if(parent != null) - { - String categoryName = parentClass.getSimpleName(); - object.put(categoryName.substring(0,1).toLowerCase()+categoryName.substring(1), parent.getName()); - } - } - } - - for(String name : confObject.getAttributeNames()) - { - if (!(extractAsConfig && CONFIG_EXCLUDED_ATTRIBUTES.contains(name))) - { - Object value = - useActualValues ? confObject.getActualAttributes().get(name) : confObject.getAttribute(name); - if (value instanceof ConfiguredObject) - { - object.put(name, ((ConfiguredObject) value).getName()); - } - else if (ConfiguredObject.CONTEXT.equals(name)) - { - Map<String, Object> contextValues = new HashMap<>(); - if (useActualValues) - { - collectContext(contextValues, confObject.getModel(), confObject, inheritedActuals); - } - else - { - for (String contextName : confObject.getContextKeys(!includeSystemContext)) - { - contextValues.put(contextName, confObject.getContextValue(String.class, contextName)); - } - } - if (!contextValues.isEmpty()) - { - object.put(ConfiguredObject.CONTEXT, contextValues); - } - } - else if (value instanceof Collection) - { - List<Object> converted = new ArrayList<>(); - for (Object member : (Collection) value) - { - if (member instanceof ConfiguredObject) - { - converted.add(((ConfiguredObject) member).getName()); - } - else - { - converted.add(member); - } - } - object.put(name, converted); - } - else if (value != null) - { - ConfiguredObjectAttribute<?, ?> attribute = confObject.getModel() - .getTypeRegistry() - .getAttributeTypes(confObject.getClass()) - .get(name); - - if (attribute.isSecureValue(value) && !(isSecureTransport && extractAsConfig)) - { - // do not expose actual secure attribute value - // getAttribute() returns encoded value - value = confObject.getAttribute(name); - } - - if(attribute.isOversized() && !extractAsConfig && !useActualValues) - { - String valueString = String.valueOf(value); - if(valueString.length() > oversizeThreshold) - { - - String replacementValue = "".equals(attribute.getOversizedAltText()) - ? String.valueOf(value).substring(0, oversizeThreshold - 4) + "..." - : attribute.getOversizedAltText(); - - object.put(name, replacementValue); - } - else - { - object.put(name, value); - } - } - else - { - object.put(name, value); - } - } - else if (extractAsConfig) - { - ConfiguredObjectAttribute<?, ?> attribute = confObject.getModel() - .getTypeRegistry() - .getAttributeTypes(confObject.getClass()) - .get(name); - - if(attribute.isPersisted() && attribute.isDerived()) - { - object.put(name, confObject.getAttribute(name)); - } - } - } - } - } - - private void collectContext(Map<String, Object> contextValues, Model model, ConfiguredObject<?> confObject, boolean inheritedContext) - { - Object value = confObject.getActualAttributes().get(ConfiguredObject.CONTEXT); - if (inheritedContext) - { - Collection<Class<? extends ConfiguredObject>> parents = model.getParentTypes(confObject.getCategoryClass()); - if(parents != null && !parents.isEmpty()) - { - ConfiguredObject parent = confObject.getParent(parents.iterator().next()); - if(parent != null) - { - collectContext(contextValues, model, parent, inheritedContext); - } - } - } - if (value instanceof Map) - { - contextValues.putAll((Map<String,String>)value); - } - } - - private void incorporateStatisticsIntoMap( - final ConfiguredObject<?> confObject, Map<String, Object> object) - { - - Map<String, Object> statMap = new TreeMap<String,Object>(confObject.getStatistics()); - - if(!statMap.isEmpty()) - { - object.put(STATISTICS_MAP_KEY, statMap); - } - - } - - private void incorporateChildrenIntoMap( - final ConfiguredObject confObject, - Class<? extends ConfiguredObject> clazz, - int depth, - Map<String, Object> object, - final boolean useActualValues, - final boolean inheritedActuals, - final boolean includeSystemContext, - final boolean extractAsConfig, - final int oversizeThreshold, - final boolean isSecure) - { - List<Class<? extends ConfiguredObject>> childTypes = new ArrayList<>(confObject.getModel().getChildTypes(clazz)); - - Collections.sort(childTypes, new Comparator<Class<? extends ConfiguredObject>>() - { - @Override - public int compare(final Class<? extends ConfiguredObject> o1, final Class<? extends ConfiguredObject> o2) - { - return o1.getSimpleName().compareTo(o2.getSimpleName()); - } - }); - for(Class<? extends ConfiguredObject> childClass : childTypes) - { - if(!(extractAsConfig && confObject.getModel().getParentTypes(childClass).iterator().next() != confObject.getCategoryClass())) - { - - Collection children = confObject.getChildren(childClass); - if(children != null) - { - List<? extends ConfiguredObject> sortedChildren = new ArrayList<ConfiguredObject>(children); - Collections.sort(sortedChildren, new Comparator<ConfiguredObject>() - { - @Override - public int compare(final ConfiguredObject o1, final ConfiguredObject o2) - { - return o1.getName().compareTo(o2.getName()); - } - }); - - List<Map<String, Object>> childObjects = new ArrayList<>(); - - for (ConfiguredObject child : sortedChildren) - { - if (!(extractAsConfig && !child.isDurable())) - { - childObjects.add(convertObjectToMap(child, - childClass, - depth - 1, - useActualValues, - inheritedActuals, - includeSystemContext, - extractAsConfig, - oversizeThreshold, - isSecure)); - } - } - - if (!childObjects.isEmpty()) - { - String childTypeSingular = childClass.getSimpleName().toLowerCase(); - object.put(childTypeSingular + (childTypeSingular.endsWith("s") ? "es" : "s"), childObjects); - } - } - } - } - } - - - -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/HelperServlet.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/HelperServlet.java deleted file mode 100644 index cafde3b7f9..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/HelperServlet.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - * - */ -package org.apache.qpid.server.management.plugin.servlet.rest; - -import java.io.IOException; -import java.io.Writer; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.Map; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.codehaus.jackson.map.ObjectMapper; -import org.codehaus.jackson.map.SerializationConfig; - -import org.apache.qpid.server.management.plugin.servlet.rest.action.ListAccessControlProviderAttributes; -import org.apache.qpid.server.management.plugin.servlet.rest.action.ListBrokerAttribute; -import org.apache.qpid.server.management.plugin.servlet.rest.action.ListGroupProviderAttributes; -import org.apache.qpid.server.management.plugin.servlet.rest.action.ListTimeZones; -import org.apache.qpid.server.model.Broker; - -public class HelperServlet extends AbstractServlet -{ - private static final long serialVersionUID = 1L; - - private static final String PARAM_ACTION = "action"; - - private Map<String, Action> _actions; - private ObjectMapper _mapper; - - public HelperServlet() - { - _mapper = new ObjectMapper(); - _mapper.configure(SerializationConfig.Feature.INDENT_OUTPUT, true); - - Action[] supportedActions = { - new ListBrokerAttribute(Broker.PRODUCT_VERSION, "version"), - new ListGroupProviderAttributes(), - new ListAccessControlProviderAttributes(), - new PluginClassProviderAction(), - new ListTimeZones() - }; - - _actions = new HashMap<String, Action>(); - - for(Action action : supportedActions) - { - _actions.put(action.getName(), action); - } - } - - @Override - protected void doGetWithSubjectAndActor(HttpServletRequest request, HttpServletResponse response) throws ServletException, - IOException - { - perform(request, response); - } - - @Override - protected void doPostWithSubjectAndActor(HttpServletRequest request, HttpServletResponse response) throws ServletException, - IOException - { - perform(request, response); - } - - private void perform(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException - { - String actionName = request.getParameter(PARAM_ACTION); - Action action = _actions.get(actionName); - if (action == null) - { - response.setStatus(HttpServletResponse.SC_NOT_FOUND); - return; - } - - Map<String, Object> parameters = new HashMap<String, Object>(); - @SuppressWarnings("unchecked") - Enumeration<String> names = request.getParameterNames(); - while (names.hasMoreElements()) - { - String name = (String) names.nextElement(); - String[] values = request.getParameterValues(name); - if (values.length == 1) - { - parameters.put(name, values[0]); - } - else - { - parameters.put(name, values); - } - } - - Object output = action.perform(parameters, getBroker()); - if (output == null) - { - response.setStatus(HttpServletResponse.SC_NOT_FOUND); - return; - } - response.setContentType("application/json"); - final Writer writer = getOutputWriter(request, response); - _mapper.writeValue(writer, output); - - response.setStatus(HttpServletResponse.SC_OK); - - } -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/KeyComparator.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/KeyComparator.java deleted file mode 100644 index 3d862ce321..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/KeyComparator.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.qpid.server.management.plugin.servlet.rest; - -import java.util.Comparator; -import java.util.Map; - -class KeyComparator implements Comparator<Map> -{ - private String _key; - - public KeyComparator(final String key) - { - _key = key; - } - - public int compare(final Map o1, final Map o2) - { - Comparable left = (Comparable) o1.get(_key); - Comparable right = (Comparable) o2.get(_key); - - int result; - if(left == null) - { - result = right == null ? 0 : -1; - } - else - { - result = left.compareTo(right); - } - - return result; - - } -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/LogFileListingServlet.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/LogFileListingServlet.java deleted file mode 100644 index a7889e4890..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/LogFileListingServlet.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.qpid.server.management.plugin.servlet.rest; - -import java.io.IOException; -import java.io.Writer; -import java.util.Collections; -import java.util.List; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.log4j.LogManager; -import org.codehaus.jackson.map.ObjectMapper; -import org.codehaus.jackson.map.SerializationConfig; - -import org.apache.qpid.server.management.plugin.log.LogFileDetails; -import org.apache.qpid.server.management.plugin.log.LogFileHelper; - -public class LogFileListingServlet extends AbstractServlet -{ - private static final long serialVersionUID = 1L; - - @Override - protected void doGetWithSubjectAndActor(HttpServletRequest request, HttpServletResponse response) throws IOException, - ServletException - { - response.setHeader("Cache-Control", "no-cache"); - response.setHeader("Pragma", "no-cache"); - response.setDateHeader("Expires", 0); - - if (!getBroker().getSecurityManager().authoriseLogsAccess()) - { - response.sendError(HttpServletResponse.SC_FORBIDDEN, "Log files access is denied"); - return; - } - - @SuppressWarnings("unchecked") - LogFileHelper helper = new LogFileHelper(Collections.list(LogManager.getRootLogger().getAllAppenders())); - List<LogFileDetails> logFiles = helper.getLogFileDetails(false); - response.setContentType("application/json"); - response.setStatus(HttpServletResponse.SC_OK); - - final Writer writer = getOutputWriter(request, response); - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(SerializationConfig.Feature.INDENT_OUTPUT, true); - mapper.writeValue(writer, logFiles); - - response.setStatus(HttpServletResponse.SC_OK); - } - -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/LogRecordsServlet.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/LogRecordsServlet.java deleted file mode 100644 index b9d58c8868..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/LogRecordsServlet.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.qpid.server.management.plugin.servlet.rest; - -import java.io.IOException; -import java.io.Writer; -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.codehaus.jackson.map.ObjectMapper; -import org.codehaus.jackson.map.SerializationConfig; - -import org.apache.qpid.server.logging.LogRecorder; - -public class LogRecordsServlet extends AbstractServlet -{ - private static final long serialVersionUID = 2L; - - public static final String PARAM_LAST_LOG_ID = "lastLogId"; - - public LogRecordsServlet() - { - super(); - } - - @Override - protected void doGetWithSubjectAndActor(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException - { - response.setContentType("application/json"); - response.setStatus(HttpServletResponse.SC_OK); - - response.setHeader("Cache-Control","no-cache"); - response.setHeader("Pragma","no-cache"); - response.setDateHeader ("Expires", 0); - - if (!getBroker().getSecurityManager().authoriseLogsAccess()) - { - response.sendError(HttpServletResponse.SC_FORBIDDEN, "Broker logs access is denied"); - return; - } - - long lastLogId = 0; - try - { - lastLogId = Long.parseLong(request.getParameter(PARAM_LAST_LOG_ID)); - } - catch(Exception e) - { - // ignore null and incorrect parameter values - } - - List<Map<String,Object>> logRecords = new ArrayList<Map<String, Object>>(); - - LogRecorder logRecorder = getBroker().getLogRecorder(); - for(LogRecorder.Record record : logRecorder) - { - if (record.getId() > lastLogId) - { - logRecords.add(logRecordToObject(record)); - } - } - - final Writer writer = getOutputWriter(request,response); - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(SerializationConfig.Feature.INDENT_OUTPUT, true); - mapper.writeValue(writer, logRecords); - - response.setStatus(HttpServletResponse.SC_OK); - - } - - private Map<String, Object> logRecordToObject(LogRecorder.Record record) - { - Map<String, Object> recordMap = new LinkedHashMap<String, Object>(); - recordMap.put("id",record.getId()); - recordMap.put("timestamp", record.getTimestamp()); - recordMap.put("level", record.getLevel()); - recordMap.put("thread", record.getThreadName()); - recordMap.put("logger", record.getLogger()); - recordMap.put("message", record.getMessage()); - return recordMap; - } - -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/LoggedOnUserPreferencesServlet.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/LoggedOnUserPreferencesServlet.java deleted file mode 100644 index 6984a32e09..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/LoggedOnUserPreferencesServlet.java +++ /dev/null @@ -1,138 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -package org.apache.qpid.server.management.plugin.servlet.rest; - -import java.io.IOException; -import java.net.SocketAddress; -import java.security.Principal; -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.Map; - -import javax.security.auth.Subject; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.codehaus.jackson.map.ObjectMapper; - -import org.apache.qpid.server.management.plugin.HttpManagementUtil; -import org.apache.qpid.server.model.AuthenticationProvider; -import org.apache.qpid.server.model.PreferencesProvider; -import org.apache.qpid.server.security.auth.AuthenticatedPrincipal; - -public class LoggedOnUserPreferencesServlet extends AbstractServlet -{ - private static final long serialVersionUID = 1L; - - @Override - protected void doGetWithSubjectAndActor(HttpServletRequest request, HttpServletResponse response) throws IOException, - ServletException - { - PreferencesProvider preferencesProvider = getPreferencesProvider(request); - if (preferencesProvider == null) - { - response.sendError(HttpServletResponse.SC_NOT_FOUND, "Preferences provider is not configured"); - return; - } - String userName = getAuthenticatedUserName(request); - Map<String, Object> preferences = preferencesProvider.getPreferences(userName); - if (preferences == null) - { - preferences = Collections.<String, Object>emptyMap(); - } - sendJsonResponse(preferences, request, response); - } - - /* - * replace preferences - */ - @Override - protected void doPutWithSubjectAndActor(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException - { - PreferencesProvider preferencesProvider = getPreferencesProvider(request); - if (preferencesProvider == null) - { - response.sendError(HttpServletResponse.SC_NOT_FOUND, "Preferences provider is not configured"); - return; - } - String userName = getAuthenticatedUserName(request); - - ObjectMapper mapper = new ObjectMapper(); - - @SuppressWarnings("unchecked") - Map<String, Object> newPreferences = mapper.readValue(request.getInputStream(), LinkedHashMap.class); - - preferencesProvider.deletePreferences(userName); - Map<String, Object> preferences = preferencesProvider.setPreferences(userName, newPreferences); - if (preferences == null) - { - preferences = Collections.<String, Object>emptyMap(); - } - sendJsonResponse(preferences, request, response); - } - - /* - * update preferences - */ - @Override - protected void doPostWithSubjectAndActor(HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException - { - PreferencesProvider preferencesProvider = getPreferencesProvider(request); - if (preferencesProvider == null) - { - response.sendError(HttpServletResponse.SC_NOT_FOUND, "Preferences provider is not configured"); - return; - } - String userName = getAuthenticatedUserName(request); - - ObjectMapper mapper = new ObjectMapper(); - - @SuppressWarnings("unchecked") - Map<String, Object> newPreferences = mapper.readValue(request.getInputStream(), LinkedHashMap.class); - Map<String, Object> preferences = preferencesProvider.setPreferences(userName, newPreferences); - if (preferences == null) - { - preferences = Collections.<String, Object>emptyMap(); - } - sendJsonResponse(preferences, request, response); - } - - private String getAuthenticatedUserName(HttpServletRequest request) - { - Subject subject = getAuthorisedSubject(request); - Principal principal = AuthenticatedPrincipal.getAuthenticatedPrincipalFromSubject(subject); - return principal.getName(); - } - - private PreferencesProvider getPreferencesProvider(HttpServletRequest request) - { - AuthenticationProvider authenticationProvider = getManagementConfiguration().getAuthenticationProvider(request); - if (authenticationProvider == null) - { - throw new IllegalStateException("Authentication provider is not found"); - } - return authenticationProvider.getPreferencesProvider(); - } -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/LogoutServlet.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/LogoutServlet.java deleted file mode 100644 index 34b115ed13..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/LogoutServlet.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.qpid.server.management.plugin.servlet.rest; - -import java.io.IOException; - -import javax.servlet.ServletConfig; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; - -import org.apache.qpid.server.management.plugin.HttpManagementUtil; - -@SuppressWarnings("serial") -public class LogoutServlet extends HttpServlet -{ - public static final String RETURN_URL_INIT_PARAM = "qpid.webui_logout_redirect"; - private String _returnUrl = HttpManagementUtil.ENTRY_POINT_PATH; - - @Override - public void init(ServletConfig config) throws ServletException - { - super.init(config); - - String initValue = config.getServletContext().getInitParameter(RETURN_URL_INIT_PARAM); - if(initValue != null) - { - _returnUrl = initValue; - } - } - - @Override - protected void doGet(HttpServletRequest request, HttpServletResponse resp) throws ServletException, IOException - { - HttpSession session = request.getSession(false); - if(session != null) - { - // Invalidating the session will cause LoginLogoutReporter to log the user logoff. - session.invalidate(); - } - - resp.sendRedirect(_returnUrl); - } - -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/MapComparator.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/MapComparator.java deleted file mode 100644 index 84d987813b..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/MapComparator.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.qpid.server.management.plugin.servlet.rest; - -import java.util.Collections; -import java.util.Comparator; -import java.util.Map; - -class MapComparator implements Comparator<Map> -{ - private Comparator<Map>[] _sortKeys; - - public MapComparator(final String[] sortKeys) - { - _sortKeys = parseKeys(sortKeys); - } - - private static Comparator<Map>[] parseKeys(final String[] sortKeys) - { - Comparator<Map>[] comparators = new Comparator[sortKeys.length]; - for(int i = 0; i < sortKeys.length; i++) - { - String key = sortKeys[i]; - - if(key.startsWith("+") || key.startsWith(" ")) - { - comparators[i] = new KeyComparator(key.substring(1)); - } - else if(key.startsWith("-")) - { - comparators[i] = Collections.reverseOrder(new KeyComparator(key.substring(1))); - } - else - { - comparators[i] = new KeyComparator(key); - } - } - return comparators; - } - - - public int compare(final Map o1, final Map o2) - { - int result = 0; - for(int i = 0; i < _sortKeys.length; i++) - { - result = _sortKeys[i].compare(o1, o2); - if(result != 0) - { - return result; - } - } - return 0; - } - -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/MessageContentServlet.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/MessageContentServlet.java deleted file mode 100644 index db58e49eeb..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/MessageContentServlet.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.qpid.server.management.plugin.servlet.rest; - -import java.io.IOException; -import java.nio.ByteBuffer; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.qpid.server.message.MessageDeletedException; -import org.apache.qpid.server.message.MessageReference; -import org.apache.qpid.server.message.ServerMessage; -import org.apache.qpid.server.model.Queue; -import org.apache.qpid.server.model.VirtualHost; -import org.apache.qpid.server.queue.QueueEntry; -import org.apache.qpid.server.queue.QueueEntryVisitor; - -public class MessageContentServlet extends AbstractServlet -{ - public MessageContentServlet() - { - super(); - } - - @Override - protected void doGetWithSubjectAndActor(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException - { - String[] pathInfoElements = getPathInfoElements(request); - if(pathInfoElements != null && pathInfoElements.length > 2) - { - getMessageContent(request, response); - } - - } - - private void getMessageContent(HttpServletRequest request, HttpServletResponse response) throws IOException - { - Queue queue = getQueueFromRequest(request); - String path[] = getPathInfoElements(request); - MessageFinder finder = new MessageFinder(Long.parseLong(path[2])); - queue.visit(finder); - if(finder.isFound()) - { - response.setContentType(finder.getMimeType()); - response.setContentLength((int) finder.getSize()); - getOutputStream(request, response).write(finder.getContent()); - - } - - } - - private Queue getQueueFromRequest(HttpServletRequest request) - { - // TODO - validation that there is a vhost and queue and only those in the path - - String[] pathInfoElements = getPathInfoElements(request); - if(pathInfoElements == null || pathInfoElements.length < 2) - { - throw new IllegalArgumentException("Invalid path is specified"); - } - String vhostName = pathInfoElements[0]; - String queueName = pathInfoElements[1]; - - VirtualHost<?,?,?> vhost = getBroker().findVirtualHostByName(vhostName); - if (vhost == null) - { - throw new IllegalArgumentException("Could not find virtual host with name '" + vhostName + "'"); - } - return getQueueFromVirtualHost(queueName, vhost); - } - - private Queue getQueueFromVirtualHost(String queueName, VirtualHost<?,?,?> vhost) - { - Queue queue = null; - - for(Queue q : vhost.getQueues()) - { - if(q.getName().equals(queueName)) - { - queue = q; - break; - } - } - return queue; - } - - private class MessageFinder implements QueueEntryVisitor - { - private final long _messageNumber; - private String _mimeType; - private long _size; - private byte[] _content; - private boolean _found; - - private MessageFinder(long messageNumber) - { - _messageNumber = messageNumber; - } - - - public boolean visit(QueueEntry entry) - { - ServerMessage message = entry.getMessage(); - if(message != null) - { - if(_messageNumber == message.getMessageNumber()) - { - try - { - MessageReference reference = message.newReference(); - try - { - _mimeType = message.getMessageHeader().getMimeType(); - _size = message.getSize(); - _content = new byte[(int) _size]; - _found = true; - message.getContent(ByteBuffer.wrap(_content), 0); - } - finally - { - reference.release(); - } - return true; - } - catch (MessageDeletedException e) - { - // ignore - the message was deleted as we tried too look at it, treat as if no message found - } - } - - } - return false; - } - - public String getMimeType() - { - return _mimeType; - } - - public long getSize() - { - return _size; - } - - public byte[] getContent() - { - return _content; - } - - public boolean isFound() - { - return _found; - } - } - - -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/MessageServlet.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/MessageServlet.java deleted file mode 100644 index 38f7ef06bc..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/MessageServlet.java +++ /dev/null @@ -1,568 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.qpid.server.management.plugin.servlet.rest; - -import java.io.IOException; -import java.io.Writer; -import java.security.AccessControlException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.codehaus.jackson.map.ObjectMapper; -import org.codehaus.jackson.map.SerializationConfig; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import org.apache.qpid.server.consumer.ConsumerImpl; -import org.apache.qpid.server.message.AMQMessageHeader; -import org.apache.qpid.server.message.MessageDeletedException; -import org.apache.qpid.server.message.MessageReference; -import org.apache.qpid.server.message.ServerMessage; -import org.apache.qpid.server.model.Queue; -import org.apache.qpid.server.model.VirtualHost; -import org.apache.qpid.server.queue.QueueEntry; -import org.apache.qpid.server.queue.QueueEntryVisitor; -import org.apache.qpid.server.security.SecurityManager; -import org.apache.qpid.server.security.access.Operation; -import org.apache.qpid.server.store.TransactionLogResource; - -public class MessageServlet extends AbstractServlet -{ - private static final Logger LOGGER = LoggerFactory.getLogger(MessageServlet.class); - - public MessageServlet() - { - super(); - } - - @Override - protected void doGetWithSubjectAndActor(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException - { - String[] pathInfoElements = getPathInfoElements(request); - if(pathInfoElements != null && pathInfoElements.length > 2) - { - getMessageContent(request, response); - } - else - { - getMessageList(request, response); - } - - } - - private void getMessageContent(HttpServletRequest request, HttpServletResponse response) throws IOException - { - Queue queue = getQueueFromRequest(request); - String path[] = getPathInfoElements(request); - MessageFinder messageFinder = new MessageFinder(Long.parseLong(path[2])); - queue.visit(messageFinder); - - response.setStatus(HttpServletResponse.SC_OK); - - response.setHeader("Cache-Control","no-cache"); - response.setHeader("Pragma","no-cache"); - response.setDateHeader ("Expires", 0); - response.setContentType("application/json"); - - final Writer writer = getOutputWriter(request,response); - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(SerializationConfig.Feature.INDENT_OUTPUT, true); - mapper.writeValue(writer, messageFinder.getMessageObject()); - } - - private void getMessageList(HttpServletRequest request, HttpServletResponse response) throws IOException - { - Queue queue = getQueueFromRequest(request); - - int first = -1; - int last = -1; - String range = request.getHeader("Range"); - if(range != null) - { - String[] boundaries = range.split("=")[1].split("-"); - first = Integer.parseInt(boundaries[0]); - last = Integer.parseInt(boundaries[1]); - } - final MessageCollector messageCollector = new MessageCollector(first, last); - queue.visit(messageCollector); - - response.setContentType("application/json"); - final List<Map<String, Object>> messages = messageCollector.getMessages(); - int queueSize = (int) queue.getQueueDepthMessages(); - String min = messages.isEmpty() ? "0" : messages.get(0).get("position").toString(); - String max = messages.isEmpty() ? "0" : messages.get(messages.size()-1).get("position").toString(); - response.setHeader("Content-Range", (min + "-" + max + "/" + queueSize)); - response.setStatus(HttpServletResponse.SC_OK); - - response.setHeader("Cache-Control","no-cache"); - response.setHeader("Pragma","no-cache"); - response.setDateHeader ("Expires", 0); - - final Writer writer = getOutputWriter(request,response); - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(SerializationConfig.Feature.INDENT_OUTPUT, true); - mapper.writeValue(writer, messages); - } - - private Queue<?> getQueueFromRequest(HttpServletRequest request) - { - // TODO - validation that there is a vhost and queue and only those in the path - - String[] pathInfoElements = getPathInfoElements(request); - if(pathInfoElements == null || pathInfoElements.length < 2) - { - throw new IllegalArgumentException("Invalid path is specified"); - } - String vhostName = pathInfoElements[0]; - String queueName = pathInfoElements[1]; - - VirtualHost<?,?,?> vhost = getBroker().findVirtualHostByName(vhostName); - if (vhost == null) - { - throw new IllegalArgumentException("Could not find virtual host with name '" + vhostName + "'"); - } - - Queue queueFromVirtualHost = getQueueFromVirtualHost(queueName, vhost); - if (queueFromVirtualHost == null) - { - throw new IllegalArgumentException("Could not find queue with name '" + queueName + "' on virtual host '" + vhost.getName() + "'"); - } - return queueFromVirtualHost; - } - - private Queue getQueueFromVirtualHost(String queueName, VirtualHost<?,?,?> vhost) - { - Queue queue = null; - - for(Queue<?> q : vhost.getQueues()) - { - - if(q.getName().equals(queueName)) - { - queue = q; - break; - } - } - return queue; - } - - private abstract static class QueueEntryTransaction implements VirtualHost.TransactionalOperation - { - private final Queue _sourceQueue; - private final List _messageIds; - - protected QueueEntryTransaction(Queue sourceQueue, List messageIds) - { - _sourceQueue = sourceQueue; - _messageIds = messageIds; - } - - @Override - public void withinTransaction(final VirtualHost.Transaction txn) - { - - _sourceQueue.visit(new QueueEntryVisitor() - { - - public boolean visit(final QueueEntry entry) - { - final ServerMessage message = entry.getMessage(); - if(message != null) - { - final long messageId = message.getMessageNumber(); - if (_messageIds.remove(messageId) || (messageId <= (long) Integer.MAX_VALUE - && _messageIds.remove(Integer.valueOf((int)messageId)))) - { - updateEntry(entry, txn); - } - } - return _messageIds.isEmpty(); - } - }); - } - - - protected abstract void updateEntry(QueueEntry entry, VirtualHost.Transaction txn); - } - - private static class MoveTransaction extends QueueEntryTransaction - { - private final Queue _destinationQueue; - - public MoveTransaction(Queue sourceQueue, List<Long> messageIds, Queue destinationQueue) - { - super(sourceQueue, messageIds); - _destinationQueue = destinationQueue; - } - - @Override - protected void updateEntry(QueueEntry entry, VirtualHost.Transaction txn) - { - ServerMessage msg = entry.getMessage(); - if(msg != null && !msg.isReferenced((TransactionLogResource)_destinationQueue)) - { - txn.move(entry, _destinationQueue); - } - } - } - - private static class CopyTransaction extends QueueEntryTransaction - { - private final Queue _destinationQueue; - - public CopyTransaction(Queue sourceQueue, List<Long> messageIds, Queue destinationQueue) - { - super(sourceQueue, messageIds); - _destinationQueue = destinationQueue; - } - - @Override - protected void updateEntry(QueueEntry entry, VirtualHost.Transaction txn) - { - ServerMessage msg = entry.getMessage(); - if(msg != null && !msg.isReferenced((TransactionLogResource)_destinationQueue)) - { - txn.copy(entry, _destinationQueue); - } - } - } - - private static class DeleteTransaction extends QueueEntryTransaction - { - public DeleteTransaction(Queue sourceQueue, List<Long> messageIds) - { - super(sourceQueue, messageIds); - } - - @Override - protected void updateEntry(QueueEntry entry, VirtualHost.Transaction txn) - { - txn.dequeue(entry); - } - } - - - private static class ClearQueueTransaction implements VirtualHost.TransactionalOperation - { - private final Queue _queue; - - protected ClearQueueTransaction(Queue queue) - { - _queue = queue; - } - - @Override - public void withinTransaction(final VirtualHost.Transaction txn) - { - _queue.visit(new QueueEntryVisitor() - { - - public boolean visit(final QueueEntry entry) - { - final ServerMessage message = entry.getMessage(); - if(message != null) - { - txn.dequeue(entry); - } - return false; - } - }); - - } - } - - private class MessageCollector implements QueueEntryVisitor - { - private final int _first; - private final int _last; - private int _position = -1; - private final List<Map<String, Object>> _messages = new ArrayList<Map<String, Object>>(); - - private MessageCollector(int first, int last) - { - _first = first; - _last = last; - } - - - public boolean visit(QueueEntry entry) - { - - _position++; - if((_first == -1 || _position >= _first) && (_last == -1 || _position <= _last)) - { - final Map<String, Object> messageObject = convertToObject(entry, false); - messageObject.put("position", _position); - _messages.add(messageObject); - } - return _last != -1 && _position > _last; - } - - public List<Map<String, Object>> getMessages() - { - return _messages; - } - } - - - private class MessageFinder implements QueueEntryVisitor - { - private final long _messageNumber; - private Map<String, Object> _messageObject; - - private MessageFinder(long messageNumber) - { - _messageNumber = messageNumber; - } - - - public boolean visit(QueueEntry entry) - { - ServerMessage message = entry.getMessage(); - if(message != null) - { - if(_messageNumber == message.getMessageNumber()) - { - try - { - MessageReference reference = message.newReference(); - try - { - _messageObject = convertToObject(entry, true); - } - finally - { - reference.release(); - } - return true; - } - catch (MessageDeletedException e) - { - // ignore - the message has been deleted before we got a chance to look at it - } - } - } - return false; - } - - public Map<String, Object> getMessageObject() - { - return _messageObject; - } - } - - private Map<String, Object> convertToObject(QueueEntry entry, boolean includeContent) - { - Map<String, Object> object = new LinkedHashMap<String, Object>(); - object.put("size", entry.getSize()); - object.put("deliveryCount", entry.getDeliveryCount()); - object.put("state",entry.isAvailable() - ? "Available" - : entry.isAcquired() - ? "Acquired" - : ""); - final ConsumerImpl deliveredConsumer = entry.getDeliveredConsumer(); - object.put("deliveredTo", deliveredConsumer == null ? null : deliveredConsumer.getConsumerNumber()); - ServerMessage message = entry.getMessage(); - - if(message != null) - { - convertMessageProperties(object, message); - if(includeContent) - { - convertMessageHeaders(object, message); - } - } - - return object; - } - - private void convertMessageProperties(Map<String, Object> object, ServerMessage message) - { - object.put("id", message.getMessageNumber()); - object.put("arrivalTime",message.getArrivalTime()); - object.put("persistent", message.isPersistent()); - - final AMQMessageHeader messageHeader = message.getMessageHeader(); - if(messageHeader != null) - { - addIfPresent(object, "messageId", messageHeader.getMessageId()); - addIfPresentAndNotZero(object, "expirationTime", messageHeader.getExpiration()); - addIfPresent(object, "applicationId", messageHeader.getAppId()); - addIfPresent(object, "correlationId", messageHeader.getCorrelationId()); - addIfPresent(object, "encoding", messageHeader.getEncoding()); - addIfPresent(object, "mimeType", messageHeader.getMimeType()); - addIfPresent(object, "priority", messageHeader.getPriority()); - addIfPresent(object, "replyTo", messageHeader.getReplyTo()); - addIfPresentAndNotZero(object, "timestamp", messageHeader.getTimestamp()); - addIfPresent(object, "type", messageHeader.getType()); - addIfPresent(object, "userId", messageHeader.getUserId()); - } - - } - - private void addIfPresentAndNotZero(Map<String, Object> object, String name, Object property) - { - if(property instanceof Number) - { - Number value = (Number)property; - if (value.longValue() != 0) - { - object.put(name, property); - } - } - } - - private void addIfPresent(Map<String, Object> object, String name, Object property) - { - if(property != null) - { - object.put(name, property); - } - } - - private void convertMessageHeaders(Map<String, Object> object, ServerMessage message) - { - final AMQMessageHeader messageHeader = message.getMessageHeader(); - if(messageHeader != null) - { - Map<String, Object> headers = new HashMap<String,Object>(); - for(String headerName : messageHeader.getHeaderNames()) - { - headers.put(headerName, messageHeader.getHeader(headerName)); - } - object.put("headers", headers); - } - } - - /* - * POST moves or copies messages to the given queue from a queue specified in the posted JSON data - */ - @Override - protected void doPostWithSubjectAndActor(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException - { - - try - { - final Queue<?> sourceQueue = getQueueFromRequest(request); - - ObjectMapper mapper = new ObjectMapper(); - - @SuppressWarnings("unchecked") - Map<String,Object> providedObject = mapper.readValue(request.getInputStream(), LinkedHashMap.class); - - String destQueueName = (String) providedObject.get("destinationQueue"); - Boolean move = (Boolean) providedObject.get("move"); - - final VirtualHost<?,?,?> vhost = sourceQueue.getParent(VirtualHost.class); - - boolean isMoveTransaction = move != null && Boolean.valueOf(move); - - // FIXME: added temporary authorization check until we introduce management layer - // and review current ACL rules to have common rules for all management interfaces - String methodName = isMoveTransaction? "moveMessages":"copyMessages"; - authorizeMethod(methodName, vhost); - - - final Queue destinationQueue = getQueueFromVirtualHost(destQueueName, vhost); - final List<Long> messageIds = new ArrayList<Long>((List<Long>) providedObject.get("messages")); - QueueEntryTransaction txn = - isMoveTransaction - ? new MoveTransaction(sourceQueue, messageIds, destinationQueue) - : new CopyTransaction(sourceQueue, messageIds, destinationQueue); - vhost.executeTransaction(txn); - response.setStatus(HttpServletResponse.SC_OK); - - } - catch(AccessControlException e) - { - response.setStatus(HttpServletResponse.SC_FORBIDDEN); - } - catch(RuntimeException e) - { - LOGGER.error("Failure to perform message operation", e); - response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); - } - } - - /* - * DELETE removes specified messages from, or clears the queue - */ - @Override - protected void doDeleteWithSubjectAndActor(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException - { - final Queue<?> queue = getQueueFromRequest(request); - - final VirtualHost<?,?,?> vhost = queue.getParent(VirtualHost.class); - boolean clearQueue = Boolean.parseBoolean(request.getParameter("clear")); - - try - { - if (clearQueue) - { - clearQueue(queue, vhost); - } - else - { - final List<Long> messageIds = new ArrayList<>(); - for(String idStr : request.getParameterValues("id")) - { - messageIds.add(Long.valueOf(idStr)); - } - - deleteMessages(queue, vhost, messageIds); - } - response.setStatus(HttpServletResponse.SC_OK); - } - catch (AccessControlException e) - { - response.setStatus(HttpServletResponse.SC_FORBIDDEN); - } - - } - - private void deleteMessages(final Queue<?> queue, final VirtualHost<?, ?, ?> vhost, final List<Long> messageIds) - { - // FIXME: added temporary authorization check until we introduce management layer - // and review current ACL rules to have common rules for all management interfaces - authorizeMethod("deleteMessages", vhost); - vhost.executeTransaction(new DeleteTransaction(queue, messageIds)); - } - - private void clearQueue(final Queue<?> queue, final VirtualHost<?, ?, ?> vhost) - { - // FIXME: added temporary authorization check until we introduce management layer - // and review current ACL rules to have common rules for all management interfaces - authorizeMethod("clearQueue", vhost); - vhost.executeTransaction(new ClearQueueTransaction(queue)); - } - - private void authorizeMethod(String methodName, VirtualHost<?,?,?> vhost) - { - SecurityManager securityManager = getBroker().getSecurityManager(); - securityManager.authoriseMethod(Operation.UPDATE, "VirtualHost.Queue", methodName, vhost.getName()); - } - -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/MetaDataServlet.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/MetaDataServlet.java deleted file mode 100644 index 88705563af..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/MetaDataServlet.java +++ /dev/null @@ -1,200 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.qpid.server.management.plugin.servlet.rest; - -import java.io.IOException; -import java.io.Writer; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Set; -import java.util.TreeMap; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.codehaus.jackson.map.ObjectMapper; -import org.codehaus.jackson.map.SerializationConfig; - -import org.apache.qpid.server.model.BrokerModel; -import org.apache.qpid.server.model.ConfiguredAutomatedAttribute; -import org.apache.qpid.server.model.ConfiguredObject; -import org.apache.qpid.server.model.ConfiguredObjectAttribute; -import org.apache.qpid.server.model.ConfiguredObjectTypeRegistry; -import org.apache.qpid.server.model.ManagedObject; -import org.apache.qpid.server.model.Model; - -public class MetaDataServlet extends AbstractServlet -{ - - private Model _instance; - - public MetaDataServlet(final Model model) - { - _instance = model; - } - - @Override - public void init() throws ServletException - { - super.init(); - } - - - - @Override - protected void doGetWithSubjectAndActor(final HttpServletRequest request, final HttpServletResponse response) - throws ServletException, IOException - { - response.setContentType("application/json"); - response.setStatus(HttpServletResponse.SC_OK); - - Map<String,Map> classToDataMap = new TreeMap<>(); - - for(Class<? extends ConfiguredObject> clazz : _instance.getSupportedCategories()) - { - classToDataMap.put(clazz.getSimpleName(), processCategory(clazz)); - } - - final Writer writer = getOutputWriter(request, response); - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(SerializationConfig.Feature.INDENT_OUTPUT, true); - mapper.writeValue(writer, classToDataMap); - - response.setContentType("application/json"); - response.setStatus(HttpServletResponse.SC_OK); - - } - - private Map<String,Map> processCategory(final Class<? extends ConfiguredObject> clazz) - { - Map<String, Map> typeToDataMap = new TreeMap<>(); - ConfiguredObjectTypeRegistry typeRegistry = _instance.getTypeRegistry(); - for(Class<? extends ConfiguredObject> type : typeRegistry.getTypeSpecialisations(clazz)) - { - typeToDataMap.put(ConfiguredObjectTypeRegistry.getType(type), processType(type)); - } - return typeToDataMap; - } - - private Map<String,Object> processType(final Class<? extends ConfiguredObject> type) - { - Map<String,Object> typeDetails = new LinkedHashMap<>(); - typeDetails.put("attributes", processAttributes(type)); - typeDetails.put("managedInterfaces", getManagedInterfaces(type)); - typeDetails.put("validChildTypes", getValidChildTypes(type)); - ManagedObject annotation = type.getAnnotation(ManagedObject.class); - if(annotation != null) - { - if(annotation.deprecated()) - { - typeDetails.put("deprecated",true); - } - if(!"".equals(annotation.description() ) ) - { - typeDetails.put("description", annotation.description()); - } - } - return typeDetails; - } - - private Map<String, Collection<String>> getValidChildTypes(final Class<? extends ConfiguredObject> type) - { - Map<String, Collection<String>> validChildTypes = new HashMap<>(); - for(Class<? extends ConfiguredObject> childType : _instance.getChildTypes(ConfiguredObjectTypeRegistry.getCategory(type))) - { - Collection<String> validValues = _instance.getTypeRegistry().getValidChildTypes(type, childType); - if(validValues != null) - { - validChildTypes.put(childType.getSimpleName(), validValues); - } - } - return validChildTypes; - } - - private Set<String> getManagedInterfaces(Class<? extends ConfiguredObject> type) - { - Set<String> interfaces = new HashSet<>(); - for(Class<?> classObject: _instance.getTypeRegistry().getManagedInterfaces(type)) - { - interfaces.add(classObject.getSimpleName()); - } - return interfaces; - } - - private Map<String,Map> processAttributes(final Class<? extends ConfiguredObject> type) - { - Collection<ConfiguredObjectAttribute<?, ?>> attributes = - _instance.getTypeRegistry().getAttributeTypes(type).values(); - - Map<String,Map> attributeDetails = new LinkedHashMap<>(); - for(ConfiguredObjectAttribute<?, ?> attribute : attributes) - { - Map<String,Object> attrDetails = new LinkedHashMap<>(); - attrDetails.put("type",attribute.getType().getSimpleName()); - if(!"".equals(attribute.getDescription())) - { - attrDetails.put("description",attribute.getDescription()); - } - if(attribute.isDerived()) - { - attrDetails.put("derived",attribute.isDerived()); - } - if(attribute.isAutomated()) - { - if(!"".equals(((ConfiguredAutomatedAttribute)attribute).defaultValue())) - { - attrDetails.put("defaultValue",((ConfiguredAutomatedAttribute)attribute).defaultValue()); - } - if(((ConfiguredAutomatedAttribute)attribute).isMandatory()) - { - attrDetails.put("mandatory",((ConfiguredAutomatedAttribute)attribute).isMandatory()); - } - if(!(((ConfiguredAutomatedAttribute)attribute).validValues()).isEmpty()) - { - Collection<String> validValues = ((ConfiguredAutomatedAttribute<?,?>) attribute).validValues(); - - Collection<Object> convertedValues = new ArrayList<>(validValues.size()); - for(String value : validValues) - { - convertedValues.add(attribute.convert(value,null)); - } - attrDetails.put("validValues", convertedValues); - } - - } - if(attribute.isSecure()) - { - attrDetails.put("secure",attribute.isSecure()); - } - if(attribute.isOversized()) - { - attrDetails.put("oversize", attribute.isOversized()); - } - attributeDetails.put(attribute.getName(), attrDetails); - } - return attributeDetails; - } -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/PluginClassProviderAction.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/PluginClassProviderAction.java deleted file mode 100644 index cd14abc582..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/PluginClassProviderAction.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.apache.qpid.server.management.plugin.servlet.rest;/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Map; - -import org.apache.qpid.server.model.Broker; -import org.apache.qpid.server.plugin.Pluggable; -import org.apache.qpid.server.plugin.QpidServiceLoader; - -public class PluginClassProviderAction implements Action -{ - @Override - public String getName() - { - return "pluginList"; - } - - @Override - public Object perform(Map<String, Object> request, Broker broker) - { - try - { - String className = (String) request.get("plugin"); - QpidServiceLoader serviceLoader = new QpidServiceLoader(); - final Class<Pluggable> clazz = (Class<Pluggable>) Class.forName("org.apache.qpid.server.plugin."+className); - List<String> values = new ArrayList<String>(); - for(Pluggable instance : serviceLoader.instancesOf(clazz)) - { - values.add(instance.getType()); - } - return values; - } - catch (ClassNotFoundException e) - { - return Collections.emptyList(); - } - - } -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/QueueReportServlet.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/QueueReportServlet.java deleted file mode 100644 index 2b3def2dab..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/QueueReportServlet.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.qpid.server.management.plugin.servlet.rest; - -import java.io.IOException; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.qpid.server.management.plugin.report.ReportRunner; -import org.apache.qpid.server.model.Queue; -import org.apache.qpid.server.model.VirtualHost; - -public class QueueReportServlet extends AbstractServlet -{ - @Override - protected void doGetWithSubjectAndActor(HttpServletRequest request, HttpServletResponse response) throws - IOException, - ServletException - { - String[] pathInfoElements = getPathInfoElements(request); - if(pathInfoElements != null && pathInfoElements.length == 3) - { - Queue<?> queue = getQueueFromRequest(request); - ReportRunner<?> reportRunner = ReportRunner.createRunner(pathInfoElements[2],request.getParameterMap()); - Object output = reportRunner.runReport(queue); - response.setContentType(reportRunner.getContentType()); - if(reportRunner.isBinaryReport()) - { - response.getOutputStream().write((byte[])output); - } - else - { - response.getWriter().write((String)output); - } - } - else - { - throw new IllegalArgumentException("Invalid path is specified"); - } - - } - - private Queue<?> getQueueFromRequest(HttpServletRequest request) - { - String[] pathInfoElements = getPathInfoElements(request); - if(pathInfoElements == null || pathInfoElements.length < 2) - { - throw new IllegalArgumentException("Invalid path is specified"); - } - String vhostName = pathInfoElements[0]; - String queueName = pathInfoElements[1]; - - VirtualHost<?,?,?> vhost = getBroker().findVirtualHostByName(vhostName); - if (vhost == null) - { - throw new IllegalArgumentException("Could not find virtual host with name '" + vhostName + "'"); - } - - Queue queueFromVirtualHost = getQueueFromVirtualHost(queueName, vhost); - if (queueFromVirtualHost == null) - { - throw new IllegalArgumentException("Could not find queue with name '" + queueName + "' on virtual host '" + vhost.getName() + "'"); - } - return queueFromVirtualHost; - } - - private Queue getQueueFromVirtualHost(String queueName, VirtualHost<?,?,?> vhost) - { - Queue queue = null; - - for(Queue<?> q : vhost.getQueues()) - { - - if(q.getName().equals(queueName)) - { - queue = q; - break; - } - } - return queue; - } - -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/RestServlet.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/RestServlet.java deleted file mode 100644 index 275d7f6794..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/RestServlet.java +++ /dev/null @@ -1,774 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * <p/> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p/> - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.qpid.server.management.plugin.servlet.rest; - -import java.io.IOException; -import java.io.Writer; -import java.security.AccessControlException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import javax.servlet.ServletConfig; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.Part; - -import org.apache.qpid.server.model.AbstractConfiguredObject; -import org.apache.qpid.server.model.IllegalStateTransitionException; -import org.apache.qpid.server.model.IntegrityViolationException; -import org.apache.qpid.server.virtualhost.ExchangeExistsException; -import org.apache.qpid.server.virtualhost.QueueExistsException; -import org.codehaus.jackson.map.ObjectMapper; -import org.codehaus.jackson.map.SerializationConfig; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import org.apache.qpid.server.configuration.IllegalConfigurationException; -import org.apache.qpid.server.model.Broker; -import org.apache.qpid.server.model.ConfiguredObject; -import org.apache.qpid.server.util.urlstreamhandler.data.Handler; -import org.apache.qpid.util.DataUrlUtils; - -public class RestServlet extends AbstractServlet -{ - private static final Logger LOGGER = LoggerFactory.getLogger(RestServlet.class); - /** - * An initialization parameter to specify hierarchy - */ - private static final String HIERARCHY_INIT_PARAMETER = "hierarchy"; - - public static final String DEPTH_PARAM = "depth"; - public static final String OVERSIZE_PARAM = "oversize"; - public static final String ACTUALS_PARAM = "actuals"; - public static final String SORT_PARAM = "sort"; - public static final String INCLUDE_SYS_CONTEXT_PARAM = "includeSysContext"; - public static final String INHERITED_ACTUALS_PARAM = "inheritedActuals"; - public static final String EXTRACT_INITIAL_CONFIG_PARAM = "extractInitialConfig"; - public static final int SC_UNPROCESSABLE_ENTITY = 422; - - /** - * Signifies that the agent wishes the servlet to set the Content-Disposition on the - * response with the value attachment. This filename will be derived from the parameter value. - */ - public static final String CONTENT_DISPOSITION_ATTACHMENT_FILENAME_PARAM = "contentDispositionAttachmentFilename"; - - public static final Set<String> RESERVED_PARAMS = - new HashSet<>(Arrays.asList(DEPTH_PARAM, - SORT_PARAM, - OVERSIZE_PARAM, - ACTUALS_PARAM, - INCLUDE_SYS_CONTEXT_PARAM, - EXTRACT_INITIAL_CONFIG_PARAM, - INHERITED_ACTUALS_PARAM, - CONTENT_DISPOSITION_ATTACHMENT_FILENAME_PARAM)); - - private Class<? extends ConfiguredObject>[] _hierarchy; - - private final ConfiguredObjectToMapConverter _objectConverter = new ConfiguredObjectToMapConverter(); - private final boolean _hierarchyInitializationRequired; - - public RestServlet() - { - super(); - _hierarchyInitializationRequired = true; - } - - public RestServlet(Class<? extends ConfiguredObject>... hierarchy) - { - super(); - _hierarchy = hierarchy; - _hierarchyInitializationRequired = false; - } - - @Override - public void init() throws ServletException - { - super.init(); - if (_hierarchyInitializationRequired) - { - doInitialization(); - } - Handler.register(); - } - - @SuppressWarnings("unchecked") - private void doInitialization() throws ServletException - { - ServletConfig config = getServletConfig(); - String hierarchy = config.getInitParameter(HIERARCHY_INIT_PARAMETER); - if (hierarchy != null && !"".equals(hierarchy)) - { - List<Class<? extends ConfiguredObject>> classes = new ArrayList<Class<? extends ConfiguredObject>>(); - String[] hierarchyItems = hierarchy.split(","); - for (String item : hierarchyItems) - { - Class<?> itemClass = null; - try - { - itemClass = Class.forName(item); - } - catch (ClassNotFoundException e) - { - try - { - itemClass = Class.forName("org.apache.qpid.server.model." + item); - } - catch (ClassNotFoundException e1) - { - throw new ServletException("Unknown configured object class '" + item - + "' is specified in hierarchy for " + config.getServletName()); - } - } - Class<? extends ConfiguredObject> clazz = (Class<? extends ConfiguredObject>)itemClass; - classes.add(clazz); - } - Class<? extends ConfiguredObject>[] hierarchyClasses = (Class<? extends ConfiguredObject>[])new Class[classes.size()]; - _hierarchy = classes.toArray(hierarchyClasses); - } - else - { - _hierarchy = (Class<? extends ConfiguredObject>[])new Class[0]; - } - } - - protected Collection<ConfiguredObject<?>> getObjects(HttpServletRequest request) - { - String[] pathInfoElements = getPathInfoElements(request); - List<String> names = new ArrayList<String>(); - if(pathInfoElements != null) - { - if(pathInfoElements.length > _hierarchy.length) - { - throw new IllegalArgumentException("Too many entries in path for REST servlet " - + getServletName() + ". Expected hierarchy length: " + _hierarchy.length - + "; Request hierarchy length: " + pathInfoElements.length - + "; Path Elements: " + Arrays.toString(pathInfoElements)); - } - names.addAll(Arrays.asList(pathInfoElements)); - } - - Collection<ConfiguredObject<?>> parents = new ArrayList<ConfiguredObject<?>>(); - parents.add(getBroker()); - Collection<ConfiguredObject<?>> children = new ArrayList<ConfiguredObject<?>>(); - - Map<Class<? extends ConfiguredObject>, String> filters = - new HashMap<Class<? extends ConfiguredObject>, String>(); - - for(int i = 0; i < _hierarchy.length; i++) - { - if(i == 0 || getBroker().getModel().getChildTypes(_hierarchy[i - 1]).contains(_hierarchy[i])) - { - - for(ConfiguredObject<?> parent : parents) - { - if(names.size() > i - && names.get(i) != null - && !names.get(i).equals("*") - && names.get(i).trim().length() != 0) - { - for(ConfiguredObject<?> child : parent.getChildren(_hierarchy[i])) - { - if(child.getName().equals(names.get(i))) - { - children.add(child); - } - } - } - else - { - children.addAll((Collection<? extends ConfiguredObject<?>>) parent.getChildren(_hierarchy[i])); - } - } - } - else - { - children = parents; - if(names.size() > i - && names.get(i) != null - && !names.get(i).equals("*") - && names.get(i).trim().length() != 0) - { - filters.put(_hierarchy[i], names.get(i)); - } - } - - parents = children; - children = new ArrayList<ConfiguredObject<?>>(); - } - - if(!filters.isEmpty()) - { - Collection<ConfiguredObject<?>> potentials = parents; - parents = new ArrayList<ConfiguredObject<?>>(); - - for(ConfiguredObject o : potentials) - { - - boolean match = true; - - for(Map.Entry<Class<? extends ConfiguredObject>, String> entry : filters.entrySet()) - { - Collection<? extends ConfiguredObject> ancestors = - getAncestors(getConfiguredClass(),entry.getKey(), o); - match = false; - for(ConfiguredObject ancestor : ancestors) - { - if(ancestor.getName().equals(entry.getValue())) - { - match = true; - break; - } - } - if(!match) - { - break; - } - } - if(match) - { - parents.add(o); - } - - } - } - - return filter(parents, request); - } - - private Collection<ConfiguredObject<?>> filter(Collection<ConfiguredObject<?>> objects, HttpServletRequest request) - { - - - Map<String, Collection<String>> filters = new HashMap<String, Collection<String>>(); - - for(String param : (Collection<String>) Collections.list(request.getParameterNames())) - { - if(!RESERVED_PARAMS.contains(param)) - { - filters.put(param, Arrays.asList(request.getParameterValues(param))); - } - } - - if(filters.isEmpty()) - { - return objects; - } - - Collection<ConfiguredObject<?>> filteredObj = new ArrayList<ConfiguredObject<?>>(objects); - - Iterator<ConfiguredObject<?>> iter = filteredObj.iterator(); - - while(iter.hasNext()) - { - ConfiguredObject obj = iter.next(); - for(Map.Entry<String, Collection<String>> entry : filters.entrySet()) - { - Object value = obj.getAttribute(entry.getKey()); - if(!entry.getValue().contains(String.valueOf(value))) - { - iter.remove(); - } - } - - } - - return filteredObj; - } - - private Collection<? extends ConfiguredObject> getAncestors(Class<? extends ConfiguredObject> childType, - Class<? extends ConfiguredObject> ancestorType, - ConfiguredObject child) - { - Collection<ConfiguredObject> ancestors = new HashSet<ConfiguredObject>(); - Collection<Class<? extends ConfiguredObject>> parentTypes = child.getModel().getParentTypes(childType); - - for(Class<? extends ConfiguredObject> parentClazz : parentTypes) - { - if(parentClazz == ancestorType) - { - ConfiguredObject parent = child.getParent(parentClazz); - if(parent != null) - { - ancestors.add(parent); - } - } - else - { - ConfiguredObject parent = child.getParent(parentClazz); - if(parent != null) - { - ancestors.addAll(getAncestors(parentClazz, ancestorType, parent)); - } - } - } - - return ancestors; - } - - @Override - protected void doGetWithSubjectAndActor(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException - { - // TODO - sort special params, everything else should act as a filter - String attachmentFilename = request.getParameter(CONTENT_DISPOSITION_ATTACHMENT_FILENAME_PARAM); - boolean extractInitialConfig = getBooleanParameterFromRequest(request, EXTRACT_INITIAL_CONFIG_PARAM); - - response.setContentType("application/json"); - response.setStatus(HttpServletResponse.SC_OK); - - if (attachmentFilename == null) - { - setCachingHeadersOnResponse(response); - } - else - { - setContentDispositionHeaderIfNecessary(response, attachmentFilename); - } - - Collection<ConfiguredObject<?>> allObjects = getObjects(request); - - int depth; - boolean actuals; - boolean includeSystemContext; - boolean inheritedActuals; - int oversizeThreshold; - - if(extractInitialConfig) - { - depth = Integer.MAX_VALUE; - oversizeThreshold = Integer.MAX_VALUE; - actuals = true; - includeSystemContext = false; - inheritedActuals = false; - } - else - { - depth = getIntParameterFromRequest(request, DEPTH_PARAM, 1); - oversizeThreshold = getIntParameterFromRequest(request, OVERSIZE_PARAM, 120); - actuals = getBooleanParameterFromRequest(request, ACTUALS_PARAM); - includeSystemContext = getBooleanParameterFromRequest(request, INCLUDE_SYS_CONTEXT_PARAM); - inheritedActuals = getBooleanParameterFromRequest(request, INHERITED_ACTUALS_PARAM); - } - - List<Map<String, Object>> output = new ArrayList<>(); - for(ConfiguredObject configuredObject : allObjects) - { - - output.add(_objectConverter.convertObjectToMap(configuredObject, getConfiguredClass(), - depth, actuals, inheritedActuals, includeSystemContext, extractInitialConfig, oversizeThreshold, request.isSecure())); - } - - - Writer writer = getOutputWriter(request, response); - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(SerializationConfig.Feature.INDENT_OUTPUT, true); - mapper.writeValue(writer, extractInitialConfig && output.size() == 1 ? output.get(0) : output); - } - - private void setContentDispositionHeaderIfNecessary(final HttpServletResponse response, - final String attachmentFilename) - { - if (attachmentFilename != null) - { - String filenameRfc2183 = ensureFilenameIsRfc2183(attachmentFilename); - if (filenameRfc2183.length() > 0) - { - response.setHeader("Content-disposition", String.format("attachment; filename=\"%s\"", filenameRfc2183)); - } - else - { - response.setHeader("Content-disposition", String.format("attachment")); // Agent will allow user to choose a name - } - } - } - - private Class<? extends ConfiguredObject> getConfiguredClass() - { - return _hierarchy.length == 0 ? Broker.class : _hierarchy[_hierarchy.length-1]; - } - - @Override - protected void doPutWithSubjectAndActor(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException - { - performCreateOrUpdate(request, response); - } - - private void performCreateOrUpdate(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException - { - response.setContentType("application/json"); - - List<String> names = getParentNamesFromServletPath(request); - Map<String, Object> providedObject = getRequestProvidedObject(request); - boolean isFullObjectURL = names.size() == _hierarchy.length; - boolean updateOnlyAllowed = isFullObjectURL && "POST".equalsIgnoreCase(request.getMethod()); - try - { - if (names.isEmpty() && _hierarchy.length == 0) - { - getBroker().setAttributes(providedObject); - response.setStatus(HttpServletResponse.SC_OK); - return; - } - - ConfiguredObject theParent = getBroker(); - ConfiguredObject[] otherParents = null; - Class<? extends ConfiguredObject> objClass = getConfiguredClass(); - if (_hierarchy.length > 1) - { - List<ConfiguredObject> parents = findAllObjectParents(names); - theParent = parents.remove(0); - otherParents = parents.toArray(new ConfiguredObject[parents.size()]); - } - - if (isFullObjectURL) - { - providedObject.put("name", names.get(names.size() - 1)); - ConfiguredObject<?> configuredObject = findObjectToUpdateInParent(objClass, providedObject, theParent, otherParents); - - if (configuredObject != null) - { - configuredObject.setAttributes(providedObject); - response.setStatus(HttpServletResponse.SC_OK); - return; - } - else if (updateOnlyAllowed) - { - sendErrorResponse(request, response, HttpServletResponse.SC_NOT_FOUND, "Object with " - + (providedObject.containsKey("id") ? " id '" + providedObject.get("id") : " name '" + providedObject.get("name")) - + "' does not exist!"); - return; - } - } - - ConfiguredObject<?> configuredObject = theParent.createChild(objClass, providedObject, otherParents); - StringBuffer requestURL = request.getRequestURL(); - if (!isFullObjectURL) - { - requestURL.append("/").append(configuredObject.getName()); - } - response.setHeader("Location", requestURL.toString()); - response.setStatus(HttpServletResponse.SC_CREATED); - } - catch (RuntimeException e) - { - setResponseStatus(request, response, e); - } - - } - - private List<ConfiguredObject> findAllObjectParents(List<String> names) - { - Collection<ConfiguredObject>[] objects = new Collection[_hierarchy.length]; - for (int i = 0; i < _hierarchy.length - 1; i++) - { - objects[i] = new HashSet<>(); - if (i == 0) - { - for (ConfiguredObject object : getBroker().getChildren(_hierarchy[0])) - { - if (object.getName().equals(names.get(0))) - { - objects[0].add(object); - break; - } - } - } - else - { - for (int j = i - 1; j >= 0; j--) - { - if (getBroker().getModel().getChildTypes(_hierarchy[j]).contains(_hierarchy[i])) - { - for (ConfiguredObject<?> parent : objects[j]) - { - for (ConfiguredObject<?> object : parent.getChildren(_hierarchy[i])) - { - if (object.getName().equals(names.get(i))) - { - objects[i].add(object); - } - } - } - break; - } - } - } - - } - List<ConfiguredObject> parents = new ArrayList<>(); - Class<? extends ConfiguredObject> objClass = getConfiguredClass(); - Collection<Class<? extends ConfiguredObject>> parentClasses = - getBroker().getModel().getParentTypes(objClass); - for (int i = _hierarchy.length - 2; i >= 0; i--) - { - if (parentClasses.contains(_hierarchy[i])) - { - if (objects[i].size() == 1) - { - parents.add(objects[i].iterator().next()); - } - else - { - throw new IllegalArgumentException("Cannot deduce parent of class " - + _hierarchy[i].getSimpleName()); - } - } - - } - return parents; - } - - private List<String> getParentNamesFromServletPath(HttpServletRequest request) - { - List<String> names = new ArrayList<>(); - String[] pathInfoElements = getPathInfoElements(request); - if (pathInfoElements != null) - { - if (!(pathInfoElements.length == _hierarchy.length || - (_hierarchy.length > 0 && pathInfoElements.length == _hierarchy.length - 1))) - { - throw new IllegalArgumentException("Either parent path or full object path must be specified on object creation." - + " Full object path must be specified on object update. " - + "Found " - + names - + " of size " - + names.size() - + " expecting " - + _hierarchy.length); - } - names.addAll(Arrays.asList(pathInfoElements)); - } - return names; - } - - private Map<String, Object> getRequestProvidedObject(HttpServletRequest request) throws IOException, ServletException - { - Map<String, Object> providedObject; - - ArrayList<String> headers = Collections.list(request.getHeaderNames()); - ObjectMapper mapper = new ObjectMapper(); - - if(headers.contains("Content-Type") && request.getHeader("Content-Type").startsWith("multipart/form-data")) - { - providedObject = new HashMap<>(); - Map<String,String> fileUploads = new HashMap<>(); - Collection<Part> parts = request.getParts(); - for(Part part : parts) - { - if("data".equals(part.getName()) && "application/json".equals(part.getContentType())) - { - providedObject = mapper.readValue(part.getInputStream(), LinkedHashMap.class); - } - else - { - byte[] data = new byte[(int) part.getSize()]; - part.getInputStream().read(data); - String inlineURL = DataUrlUtils.getDataUrlForBytes(data); - fileUploads.put(part.getName(),inlineURL.toString()); - } - } - providedObject.putAll(fileUploads); - } - else - { - - providedObject = mapper.readValue(request.getInputStream(), LinkedHashMap.class); - } - return providedObject; - } - - private ConfiguredObject<?> findObjectToUpdateInParent(Class<? extends ConfiguredObject> objClass, Map<String, Object> providedObject, ConfiguredObject theParent, ConfiguredObject[] otherParents) - { - Collection<? extends ConfiguredObject> existingChildren = theParent.getChildren(objClass); - - for (ConfiguredObject obj : existingChildren) - { - if ((providedObject.containsKey("id") && String.valueOf(providedObject.get("id")).equals(obj.getId().toString())) - || (obj.getName().equals(providedObject.get("name")) && sameOtherParents(obj, otherParents, objClass))) - { - return obj; - } - } - return null; - } - - private boolean sameOtherParents(ConfiguredObject obj, ConfiguredObject[] otherParents, Class<? extends ConfiguredObject> objClass) - { - Collection<Class<? extends ConfiguredObject>> parentClasses = obj.getModel().getParentTypes(objClass); - - if(otherParents == null || otherParents.length == 0) - { - return parentClasses.size() == 1; - } - - - for (ConfiguredObject parent : otherParents) - { - boolean found = false; - for (Class<? extends ConfiguredObject> parentClass : parentClasses) - { - if (parent == obj.getParent(parentClass)) - { - found = true; - break; - } - } - - if (!found) - { - return false; - } - } - - return true; - } - - private void setResponseStatus(HttpServletRequest request, HttpServletResponse response, RuntimeException e) throws IOException - { - if (e instanceof AccessControlException) - { - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug("AccessControlException, sending " + HttpServletResponse.SC_FORBIDDEN, e); - } - response.setStatus(HttpServletResponse.SC_FORBIDDEN); - } - else - { - int responseCode = HttpServletResponse.SC_BAD_REQUEST; - String message = e.getMessage(); - if (e instanceof ExchangeExistsException || e instanceof QueueExistsException - || e instanceof AbstractConfiguredObject.DuplicateIdException - || e instanceof AbstractConfiguredObject.DuplicateNameException - || e instanceof IntegrityViolationException - || e instanceof IllegalStateTransitionException) - { - responseCode = HttpServletResponse.SC_CONFLICT; - } - else if (e instanceof IllegalConfigurationException || e instanceof IllegalArgumentException) - { - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug(e.getClass().getSimpleName() + " processing request : " + message); - } - else if (LOGGER.isTraceEnabled()) - { - LOGGER.trace(e.getClass().getSimpleName() + " processing request", e); - } - responseCode = SC_UNPROCESSABLE_ENTITY; - } - else - { - LOGGER.warn("Unexpected exception processing request ", e); - } - - - sendErrorResponse(request, response, responseCode, message); - - } - } - - private void sendErrorResponse(HttpServletRequest request, HttpServletResponse response, int responseCode, String message) throws IOException - { - response.setStatus(responseCode); - - response.setContentType("application/json"); - response.setCharacterEncoding("UTF-8"); - - Writer out = getOutputWriter(request, response); - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(SerializationConfig.Feature.INDENT_OUTPUT, true); - mapper.writeValue(out, Collections.singletonMap("errorMessage", message)); - } - - @Override - protected void doDeleteWithSubjectAndActor(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException - { - response.setContentType("application/json"); - response.setStatus(HttpServletResponse.SC_OK); - - setCachingHeadersOnResponse(response); - try - { - Collection<ConfiguredObject<?>> allObjects = getObjects(request); - for(ConfiguredObject o : allObjects) - { - o.delete(); - } - - response.setStatus(HttpServletResponse.SC_OK); - } - catch(RuntimeException e) - { - setResponseStatus(request, response, e); - } - } - - @Override - protected void doPostWithSubjectAndActor(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException - { - performCreateOrUpdate(request, response); - } - - private void setCachingHeadersOnResponse(HttpServletResponse response) - { - response.setHeader("Cache-Control","no-cache"); - response.setHeader("Pragma","no-cache"); - response.setDateHeader ("Expires", 0); - } - - private int getIntParameterFromRequest(final HttpServletRequest request, - final String paramName, - final int defaultValue) - { - int intValue = defaultValue; - final String stringValue = request.getParameter(paramName); - if(stringValue!=null) - { - try - { - intValue = Integer.parseInt(stringValue); - } - catch (NumberFormatException e) - { - LOGGER.warn("Could not parse " + stringValue + " as integer for parameter " + paramName); - } - } - return intValue; - } - - private boolean getBooleanParameterFromRequest(HttpServletRequest request, final String paramName) - { - return Boolean.parseBoolean(request.getParameter(paramName)); - } - - private String ensureFilenameIsRfc2183(final String requestedFilename) - { - String fileNameRfc2183 = requestedFilename.replaceAll("[\\P{InBasic_Latin}\\\\:/]", ""); - return fileNameRfc2183; - } - -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/SaslServlet.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/SaslServlet.java deleted file mode 100644 index 5bff0e22e5..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/SaslServlet.java +++ /dev/null @@ -1,319 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.qpid.server.management.plugin.servlet.rest; - -import java.io.IOException; -import java.io.Writer; -import java.net.SocketAddress; -import java.security.Principal; -import java.security.SecureRandom; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Random; - -import javax.security.auth.Subject; -import javax.security.sasl.SaslException; -import javax.security.sasl.SaslServer; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; - -import org.apache.commons.codec.binary.Base64; -import org.codehaus.jackson.map.ObjectMapper; -import org.codehaus.jackson.map.SerializationConfig; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import org.apache.qpid.server.management.plugin.HttpManagementConfiguration; -import org.apache.qpid.server.management.plugin.HttpManagementUtil; -import org.apache.qpid.server.management.plugin.servlet.ServletConnectionPrincipal; -import org.apache.qpid.server.model.Broker; -import org.apache.qpid.server.security.SubjectCreator; -import org.apache.qpid.server.security.auth.AuthenticatedPrincipal; -import org.apache.qpid.server.util.ConnectionScopedRuntimeException; - -public class SaslServlet extends AbstractServlet -{ - - private static final Logger LOGGER = LoggerFactory.getLogger(SaslServlet.class); - - private static final SecureRandom SECURE_RANDOM = new SecureRandom(); - private static final String ATTR_RANDOM = "SaslServlet.Random"; - private static final String ATTR_ID = "SaslServlet.ID"; - private static final String ATTR_SASL_SERVER = "SaslServlet.SaslServer"; - private static final String ATTR_EXPIRY = "SaslServlet.Expiry"; - private static final long SASL_EXCHANGE_EXPIRY = 3000L; - - public SaslServlet() - { - super(); - } - - protected void doGetWithSubjectAndActor(HttpServletRequest request, HttpServletResponse response) throws - ServletException, - IOException - { - response.setContentType("application/json"); - response.setStatus(HttpServletResponse.SC_OK); - - response.setHeader("Cache-Control","no-cache"); - response.setHeader("Pragma","no-cache"); - response.setDateHeader ("Expires", 0); - - HttpSession session = request.getSession(); - getRandom(session); - - SubjectCreator subjectCreator = getSubjectCreator(request); - List<String> mechanismsList = subjectCreator.getMechanisms(); - String[] mechanisms = mechanismsList.toArray(new String[mechanismsList.size()]); - Map<String, Object> outputObject = new LinkedHashMap<String, Object>(); - - final Subject subject = getAuthorisedSubject(request); - if(subject != null) - { - Principal principal = AuthenticatedPrincipal.getAuthenticatedPrincipalFromSubject(subject); - outputObject.put("user", principal.getName()); - } - else if (request.getRemoteUser() != null) - { - outputObject.put("user", request.getRemoteUser()); - } - - outputObject.put("mechanisms", (Object) mechanisms); - - final Writer writer = getOutputWriter(request, response); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(SerializationConfig.Feature.INDENT_OUTPUT, true); - mapper.writeValue(writer, outputObject); - - } - - private Random getRandom(final HttpSession session) - { - Random rand = (Random) session.getAttribute(ATTR_RANDOM); - if(rand == null) - { - synchronized (SECURE_RANDOM) - { - rand = new Random(SECURE_RANDOM.nextLong()); - } - session.setAttribute(ATTR_RANDOM, rand); - } - return rand; - } - - - @Override - protected void doPostWithSubjectAndActor(final HttpServletRequest request, final HttpServletResponse response) throws IOException - { - checkSaslAuthEnabled(request); - - try - { - response.setContentType("application/json"); - response.setHeader("Cache-Control","no-cache"); - response.setHeader("Pragma","no-cache"); - response.setDateHeader("Expires", 0); - - HttpSession session = request.getSession(); - - String mechanism = request.getParameter("mechanism"); - String id = request.getParameter("id"); - String saslResponse = request.getParameter("response"); - - SubjectCreator subjectCreator = getSubjectCreator(request); - - if(mechanism != null) - { - if(id == null) - { - if(LOGGER.isDebugEnabled()) - { - LOGGER.debug("Creating SaslServer for mechanism: " + mechanism); - } - SaslServer saslServer = subjectCreator.createSaslServer(mechanism, request.getServerName(), null/*TODO*/); - evaluateSaslResponse(request, response, session, saslResponse, saslServer, subjectCreator); - } - else - { - response.setStatus(HttpServletResponse.SC_EXPECTATION_FAILED); - session.removeAttribute(ATTR_ID); - session.removeAttribute(ATTR_SASL_SERVER); - session.removeAttribute(ATTR_EXPIRY); - } - } - else - { - if(id != null) - { - if(id.equals(session.getAttribute(ATTR_ID)) && System.currentTimeMillis() < (Long) session.getAttribute(ATTR_EXPIRY)) - { - SaslServer saslServer = (SaslServer) session.getAttribute(ATTR_SASL_SERVER); - evaluateSaslResponse(request, response, session, saslResponse, saslServer, subjectCreator); - } - else - { - response.setStatus(HttpServletResponse.SC_EXPECTATION_FAILED); - session.removeAttribute(ATTR_ID); - session.removeAttribute(ATTR_SASL_SERVER); - session.removeAttribute(ATTR_EXPIRY); - } - } - else - { - response.setStatus(HttpServletResponse.SC_EXPECTATION_FAILED); - session.removeAttribute(ATTR_ID); - session.removeAttribute(ATTR_SASL_SERVER); - session.removeAttribute(ATTR_EXPIRY); - } - } - } - catch(IOException e) - { - LOGGER.error("Error processing SASL request", e); - throw e; - } - catch(RuntimeException e) - { - LOGGER.error("Error processing SASL request", e); - throw e; - } - } - - private void checkSaslAuthEnabled(HttpServletRequest request) - { - boolean saslAuthEnabled = false; - HttpManagementConfiguration management = getManagementConfiguration(); - if (request.isSecure()) - { - saslAuthEnabled = management.isHttpsSaslAuthenticationEnabled(); - } - else - { - saslAuthEnabled = management.isHttpSaslAuthenticationEnabled(); - } - if (!saslAuthEnabled) - { - throw new ConnectionScopedRuntimeException("Sasl authentication disabled."); - } - } - - private void evaluateSaslResponse(final HttpServletRequest request, - final HttpServletResponse response, - final HttpSession session, final String saslResponse, final SaslServer saslServer, SubjectCreator subjectCreator) throws IOException - { - final String id; - byte[] challenge; - try - { - challenge = saslServer.evaluateResponse(saslResponse == null ? new byte[0] : Base64.decodeBase64(saslResponse.getBytes())); - } - catch(SaslException e) - { - session.removeAttribute(ATTR_ID); - session.removeAttribute(ATTR_SASL_SERVER); - session.removeAttribute(ATTR_EXPIRY); - response.setStatus(HttpServletResponse.SC_UNAUTHORIZED); - - return; - } - - if(saslServer.isComplete()) - { - Subject originalSubject = subjectCreator.createSubjectWithGroups(new AuthenticatedPrincipal(saslServer.getAuthorizationID())); - Subject subject = new Subject(false, - originalSubject.getPrincipals(), - originalSubject.getPublicCredentials(), - originalSubject.getPrivateCredentials()); - subject.getPrincipals().add(new ServletConnectionPrincipal(request)); - subject.setReadOnly(); - - Broker broker = getBroker(); - try - { - HttpManagementUtil.assertManagementAccess(broker.getSecurityManager(), subject); - } - catch(SecurityException e) - { - sendError(response, HttpServletResponse.SC_FORBIDDEN); - return; - } - - HttpManagementUtil.saveAuthorisedSubject(request.getSession(), subject); - session.removeAttribute(ATTR_ID); - session.removeAttribute(ATTR_SASL_SERVER); - session.removeAttribute(ATTR_EXPIRY); - if(challenge != null && challenge.length != 0) - { - Map<String, Object> outputObject = new LinkedHashMap<String, Object>(); - outputObject.put("challenge", new String(Base64.encodeBase64(challenge))); - - final Writer writer = getOutputWriter(request, response); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(SerializationConfig.Feature.INDENT_OUTPUT, true); - mapper.writeValue(writer, outputObject); - } - response.setStatus(HttpServletResponse.SC_OK); - } - else - { - Random rand = getRandom(session); - id = String.valueOf(rand.nextLong()); - session.setAttribute(ATTR_ID, id); - session.setAttribute(ATTR_SASL_SERVER, saslServer); - session.setAttribute(ATTR_EXPIRY, System.currentTimeMillis() + SASL_EXCHANGE_EXPIRY); - - response.setStatus(HttpServletResponse.SC_OK); - - Map<String, Object> outputObject = new LinkedHashMap<String, Object>(); - outputObject.put("id", id); - outputObject.put("challenge", new String(Base64.encodeBase64(challenge))); - - final Writer writer = getOutputWriter(request, response); - - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(SerializationConfig.Feature.INDENT_OUTPUT, true); - mapper.writeValue(writer, outputObject); - } - } - - private SubjectCreator getSubjectCreator(HttpServletRequest request) - { - return HttpManagementUtil.getManagementConfiguration(getServletContext()).getAuthenticationProvider(request).getSubjectCreator( - request.isSecure()); - } - - @Override - protected Subject getAuthorisedSubject(HttpServletRequest request) - { - Subject subject = HttpManagementUtil.getAuthorisedSubject(request.getSession()); - if(subject == null) - { - subject = HttpManagementUtil.tryToAuthenticate(request, HttpManagementUtil.getManagementConfiguration(getServletContext())); - } - return subject; - } - -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/StructureServlet.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/StructureServlet.java deleted file mode 100644 index 7508aa2d0b..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/StructureServlet.java +++ /dev/null @@ -1,100 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * <p/> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p/> - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.qpid.server.management.plugin.servlet.rest; - -import java.io.IOException; -import java.io.Writer; -import java.util.ArrayList; -import java.util.Collection; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.codehaus.jackson.map.ObjectMapper; -import org.codehaus.jackson.map.SerializationConfig; - -import org.apache.qpid.server.model.Broker; -import org.apache.qpid.server.model.ConfiguredObject; - -public class StructureServlet extends AbstractServlet -{ - public StructureServlet() - { - super(); - } - - @Override - protected void doGetWithSubjectAndActor(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException - { - response.setContentType("application/json"); - response.setStatus(HttpServletResponse.SC_OK); - - response.setHeader("Cache-Control","no-cache"); - response.setHeader("Pragma","no-cache"); - response.setDateHeader ("Expires", 0); - - // TODO filtering??? request.getParameter("filter"); // filter=1,2,3 /groups/*/* - - Map<String,Object> structure = generateStructure(getBroker(), Broker.class); - - final Writer writer = getOutputWriter(request, response); - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(SerializationConfig.Feature.INDENT_OUTPUT, true); - mapper.writeValue(writer, structure); - - response.setStatus(HttpServletResponse.SC_OK); - - } - - private Map<String, Object> generateStructure(ConfiguredObject object, Class<? extends ConfiguredObject> clazz) - { - Map<String, Object> structure = new LinkedHashMap<String, Object>(); - structure.put("id", object.getId()); - structure.put("name", object.getName()); - - for(Class<? extends ConfiguredObject> childClass : object.getModel().getChildTypes(clazz)) - { - Collection<? extends ConfiguredObject> children = object.getChildren(childClass); - if(children != null) - { - List<Map<String, Object>> childObjects = new ArrayList<Map<String, Object>>(); - - for(ConfiguredObject child : children) - { - childObjects.add(generateStructure(child, childClass)); - } - - if(!childObjects.isEmpty()) - { - structure.put(pluralize(childClass),childObjects); - } - } - } - - return structure; - } - - private String pluralize(Class<? extends ConfiguredObject> childClass) - { - String name = childClass.getSimpleName().toLowerCase(); - return name + (name.endsWith("s") ? "es" : "s"); - } -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/UserPreferencesServlet.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/UserPreferencesServlet.java deleted file mode 100644 index bbaecca017..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/UserPreferencesServlet.java +++ /dev/null @@ -1,237 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -package org.apache.qpid.server.management.plugin.servlet.rest; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import org.apache.qpid.server.model.AuthenticationProvider; -import org.apache.qpid.server.model.Broker; -import org.apache.qpid.server.model.PreferencesProvider; -import org.apache.qpid.server.model.User; -import org.apache.qpid.server.security.access.Operation; - -public class UserPreferencesServlet extends AbstractServlet -{ - private static final Logger LOGGER = LoggerFactory.getLogger(UserPreferencesServlet.class); - private static final long serialVersionUID = 1L; - - @Override - protected void doGetWithSubjectAndActor(HttpServletRequest request, HttpServletResponse response) throws IOException, - ServletException - { - String[] pathElements = getPathInfoElements(request); - if (pathElements != null && pathElements.length > 1) - { - getUserPreferences(pathElements[0], pathElements[1], request, response); - } - else - { - getUserList(pathElements, request, response); - } - } - - private void getUserPreferences(String authenticationProviderName, String userId, HttpServletRequest request, HttpServletResponse response) - throws IOException - { - Map<String, Object> preferences = null; - PreferencesProvider preferencesProvider = getPreferencesProvider(authenticationProviderName); - if (preferencesProvider == null) - { - response.sendError(HttpServletResponse.SC_NOT_FOUND, "Preferences provider is not configured"); - return; - } - try - { - preferences = preferencesProvider.getPreferences(userId); - - sendJsonResponse(preferences, request, response); - } - catch (SecurityException e) - { - response.sendError(HttpServletResponse.SC_FORBIDDEN, "Viewing of preferences is not allowed"); - return; - } - } - - private void getUserList(String[] pathElements, HttpServletRequest request, HttpServletResponse response) throws IOException - { - List<Map<String, Object>> users = null; - try - { - users = getUsers(pathElements); - } - catch (Exception e) - { - LOGGER.debug("Bad preferences request", e); - response.sendError(HttpServletResponse.SC_BAD_REQUEST, e.getMessage()); - } - sendJsonResponse(users, request, response); - } - - private PreferencesProvider getPreferencesProvider(String authenticationProviderName) - { - AuthenticationProvider authenticationProvider = getAuthenticationProvider(authenticationProviderName); - if (authenticationProvider == null) - { - throw new IllegalArgumentException(String.format("Authentication provider '%s' is not found", - authenticationProviderName)); - } - PreferencesProvider preferencesProvider = authenticationProvider.getPreferencesProvider(); - return preferencesProvider; - } - - private AuthenticationProvider getAuthenticationProvider(String authenticationProviderName) - { - Broker broker = getBroker(); - Collection<AuthenticationProvider> authenticationProviders = broker.getAuthenticationProviders(); - for (AuthenticationProvider authenticationProvider : authenticationProviders) - { - if (authenticationProviderName.equals(authenticationProvider.getName())) - { - return authenticationProvider; - } - } - return null; - } - - private List<Map<String, Object>> getUsers(String[] pathElements) - { - List<Map<String, Object>> users = new ArrayList<Map<String, Object>>(); - String authenticationProviderName = pathElements != null && pathElements.length > 0 ? pathElements[0] : null; - - Broker broker = getBroker(); - Collection<AuthenticationProvider> authenticationProviders = broker.getAuthenticationProviders(); - for (AuthenticationProvider authenticationProvider : authenticationProviders) - { - if (authenticationProviderName != null && !authenticationProvider.getName().equals(authenticationProviderName)) - { - continue; - } - PreferencesProvider preferencesProvider = authenticationProvider.getPreferencesProvider(); - if (preferencesProvider != null) - { - Set<String> usernames = preferencesProvider.listUserIDs(); - for (String name : usernames) - { - Map<String, Object> userMap = new HashMap<String, Object>(); - userMap.put(User.NAME, name); - userMap.put("authenticationProvider", authenticationProvider.getName()); - users.add(userMap); - } - } - } - return users; - } - - /* - * removes preferences - */ - @Override - protected void doDeleteWithSubjectAndActor(HttpServletRequest request, HttpServletResponse response) throws IOException - { - Broker broker = getBroker(); - Collection<AuthenticationProvider> authenticationProviders = broker.getAuthenticationProviders(); - Map<String, Set<String>> providerUsers = new HashMap<String, Set<String>>(); - Map<String, AuthenticationProvider> requestProviders = new HashMap<String, AuthenticationProvider>(); - for (String path : request.getParameterValues("user")) - { - String[] elements = path.split("/"); - if (elements.length != 2) - { - throw new IllegalArgumentException("Illegal user parameter " + path); - } - - String userId = elements[1]; - - String providerName = elements[0]; - Set<String> users = providerUsers.get(providerName); - - if (users == null) - { - AuthenticationProvider provider = findAuthenticationProviderByName(providerName, authenticationProviders); - if (provider == null) - { - throw new IllegalArgumentException("Cannot find provider with name '" + providerName + "'"); - } - users = new HashSet<String>(); - providerUsers.put(providerName, users); - requestProviders.put(providerName, provider); - } - users.add(userId); - } - - if (!providerUsers.isEmpty()) - { - for (Map.Entry<String, Set<String>> entry : providerUsers.entrySet()) - { - String providerName = entry.getKey(); - AuthenticationProvider provider = requestProviders.get(providerName); - Set<String> usersToDelete = entry.getValue(); - PreferencesProvider preferencesProvider = provider.getPreferencesProvider(); - - if (preferencesProvider != null && !usersToDelete.isEmpty()) - { - String[] users = usersToDelete.toArray(new String[usersToDelete.size()]); - try - { - preferencesProvider.deletePreferences(users); - } - catch (SecurityException e) - { - response.sendError(HttpServletResponse.SC_FORBIDDEN, "Deletion of preferences is not allowed"); - return; - } - } - } - } - - } - - protected AuthenticationProvider findAuthenticationProviderByName(String providerName, Collection<AuthenticationProvider> authenticationProviders) - { - AuthenticationProvider provider = null; - for (AuthenticationProvider authenticationProvider : authenticationProviders) - { - if(authenticationProvider.getName().equals(providerName)) - { - provider = authenticationProvider; - break; - } - } - return provider; - } - -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/action/AbstractSpecialisedAttributeLister.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/action/AbstractSpecialisedAttributeLister.java deleted file mode 100644 index c697603c6c..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/action/AbstractSpecialisedAttributeLister.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.qpid.server.management.plugin.servlet.rest.action; - -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; -import java.util.TreeMap; -import java.util.TreeSet; - -import org.apache.qpid.server.management.plugin.servlet.rest.Action; -import org.apache.qpid.server.model.Broker; -import org.apache.qpid.server.model.ConfiguredObject; -import org.apache.qpid.server.model.ConfiguredObjectAttribute; -import org.apache.qpid.server.model.ConfiguredObjectTypeRegistry; - -abstract class AbstractSpecialisedAttributeLister<T extends ConfiguredObject> implements Action -{ - - - private static final String ATTRIBUTES = "attributes"; - private static final String DESCRIPTIONS = "descriptions"; - - @Override - final public Object perform(Map<String, Object> request, Broker broker) - { - ConfiguredObjectTypeRegistry typeRegistry = broker.getModel().getTypeRegistry(); - Collection<Class<? extends ConfiguredObject>> groupProviderTypes = - typeRegistry.getTypeSpecialisations(getCategoryClass()); - - Map<String, Object> attributes = new TreeMap<String, Object>(); - - for (Class<? extends ConfiguredObject> groupProviderType : groupProviderTypes) - { - Collection<ConfiguredObjectAttribute<?, ?>> typeSpecificAttributes = - typeRegistry.getTypeSpecificAttributes(groupProviderType); - - Map<String, Object> data = new HashMap<String, Object>(); - - Collection<String> attributeNames = new TreeSet<>(); - Map<String,String> descriptions = new HashMap<>(); - for(ConfiguredObjectAttribute<?, ?> attr : typeSpecificAttributes) - { - attributeNames.add(attr.getName()); - if(!"".equals(attr.getDescription())) - { - descriptions.put(attr.getName(), attr.getDescription()); - } - } - data.put(ATTRIBUTES, attributeNames); - data.put(DESCRIPTIONS, descriptions); - - attributes.put(ConfiguredObjectTypeRegistry.getType(groupProviderType), data); - } - return attributes; - } - - abstract Class<T> getCategoryClass(); - -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/action/ListAccessControlProviderAttributes.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/action/ListAccessControlProviderAttributes.java deleted file mode 100644 index 1eb3f9a9ac..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/action/ListAccessControlProviderAttributes.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.qpid.server.management.plugin.servlet.rest.action; - -import org.apache.qpid.server.model.AccessControlProvider; - -public class ListAccessControlProviderAttributes extends AbstractSpecialisedAttributeLister<AccessControlProvider> -{ - @Override - public String getName() - { - return ListAccessControlProviderAttributes.class.getSimpleName(); - } - - @Override - Class<AccessControlProvider> getCategoryClass() - { - return AccessControlProvider.class; - } -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/action/ListBrokerAttribute.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/action/ListBrokerAttribute.java deleted file mode 100644 index dc414e6a64..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/action/ListBrokerAttribute.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.qpid.server.management.plugin.servlet.rest.action; - -import java.util.Map; - -import org.apache.qpid.server.management.plugin.servlet.rest.Action; -import org.apache.qpid.server.model.Broker; - -public class ListBrokerAttribute implements Action -{ - - private final String _attributeName; - private final String _name; - - public ListBrokerAttribute(String attributeName, String name) - { - _attributeName = attributeName; - _name = name; - } - - @Override - public String getName() - { - return _name; - } - - @Override - public Object perform(Map<String, Object> request, Broker broker) - { - return broker.getAttribute(_attributeName); - } - -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/action/ListGroupProviderAttributes.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/action/ListGroupProviderAttributes.java deleted file mode 100644 index ecb4320f1f..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/action/ListGroupProviderAttributes.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - * - */ -package org.apache.qpid.server.management.plugin.servlet.rest.action; - -import org.apache.qpid.server.model.GroupProvider; - -public class ListGroupProviderAttributes extends AbstractSpecialisedAttributeLister<GroupProvider> -{ - @Override - public String getName() - { - return ListGroupProviderAttributes.class.getSimpleName(); - } - - @Override - Class<GroupProvider> getCategoryClass() - { - return GroupProvider.class; - } -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/action/ListTimeZones.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/action/ListTimeZones.java deleted file mode 100644 index 56bc7b1bf7..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/action/ListTimeZones.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -package org.apache.qpid.server.management.plugin.servlet.rest.action; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.Map; -import java.util.TimeZone; - -import org.apache.qpid.server.management.plugin.servlet.rest.Action; -import org.apache.qpid.server.model.Broker; - -public class ListTimeZones implements Action -{ - - private static final String[] TIMEZONE_REGIONS = { "Africa", "America", "Antarctica", "Arctic", "Asia", "Atlantic", "Australia", - "Europe", "Indian", "Pacific" }; - - @Override - public String getName() - { - return ListTimeZones.class.getSimpleName(); - } - - @Override - public Object perform(Map<String, Object> request, Broker broker) - { - List<TimeZoneDetails> timeZoneDetails = new ArrayList<TimeZoneDetails>(); - String[] ids = TimeZone.getAvailableIDs(); - long currentTime = System.currentTimeMillis(); - Date currentDate = new Date(currentTime); - for (String id : ids) - { - int cityPos = id.indexOf("/"); - if (cityPos > 0 && cityPos < id.length() - 1) - { - String region = id.substring(0, cityPos); - for (int i = 0; i < TIMEZONE_REGIONS.length; i++) - { - if (region.equals(TIMEZONE_REGIONS[i])) - { - TimeZone tz = TimeZone.getTimeZone(id); - int offset = tz.getOffset(currentTime)/60000; - String city = id.substring(cityPos + 1).replace('_', ' '); - timeZoneDetails.add(new TimeZoneDetails(id, tz.getDisplayName(tz.inDaylightTime(currentDate), TimeZone.SHORT), offset, city, region)); - break; - } - } - } - } - return timeZoneDetails; - } - - public static class TimeZoneDetails - { - private String id; - private String name; - private int offset; - private String city; - private String region; - - public TimeZoneDetails(String id, String name, int offset, String city, String region) - { - super(); - this.id = id; - this.name = name; - this.offset = offset; - this.city = city; - this.region = region; - } - - public String getId() - { - return id; - } - - public String getName() - { - return name; - } - - public int getOffset() - { - return offset; - } - - public String getCity() - { - return city; - } - - public String getRegion() - { - return region; - } - } -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/session/LoginLogoutReporter.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/session/LoginLogoutReporter.java deleted file mode 100644 index 7e0d13fddb..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/session/LoginLogoutReporter.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.qpid.server.management.plugin.session; - -import java.security.Principal; -import java.security.PrivilegedAction; - -import javax.security.auth.Subject; -import javax.servlet.http.HttpSession; -import javax.servlet.http.HttpSessionBindingEvent; -import javax.servlet.http.HttpSessionBindingListener; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import org.apache.qpid.server.logging.EventLogger; -import org.apache.qpid.server.logging.EventLoggerProvider; -import org.apache.qpid.server.logging.messages.ManagementConsoleMessages; -import org.apache.qpid.server.security.auth.AuthenticatedPrincipal; - -/** - * Logs {@link ManagementConsoleMessages#OPEN(String)} and {@link ManagementConsoleMessages#CLOSE(String)} - * messages. A single instance of this class must be placed in the {@link HttpSession} immediately after - * the user has successfully logged-in, and removed (or the whole session invalidated) as the user logs out. - */ -public class LoginLogoutReporter implements HttpSessionBindingListener -{ - private static final Logger LOGGER = LoggerFactory.getLogger(LoginLogoutReporter.class); - private final Subject _subject; - private final Principal _principal; - private final EventLoggerProvider _eventLoggerProvider; - - public LoginLogoutReporter(Subject subject, EventLoggerProvider eventLoggerProvider) - { - super(); - _subject = subject; - _principal = AuthenticatedPrincipal.getAuthenticatedPrincipalFromSubject(_subject); - _eventLoggerProvider = eventLoggerProvider; - } - - @Override - public void valueBound(HttpSessionBindingEvent arg0) - { - reportLogin(); - } - - @Override - public void valueUnbound(HttpSessionBindingEvent arg0) - { - reportLogout(); - } - - private void reportLogin() - { - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug("User logging in : " + _principal); - } - - Subject.doAs(_subject, new PrivilegedAction<Void>() - { - @Override - public Void run() - { - getEventLogger().message(ManagementConsoleMessages.OPEN(_principal.getName())); - return null; - } - }); - } - - private void reportLogout() - { - if (LOGGER.isDebugEnabled()) - { - LOGGER.debug("User logging out : " + _principal); - } - - Subject.doAs(_subject, new PrivilegedAction<Void>() - { - @Override - public Void run() - { - getEventLogger().message(ManagementConsoleMessages.CLOSE(_principal.getName())); - return null; - } - }); - } - - public EventLogger getEventLogger() - { - return _eventLoggerProvider.getEventLogger(); - } -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/accesscontrolprovider/aclfile/add.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/accesscontrolprovider/aclfile/add.html deleted file mode 100644 index 796988c410..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/accesscontrolprovider/aclfile/add.html +++ /dev/null @@ -1,64 +0,0 @@ -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one - ~ or more contributor license agreements. See the NOTICE file - ~ distributed with this work for additional information - ~ regarding copyright ownership. The ASF licenses this file - ~ to you under the Apache License, Version 2.0 (the - ~ "License"); you may not use this file except in compliance - ~ with the License. You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, - ~ software distributed under the License is distributed on an - ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - ~ KIND, either express or implied. See the License for the - ~ specific language governing permissions and limitations - ~ under the License. - --> - -<div> - <div id="addAccessControlProvider.oldBrowserWarning" class="infoMessage hidden clear"></div> - <div class="clear"> - <div id="addAccessControlProvider.serverPathLabel" class="formLabel-labelCell tableContainer-labelCell">Server path or upload*:</div> - <div class="formLabel-controlCell tableContainer-valueCell"> - <input type="text" id="addAccessControlProvider.serverPath" - data-dojo-type="dijit/form/ValidationTextBox" - data-dojo-props=" - name: 'serverPath', - placeHolder: 'access control provider file server path', - required: true, - excluded: true, - promptMessage: 'Location of the access control provider file on the server', - title: 'Enter the access control provider file path'" /> - - <!-- Hidden and used purely for form submission --> - <input type="hidden" id="addAccessControlProvider.path" - data-dojo-type="dijit/form/ValidationTextBox" - data-dojo-props=" - name: 'path', - required: true" /> - </div> - - <div id="addAccessControlProvider.uploadFields"> - <div id="addAccessControlProvider.fileLabel" class="formLabel-labelCell tableContainer-labelCell"></div> - <div class="fileUpload clear"> - <span id="addAccessControlProvider.selectedFile" class="infoMessage"></span> - <span id="addAccessControlProvider.selectedFileStatus"></span> - </div> - - <div class="fileUpload clear"> - <input type="file" id="addAccessControlProvider.file" - multiple="false" - data-dojo-type="dojox/form/Uploader" - data-dojo-props="label: 'Upload'"/> - <button id="addAccessControlProvider.fileClearButton" - data-dojo-type="dijit/form/Button" - data-dojo-props="label: 'Clear', - disabled: true"> - </button> - </div> - </div> - - </div> -</div> diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/accesscontrolprovider/showAclFile.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/accesscontrolprovider/showAclFile.html deleted file mode 100644 index 24cef75737..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/accesscontrolprovider/showAclFile.html +++ /dev/null @@ -1,27 +0,0 @@ -<!-- - - - - Licensed to the Apache Software Foundation (ASF) under one - - or more contributor license agreements. See the NOTICE file - - distributed with this work for additional information - - regarding copyright ownership. The ASF licenses this file - - to you under the Apache License, Version 2.0 (the - - "License"); you may not use this file except in compliance - - with the License. You may obtain a copy of the License at - - - - http://www.apache.org/licenses/LICENSE-2.0 - - - - Unless required by applicable law or agreed to in writing, - - software distributed under the License is distributed on an - - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - - KIND, either express or implied. See the License for the - - specific language governing permissions and limitations - - under the License. - - - --> -<div class="AclFileProvider"> - <div class="clear"> - <div class="formLabel-labelCell">Path:</div> - <div class="path"></div> - </div> - <div class="clear"></div> -</div> diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/addAccessControlProvider.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/addAccessControlProvider.html deleted file mode 100644 index 64f8078314..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/addAccessControlProvider.html +++ /dev/null @@ -1,66 +0,0 @@ -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one - ~ or more contributor license agreements. See the NOTICE file - ~ distributed with this work for additional information - ~ regarding copyright ownership. The ASF licenses this file - ~ to you under the Apache License, Version 2.0 (the - ~ "License"); you may not use this file except in compliance - ~ with the License. You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, - ~ software distributed under the License is distributed on an - ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - ~ KIND, either express or implied. See the License for the - ~ specific language governing permissions and limitations - ~ under the License. - --> -<div class="dijitHidden"> - <div data-dojo-type="dijit/Dialog" data-dojo-props="title:'Access Control Provider'" id="addAccessControlProvider"> - <div id="addAccessControlProvider.contentPane"> - <form id="addAccessControlProvider.form" method="post" data-dojo-type="dijit/form/Form"> - <div class="formBox"> - <div class="clear"> - <div class="formLabel-labelCell tableContainer-labelCell">Name*:</div> - <div class="formLabel-controlCell tableContainer-valueCell"> - <input type="text" id="addAccessControlProvider.name" - data-dojo-type="dijit/form/ValidationTextBox" - data-dojo-props=" - name: 'name', - placeHolder: 'access control provider name', - required: true, - promptMessage: 'Name of access control provider, must be unique', - title: 'Enter a unique access control provider name per broker'" /> - </div> - </div> - <div class="clear"> - <div class="formLabel-labelCell tableContainer-labelCell">Type*:</div> - <div class="tableContainer-valueCell formLabel-controlCell"> - <select id="addAccessControlProvider.type" data-dojo-type="dijit/form/FilteringSelect" - data-dojo-props=" - name: 'type', - required: true, - placeHolder: 'select access control provider type', - promptMessage: 'Type of access control provider', - title: 'Select access control provider type', - searchAttr: 'name'"> - </select> - </div> - </div> - - <div class="clear"> - <div id="addAccessControlProvider.typeFields"></div> - </div> - </div> - </form> - <div class="clear"> - </div> - </div> - - <div class="dijitDialogPaneActionBar qpidDialogPaneActionBar"> - <button data-dojo-type="dijit/form/Button" id="addAccessControlProvider.addButton" data-dojo-props="label: 'Save'" type="submit"></button> - <button data-dojo-type="dijit/form/Button" id="addAccessControlProvider.cancelButton" data-dojo-props="label: 'Cancel'" ></button> - </div> - </div> -</div> diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/addAuthenticationProvider.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/addAuthenticationProvider.html deleted file mode 100644 index 5a565e72e3..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/addAuthenticationProvider.html +++ /dev/null @@ -1,64 +0,0 @@ -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one or more - ~ contributor license agreements. See the NOTICE file distributed with - ~ this work for additional information regarding copyright ownership. - ~ The ASF licenses this file to You under the Apache License, Version 2.0 - ~ (the "License"); you may not use this file except in compliance with - ~ the License. You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --> -<div class="dijitHidden"> - <div data-dojo-type="dijit/Dialog" data-dojo-props="title:'Authentication Provider'" id="addAuthenticationProvider"> - <div id="addAuthenticationProvider.contentPane"> - <form id="addAuthenticationProvider.form" method="post" data-dojo-type="dijit/form/Form"> - <div class="formBox"> - <fieldset> - <legend>Authentication Provider</legend> - <div class="clear"> - <div class="formLabel-labelCell tableContainer-labelCell">Name*:</div> - <div class="formLabel-controlCell tableContainer-valueCell"> - <input type="text" id="addAuthenticationProvider.name" - data-dojo-type="dijit/form/ValidationTextBox" - data-dojo-props=" - name: 'name', - placeHolder: 'authentication provider name', - required: true, - promptMessage: 'Name of authentication provider, must be unique', - title: 'Enter a unique authentication provider name per broker'" /> - </div> - </div> - <div class="clear"> - <div class="formLabel-labelCell tableContainer-labelCell">Type*:</div> - <div class="tableContainer-valueCell formLabel-controlCell"> - <select id="addAuthenticationProvider.type" data-dojo-type="dijit/form/FilteringSelect" - data-dojo-props=" - name: 'type', - required: true, - placeHolder: 'select authentication provider type', - promptMessage: 'Type of authentication provider', - title: 'Select authentication provider type', - searchAttr: 'name'"> - </select> - </div> - </div> - <div class="clear"></div> - <div id="addAuthenticationProvider.typeFields"></div> - </fieldset> - </div> - </form> - - <div id="addPreferencesProvider.form"></div> - </div> - <div class="dijitDialogPaneActionBar qpidDialogPaneActionBar"> - <button data-dojo-type="dijit/form/Button" id="addAuthenticationProvider.addButton" data-dojo-props="label: 'Save'" type="submit"></button> - <button data-dojo-type="dijit/form/Button" id="addAuthenticationProvider.cancelButton" data-dojo-props="label: 'Cancel'" ></button> - </div> - </div> -</div> diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/addBinding.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/addBinding.html deleted file mode 100644 index d4ac5877cb..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/addBinding.html +++ /dev/null @@ -1,64 +0,0 @@ -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one or more - ~ contributor license agreements. See the NOTICE file distributed with - ~ this work for additional information regarding copyright ownership. - ~ The ASF licenses this file to You under the Apache License, Version 2.0 - ~ (the "License"); you may not use this file except in compliance with - ~ the License. You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --> -<div class="dijitHidden"> - <div data-dojo-type="dijit/Dialog" style="width:600px;" data-dojo-props="title:'Add Binding'" id="addBinding"> - <form id="formAddBinding" method="post" data-dojo-type="dijit/form/Form"> - - <div class="clear"> - <div class="formLabel-labelCell tableContainer-labelCell">Exchange Name*:</div> - <div class="formLabel-controlCell tableContainer-valueCell"> - <div id="addBinding.selectExchangeDiv"></div> - </div> - </div> - <div class="clear"> - <div class="formLabel-labelCell tableContainer-labelCell">Queue Name*: </div> - <div class="formLabel-controlCell tableContainer-valueCell"> - <div id="addBinding.selectQueueDiv"></div> - </div> - </div> - <div class="clear"> - <div class="formLabel-labelCell tableContainer-labelCell">Binding Key*:</div> - <div class="formLabel-controlCell tableContainer-valueCell"> - <input type="text" id="formAddbinding.bindingKey" - data-dojo-type="dijit/form/ValidationTextBox" - data-dojo-props=" - name: 'name', - placeHolder: 'Binding Key', - required: true, - promptMessage: 'Binding key', - title: 'Enter binding key'" /> - </div> - </div> - - <div class="clear formBox"> - <fieldset> - <legend>Binding Arguments</legend> - <div class="editNoteBanner">NOTE: Only arguments with name and value will be submitted. To edit, please, click on a grid cell.</div> - <div id="formAddbinding.bindingArguments"></div> - <div> - <button data-dojo-type="dijit/form/Button" id="formAddbinding.addArgumentButton" type="button" data-dojo-props="title:'Add new binding argument'">+</button> - <button data-dojo-type="dijit/form/Button" id="formAddbinding.deleteArgumentButton" type="button" data-dojo-props="title:'Remove selected binding argument(s)'">-</button> - </div> - </fieldset> - </div> - - <div class="dijitDialogPaneActionBar qpidDialogPaneActionBar"> - <input type="submit" value="Create Binding" label="Create Binding" data-dojo-type="dijit/form/Button" /> - </div> - </form> - </div> -</div> diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/addExchange.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/addExchange.html deleted file mode 100644 index 25e9752392..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/addExchange.html +++ /dev/null @@ -1,74 +0,0 @@ -<!-- - - - - Licensed to the Apache Software Foundation (ASF) under one - - or more contributor license agreements. See the NOTICE file - - distributed with this work for additional information - - regarding copyright ownership. The ASF licenses this file - - to you under the Apache License, Version 2.0 (the - - "License"); you may not use this file except in compliance - - with the License. You may obtain a copy of the License at - - - - http://www.apache.org/licenses/LICENSE-2.0 - - - - Unless required by applicable law or agreed to in writing, - - software distributed under the License is distributed on an - - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - - KIND, either express or implied. See the License for the - - specific language governing permissions and limitations - - under the License. - - - --> -<div class="dijitHidden"> - <div data-dojo-type="dijit.Dialog" style="width:600px;" data-dojo-props="title:'Add Exchange'" id="addExchange"> - <form id="formAddExchange" method="post" dojoType="dijit.form.Form"> - <div class="clear"> - <div class="formLabel-labelCell">Name*:</div> - <div class="formLabel-controlCell"> - <input type="text" id="formAddExchange.name" - data-dojo-type="dijit/form/ValidationTextBox" - data-dojo-props=" - name: 'name', - placeHolder: 'exchange name', - required: true, - promptMessage: 'Name of exchange', - title: 'Enter an exchange name', - regExp:'^(?!qpid\.|amq\.|\<\<default\>\>)[\x20-\x2e\x30-\x7F]{1,255}$', - invalidMessage:'Illegal or reserved exchange name!'"/> - </div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">Exchange Type:</div> - <div class="formLabel-controlCell"> - <select id="formAddExchange.type" - dojoType="dijit.form.FilteringSelect" - data-dojo-props=" - name: 'type', - promptMessage: 'Type of exchange - responsible for routing messages to queues'"> - <option value="direct">direct</option> - <option value="topic">topic</option> - <option value="headers">headers</option> - <option value="fanout">fanout</option> - </select> - </div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">Durable?</div> - <div class="formLabel-controlCell"> - <input type="checkbox" id="formAddExchange.durable" - dojoType="dijit.form.CheckBox" - data-dojo-props=" - name: 'durable', - value: 'durable', - checked: true"/> - </div> - </div> - - - <div class="clear"></div> - - <div class="dijitDialogPaneActionBar qpidDialogPaneActionBar"> - <input type="submit" value="Create Exchange" label="Create Exchange" dojoType="dijit.form.Button" /> - </div> - </form> - </div> -</div> diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/addGroupProvider.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/addGroupProvider.html deleted file mode 100644 index b622fe94d2..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/addGroupProvider.html +++ /dev/null @@ -1,66 +0,0 @@ -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one - ~ or more contributor license agreements. See the NOTICE file - ~ distributed with this work for additional information - ~ regarding copyright ownership. The ASF licenses this file - ~ to you under the Apache License, Version 2.0 (the - ~ "License"); you may not use this file except in compliance - ~ with the License. You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, - ~ software distributed under the License is distributed on an - ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - ~ KIND, either express or implied. See the License for the - ~ specific language governing permissions and limitations - ~ under the License. - --> - -<div class="dijitHidden"> - <div data-dojo-type="dijit/Dialog" data-dojo-props="title:'Add Store'" id="addGroupProvider"> - <div id="addGroupProvider.contentPane"> - <form id="addGroupProvider.form" method="post" data-dojo-type="dijit/form/Form"> - <div class="formBox"> - <div class="clear"> - <div class="formLabel-labelCell tableContainer-labelCell">Name*:</div> - <div class="formLabel-controlCell tableContainer-valueCell"> - <input type="text" id="addGroupProvider.name" - data-dojo-type="dijit/form/ValidationTextBox" - data-dojo-props=" - name: 'name', - placeHolder: 'group provider name', - required: true, - promptMessage: 'Name of group provider, must be unique', - title: 'Enter a unique group provider name per broker'" /> - </div> - </div> - <div class="clear"> - <div class="formLabel-labelCell tableContainer-labelCell">Type*:</div> - <div class="tableContainer-valueCell formLabel-controlCell"> - <select id="addGroupProvider.type" data-dojo-type="dijit/form/FilteringSelect" - data-dojo-props=" - name: 'type', - required: true, - placeHolder: 'group provider type', - promptMessage: 'Type of group provider', - title: 'Select type', - searchAttr: 'name'"> - </select> - </div> - </div> - <div class="clear"> - <div id="addGroupProvider.typeFields"></div> - </div> - </div> - </form> - <div class="clear"> - </div> - </div> - - <div class="dijitDialogPaneActionBar qpidDialogPaneActionBar"> - <button data-dojo-type="dijit/form/Button" id="addGroupProvider.addButton" data-dojo-props="label: 'Save'" type="submit"></button> - <button data-dojo-type="dijit/form/Button" id="addGroupProvider.cancelButton" data-dojo-props="label: 'Cancel'" ></button> - </div> - </div> -</div> diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/addPort.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/addPort.html deleted file mode 100644 index 10b79987a5..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/addPort.html +++ /dev/null @@ -1,260 +0,0 @@ -<!-- - - - - Licensed to the Apache Software Foundation (ASF) under one - - or more contributor license agreements. See the NOTICE file - - distributed with this work for additional information - - regarding copyright ownership. The ASF licenses this file - - to you under the Apache License, Version 2.0 (the - - "License"); you may not use this file except in compliance - - with the License. You may obtain a copy of the License at - - - - http://www.apache.org/licenses/LICENSE-2.0 - - - - Unless required by applicable law or agreed to in writing, - - software distributed under the License is distributed on an - - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - - KIND, either express or implied. See the License for the - - specific language governing permissions and limitations - - under the License. - - - --> -<div class="dijitHidden"> - <div data-dojo-type="dijit.Dialog" data-dojo-props="title:'Port'" id="addPort"> - <form id="formAddPort" method="post" data-dojo-type="dijit.form.Form"> - <div class="hidden infoMessage" id="portEditWarning">NOTE: changes will only take effect after Broker restart.</div> - <div id="formAddPort:fields"> - - <div class="clear"> - <div class="formLabel-labelCell"> - <label for="formAddPort.name">Name*:</label> - </div> - <div class="formLabel-controlCell"> - <input id="formAddPort.name" type="text" - data-dojo-type="dijit.form.ValidationTextBox" - data-dojo-props=" - name: 'name', - required: 'true', - placeHolder: 'name', - promptMessage: 'Name of port, must be unique', - title: 'Enter name of port'"/> - </div> - </div> - - <div class="clear"> - <div class="formLabel-labelCell"> - <label for="formAddPort.type">Port Type*:</label> - </div> - <div class="formLabel-controlCell"> - <select id="formAddPort.type" - data-dojo-type="dijit.form.FilteringSelect" - data-dojo-props=" - name: 'type', - label: 'Port Type*:', - value: '', - placeHolder: 'port type', - promptMessage: 'Port type', - title: 'Enter port type'"> - </select> - </div> - </div> - - <div class="clear"> - <div class="formLabel-labelCell"> - <label for="formAddPort.port">Port Number*:</label> - </div> - <div class="formLabel-controlCell"> - <input id="formAddPort.port" type="text" - data-dojo-type="dijit.form.ValidationTextBox" - data-dojo-props=" - name: 'port', - required: 'true', - placeHolder: 'port number', - promptMessage: 'Port number to be bound', - title: 'Enter port number'"/> - </div> - </div> - </div> - - <div id="formAddPort:fieldsProtocols"> - <div class="clear"> - <div class="formLabel-labelCell"> - <label for="formAddPort.protocols">Protocols:</label> - </div> - <div class="formLabel-controlCell"> - <select id="formAddPort.protocols" - data-dojo-type="dijit.form.MultiSelect" - data-dojo-props=" - name: 'protocols', - value: '', - title: 'Select protocol(s) to be associated with this port'"> - </select> - </div> - <div id="formAddPort.protocols.tooltip" - data-dojo-type="dijit.Tooltip" - data-dojo-props="connectId: 'formAddPort.protocols', - label: 'Protocol(s) to be associated with the port'"> - </div> - - </div> - </div> - - <div id="formAddPort:fieldsAuthenticationProvider"> - <div class="clear"> - <div class="formLabel-labelCell"> - <label for="formAddPort.authenticationProvider">Authentication Provider*:</label> - </div> - <div class="formLabel-controlCell"> - <select id="formAddPort.authenticationProvider" - data-dojo-type="dijit.form.FilteringSelect" - data-dojo-props=" - name: 'authenticationProvider', - searchAttr: 'name', - required: true, - placeHolder: 'provider', - promptMessage: 'Authentication provider to authenticate users connecting to the port', - title: 'Associate the port with an authentication provider'"> - </select> - </div> - </div> - </div> - - <div id="formAddPort:fieldsBindingAddress"> - <div class="clear"> - <div class="formLabel-labelCell"> - <label for="formAddPort.bindingAddress">Binding address:</label> - </div> - <div class="formLabel-controlCell"> - <input id="formAddPort.bindingAddress" type="text" - data-dojo-type="dijit.form.ValidationTextBox" - data-dojo-props=" - name: 'bindingAddress', - placeHolder: 'binding address', - promptMessage: 'Restricts the port to listen on the specified address only. The <code>*</code> wildcard signifies all addresses', - title: 'Enter a binding address'"/> - </div> - </div> - </div> - - <div id="formAddPort:transport" > - <div class="clear"> - <div class="formLabel-labelCell"> - <label for="formAddPort.transports">Transport:</label> - </div> - <div class="formLabel-controlCell"> - <select id="formAddPort.transports" - data-dojo-type="dijit.form.MultiSelect" - data-dojo-props=" - name: 'transports', - placeHolder: 'TCP', - value: '', - multiple: true, - title: 'Select transport(s) to be associated with the port'"> - </select> - <div id="formAddPort.transports.tooltip" - data-dojo-type="dijit.Tooltip" - data-dojo-props="connectId: 'formAddPort.transports', - label: 'Transport(s) to be associated with the port'"> - </div> - </div> - </div> - </div> - - <div id="formAddPort:maxOpenConnections" > - <div class="clear"> - <div class="formLabel-labelCell"> - <label for="formAddPort.transports">Maximum number of connections:</label> - </div> - <div class="formLabel-controlCell"> - <input id="formAddPort.maxOpenConnections" type="text" - data-dojo-type="dijit.form.ValidationTextBox" - data-dojo-props=" - name: 'maxOpenConnections', - placeHolder: 'maximum number of connections', - promptMessage: 'Maximum number of concurrent connections permitted by this port. The <code>-1</code> signifies no limit is imposed.', - title: 'Enter a maximum number of connections'"/> - </div> - </div> - </div> - - <div id="formAddPort:fieldsTransportSSL"> - <div class="clear"> - <div class="formLabel-labelCell"> - <label for="formAddPort.keyStore">Key Store*:</label> - </div> - <div class="formLabel-controlCell"> - <select id="formAddPort.keyStore" - data-dojo-type="dijit.form.FilteringSelect" - data-dojo-props=" - name: 'keyStore', - label: 'Key Store*:', - searchAttr: 'name', - placeHolder: 'keystore', - value: '', - required: true, - promptMessage: 'Keystore that provides the SSL certificate', - title: 'Select the keystore that provides the SSL certificate'"> - </select> - </div> - </div> - </div> - - <div id="formAddPort:fieldsClientAuth"> - <div id="formAddPort:fieldsClientAuthCheckboxes"> - <div class="clear"> - <div class="formLabel-labelCell"> - <label for="formAddPort.needClientAuth">Need SSL Client Certificate:</label> - </div> - <div class="formLabel-controlCell"> - <input id="formAddPort.needClientAuth" type="checkbox" - data-dojo-type="dijit.form.CheckBox" - data-dojo-props=" - name: 'needClientAuth'" /> - </div> - </div> - <div class="clear"> - <div class="formLabel-labelCell"> - <label for="formAddPort.wantClientAuth">Want SSL Client Certificate:</label> - </div> - <div class="formLabel-controlCell"> - <input id="formAddPort.wantClientAuth" type="checkbox" - data-dojo-type="dijit.form.CheckBox" - data-dojo-props=" - name: 'wantClientAuth'" /> - </div> - </div> - </div> - - <div class="clear"> - <div class="formLabel-labelCell"> - Trust Stores: - </div> - </div> - - <div class="clear"> - <div class="formLabel-controlCell"> - <table id="formAddPort.trustStores" - data-dojo-type="dojox.grid.EnhancedGrid" - data-dojo-props=" - plugins: {indirectSelection: true}, - rowSelector:'0px'" - style="height: 100px; width:400px"> <!--todo remove --> - <thead> - <tr> - <th field="name">Name</th> - <th field="peersOnly">Peers Only</th> - </tr> - </thead> - </table> - </div> - </div> - </div> - - <input type="hidden" id="formAddPort.id" name="id"/> - <div class="clear"></div> - <div class="dijitDialogPaneActionBar qpidDialogPaneActionBar"> - <!-- submit buttons --> - <input type="submit" value="Save Port" label="Save Port" dojoType="dijit.form.Button" /> - </div> - </form> - </div> -</div> diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/addPreferencesProvider.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/addPreferencesProvider.html deleted file mode 100644 index e3984e1ae2..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/addPreferencesProvider.html +++ /dev/null @@ -1,28 +0,0 @@ -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one or more - ~ contributor license agreements. See the NOTICE file distributed with - ~ this work for additional information regarding copyright ownership. - ~ The ASF licenses this file to You under the Apache License, Version 2.0 - ~ (the "License"); you may not use this file except in compliance with - ~ the License. You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --> -<div class="dijitHidden"> - <div data-dojo-type="dijit/Dialog" data-dojo-props="title:'Preferences Provider'" id="addPreferencesProvider"> - - <div id="addPreferencesProvider.preferencesProvider" data-dojo-type="qpid/management/preferencesprovider/PreferencesProviderForm"></div> - - <div class="dijitDialogPaneActionBar qpidDialogPaneActionBar"> - <!-- submit buttons --> - <input type="button" value="Save" data-dojo-props="label: 'Save'" data-dojo-type="dijit/form/Button" id="addPreferencesProvider.saveButton"/> - <input type="button" value="Cancel" data-dojo-props="label: 'Cancel'" data-dojo-type="dijit/form/Button" id="addPreferencesProvider.cancelButton"/> - </div> - </div> -</div> diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/addQueue.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/addQueue.html deleted file mode 100644 index 61f0de22d8..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/addQueue.html +++ /dev/null @@ -1,344 +0,0 @@ -<!-- - - - - Licensed to the Apache Software Foundation (ASF) under one - - or more contributor license agreements. See the NOTICE file - - distributed with this work for additional information - - regarding copyright ownership. The ASF licenses this file - - to you under the Apache License, Version 2.0 (the - - "License"); you may not use this file except in compliance - - with the License. You may obtain a copy of the License at - - - - http://www.apache.org/licenses/LICENSE-2.0 - - - - Unless required by applicable law or agreed to in writing, - - software distributed under the License is distributed on an - - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - - KIND, either express or implied. See the License for the - - specific language governing permissions and limitations - - under the License. - - - --> -<div class="dijitHidden"> - <div data-dojo-type="dijit.Dialog" data-dojo-props="title:'Add Queue'" id="addQueue"> - <form id="formAddQueue" method="post" dojoType="dijit.form.Form"> - - <div class="clear"> - <div class="formLabel-labelCell">Queue Name*:</div> - <div class="formLabel-controlCell"> - <input type="text" id="formAddQueue.name" - data-dojo-type="dijit/form/ValidationTextBox" - data-dojo-props=" - name: 'name', - placeHolder: 'queue name', - required: true, - promptMessage: 'Name of queue', - title: 'Enter a queue name', - regExp:'^[\x20-\x2e\x30-\x7F]{1,255}$'"/> - </div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">Queue Type:</div> - <div class="formLabel-controlCell"> - <select id="formAddQueue.type" - dojoType="dijit.form.FilteringSelect" - data-dojo-props=" - name: 'type', - value: 'standard', - searchAttr: 'name', - required: true, - promptMessage: 'Type of Queue', - title: 'Enter the queue type'"> - <option value="standard">Standard</option> - <option value="priority">Priority</option> - <option value="lvq">LVQ</option> - <option value="sorted">Sorted</option> - </select> - </div> - </div> - <div class="clear"></div> - - <div id="formAddQueueType:priority" class="hidden typeSpecificDiv"> - <div class="clear"> - <div class="formLabel-labelCell">Priorities:</div> - <div class="formLabel-controlCell"> - <input type="text" id="formAddQueue.priorities" - data-dojo-type="dijit/form/ValidationTextBox" - data-dojo-props=" - name: 'priorities', - placeHolder: 'number of priorities', - promptMessage: 'Number of priorities supported by the queue', - title: 'Enter the number of priorities supported by the queue', - trim: true"/> - </div> - </div> - <div class="clear"></div> - </div> - - <div id="formAddQueueType:lvq" class="hidden typeSpecificDiv"> - <div class="clear"> - <div class="formLabel-labelCell">LVQ Message Property:</div> - <div class="formLabel-controlCell"> - <input type="text" id="formAddQueue.lvqKey" - data-dojo-type="dijit/form/ValidationTextBox" - data-dojo-props=" - name: 'lvqKey', - placeHolder: 'lvq key', - promptMessage: 'Name of the message property used to perform the conflation', - title: 'Enter the name of the message property used to perform the conflation', - trim: true"/> - </div> - </div> - <div class="clear"></div> - </div> - - <div id="formAddQueueType:sorted" class="hidden typeSpecificDiv"> - <div class="clear"> - <div class="formLabel-labelCell">Sort Message Property*:</div> - <div class="formLabel-controlCell"> - <input type="text" id="formAddQueue.sortKey" - data-dojo-type="dijit/form/ValidationTextBox" - data-dojo-props=" - name: 'sortKey', - placeHolder: 'sort key', - promptMessage: 'Name of the message property used for sorting the messages on the queue', - title: 'Enter the name of the message property used for sorting the messages on the queue', - trim: true"/> - </div> - </div> - <div class="clear"></div> - </div> - - <div class="clear"> - <div class="formLabel-labelCell">Durable?</div> - <div class="formLabel-controlCell"> - <input type="checkbox" id="formAddQueue.durable" - dojoType="dijit.form.CheckBox" - data-dojo-props=" - name: 'durable', - value: 'durable', - checked: true"/> - </div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">Persist Messages?</div> - <div class="formLabel-controlCell"> - <select id="formAddQueue.messageDurability" - dojoType="dijit.form.FilteringSelect" - data-dojo-props=" - name: 'messageDurability', - value: '', - searchAttr: 'name', - required: false, - promptMessage: 'Message persistence override. If not default, messages arriving will have persistence setting overridden', - title: 'Enter message persistence override'"> - <option value="ALWAYS">Always</option> - <option value="DEFAULT">Default</option> - <option value="NEVER">Never</option> - </select> - </div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">Maximum Ttl:</div> - <div class="formLabel-controlCell"> - <input type="text" id="formAddQueue.maximumMessageTtl" - data-dojo-type="dijit/form/ValidationTextBox" - data-dojo-props=" - name: 'maximumMessageTtl', - placeHolder: 'ttl in ms', - promptMessage: 'Maximum message time to live (ttl) in ms. Messages arriving with larger ttl values will be overridden by this value', - title: 'Enter the maximum message time to live in milliseconds', - trim: true"/> - </div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">Minimum Ttl:</div> - <div class="formLabel-controlCell"> - <input type="text" id="formAddQueue.minimumMessageTtl" - data-dojo-type="dijit/form/ValidationTextBox" - data-dojo-props=" - name: 'minimumMessageTtl', - placeHolder: 'ttl in ms', - promptMessage: 'Minimum message time to live (ttl) in ms. Messages arriving with smaller ttl values will be overridden by this value', - title: 'Enter the minimum message time to live in milliseconds', - trim: true"/> - </div> - </div> - - <div class="clear formBox"> - <fieldset> - <legend>Flow Control Settings</legend> - <div class="clear"> - <div class="formLabel-labelCell">Capacity:</div> - <div class="formLabel-controlCell"> - <input type="text" id="formAddQueue.capacity" - data-dojo-type="dijit/form/ValidationTextBox" - data-dojo-props=" - name: 'queueFlowControlSizeBytes', - placeHolder: 'size in bytes', - promptMessage: 'Ceiling (in bytes) at which queue will begin to throttle sessions producing messages', - title: 'Enter the ceiling (in bytes) at which queue will begin to throttle sessions producing messages', - trim: true"/> - </div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">Resume Capacity:</div> - <div class="formLabel-controlCell"> - <input type="text" id="formAddQueue.flowResumeCapacity" - data-dojo-type="dijit/form/ValidationTextBox" - data-dojo-props=" - name: 'queueFlowResumeSizeBytes', - placeHolder: 'size in bytes', - promptMessage: 'Floor (in bytes) at which queue will cease to throttle sessions producing messages', - title: 'Enter the floor (in bytes) at which queue will cease to throttle sessions producing messages', - trim: true"/> - </div> - </div> - </fieldset> - <div class="clear"></div> - </div> - - <div class="clear formBox"> - <fieldset> - <legend>Alerting Settings</legend> - <div class="clear"> - <div class="formLabel-labelCell">Queue Depth:</div> - <div class="formLabel-controlCell"> - <input type="text" id="formAddQueue.maximumMessageCount" - data-dojo-type="dijit/form/ValidationTextBox" - data-dojo-props=" - name: 'alertThresholdQueueDepthMessages', - placeHolder: 'number of messages', - promptMessage: 'Ceiling value for number of messages on queue before alerts will be generated', - title: 'Enter the ceiling value for number of messages on queue before alerts will be generated', - trim: true"/> - </div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">Queue Depth:</div> - <div class="formLabel-controlCell"> - <input type="text" id="formAddQueue.maximumQueueDepth" - data-dojo-type="dijit/form/ValidationTextBox" - data-dojo-props=" - name: 'alertThresholdQueueDepthBytes', - placeHolder: 'total message size in bytes', - promptMessage: 'Ceiling value (in bytes) for total size of all messages on the queue before alerts will be generated', - title: 'Enter the ceiling value (in bytes) for total size of all messages on the queue before alerts will be generated', - trim: true"/> - </div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">Message Age:</div> - <div class="formLabel-controlCell"> - <input type="text" id="formAddQueue.maximumMessageAge" - data-dojo-type="dijit/form/ValidationTextBox" - data-dojo-props=" - name: 'alertThresholdMessageAge', - placeHolder: 'time in ms', - promptMessage: 'Message age (in milliseconds) above which alerts will be generated', - title: 'Enter the message age (in milliseconds) above which alerts will be generated', - trim: true"/> - </div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">Message Size:</div> - <div class="formLabel-controlCell"> - <input type="text" id="formAddQueue.maximumMessageSize" - data-dojo-type="dijit/form/ValidationTextBox" - data-dojo-props=" - name: 'alertThresholdMessageSize', - placeHolder: 'message size in bytes', - promptMessage: 'Message size (in bytes) above which alerts will be generated', - title: 'Enter the message size (in bytes) above which alerts will be generated', - trim: true"/> - </div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">Gap between alerts:</div> - <div class="formLabel-controlCell"> - <input type="text" id="formAddQueue.alertRepeatGap" - data-dojo-type="dijit/form/ValidationTextBox" - data-dojo-props=" - name: 'alertRepeatGap', - placeHolder: 'time in ms', - promptMessage: 'Minimum time (in milliseconds) between each alert', - title: 'Enter the minimum time (in milliseconds) between each alert.', - trim: true"/> - </div> - </div> - </fieldset> - <div class="clear"></div> - </div> - - <div class="clear formBox"> - <fieldset> - <legend>Other Settings</legend> - <div class="clear"> - <div class="formLabel-labelCell">Maximum Delivery Retries:</div> - <div class="formLabel-controlCell"> - <input type="text" id="formAddQueue.maximumDeliveryAttempts" - data-dojo-type="dijit/form/ValidationTextBox" - data-dojo-props=" - name: 'maximumDeliveryAttempts', - placeHolder: 'number of retries', - promptMessage: 'Maximum number of delivery attempts before the message will be sent to the alternate exchange', - title: 'Enter the maximum number of delivery attempts before the message will be sent to the alternate exchange', - trim: true"/> - </div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">Create DLQ?</div> - <div class="formLabel-controlCell"> - <input type="checkbox" id="formAddQueue.dlqEnabled" - dojoType="dijit.form.CheckBox" - data-dojo-props=" - name: 'dlqEnabled', - value: 'dlqEnabled', - title: 'Controls where a dead letter queue is automatically created', - checked: false"/> - </div> - </div> - - <div class="clear"></div> - <div class="infoMessage">Configuring maximum delivery retries on a queue which has no DLQ or alternate <br/>exchange will result in messages being discarded after the limit is reached.</div> - - <div class="clear"> - <div class="formLabel-labelCell">Message Group Key:</div> - <div class="formLabel-controlCell"> - <input type="text" id="formAddQueue.messageGroupKey" - data-dojo-type="dijit/form/ValidationTextBox" - data-dojo-props=" - name: 'messageGroupKey', - placeHolder: 'message group key', - promptMessage: 'Name of the message property used for message grouping', - title: 'Enter the name of the message property used for message grouping', - trim: true"/> - </div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">Shared Message Groups?</div> - <div class="formLabel-controlCell"> - <input type="checkbox" id="formAddQueue.messageGroupSharedGroups" - dojoType="dijit.form.CheckBox" - data-dojo-props=" - name: 'messageGroupSharedGroups', - value: 'messageGroupSharedGroups', - checked: false, - title: 'Controls where a shared groups feature is enabled'"/> - </div> - </div> - </fieldset> - <div class="clear"></div> - </div> - - <div class="clear" data-dojo-type="dijit/TitlePane" data-dojo-props="title: 'Context variables', open: false"> - <div id="formAddQueue.context" ></div> - </div> - - <div class="dijitDialogPaneActionBar qpidDialogPaneActionBar"> - <!-- submit buttons --> - <input type="submit" value="Create Queue" label="Create Queue" dojoType="dijit.form.Button" /> - </div> - - </form> - </div> -</div> diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/addStore.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/addStore.html deleted file mode 100644 index a1903d456e..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/addStore.html +++ /dev/null @@ -1,66 +0,0 @@ -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one - ~ or more contributor license agreements. See the NOTICE file - ~ distributed with this work for additional information - ~ regarding copyright ownership. The ASF licenses this file - ~ to you under the Apache License, Version 2.0 (the - ~ "License"); you may not use this file except in compliance - ~ with the License. You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, - ~ software distributed under the License is distributed on an - ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - ~ KIND, either express or implied. See the License for the - ~ specific language governing permissions and limitations - ~ under the License. - --> - -<div class="dijitHidden"> - <div data-dojo-type="dijit/Dialog" data-dojo-props="title:'Add Store'" id="addStore"> - <div id="addStore.contentPane"> - <form id="addStore.form" method="post" data-dojo-type="dijit/form/Form"> - <div class="formBox"> - <div class="clear"> - <div class="formLabel-labelCell tableContainer-labelCell">Name*:</div> - <div class="formLabel-controlCell tableContainer-valueCell"> - <input type="text" id="addStore.name" - data-dojo-type="dijit/form/ValidationTextBox" - data-dojo-props=" - name: 'name', - placeHolder: 'store name', - required: true, - promptMessage: 'Name of store, must be unique', - title: 'Enter a unique store name per broker'" /> - </div> - </div> - <div class="clear"> - <div class="formLabel-labelCell tableContainer-labelCell">Type*:</div> - <div class="tableContainer-valueCell formLabel-controlCell"> - <select id="addStore.type" data-dojo-type="dijit/form/FilteringSelect" - data-dojo-props=" - name: 'type', - required: true, - placeHolder: 'store type', - promptMessage: 'Type of store', - title: 'Select type', - searchAttr: 'name'"> - </select> - </div> - </div> - <div class="clear"> - <div id="addStore.typeFields"></div> - </div> - </div> - </form> - <div class="clear"> - </div> - </div> - - <div class="dijitDialogPaneActionBar qpidDialogPaneActionBar"> - <button data-dojo-type="dijit/form/Button" id="addStore.addButton" data-dojo-props="label: 'Save'" type="submit"></button> - <button data-dojo-type="dijit/form/Button" id="addStore.cancelButton" data-dojo-props="label: 'Cancel'" ></button> - </div> - </div> -</div> diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/addVirtualHostNodeAndVirtualHost.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/addVirtualHostNodeAndVirtualHost.html deleted file mode 100644 index a2ee2c1b4b..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/addVirtualHostNodeAndVirtualHost.html +++ /dev/null @@ -1,136 +0,0 @@ -<!-- - - - - Licensed to the Apache Software Foundation (ASF) under one - - or more contributor license agreements. See the NOTICE file - - distributed with this work for additional information - - regarding copyright ownership. The ASF licenses this file - - to you under the Apache License, Version 2.0 (the - - "License"); you may not use this file except in compliance - - with the License. You may obtain a copy of the License at - - - - http://www.apache.org/licenses/LICENSE-2.0 - - - - Unless required by applicable law or agreed to in writing, - - software distributed under the License is distributed on an - - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - - KIND, either express or implied. See the License for the - - specific language governing permissions and limitations - - under the License. - - - --> -<div class="dijitHidden"> - <div data-dojo-type="dijit.Dialog" style="width:600px;" data-dojo-props="title:'Add'" id="addVirtualHostNodeAndVirtualHost"> - <div id="addVirtualHostNodeAndVirtualHost.contentPane"> - - <!-- VHN Form --> - <form id="addVirtualHostNode.form" method="post" data-dojo-type="dijit/form/Form"> - <div class="formBox"> - <fieldset> - <legend>Virtual Host Node</legend> - <div class="clear"> - <div class="formLabel-labelCell tableContainer-labelCell">Name*:</div> - <div class="formLabel-controlCell tableContainer-valueCell"> - <input type="text" id="addVirtualHostNode.nodeName" - data-dojo-type="dijit/form/ValidationTextBox" - data-dojo-props=" - name: 'name', - placeHolder: 'node name', - required: true, - promptMessage: 'Name of node, must be unique', - title: 'Enter a unique node name per broker'" /> - </div> - </div> - <div class="clear"> - <div class="formLabel-labelCell tableContainer-labelCell">Type*:</div> - <div class="tableContainer-valueCell formLabel-controlCell"> - <select id="addVirtualHostNode.type" data-dojo-type="dijit/form/FilteringSelect" - data-dojo-props=" - name: 'type', - required: true, - disabled: true, - placeHolder: 'select virtual host node type', - promptMessage: 'Type of virtual host node', - title: 'Select virtual host node type', - searchAttr: 'name'"> - </select> - </div> - </div> - <div class="clear"></div> - - <div id="addVirtualHostNode.typeFields"></div> - - <div id="addVirtualHostNode.uploadFields" class="clear"> - <div class="formLabel-labelCell"> - <label for="addVirtualHostNode.upload">Upload virtualhost configuration from file:</label> - </div> - <div class="formLabel-controlCell"> - <input id="addVirtualHostNode.upload" type="checkbox" - data-dojo-type="dijit.form.CheckBox" - data-dojo-props=" - name: 'upload'" /> - </div> - <div id="addVirtualHostNode.fileFields" class="clear"> - <div class="formLabel-labelCell"> - <label for="addVirtualHostNode.file">Select JSON file*:</label> - </div> - <div class="tableContainer-valueCell formLabel-controlCell"> - <input type="file" id="addVirtualHostNode.file" - multiple="false" - data-dojo-type="dojox.form.Uploader" - data-dojo-props=" - label: 'Select'"/> - <span id="addVirtualHostNode.selectedFile" class="infoMessage"></span> - <span id="addVirtualHostNode.selectedFileStatus"></span> - </div> - </div> - </div> - - <div class="clear"></div> - - <div data-dojo-type="dijit/TitlePane" data-dojo-props="title: 'Context variables', open: false"> - <div id="addVirtualHostNode.context"></div> - </div> - - - </fieldset> - </div> - </form> - - <!-- VH Form --> - <form id="addVirtualHost.form" method="post" data-dojo-type="dijit/form/Form"> - <div class="formBox"> - <fieldset> - <legend>Virtual Host</legend> - <div class="clear"> - <div class="formLabel-labelCell tableContainer-labelCell">Type*:</div> - <div class="tableContainer-valueCell formLabel-controlCell"> - <select id="addVirtualHost.type" data-dojo-type="dijit/form/FilteringSelect" - data-dojo-props=" - name: 'type', - required: true, - disabled: true, - placeHolder: 'select virtual host type', - promptMessage: 'Type of virtual host', - title: 'Select virtual host type', - searchAttr: 'name'"> - </select> - </div> - </div> - <div class="clear"></div> - - <div id="addVirtualHost.typeFields"></div> - - <div data-dojo-type="dijit/TitlePane" data-dojo-props="title: 'Context variables', open: false"> - <div id="addVirtualHost.context"></div> - </div> - - </fieldset> - </div> - </form> - </div> - <div class="dijitDialogPaneActionBar qpidDialogPaneActionBar"> - <button data-dojo-type="dijit/form/Button" id="addVirtualHostNodeAndVirtualHost.addButton" data-dojo-props="label: 'Add'" type="submit"></button> - <button data-dojo-type="dijit/form/Button" id="addVirtualHostNodeAndVirtualHost.cancelButton" data-dojo-props="label: 'Cancel'" ></button> - </div> - </div> -</div> diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/addUser.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/addUser.html deleted file mode 100644 index 785605f694..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/addUser.html +++ /dev/null @@ -1,42 +0,0 @@ -<!-- - - - - Licensed to the Apache Software Foundation (ASF) under one - - or more contributor license agreements. See the NOTICE file - - distributed with this work for additional information - - regarding copyright ownership. The ASF licenses this file - - to you under the Apache License, Version 2.0 (the - - "License"); you may not use this file except in compliance - - with the License. You may obtain a copy of the License at - - - - http://www.apache.org/licenses/LICENSE-2.0 - - - - Unless required by applicable law or agreed to in writing, - - software distributed under the License is distributed on an - - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - - KIND, either express or implied. See the License for the - - specific language governing permissions and limitations - - under the License. - - - --> -<div class="dijitHidden"> - <div data-dojo-type="dijit.Dialog" style="width:600px;" data-dojo-props="title:'Add User'" id="addUser"> - <form id="formAddUser" method="post" dojoType="dijit.form.Form"> - <table cellpadding="0" cellspacing="2"> - <tr> - <td valign="top"><strong>User Name*: </strong></td> - <td><input type="text" required="true" name="name" id="formAddUser.name" placeholder="User Name" - dojoType="dijit.form.ValidationTextBox" missingMessage="A name must be supplied" /></td> - </tr> - <tr> - <td valign="top"><strong>Password*</strong></td> - <td><input type="password" required="true" name="password" id="formAddUser.password" dojoType="dijit.form.ValidationTextBox"/></td> - </tr> - </table> - <br/> - - <!-- submit buttons --> - <input type="submit" value="Create User" label="Create User" dojoType="dijit.form.Button" /> - - </form> - </div> -</div> diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/external/add.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/external/add.html deleted file mode 100644 index 11a9bf8ea0..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/external/add.html +++ /dev/null @@ -1,30 +0,0 @@ -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one - ~ or more contributor license agreements. See the NOTICE file - ~ distributed with this work for additional information - ~ regarding copyright ownership. The ASF licenses this file - ~ to you under the Apache License, Version 2.0 (the - ~ "License"); you may not use this file except in compliance - ~ with the License. You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, - ~ software distributed under the License is distributed on an - ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - ~ KIND, either express or implied. See the License for the - ~ specific language governing permissions and limitations - ~ under the License. - --> -<div class="clear"> - <div class="formLabel-labelCell tableContainer-labelCell">Use full DN:</div> - <div class="formLabel-controlCell tableContainer-valueCell"> - <input type="text" class="useFullDN" id="external.useFullDN" - data-dojo-type="dijit/form/CheckBox" - data-dojo-props=" name: 'useFullDN' " /> - </div> - <div data-dojo-type="dijit/Tooltip" - data-dojo-props="connectId: ['external.useFullDN'], - label: 'If selected, full distinguished name will be used as principal name'"> - </div> -</div> diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/external/show.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/external/show.html deleted file mode 100644 index ac065c723c..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/external/show.html +++ /dev/null @@ -1,26 +0,0 @@ -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one - ~ or more contributor license agreements. See the NOTICE file - ~ distributed with this work for additional information - ~ regarding copyright ownership. The ASF licenses this file - ~ to you under the Apache License, Version 2.0 (the - ~ "License"); you may not use this file except in compliance - ~ with the License. You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, - ~ software distributed under the License is distributed on an - ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - ~ KIND, either express or implied. See the License for the - ~ specific language governing permissions and limitations - ~ under the License. - --> -<div> - <div class="clear"> - <div class="formLabel-labelCell">Use full DN:</div> - <div ><span class="useFullDN" ></span></div> - </div> - <div class="clear"></div> -</div> - diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/filebased/add.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/filebased/add.html deleted file mode 100644 index 53eb786722..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/filebased/add.html +++ /dev/null @@ -1,31 +0,0 @@ -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one - ~ or more contributor license agreements. See the NOTICE file - ~ distributed with this work for additional information - ~ regarding copyright ownership. The ASF licenses this file - ~ to you under the Apache License, Version 2.0 (the - ~ "License"); you may not use this file except in compliance - ~ with the License. You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, - ~ software distributed under the License is distributed on an - ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - ~ KIND, either express or implied. See the License for the - ~ specific language governing permissions and limitations - ~ under the License. - --> -<div class="clear"> - <div class="formLabel-labelCell tableContainer-labelCell">Path*:</div> - <div class="formLabel-controlCell tableContainer-valueCell"> - <input type="text" class="path" - data-dojo-type="dijit/form/ValidationTextBox" - data-dojo-props=" - name: 'path', - required: true, - placeHolder: 'path/to/store', - title: 'Enter path to user store', - promptMessage: 'File system location for the users store.'"/> - </div> -</div> diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/filebased/show.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/filebased/show.html deleted file mode 100644 index 5060656964..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/filebased/show.html +++ /dev/null @@ -1,26 +0,0 @@ -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one - ~ or more contributor license agreements. See the NOTICE file - ~ distributed with this work for additional information - ~ regarding copyright ownership. The ASF licenses this file - ~ to you under the Apache License, Version 2.0 (the - ~ "License"); you may not use this file except in compliance - ~ with the License. You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, - ~ software distributed under the License is distributed on an - ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - ~ KIND, either express or implied. See the License for the - ~ specific language governing permissions and limitations - ~ under the License. - --> -<div> - <div class="clear"> - <div class="formLabel-labelCell">Path to file:</div> - <div ><span class="path" ></span></div> - </div> - <div class="clear"></div> -</div> - diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/setPassword.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/setPassword.html deleted file mode 100644 index 3d67463abd..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/setPassword.html +++ /dev/null @@ -1,42 +0,0 @@ -<!-- - - - - Licensed to the Apache Software Foundation (ASF) under one - - or more contributor license agreements. See the NOTICE file - - distributed with this work for additional information - - regarding copyright ownership. The ASF licenses this file - - to you under the Apache License, Version 2.0 (the - - "License"); you may not use this file except in compliance - - with the License. You may obtain a copy of the License at - - - - http://www.apache.org/licenses/LICENSE-2.0 - - - - Unless required by applicable law or agreed to in writing, - - software distributed under the License is distributed on an - - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - - KIND, either express or implied. See the License for the - - specific language governing permissions and limitations - - under the License. - - - --> -<div class="dijitHidden"> - <div data-dojo-type="dijit.Dialog" style="width:600px;" data-dojo-props="title:'Set Password'" id="setPassword"> - <form id="formSetPassword" method="post" dojoType="dijit.form.Form"> - <table cellpadding="0" cellspacing="2"> - <tr> - <td valign="top"><strong>User Name: </strong></td> - <td><input type="text" required="true" name="name" id="formSetPassword.name" placeholder="User Name" - dojoType="dijit.form.TextBox" enabled="false" /></td> - </tr> - <tr> - <td valign="top"><strong>Password*</strong></td> - <td><input type="password" required="true" name="password" id="formSetPassword.password" dojoType="dijit.form.ValidationTextBox"/></td> - </tr> - </table> - <br/> - - <!-- submit buttons --> - <input type="submit" value="Set Password" label="Set Password" dojoType="dijit.form.Button" /> - - </form> - </div> -</div> diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/showPrincipalDatabaseAuthenticationManager.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/showPrincipalDatabaseAuthenticationManager.html deleted file mode 100644 index e6c067fddf..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/showPrincipalDatabaseAuthenticationManager.html +++ /dev/null @@ -1,27 +0,0 @@ -<!-- - - - - Licensed to the Apache Software Foundation (ASF) under one - - or more contributor license agreements. See the NOTICE file - - distributed with this work for additional information - - regarding copyright ownership. The ASF licenses this file - - to you under the Apache License, Version 2.0 (the - - "License"); you may not use this file except in compliance - - with the License. You may obtain a copy of the License at - - - - http://www.apache.org/licenses/LICENSE-2.0 - - - - Unless required by applicable law or agreed to in writing, - - software distributed under the License is distributed on an - - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - - KIND, either express or implied. See the License for the - - specific language governing permissions and limitations - - under the License. - - - --> -<div class="PrincipalDatabaseAuthenticationManager"> - <div data-dojo-type="dijit.TitlePane" data-dojo-props="title: 'Users'"> - <div class="users"></div> - <button data-dojo-type="dijit.form.Button" class="addUserButton">Add User</button> - <button data-dojo-type="dijit.form.Button" class="deleteUserButton">Delete Users</button> - </div> -</div> diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/simpleldap/add.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/simpleldap/add.html deleted file mode 100644 index 3a3b613564..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/simpleldap/add.html +++ /dev/null @@ -1,133 +0,0 @@ -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one - ~ or more contributor license agreements. See the NOTICE file - ~ distributed with this work for additional information - ~ regarding copyright ownership. The ASF licenses this file - ~ to you under the Apache License, Version 2.0 (the - ~ "License"); you may not use this file except in compliance - ~ with the License. You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, - ~ software distributed under the License is distributed on an - ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - ~ KIND, either express or implied. See the License for the - ~ specific language governing permissions and limitations - ~ under the License. - --> -<div> - <div class="clear"> - <div class="formLabel-labelCell tableContainer-labelCell">LDAP server URL*:</div> - <div class="formLabel-controlCell tableContainer-valueCell"> - <input type="text" class="providerUrl" - data-dojo-type="dijit/form/ValidationTextBox" - data-dojo-props=" - name: 'providerUrl', - required: true, - placeHolder: 'ldap://host:port', - title: 'Enter LDAP server URL', - promptMessage: 'LDAP server URL'"/> - </div> - </div> - <div class="clear"> - <div class="formLabel-labelCell tableContainer-labelCell">LDAP authentication URL</div> - <div class="formLabel-controlCell tableContainer-valueCell"> - <input type="text" class="providerAuthUrl" - data-dojo-type="dijit/form/ValidationTextBox" - data-dojo-props=" - name: 'providerAuthUrl', - placeHolder: 'ldap://host:port', - title: 'Enter optional LDAP authentication URL', - promptMessage: 'URL of LDAP server for performing \'ldap bind\'. If not specified, the LDAP server URL will be used for both searches and authentications'"/> - </div> - </div> - <div class="clear"> - <div class="formLabel-labelCell tableContainer-labelCell">Trust Store:</div> - <div class="tableContainer-valueCell formLabel-controlCell"> - <select class="trustStore" data-dojo-type="dijit/form/FilteringSelect" - data-dojo-props=" - required: false, - name: 'trustStore', - placeHolder: 'Select trust store', - promptMessage: 'Select the trust store containing the certificate of the CA that signs to LDAP servers certificate', - title: 'Select trust store for secure connection', - searchAttr: 'name'"> - </select> - </div> - </div> - <div class="clear"> - <div class="formLabel-labelCell tableContainer-labelCell">Search context*:</div> - <div class="formLabel-controlCell tableContainer-valueCell"> - <input type="text" class="searchContext" - data-dojo-type="dijit/form/ValidationTextBox" - data-dojo-props=" - name: 'searchContext', - required: true, - placeHolder: 'dc=users,dc=example,dc=com', - title: 'Enter search context', - promptMessage: 'Identifies the entry that is the base of the subtree containing users'"/> - </div> - </div> - <div class="clear"> - <div class="formLabel-labelCell tableContainer-labelCell">Search filter*:</div> - <div class="formLabel-controlCell tableContainer-valueCell"> - <input type="text" class="searchFilter" - data-dojo-type="dijit/form/ValidationTextBox" - data-dojo-props=" - name: 'searchFilter', - required: true, - placeHolder: '(uid={0})', - title: 'Enter user search filter ', - promptMessage: 'Filter expression used to locate users within the subtree. {0} will be replaced by the user id.'"/> - </div> - </div> - <div class="clear"> - <div class="formLabel-labelCell tableContainer-labelCell">Search username:</div> - <div class="formLabel-controlCell tableContainer-valueCell"> - <input type="text" class="searchUsername" - data-dojo-type="dijit/form/ValidationTextBox" - data-dojo-props=" - name: 'searchUsername', - placeHolder: 'username', - title: 'Enter username for authenticated search', - promptMessage: 'The username used to authenticate to the directory in order to perform the search. If not specified, an anonymous bind is used to perform the search'"/> - </div> - </div> - <div class="clear"> - <div class="formLabel-labelCell tableContainer-labelCell">Search password:</div> - <div class="formLabel-controlCell tableContainer-valueCell"> - <input type="password" class="searchPassword" - data-dojo-type="dijit/form/ValidationTextBox" - data-dojo-props=" - name: 'searchPassword', - placeHolder: '****', - title: 'Enter password for authenticated search', - promptMessage: 'The password to be used with the search username'"/> - </div> - </div> - <div class="clear"> - <div class="formLabel-labelCell tableContainer-labelCell">Authenticate without search:</div> - <div class="formLabel-controlCell tableContainer-valueCell"> - <input type="text" class="bindWithoutSearch" id="addAuthenticationProvider.simpleldap.bindWithoutSearch" - data-dojo-type="dijit/form/CheckBox" - data-dojo-props=" name: 'bindWithoutSearch' " /> - </div> - </div> - <div data-dojo-type="dijit/Tooltip" - data-dojo-props="connectId: ['addAuthenticationProvider.simpleldap.bindWithoutSearch'], - label: 'If selected, the provider will not search the directory'"> - </div> - <div class="clear"> - <div class="formLabel-labelCell tableContainer-labelCell">LDAP Context Factory:</div> - <div class="formLabel-controlCell tableContainer-valueCell"> - <input type="text" class="ldapContextFactory" - data-dojo-type="dijit/form/ValidationTextBox" - data-dojo-props=" - name: 'ldapContextFactory', - placeHolder: 'com.sun.jndi.ldap.LdapCtxFactory', - title: 'Enter fully qualified class name for LDAP Context Factory', - promptMessage: 'Fully qualified class name for LDAP Context Factory'"/> - </div> - </div> -</div> diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/simpleldap/show.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/simpleldap/show.html deleted file mode 100644 index e2f1da32af..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/simpleldap/show.html +++ /dev/null @@ -1,58 +0,0 @@ -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one - ~ or more contributor license agreements. See the NOTICE file - ~ distributed with this work for additional information - ~ regarding copyright ownership. The ASF licenses this file - ~ to you under the Apache License, Version 2.0 (the - ~ "License"); you may not use this file except in compliance - ~ with the License. You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, - ~ software distributed under the License is distributed on an - ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - ~ KIND, either express or implied. See the License for the - ~ specific language governing permissions and limitations - ~ under the License. - --> -<div> - <div class="clear"> - <div class="formLabel-labelCell">LDAP server URL:</div> - <div ><span class="providerUrl" ></span></div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">Search context:</div> - <div><span class="searchContext" ></span></div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">Search filter:</div> - <div><span class="searchFilter" ></span></div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">Search user name:</div> - <div><span class="searchUsername" ></span></div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">Search password:</div> - <div><span class="searchPassword" ></span></div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">Trust Store:</div> - <div><span class="trustStore" ></span></div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">Bind without search:</div> - <div><span class="bindWithoutSearch" ></span></div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">LDAP Context Factory:</div> - <div><span class="ldapContextFactory" ></span></div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">LDAP authentication URL:</div> - <div><span class="providerAuthUrl" ></span></div> - </div> - <div class="clear"></div> -</div> - diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/common/ContextVariablesEditor.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/common/ContextVariablesEditor.html deleted file mode 100644 index 60fc0843eb..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/common/ContextVariablesEditor.html +++ /dev/null @@ -1,35 +0,0 @@ -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one - ~ or more contributor license agreements. See the NOTICE file - ~ distributed with this work for additional information - ~ regarding copyright ownership. The ASF licenses this file - ~ to you under the Apache License, Version 2.0 (the - ~ "License"); you may not use this file except in compliance - ~ with the License. You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, - ~ software distributed under the License is distributed on an - ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - ~ KIND, either express or implied. See the License for the - ~ specific language governing permissions and limitations - ~ under the License. - --> -<div class="contextEditor"> - <div class="contextGrid"> - <div class="grid"></div> - </div> - <div> - <button data-dojo-type="dijit/form/Button" class="addButton" type="button" data-dojo-props="title:'Add new entry'">+</button> - <button data-dojo-type="dijit/form/Button" class="deleteButton" type="button" data-dojo-props="title:'Remove selected entry'">-</button> - <span class="dijit dijitReset dijitInline"> - <label>Show</label> - <select class="filter" name="filter" data-dojo-type="dijit/form/Select"> - <option value="*" selected="selected">All</option> - <option value="false">Local</option> - <option value="true" >Inherited</option> - </select> - </span> - </div> -</div>
\ No newline at end of file diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/common/ResourceWidget.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/common/ResourceWidget.html deleted file mode 100644 index e47fa6ca6d..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/common/ResourceWidget.html +++ /dev/null @@ -1,48 +0,0 @@ -<!-- - - - - Licensed to the Apache Software Foundation (ASF) under one - - or more contributor license agreements. See the NOTICE file - - distributed with this work for additional information - - regarding copyright ownership. The ASF licenses this file - - to you under the Apache License, Version 2.0 (the - - "License"); you may not use this file except in compliance - - with the License. You may obtain a copy of the License at - - - - http://www.apache.org/licenses/LICENSE-2.0 - - - - Unless required by applicable law or agreed to in writing, - - software distributed under the License is distributed on an - - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - - KIND, either express or implied. See the License for the - - specific language governing permissions and limitations - - under the License. - - - --> - -<div class="dijit dijitReset dijitInline dijitLeft" id="widget_${id}" role="presentation"> - <input type="text" name="${name}_resourceLocation" - data-dojo-attach-point="resourceLocation,textbox,focusNode" - data-dojo-type="dijit/form/ValidationTextBox" - data-dojo-props="required:true,disabled:false"/> - - <div data-dojo-attach-point="uploadFields"> - <div data-dojo-attach-point="uploadData" style="width:auto;overflow:hidden;text-align:right"> - <span data-dojo-attach-point="selectedFile" class="infoMessage"></span> - <span data-dojo-attach-point="selectedFileStatus"></span> - </div> - <div style="text-align:right"> - <span data-dojo-attach-point="blah"></span> - <input name="${name}_uploadedFile" multiple="false" type="file" id="uploader_${id}" - data-dojo-attach-point="uploader" - data-dojo-type="dojox/form/Uploader" - data-dojo-props="label: 'Upload'"/> - <button data-dojo-attach-point="clearButton" data-dojo-type="dijit/form/Button" - data-dojo-props="label: 'Clear', disabled: true"/>Clear</button> - - </div> - <div class="clear"></div> - </div> - <div data-dojo-attach-point="unsupportedWarning" class="infoMessage hidden clear" style="overflow:scroll;"> - File upload requires a more recent browser with HTML5 support - </div> -</div> diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/common/TimeZoneSelector.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/common/TimeZoneSelector.html deleted file mode 100644 index 2b2fca7d8a..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/common/TimeZoneSelector.html +++ /dev/null @@ -1,66 +0,0 @@ -<!-- - - - - Licensed to the Apache Software Foundation (ASF) under one - - or more contributor license agreements. See the NOTICE file - - distributed with this work for additional information - - regarding copyright ownership. The ASF licenses this file - - to you under the Apache License, Version 2.0 (the - - "License"); you may not use this file except in compliance - - with the License. You may obtain a copy of the License at - - - - http://www.apache.org/licenses/LICENSE-2.0 - - - - Unless required by applicable law or agreed to in writing, - - software distributed under the License is distributed on an - - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - - KIND, either express or implied. See the License for the - - specific language governing permissions and limitations - - under the License. - - - --> -<table cellpadding="0" cellspacing="2"> - <tr> - <td class="labelClass"><strong>Use UTC time:</strong></td> - <td> - <input type="checkbox" class='utcSelector' name="utc" data-dojo-type="dijit/form/CheckBox" value="UTC"></input> - </td> - </tr> - <tr> - <td class="labelClass"><strong>Time Zone:</strong></td> - <td> - <table cellpadding="0" cellspacing="2"> - <tr> - <td>Region</td> - <td><select class='timezoneRegion' name="region" data-dojo-type="dijit/form/FilteringSelect" - data-dojo-props=" - placeholder: 'Select region', - required: true, - missingMessage: 'A region must be supplied', - title: 'Select region', - autoComplete: true, - value:'undefined'"> - <option value="undefined">Undefined</option> - <option value="Africa">Africa</option> - <option value="America">America</option> - <option value="Antarctica">Antarctica</option> - <option value="Arctic">Arctic</option> - <option value="Asia">Asia</option> - <option value="Atlantic">Atlantic</option> - <option value="Australia">Australia</option> - <option value="Europe">Europe</option> - <option value="Indian">Indian</option> - <option value="Pacific">Pacific</option> - </select></td> - <td>City</td> - <td><select class='timezoneCity' name="city" data-dojo-type="dijit/form/FilteringSelect" - data-dojo-props=" - placeholder: 'Select city', - required: true, - missingMessage: 'A city must be supplied', - title: 'Select city'"> - </select></td> - </tr> - </table> - </td> - </tr> -</table>
\ No newline at end of file diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/css/apidocs.css b/qpid/java/broker-plugins/management-http/src/main/java/resources/css/apidocs.css deleted file mode 100644 index 5baecf7c02..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/css/apidocs.css +++ /dev/null @@ -1,86 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -html, body { - margin-top: 20px; - margin-left: 40px; - margin-right: 40px; - padding: 0; - font-family: Lucida Sans,Lucida Grande,Arial,sans-serif !important; - font-size: 13px !important; - background: white; - color: #333; -} - -th, td { - text-align: left; -} - -.type { - font-family: "Courier New", courier, monospace; -} - -table.types td.name { - width: 20em; -} - -table.attributes td.name { - font-family: "Courier New", courier, monospace; - width: 20em; -} - -table.attributes td.type { - width: 7em; -} - -table.api td,th { - vertical-align: top; -} - - -table.api td.type { - width: 12em; -} - - -table.api td.path { - width: 20em; -} - - -table.api td.description { - width: 25em; -} - -table.api a:link { - color: #333; - text-decoration: none; -} - -table.api a:visited { - color: #666; - text-decoration: none; -} - - -div.restriction { - border-bottom: 1px dotted #666; - display: inline; -} diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/css/common.css b/qpid/java/broker-plugins/management-http/src/main/java/resources/css/common.css deleted file mode 100644 index ec31709987..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/css/common.css +++ /dev/null @@ -1,339 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -* { - outline: none !important; -} - -html, body { - height: 100%; - margin: 0; - margin-right: 40px; - padding: 0; - overflow: hidden; - font-family: Lucida Sans,Lucida Grande,Arial !important; - font-size: 13px !important; - background: white; - color: #333; -} - -.clear { - clear: both; -} - -.hidden { - display: none; -} - -#pageLayout { - height: 100%; -} -button { - -webkit-transition: background-color 0.2s linear; - border-radius:4px; - -moz-border-radius: 4px 4px 4px 4px; - -moz-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.15); - background-color: #E4F2FF; - background-position: center top; - background-repeat: repeat-x; - border: 1px solid #769DC0; - padding: 2px 8px 4px; - font-size:1em; -} - -button:hover { - background-color: #AFD9FF; - color: #000000; -} - -h1 { - font-size:1.5em; -} - -.header { - height:100px; - background:url("../images/qpid-logo.png") left center no-repeat -} - -.logo { - text-align:left; - vertical-align: top; - font-weight:600; - height: 90px; - padding-left: 200px; - padding-top: 1px; - padding-bottom: 10px; - font-size:14px; - font-family:"Verdana", cursive; -} - -.footer { - color:#000000; - clear:both; - text-align:center; - font-size:11px; - line-height:17px; - -} - -div .messages { - width: 100%; - height: 350px; -} - -.formBox { - margin: 10px 5px; -} - -.formBox legend { - font-weight: bold; - margin-left: 5px; - background-color: white; -} - -.formBox fieldset { - padding: 5px; - border: .1em solid lightgrey; - border-radius: 5px; -} - -.formLabel-labelCell, .tableContainer-labelCell { - width: 300px; - font-weight: bold; -} - -.tableContainer-labelCell { - float: none; -} - -.formLabel-labelCell { - margin-left: 5px; - float: left; - } - -.formValue-valueCell { - float: left; -} - -.formBox .addPermittedNodeList { - width: 15em; -} - -.formBox .addPermittedNodeList select { - width: 100%; -} - -.formLabel-controlCell { - padding: 1px; - float: left; -} - -.columnDefDialogButtonIcon { - background: url("../dojo/dojox/grid/enhanced/resources/images/sprite_icons.png") no-repeat; - background-position: -260px 2px; - width: 14px; - height: 14px; -} - -.logViewerIcon { - background: url("../images/log-viewer.png") no-repeat; - width: 14px; - height: 16px; -} - -.downloadLogsIcon { - background: url("../images/download.png") no-repeat; - width: 14px; - height: 14px; -} - -.dojoxGridFBarClearFilterButtontnIcon -{ - background: url("../dojo/dojox/grid/enhanced/resources/images/sprite_icons.png") no-repeat; - background-position: -120px -18px; - width: 14px; - height: 14px; -} - -.rowNumberLimitIcon -{ - background: url("../dojo/dojox/grid/enhanced/resources/images/sprite_icons.png") no-repeat; - background-position: -240px -18px; - width: 14px; - height: 14px; -} - -.gridRefreshIcon -{ - background: url("../images/refresh.png") no-repeat; - width: 16px; - height: 16px; -} - -.gridAutoRefreshIcon -{ - background: url("../images/auto-refresh.png") no-repeat; - width: 16px; - height: 16px; -} - -.redBackground tr{ background-color:#ffdcd7 !important; background-image: none !important;} -.yellowBackground tr{background-color:#fbfddf !important; background-image: none !important;} -.grayBackground tr{background-color:#eeeeee !important; background-image: none !important;} -.dojoxGridRowOdd.grayBackground tr{ background-color:#e9e9e9 !important; background-image: none !important;} -.dojoxGridRowOdd.yellowBackground tr{background-color:#fafdd5 !important; background-image: none !important;} -.dojoxGridRowOdd.redBackground tr{background-color:#f4c1c1 !important; background-image: none !important;} - -.preferencesIcon -{ - background: url("../images/gear.png") no-repeat; - width: 16px; - height: 16px; -} - -.helpIcon -{ - background: url("../images/help.png") no-repeat; - width: 16px; - height: 16px; -} - -.loadingIcon -{ - background: url("../dojo/dojox/image/resources/images/loading.gif") no-repeat; - width: 16px; - height: 16px; - background-size: contain; - display: inline-block; -} - -.loadedIcon -{ - background: url("../dojo/dijit/icons/images/commonIconsObjActEnabled_rtl.png") no-repeat; - background-position: -352px -0px; - width: 16px; - height: 16px; - display: inline-block; -} - -.fileUpload -{ - float: right; - padding: 5px; -} - -.infoMessage -{ - padding: 5px; - font-style: italic; -} - -.alignLeft { - float: left; - display: inline-block; -} - -.alignRight { - float: right; - display: inline-block; -} - -.multiLineValue { - display: inline-block; -} - -.haOptionLabel { - font-weight: bold; - margin-left: 5px; -} - -.editNoteBanner { - font-style: italic; - margin: 0px 0px 10px 5px; -} - -#errorDialog { - overflow: auto; - width: 400px; -} - -.errorDialogErrorPrimary { - font-weight: bold; - margin-bottom: 10px; - max-width: 350px; -} - -.errorDialogErrorSecondary { - font-style: italic; -} - -/* Required to keep queue type radio buttons on one line when dialog adds scrollbar */ -#addQueue { - overflow: auto; - width: 630px; -} - -#authenticatedUserControls { - max-width: 300px; -} - -.claro .dojoxCheckedMultiSelectWrapper { - height: auto; -} - -.claro .dojoxCheckedMultiSelect .dojoxCheckedMultiSelectWrapper { - border: none; - background-color: transparent; -} - -.dijitMultiSelect { - width : 14.75em; -} - -.highlightedText -{ - font-weight: bold; -} - -.normalText -{ - font-weight: normal; -} - -.contextEditor -{ - margin-left:5px; - margin-right:5px; -} - -.contextGrid -{ - width:100%; - max-height: 140px; - overflow: auto; -} - -.qpidDialogPaneActionBar -{ - margin-left:-10px; - margin-right:-10px; - margin-bottom:-10px; - margin-top:5px; -}
\ No newline at end of file diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/editBroker.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/editBroker.html deleted file mode 100644 index 993a2c7505..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/editBroker.html +++ /dev/null @@ -1,119 +0,0 @@ -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one - ~ or more contributor license agreements. See the NOTICE file - ~ distributed with this work for additional information - ~ regarding copyright ownership. The ASF licenses this file - ~ to you under the Apache License, Version 2.0 (the - ~ "License"); you may not use this file except in compliance - ~ with the License. You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, - ~ software distributed under the License is distributed on an - ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - ~ KIND, either express or implied. See the License for the - ~ specific language governing permissions and limitations - ~ under the License. - --> -<div class="dijitHidden"> - <div data-dojo-type="dijit/Dialog" data-dojo-props="title:'Edit Broker'" id="editBrokerDialog"> - <form id="editBrokerForm" method="post" data-dojo-type="dijit/form/Form"> - <div id="editBroker.allFields"> - <div id="editBroker.contentPane"> - <div class="clear"> - <div class="formLabel-labelCell tableContainer-labelCell">Name*:</div> - <div class="formLabel-controlCell tableContainer-valueCell"> - <input type="text" id="editBroker.name" - data-dojo-type="dijit/form/ValidationTextBox" - data-dojo-props=" - name: 'name', - placeHolder: 'name', - required: true, - disabled: false, - trim: true, - promptMessage: 'Identifies the broker instance.', - title: 'Enter broker name'" /> - </div> - </div> - <div class="clear"> - <div class="formLabel-labelCell tableContainer-labelCell">Default Virtual Host*:</div> - <div class="formLabel-controlCell tableContainer-valueCell"> - <input type="text" id="editBroker.defaultVirtualHost" - data-dojo-type="dijit/form/FilteringSelect" - data-dojo-props=" - name: 'defaultVirtualHost', - required: true, - promptMessage: 'Default virtual host used for clients that do not specify one when connecting.', - title: 'Select default virtual host' " /> - </div> - </div> - <div class="clear"> - <div class="formLabel-labelCell tableContainer-labelCell">Statistics reporting period (ms):</div> - <div class="formLabel-controlCell tableContainer-valueCell"> - <input type="text" id="editBroker.statisticsReportingPeriod" - data-dojo-type="dijit/form/ValidationTextBox" - data-dojo-props=" - name: 'statisticsReportingPeriod', - trim: true, - placeholder: 'Time in ms', - label: 'Statistics reporting period (ms):', - promptMessage: 'Frequency with which statistics are reported to broker log.'" /> - </div> - </div> - <div class="clear"> - <div class="formLabel-labelCell tableContainer-labelCell">Statistics reporting period enabled:</div> - <div class="formLabel-controlCell tableContainer-valueCell"> - <input type="text" id="editBroker.statisticsReportingResetEnabled" - data-dojo-type="dijit/form/CheckBox" - data-dojo-props=" name: 'statisticsReportingResetEnabled' " /> - </div> - </div> - - <div class="clear formBox"> - <fieldset> - <legend>Global Connection Defaults</legend> - <div class="clear"> - <div class="formLabel-labelCell tableContainer-labelCell">Maximum number of sessions:</div> - <div class="tableContainer-valueCell formLabel-controlCell"> - <input data-dojo-type="dijit/form/ValidationTextBox" - id="editBroker.connection.sessionCountLimit" - data-dojo-props=" - name: 'connection.sessionCountLimit', - placeHolder: 'Number of sessions', - trim: true, - promptMessage: 'Maximum number of sessions per connection' "/> - </div> - </div> - <div class="clear"> - <div class="formLabel-labelCell tableContainer-labelCell">Heart beat delay (ms)::</div> - <div class="tableContainer-valueCell formLabel-controlCell"> - <input data-dojo-type="dijit/form/ValidationTextBox" - id="editBroker.connection.heartBeatDelay" - data-dojo-props=" - name: 'connection.heartBeatDelay', - trim: true, - invalidMessage: 'Invalid value', - placeHolder: 'Time in ms', - promptMessage: 'Interval between heart beat messages exchanged between broker and clients'"/> - </div> - </div> - </fieldset> - </div> - - <div data-dojo-type="dijit/TitlePane" data-dojo-props="title: 'Context variables', open: false"> - <div id="editBroker.context" - data-dojo-type="qpid/common/ContextVariablesEditor" - data-dojo-props="name: 'context', title: 'Context variables'" ></div> - </div> - - <div class="clear"></div> - </div> - <div class="dijitDialogPaneActionBar qpidDialogPaneActionBar"> - <button data-dojo-type="dijit/form/Button" id="editBroker.saveButton" data-dojo-props="label: 'Save'">Save</button> - <button data-dojo-type="dijit/form/Button" id="editBroker.cancelButton" data-dojo-props="label: 'Cancel'" ></button> - </div> - </div> - </form> - </div> -</div> diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/editQueue.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/editQueue.html deleted file mode 100644 index e7b33ed6f9..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/editQueue.html +++ /dev/null @@ -1,300 +0,0 @@ -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one - ~ or more contributor license agreements. See the NOTICE file - ~ distributed with this work for additional information - ~ regarding copyright ownership. The ASF licenses this file - ~ to you under the Apache License, Version 2.0 (the - ~ "License"); you may not use this file except in compliance - ~ with the License. You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, - ~ software distributed under the License is distributed on an - ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - ~ KIND, either express or implied. See the License for the - ~ specific language governing permissions and limitations - ~ under the License. - --> -<div class="dijitHidden"> - <div data-dojo-type="dijit.Dialog" data-dojo-props="title:'Edit Queue'" id="editQueue"> - <form id="formEditQueue" method="post" dojoType="dijit.form.Form"> - <div id="formEditQueue.allFields"> - <div id="formEditQueue.contentPane"> - <div class="editNoteBanner">NOTE: All changes will only take effect after Virtual Host restart.</div> - <div class="clear"> - <div class="formLabel-labelCell">Queue Name:</div> - <div class="formLabel-controlCell"> - <input type="text" id="formEditQueue.name" - data-dojo-type="dijit/form/ValidationTextBox" - data-dojo-props=" - name: 'name', - placeHolder: 'queue name', - required: true, - promptMessage: 'Name of queue', - disabled: 'true'"/> - </div> - </div> - - <div class="clear"> - <div class="formLabel-labelCell">Queue Type:</div> - <div class="formLabel-controlCell"> - <input type="text" id="formEditQueue.type" - data-dojo-type="dijit/form/ValidationTextBox" - data-dojo-props=" - name: 'type', - placeHolder: 'queue type', - required: true, - promptMessage: 'Type of queue', - disabled: 'true'"/> - </div> - </div> - <div class="clear"></div> - - <div id="formEditQueueType:priority" class="hidden typeSpecificDiv"> - <div class="clear"> - <div class="formLabel-labelCell">Priorities:</div> - <div class="formLabel-controlCell"> - <input type="text" id="formEditQueue.priorities" - data-dojo-type="dijit/form/ValidationTextBox" - data-dojo-props=" - name: 'priorities', - disabled: 'true', - promptMessage: 'Number of priorities supported by the queue', - title: 'Enter the number of priorities supported by the queue', - trim: true"/> - </div> - </div> - <div class="clear"></div> - </div> - - <div id="formEditQueueType:lvq" class="hidden typeSpecificDiv"> - <div class="clear"> - <div class="formLabel-labelCell">LVQ Message Property:</div> - <div class="formLabel-controlCell"> - <input type="text" id="formEditQueue.lvqKey" - data-dojo-type="dijit/form/ValidationTextBox" - data-dojo-props=" - name: 'lvqKey', - disabled: 'true', - promptMessage: 'Name of the message property used to perform the conflation', - title: 'Enter the name of the message property used to perform the conflation', - trim: true"/> - </div> - </div> - <div class="clear"></div> - </div> - - <div id="formEditQueueType:sorted" class="hidden typeSpecificDiv"> - <div class="clear"> - <div class="formLabel-labelCell">Sort Message Property*:</div> - <div class="formLabel-controlCell"> - <input type="text" id="formEditQueue.sortKey" - data-dojo-type="dijit/form/ValidationTextBox" - data-dojo-props=" - name: 'sortKey', - disabled: 'true', - promptMessage: 'Name of the message property used for sorting the messages on the queue', - title: 'Enter the name of the message property used for sorting the messages on the queue', - trim: true"/> - </div> - </div> - <div class="clear"></div> - </div> - - <div class="clear"> - <div class="formLabel-labelCell">Durable?</div> - <div class="formLabel-controlCell"> - <input type="checkbox" id="formEditQueue.durable" - dojoType="dijit.form.CheckBox" - data-dojo-props=" - name: 'durable', - value: 'durable', - disabled: 'true'"/> - </div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">Persist Messages?</div> - <div class="formLabel-controlCell"> - <select id="formEditQueue.messageDurability" - dojoType="dijit.form.FilteringSelect" - data-dojo-props=" - name: 'messageDurability', - value: '', - searchAttr: 'name', - required: false, - promptMessage: 'Message persistence override. If not default, messages arriving will have persistence setting overridden', - title: 'Enter message persistence override'"> - <option value="ALWAYS">Always</option> - <option value="DEFAULT">Default</option> - <option value="NEVER">Never</option> - </select> - </div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">Maximum Ttl:</div> - <div class="formLabel-controlCell"> - <input type="text" id="formEditQueue.maximumMessageTtl" - data-dojo-type="dijit/form/ValidationTextBox" - data-dojo-props=" - name: 'maximumMessageTtl', - placeHolder: 'ttl in ms', - promptMessage: 'Maximum message time to live (ttl) in ms. Messages arriving with larger ttl values will be overridden by this value', - title: 'Enter the maximum message time to live in milliseconds', - trim: true"/> - </div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">Minimum Ttl:</div> - <div class="formLabel-controlCell"> - <input type="text" id="formEditQueue.minimumMessageTtl" - data-dojo-type="dijit/form/ValidationTextBox" - data-dojo-props=" - name: 'minimumMessageTtl', - placeHolder: 'ttl in ms', - promptMessage: 'Minimum message time to live (ttl) in ms. Messages arriving with smaller ttl values will be overridden by this value', - title: 'Enter the minimum message time to live in milliseconds', - trim: true"/> - </div> - </div> - - <div class="clear"></div> - - <div class="clear formBox"> - <fieldset> - <legend>Flow Control Settings</legend> - <div class="clear"> - <div class="formLabel-labelCell">Capacity:</div> - <div class="formLabel-controlCell"> - <input type="text" id="formEditQueue.queueFlowControlSizeBytes" - data-dojo-type="dijit/form/ValidationTextBox" - data-dojo-props=" - name: 'queueFlowControlSizeBytes', - placeHolder: 'size in bytes', - promptMessage: 'Ceiling (in bytes) at which queue will begin to throttle sessions producing messages', - title: 'Enter the ceiling (in bytes) at which queue will begin to throttle sessions producing messages', - trim: true"/> - </div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">Resume Capacity:</div> - <div class="formLabel-controlCell"> - <input type="text" id="formEditQueue.queueFlowResumeSizeBytes" - data-dojo-type="dijit/form/ValidationTextBox" - data-dojo-props=" - name: 'queueFlowResumeSizeBytes', - placeHolder: 'size in bytes', - promptMessage: 'Floor (in bytes) at which queue will cease to throttle sessions producing messages', - title: 'Enter the floor (in bytes) at which queue will cease to throttle sessions producing messages', - trim: true"/> - </div> - </div> - </fieldset> - <div class="clear"></div> - </div> - - <div class="clear formBox"> - <fieldset> - <legend>Alerting Settings</legend> - <div class="clear"> - <div class="formLabel-labelCell">Queue Depth:</div> - <div class="formLabel-controlCell"> - <input type="text" id="formEditQueue.alertThresholdQueueDepthMessages" - data-dojo-type="dijit/form/ValidationTextBox" - data-dojo-props=" - name: 'alertThresholdQueueDepthMessages', - placeHolder: 'number of messages', - promptMessage: 'Ceiling value for number of messages on queue before alerts will be generated', - title: 'Enter the ceiling value for number of messages on queue before alerts will be generated', - trim: true"/> - </div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">Queue Depth:</div> - <div class="formLabel-controlCell"> - <input type="text" id="formEditQueue.alertThresholdQueueDepthBytes" - data-dojo-type="dijit/form/ValidationTextBox" - data-dojo-props=" - name: 'alertThresholdQueueDepthBytes', - placeHolder: 'total message size in bytes', - promptMessage: 'Ceiling value (in bytes) for total size of all messages on the queue before alerts will be generated', - title: 'Enter the ceiling value (in bytes) for total size of all messages on the queue before alerts will be generated', - trim: true"/> - </div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">Message Age:</div> - <div class="formLabel-controlCell"> - <input type="text" id="formEditQueue.alertThresholdMessageAge" - data-dojo-type="dijit/form/ValidationTextBox" - data-dojo-props=" - name: 'alertThresholdMessageAge', - placeHolder: 'time in ms', - promptMessage: 'Message age (in milliseconds) above which alerts will be generated', - title: 'Enter the message age (in milliseconds) above which alerts will be generated', - trim: true"/> - </div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">Message Size:</div> - <div class="formLabel-controlCell"> - <input type="text" id="formEditQueue.alertThresholdMessageSize" - data-dojo-type="dijit/form/ValidationTextBox" - data-dojo-props=" - name: 'alertThresholdMessageSize', - placeHolder: 'message size in bytes', - promptMessage: 'Message size (in bytes) above which alerts will be generated', - title: 'Enter the message size (in bytes) above which alerts will be generated', - trim: true"/> - </div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">Gap between alerts:</div> - <div class="formLabel-controlCell"> - <input type="text" id="formEditQueue.alertRepeatGap" - data-dojo-type="dijit/form/ValidationTextBox" - data-dojo-props=" - name: 'alertRepeatGap', - placeHolder: 'time in ms', - promptMessage: 'Minimum time (in milliseconds) between each alert', - title: 'Enter the minimum time (in milliseconds) between each alert.', - trim: true"/> - </div> - </div> - </fieldset> - <div class="clear"></div> - </div> - - <div class="clear formBox"> - <fieldset> - <legend>Other Settings</legend> - <div class="clear"> - <div class="formLabel-labelCell">Maximum Delivery Retries:</div> - <div class="formLabel-controlCell"> - <input type="text" id="formEditQueue.maximumDeliveryAttempts" - data-dojo-type="dijit/form/ValidationTextBox" - data-dojo-props=" - name: 'maximumDeliveryAttempts', - placeHolder: 'number of retries', - promptMessage: 'Maximum number of delivery attempts before the message will be sent to the alternate exchange', - title: 'Enter the maximum number of delivery attempts before the message will be sent to the alternate exchange', - trim: true"/> - </div> - </div> - </fieldset> - <div class="clear"></div> - </div> - - <div data-dojo-type="dijit/TitlePane" data-dojo-props="title: 'Context variables', open: false"> - <div id="formEditQueue.context" ></div> - </div> - </div> - <div class="dijitDialogPaneActionBar qpidDialogPaneActionBar"> - <button data-dojo-type="dijit/form/Button" id="formEditQueue.saveButton" data-dojo-props="label: 'Save'">Save</button> - <button data-dojo-type="dijit/form/Button" id="formEditQueue.cancelButton" data-dojo-props="label: 'Cancel'" ></button> - </div> - </div> - - </form> - </div> -</div> diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/editVirtualHost.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/editVirtualHost.html deleted file mode 100644 index 8e03dfdd17..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/editVirtualHost.html +++ /dev/null @@ -1,137 +0,0 @@ -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one - ~ or more contributor license agreements. See the NOTICE file - ~ distributed with this work for additional information - ~ regarding copyright ownership. The ASF licenses this file - ~ to you under the Apache License, Version 2.0 (the - ~ "License"); you may not use this file except in compliance - ~ with the License. You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, - ~ software distributed under the License is distributed on an - ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - ~ KIND, either express or implied. See the License for the - ~ specific language governing permissions and limitations - ~ under the License. - --> -<div class="dijitHidden"> - <div data-dojo-type="dijit/Dialog" data-dojo-props="title:'Edit Virtual Host'" id="editVirtualHostDialog"> - <form id="editVirtualHostForm" method="post" data-dojo-type="dijit/form/Form"> - <div id="editVirtualHost.allFields"> - <div id="editVirtualHost.contentPane"> - <div class="editNoteBanner">NOTE: All changes will only take effect after Virtual Host restart.</div> - <div class="clear"> - <div class="formLabel-labelCell tableContainer-labelCell">Name*:</div> - <div class="formLabel-controlCell tableContainer-valueCell"> - <input type="text" id="editVirtualHost.name" - data-dojo-type="dijit/form/ValidationTextBox" - data-dojo-props=" - name: 'name', - placeHolder: 'name', - required: true, - disabled: true, - title: 'Enter virtual host name'" /> - </div> - </div> - - <div id="editVirtualHost.typeFields"></div> - - <div class="clear formBox"> - <fieldset> - <legend>Store transaction settings</legend> - <div class="clear"> - <div class="formLabel-labelCell tableContainer-labelCell">Idle Timeout Warn:</div> - <div class="tableContainer-valueCell formLabel-controlCell"> - <input data-dojo-type="dijit/form/ValidationTextBox" - id="editVirtualHost.storeTransactionIdleTimeoutWarn" - name="storeTransactionIdleTimeoutWarn" - placeHolder="idle timeout warn time in ms" - promptMessage="Length of time a transaction must be idle before warnings produced"/> - </div> - </div> - <div class="clear"> - <div class="formLabel-labelCell tableContainer-labelCell">Idle Timeout Close:</div> - <div class="tableContainer-valueCell formLabel-controlCell"> - <input data-dojo-type="dijit/form/ValidationTextBox" - id="editVirtualHost.storeTransactionIdleTimeoutClose" - name="storeTransactionIdleTimeoutClose" - placeHolder="idle timeout close time in ms" - promptMessage="Length of time a transaction must be idle before the connection is closed"/> - </div> - </div> - <div class="clear"> - <div class="formLabel-labelCell tableContainer-labelCell">Open Timeout Warn:</div> - <div class="tableContainer-valueCell formLabel-controlCell"> - <input data-dojo-type="dijit/form/ValidationTextBox" - id="editVirtualHost.storeTransactionOpenTimeoutWarn" - name="storeTransactionOpenTimeoutWarn" - placeHolder="open timeout warn time in ms" - promptMessage="Length of time a transaction must be open before warnings produced"/> - </div> - </div> - <div class="clear"> - <div class="formLabel-labelCell tableContainer-labelCell">Open Timeout Close:</div> - <div class="tableContainer-valueCell formLabel-controlCell"> - <input data-dojo-type="dijit/form/ValidationTextBox" - id="editVirtualHost.storeTransactionOpenTimeoutClose" - name="storeTransactionOpenTimeoutClose" - placeHolder="open timeout close time in ms" - promptMessage="Length of time a transaction must be open before the connection is closed"/> - </div> - </div> - </fieldset> - </div> - - <div class="clear formBox"> - <fieldset> - <legend>House keeping settings</legend> - <div class="clear"> - <div class="formLabel-labelCell tableContainer-labelCell">Check period (ms):</div> - <div class="tableContainer-valueCell formLabel-controlCell"> - <input data-dojo-type="dijit/form/ValidationTextBox" - id="editVirtualHost.housekeepingCheckPeriod" - name="housekeepingCheckPeriod" - placeHolder="house keeping check period in ms" - promptMessage="Frequency with which the housekeeper runs"/> - </div> - </div> - <div class="clear"> - <div class="formLabel-labelCell tableContainer-labelCell">Thread count:</div> - <div class="tableContainer-valueCell formLabel-controlCell"> - <input data-dojo-type="dijit/form/ValidationTextBox" - id="editVirtualHost.housekeepingThreadCount" - name="housekeepingThreadCount" - placeHolder="house keeping thread count" - promptMessage="Number of threads used to perform housekeeping"/> - </div> - </div> - </fieldset> - </div> - <div class="clear"></div> - - <div class="clear"> - <div class="formLabel-labelCell tableContainer-labelCell">Dead letter queue enabled:</div> - <div class="tableContainer-valueCell formLabel-controlCell"> - <input type="checkbox" id="editVirtualHost.queue.deadLetterQueueEnabled" - data-dojo-type="dijit/form/CheckBox" - data-dojo-props="name: 'queue.deadLetterQueueEnabled'"> - </input> - </div> - </div> - - <div class="clear"></div> - - <div data-dojo-type="dijit/TitlePane" data-dojo-props="title: 'Context variables', open: false"> - <div id="editVirtualHost.context" ></div> - </div> - </div> - <div class="dijitDialogPaneActionBar qpidDialogPaneActionBar"> - <button data-dojo-type="dijit/form/Button" id="editVirtualHost.saveButton" data-dojo-props="label: 'Save'">Save</button> - <button data-dojo-type="dijit/form/Button" id="editVirtualHost.cancelButton" data-dojo-props="label: 'Cancel'" ></button> - </div> - </div> - </form> - </div> -</div> diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/editVirtualHostNode.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/editVirtualHostNode.html deleted file mode 100644 index 59597845a2..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/editVirtualHostNode.html +++ /dev/null @@ -1,56 +0,0 @@ -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one - ~ or more contributor license agreements. See the NOTICE file - ~ distributed with this work for additional information - ~ regarding copyright ownership. The ASF licenses this file - ~ to you under the Apache License, Version 2.0 (the - ~ "License"); you may not use this file except in compliance - ~ with the License. You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, - ~ software distributed under the License is distributed on an - ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - ~ KIND, either express or implied. See the License for the - ~ specific language governing permissions and limitations - ~ under the License. - --> -<div class="dijitHidden"> - <div data-dojo-type="dijit/Dialog" data-dojo-props="title:'Edit Virtual Host'" id="editVirtualHostNodeDialog"> - <form id="editVirtualHostNodeForm" method="post" data-dojo-type="dijit/form/Form"> - <div id="editVirtualHostNode.allFields"> - <div id="editVirtualHostNode.contentPane"> - <div class="editNoteBanner">NOTE: All changes will only take effect after Virtual Host Node restart.</div> - <div class="clear"> - <div class="formLabel-labelCell tableContainer-labelCell">Name*:</div> - <div class="formLabel-controlCell tableContainer-valueCell"> - <input type="text" id="editVirtualHostNode.name" - data-dojo-type="dijit/form/ValidationTextBox" - data-dojo-props=" - name: 'name', - placeHolder: 'name', - required: true, - missingMessage: 'Name must be supplied', - disabled: true, - title: 'Enter virtual host name'" /> - </div> - </div> - - <div id="editVirtualHostNode.typeFields"></div> - - <div class="clear"></div> - - <div data-dojo-type="dijit/TitlePane" data-dojo-props="title: 'Context variables', open: false"> - <div id="editVirtualHostNode.context" ></div> - </div> - </div> - </div> - - <div class="dijitDialogPaneActionBar qpidDialogPaneActionBar"> - <button data-dojo-type="dijit/form/Button" id="editVirtualHostNode.saveButton" data-dojo-props="label: 'Save'">Save</button> - <button data-dojo-type="dijit/form/Button" id="editVirtualHostNode.cancelButton" data-dojo-props="label: 'Cancel'" ></button> - </div> - </form> - </div> -</div> diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/footer.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/footer.html deleted file mode 100644 index 44fa4fda36..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/footer.html +++ /dev/null @@ -1,28 +0,0 @@ -<!-- - - - - Licensed to the Apache Software Foundation (ASF) under one - - or more contributor license agreements. See the NOTICE file - - distributed with this work for additional information - - regarding copyright ownership. The ASF licenses this file - - to you under the Apache License, Version 2.0 (the - - "License"); you may not use this file except in compliance - - with the License. You may obtain a copy of the License at - - - - http://www.apache.org/licenses/LICENSE-2.0 - - - - Unless required by applicable law or agreed to in writing, - - software distributed under the License is distributed on an - - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - - KIND, either express or implied. See the License for the - - specific language governing permissions and limitations - - under the License. - - - --> - -<div class="footer"><p>© 2004-<span class="currentYear">2015</span> The Apache Software Foundation. - <br/> - Apache Qpid, Qpid, Apache, the Apache feather logo, and the Apache Qpid project logo are trademarks of - The Apache Software Foundation. - <br/> - All other marks mentioned may be trademarks or registered trademarks of their respective owners. -</div> diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/grid/showColumnDefDialog.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/grid/showColumnDefDialog.html deleted file mode 100644 index 535b9a1fe5..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/grid/showColumnDefDialog.html +++ /dev/null @@ -1,32 +0,0 @@ -<!-- - - - - Licensed to the Apache Software Foundation (ASF) under one - - or more contributor license agreements. See the NOTICE file - - distributed with this work for additional information - - regarding copyright ownership. The ASF licenses this file - - to you under the Apache License, Version 2.0 (the - - "License"); you may not use this file except in compliance - - with the License. You may obtain a copy of the License at - - - - http://www.apache.org/licenses/LICENSE-2.0 - - - - Unless required by applicable law or agreed to in writing, - - software distributed under the License is distributed on an - - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - - KIND, either express or implied. See the License for the - - specific language governing permissions and limitations - - under the License. - - - --> -<div> - <div> - <div>Select columns to display:</div> - <div class="columnList"></div> - </div> - <div class="dijitDialogPaneActionBar qpidDialogPaneActionBar"> - <button value="Display" data-dojo-type="dijit.form.Button" - class="displayButton" data-dojo-props="label: 'Display' "></button> - <button value="Cancel" data-dojo-type="dijit.form.Button" data-dojo-props="label: 'Cancel'" - class="cancelButton"></button> - </div> -</div> diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/grid/showRowNumberLimitDialog.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/grid/showRowNumberLimitDialog.html deleted file mode 100644 index cacdf49e66..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/grid/showRowNumberLimitDialog.html +++ /dev/null @@ -1,33 +0,0 @@ -<!-- - - - - Licensed to the Apache Software Foundation (ASF) under one - - or more contributor license agreements. See the NOTICE file - - distributed with this work for additional information - - regarding copyright ownership. The ASF licenses this file - - to you under the Apache License, Version 2.0 (the - - "License"); you may not use this file except in compliance - - with the License. You may obtain a copy of the License at - - - - http://www.apache.org/licenses/LICENSE-2.0 - - - - Unless required by applicable law or agreed to in writing, - - software distributed under the License is distributed on an - - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - - KIND, either express or implied. See the License for the - - specific language governing permissions and limitations - - under the License. - - - --> -<div> - <div> - <div>Set the maximum number of rows to cache and display:</div> - <input class="rowNumberLimit" data-dojo-type="dijit.form.NumberSpinner" - data-dojo-props="invalidMessage: 'Invalid value', required: true, smallDelta: 1,mconstraints: {min:1,max:65535,places:0, pattern: '#####'}, label: 'Maximum number of rows:', name: 'rowNumberLimit'"></input> - </div> - <div class="dijitDialogPaneActionBar qpidDialogPaneActionBar"> - <button value="Submit" data-dojo-type="dijit.form.Button" - class="submitButton" data-dojo-props="label: 'Submit' "></button> - <button value="Cancel" data-dojo-type="dijit.form.Button" data-dojo-props="label: 'Cancel'" - class="cancelButton"></button> - </div> -</div> diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/group/addGroupMember.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/group/addGroupMember.html deleted file mode 100644 index e479e8cb74..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/group/addGroupMember.html +++ /dev/null @@ -1,38 +0,0 @@ -<!-- - - - - Licensed to the Apache Software Foundation (ASF) under one - - or more contributor license agreements. See the NOTICE file - - distributed with this work for additional information - - regarding copyright ownership. The ASF licenses this file - - to you under the Apache License, Version 2.0 (the - - "License"); you may not use this file except in compliance - - with the License. You may obtain a copy of the License at - - - - http://www.apache.org/licenses/LICENSE-2.0 - - - - Unless required by applicable law or agreed to in writing, - - software distributed under the License is distributed on an - - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - - KIND, either express or implied. See the License for the - - specific language governing permissions and limitations - - under the License. - - - --> -<div class="dijitHidden"> - <div data-dojo-type="dijit.Dialog" style="width:600px;" data-dojo-props="title:'Add Group Member'" id="addGroupMember"> - <form id="formAddGroupMember" method="post" dojoType="dijit.form.Form"> - <table cellpadding="0" cellspacing="2"> - <tr> - <td valign="top"><strong>Name*: </strong></td> - <td><input type="text" required="true" name="name" id="formAddGroupMember.name" placeholder="Name" - dojoType="dijit.form.ValidationTextBox" missingMessage="A name must be supplied" /></td> - </tr> - </table> - <br/> - - <div class="dijitDialogPaneActionBar"> - <input type="submit" value="Add Group Member" label="Add Group Member" dojoType="dijit.form.Button" /> - </div> - </form> - </div> -</div> diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/group/showGroup.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/group/showGroup.html deleted file mode 100644 index c84e794ac1..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/group/showGroup.html +++ /dev/null @@ -1,32 +0,0 @@ -<!-- - - - - Licensed to the Apache Software Foundation (ASF) under one - - or more contributor license agreements. See the NOTICE file - - distributed with this work for additional information - - regarding copyright ownership. The ASF licenses this file - - to you under the Apache License, Version 2.0 (the - - "License"); you may not use this file except in compliance - - with the License. You may obtain a copy of the License at - - - - http://www.apache.org/licenses/LICENSE-2.0 - - - - Unless required by applicable law or agreed to in writing, - - software distributed under the License is distributed on an - - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - - KIND, either express or implied. See the License for the - - specific language governing permissions and limitations - - under the License. - - - --> -<div class="group"> - <span style="">Name:</span><span class="name" style="position:absolute; left:6em"></span> - <br/> - <div data-dojo-type="dijit.TitlePane" data-dojo-props="title: 'Group Members'"> - <div class="groupMembers"></div> - <div class="dijitDialogPaneActionBar"> - <button data-dojo-type="dijit.form.Button" class="addGroupMemberButton" type="button">Add Group Member</button> - <button data-dojo-type="dijit.form.Button" class="removeGroupMemberButton" type="button">Remove Group Members</button> - </div> - </div> -</div> - diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/groupprovider/addGroup.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/groupprovider/addGroup.html deleted file mode 100644 index 29ce2ebe6c..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/groupprovider/addGroup.html +++ /dev/null @@ -1,39 +0,0 @@ -<!-- - - - - Licensed to the Apache Software Foundation (ASF) under one - - or more contributor license agreements. See the NOTICE file - - distributed with this work for additional information - - regarding copyright ownership. The ASF licenses this file - - to you under the Apache License, Version 2.0 (the - - "License"); you may not use this file except in compliance - - with the License. You may obtain a copy of the License at - - - - http://www.apache.org/licenses/LICENSE-2.0 - - - - Unless required by applicable law or agreed to in writing, - - software distributed under the License is distributed on an - - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - - KIND, either express or implied. See the License for the - - specific language governing permissions and limitations - - under the License. - - - --> -<div class="dijitHidden"> - <div data-dojo-type="dijit.Dialog" style="width:600px;" data-dojo-props="title:'Add Group'" id="addGroup"> - <form id="formAddGroup" method="post" dojoType="dijit.form.Form"> - <table cellpadding="0" cellspacing="2"> - <tr> - <td valign="top"><strong>Group Name*: </strong></td> - <td><input type="text" required="true" name="name" id="formAddGroup.name" placeholder="Group Name" - dojoType="dijit.form.ValidationTextBox" missingMessage="A name must be supplied" /></td> - </tr> - </table> - <br/> - - <div class="dijitDialogPaneActionBar"> - <input type="submit" value="Create Group" label="Create Group" dojoType="dijit.form.Button" /> - </div> - - </form> - </div> -</div> diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/groupprovider/groupfile/add.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/groupprovider/groupfile/add.html deleted file mode 100644 index 7fc458cd4f..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/groupprovider/groupfile/add.html +++ /dev/null @@ -1,37 +0,0 @@ -<!-- - - - - Licensed to the Apache Software Foundation (ASF) under one - - or more contributor license agreements. See the NOTICE file - - distributed with this work for additional information - - regarding copyright ownership. The ASF licenses this file - - to you under the Apache License, Version 2.0 (the - - "License"); you may not use this file except in compliance - - with the License. You may obtain a copy of the License at - - - - http://www.apache.org/licenses/LICENSE-2.0 - - - - Unless required by applicable law or agreed to in writing, - - software distributed under the License is distributed on an - - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - - KIND, either express or implied. See the License for the - - specific language governing permissions and limitations - - under the License. - - - --> -<div> - <div class="clear"> - <div class="formLabel-labelCell tableContainer-labelCell">Path*:</div> - <div class="formLabel-controlCell tableContainer-valueCell"> - <input type="text" class="addGroupProviderPath" - data-dojo-type="dijit/form/ValidationTextBox" - data-dojo-props=" - name: 'path', - required: true, - placeHolder: 'path/to/group/file', - title: 'Enter path to file with groups', - promptMessage: 'Enter path to file with groups'"/> - </div> - </div> - - <div class="clear"></div> -</div> diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/groupprovider/groupfile/show.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/groupprovider/groupfile/show.html deleted file mode 100644 index 740c65fd38..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/groupprovider/groupfile/show.html +++ /dev/null @@ -1,25 +0,0 @@ -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one - ~ or more contributor license agreements. See the NOTICE file - ~ distributed with this work for additional information - ~ regarding copyright ownership. The ASF licenses this file - ~ to you under the Apache License, Version 2.0 (the - ~ "License"); you may not use this file except in compliance - ~ with the License. You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, - ~ software distributed under the License is distributed on an - ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - ~ KIND, either express or implied. See the License for the - ~ specific language governing permissions and limitations - ~ under the License. - --> -<div> - <div class="clear"> - <div class="formLabel-labelCell">Path to file:</div> - <div ><span class="path" ></span></div> - </div> - <div class="clear"></div> -</div> diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/groupprovider/showGroupManagingGroupProvider.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/groupprovider/showGroupManagingGroupProvider.html deleted file mode 100644 index 62a6c7537c..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/groupprovider/showGroupManagingGroupProvider.html +++ /dev/null @@ -1,30 +0,0 @@ -<!-- - - - - Licensed to the Apache Software Foundation (ASF) under one - - or more contributor license agreements. See the NOTICE file - - distributed with this work for additional information - - regarding copyright ownership. The ASF licenses this file - - to you under the Apache License, Version 2.0 (the - - "License"); you may not use this file except in compliance - - with the License. You may obtain a copy of the License at - - - - http://www.apache.org/licenses/LICENSE-2.0 - - - - Unless required by applicable law or agreed to in writing, - - software distributed under the License is distributed on an - - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - - KIND, either express or implied. See the License for the - - specific language governing permissions and limitations - - under the License. - - - --> -<div class="FileGroupManager"> - <div data-dojo-type="dijit.TitlePane" data-dojo-props="title: 'Groups'"> - <div class="groups"></div> - <div class="dijitDialogPaneActionBar"> - <button data-dojo-type="dijit.form.Button" class="addGroupButton">Add Group</button> - <button data-dojo-type="dijit.form.Button" class="deleteGroupButton">Delete Groups</button> - </div> - </div> - -</div> diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/images/auto-refresh.png b/qpid/java/broker-plugins/management-http/src/main/java/resources/images/auto-refresh.png Binary files differdeleted file mode 100644 index 493636f467..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/images/auto-refresh.png +++ /dev/null diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/images/download.png b/qpid/java/broker-plugins/management-http/src/main/java/resources/images/download.png Binary files differdeleted file mode 100644 index b64b41d476..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/images/download.png +++ /dev/null diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/images/gear.png b/qpid/java/broker-plugins/management-http/src/main/java/resources/images/gear.png Binary files differdeleted file mode 100644 index 0bb4394b46..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/images/gear.png +++ /dev/null diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/images/help.png b/qpid/java/broker-plugins/management-http/src/main/java/resources/images/help.png Binary files differdeleted file mode 100644 index f7d3698d25..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/images/help.png +++ /dev/null diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/images/log-viewer.png b/qpid/java/broker-plugins/management-http/src/main/java/resources/images/log-viewer.png Binary files differdeleted file mode 100644 index 858fd48beb..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/images/log-viewer.png +++ /dev/null diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/images/qpid-logo.png b/qpid/java/broker-plugins/management-http/src/main/java/resources/images/qpid-logo.png Binary files differdeleted file mode 100644 index ae0fbb462f..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/images/qpid-logo.png +++ /dev/null diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/images/refresh.png b/qpid/java/broker-plugins/management-http/src/main/java/resources/images/refresh.png Binary files differdeleted file mode 100644 index 083044979b..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/images/refresh.png +++ /dev/null diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/index.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/index.html deleted file mode 100644 index 896640fd67..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/index.html +++ /dev/null @@ -1,137 +0,0 @@ -<!DOCTYPE HTML> -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one or more - ~ contributor license agreements. See the NOTICE file distributed with - ~ this work for additional information regarding copyright ownership. - ~ The ASF licenses this file to You under the Apache License, Version 2.0 - ~ (the "License"); you may not use this file except in compliance with - ~ the License. You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --> -<html lang="en"> -<head> - <meta charset="utf-8"> - <title>Qpid Management</title> - <link rel="stylesheet" href="dojo/dojo/resources/dojo.css"> - <link rel="stylesheet" href="dojo/dijit/themes/claro/claro.css"> - <link rel="stylesheet" href="dojo/dojox/grid/resources/claroGrid.css"> - <link rel="stylesheet" href="dojo/dojox/grid/enhanced/resources/claro/EnhancedGrid.css"> - <link rel="stylesheet" href="dojo/dojox/grid/enhanced/resources/EnhancedGrid_rtl.css"> - <link rel="stylesheet" href="dojo/dojox/form/resources/CheckedMultiSelect.css"> - <link rel="stylesheet" href="dojo/dojox/form/resources/FileInput.css" /> - <link rel="stylesheet" href="css/common.css" media="screen"> - <script> - function getContextPath() - { - var contextPath = "/"; - var documentURL = document.URL; - var managementPageStart = documentURL.lastIndexOf("/"); - var firstSlashPos = documentURL.indexOf("/", documentURL.indexOf("//") + 2); - if (managementPageStart > firstSlashPos) - { - contextPath = documentURL.substring(firstSlashPos, managementPageStart); - } - return contextPath; - } - - var dojoConfig = { - tlmSiblingOfDojo:false, - async:true, - baseUrl: getContextPath(), - packages:[ - { name:"dojo", location:"dojo/dojo" }, - { name:"dijit", location:"dojo/dijit" }, - { name:"dojox", location:"dojo/dojox" }, - { name:"qpid", location:"js/qpid" } - ] - }; - - </script> - <script src="dojo/dojo/dojo.js"> - </script> - - <script> - var qpidManagementHelper = null; - require([ - "dojo/parser", - "qpid/authorization/checkUser", - "qpid/common/ConsoleHelper", - "dijit/layout/BorderContainer", - "dijit/layout/TabContainer", - "dijit/layout/ContentPane", - "dijit/TitlePane", - "dijit/Menu", - "dijit/MenuItem", - "qpid/management/treeView", - "qpid/management/controller", - "qpid/common/footer" - ], function(parser, User, ConsoleHelper){ - parser.parse(); - qpidManagementHelper = ConsoleHelper; - User.getUserAndUpdateUI(); - dijit.Tooltip.defaultPosition = ["after-centered", "below-centered"]; - }); - </script> - -</head> -<body class="claro"> - -<div id="pageLayout" data-dojo-type="dijit.layout.BorderContainer" data-dojo-props="design: 'headline', gutters: false"> - <div data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'top'"> - <div id="header" class="header" style="float: left; width: 300px"></div> - <div style="float: right;"> - <div id="login" class="hidden"><span id="authenticatedUser" class="hidden"></span> - <div id="authenticatedUserControls" data-dojo-type="dijit.form.DropDownButton" data-dojo-props="iconClass: 'preferencesIcon'"> - <div data-dojo-type="dijit.Menu"> - <div data-dojo-type="dijit.MenuItem" data-dojo-props="onClick: function(){window.location='logout';}" >Log out</div> - <div data-dojo-type="dijit.MenuItem" - data-dojo-props="iconClass:'dijitIconFunction',onClick: function(){qpidManagementHelper.showPreferencesDialog();}">Preferences</div> - <div data-dojo-type="dijit.MenuItem" - data-dojo-props="iconClass: 'helpIcon', onClick: function(){qpidManagementHelper.showHelp();}">Help</div> - </div> - </div> - </div> - </div> - </div> - <div data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'leading', splitter: true" style="width:20%"> - <div qpid-type="treeView" qpid-props="query: 'service/structure'" ></div> - </div> - <div id="managedViews" data-dojo-type="dijit.layout.TabContainer" data-dojo-props="region:'center', tabPosition: 'top'"> - </div> - <div data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'bottom'"> - <div qpid-type="footer"></div> - </div> - - <div class="dijitHidden"> - <div data-dojo-type="dijit.Dialog" data-dojo-props="title: 'Error'" id="errorDialog"> - <div> - <div class="errorDialogErrorPrimary"> - <span id="errorDialog.statusCode">000</span> - <span id="errorDialog.errorMessage">error</span> - </div> - - <div class="clear" class="errorDialogErrorSecondary"> - <div id="errorDialog.advice.reconnect"> - Please login again and retry your operation. - </div> - <div id="errorDialog.advice.retry"> - Please correct the problem and retry your operation. - </div> - </div> - </div> - <div class="dijitDialogPaneActionBar qpidDialogPaneActionBar"> - <input type="button" id="errorDialog.button.cancel" value="Cancel" label="Cancel" dojoType="dijit.form.Button" onClick="dijit.byId('errorDialog').hide();"/> - <input type="button" id="errorDialog.button.relogin" value="Login" label="Login" dojoType="dijit.form.Button" onClick="dijit.byId('errorDialog').hide(); window.location='logout';"/> - </div> - </div> - </div> -</div> - -</body> -</html> diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/crypto-js/README.txt b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/crypto-js/README.txt deleted file mode 100644 index 6ef692ce31..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/crypto-js/README.txt +++ /dev/null @@ -1,8 +0,0 @@ -Crypto-JS -========= - -Version: 3.1.2 - -These files are from Crypto-JS (https://code.google.com/p/crypto-js/) by Jeff Mott. - - diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/crypto-js/enc-base64-min.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/crypto-js/enc-base64-min.js deleted file mode 100644 index 7ab054d94b..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/crypto-js/enc-base64-min.js +++ /dev/null @@ -1,8 +0,0 @@ -/* -CryptoJS v3.1.2 -code.google.com/p/crypto-js -(c) 2009-2013 by Jeff Mott. All rights reserved. -code.google.com/p/crypto-js/wiki/License -*/ -(function(){var h=CryptoJS,j=h.lib.WordArray;h.enc.Base64={stringify:function(b){var e=b.words,f=b.sigBytes,c=this._map;b.clamp();b=[];for(var a=0;a<f;a+=3)for(var d=(e[a>>>2]>>>24-8*(a%4)&255)<<16|(e[a+1>>>2]>>>24-8*((a+1)%4)&255)<<8|e[a+2>>>2]>>>24-8*((a+2)%4)&255,g=0;4>g&&a+0.75*g<f;g++)b.push(c.charAt(d>>>6*(3-g)&63));if(e=c.charAt(64))for(;b.length%4;)b.push(e);return b.join("")},parse:function(b){var e=b.length,f=this._map,c=f.charAt(64);c&&(c=b.indexOf(c),-1!=c&&(e=c));for(var c=[],a=0,d=0;d< -e;d++)if(d%4){var g=f.indexOf(b.charAt(d-1))<<2*(d%4),h=f.indexOf(b.charAt(d))>>>6-2*(d%4);c[a>>>2]|=(g|h)<<24-8*(a%4);a++}return j.create(c,a)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}})(); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/crypto-js/hmac-sha1.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/crypto-js/hmac-sha1.js deleted file mode 100644 index 0d50d81a1e..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/crypto-js/hmac-sha1.js +++ /dev/null @@ -1,17 +0,0 @@ -/* -CryptoJS v3.1.2 -code.google.com/p/crypto-js -(c) 2009-2013 by Jeff Mott. All rights reserved. -code.google.com/p/crypto-js/wiki/License -*/ -var CryptoJS=CryptoJS||function(g,l){var e={},d=e.lib={},m=function(){},k=d.Base={extend:function(a){m.prototype=this;var c=new m;a&&c.mixIn(a);c.hasOwnProperty("init")||(c.init=function(){c.$super.init.apply(this,arguments)});c.init.prototype=c;c.$super=this;return c},create:function(){var a=this.extend();a.init.apply(a,arguments);return a},init:function(){},mixIn:function(a){for(var c in a)a.hasOwnProperty(c)&&(this[c]=a[c]);a.hasOwnProperty("toString")&&(this.toString=a.toString)},clone:function(){return this.init.prototype.extend(this)}}, -p=d.WordArray=k.extend({init:function(a,c){a=this.words=a||[];this.sigBytes=c!=l?c:4*a.length},toString:function(a){return(a||n).stringify(this)},concat:function(a){var c=this.words,q=a.words,f=this.sigBytes;a=a.sigBytes;this.clamp();if(f%4)for(var b=0;b<a;b++)c[f+b>>>2]|=(q[b>>>2]>>>24-8*(b%4)&255)<<24-8*((f+b)%4);else if(65535<q.length)for(b=0;b<a;b+=4)c[f+b>>>2]=q[b>>>2];else c.push.apply(c,q);this.sigBytes+=a;return this},clamp:function(){var a=this.words,c=this.sigBytes;a[c>>>2]&=4294967295<< -32-8*(c%4);a.length=g.ceil(c/4)},clone:function(){var a=k.clone.call(this);a.words=this.words.slice(0);return a},random:function(a){for(var c=[],b=0;b<a;b+=4)c.push(4294967296*g.random()|0);return new p.init(c,a)}}),b=e.enc={},n=b.Hex={stringify:function(a){var c=a.words;a=a.sigBytes;for(var b=[],f=0;f<a;f++){var d=c[f>>>2]>>>24-8*(f%4)&255;b.push((d>>>4).toString(16));b.push((d&15).toString(16))}return b.join("")},parse:function(a){for(var c=a.length,b=[],f=0;f<c;f+=2)b[f>>>3]|=parseInt(a.substr(f, -2),16)<<24-4*(f%8);return new p.init(b,c/2)}},j=b.Latin1={stringify:function(a){var c=a.words;a=a.sigBytes;for(var b=[],f=0;f<a;f++)b.push(String.fromCharCode(c[f>>>2]>>>24-8*(f%4)&255));return b.join("")},parse:function(a){for(var c=a.length,b=[],f=0;f<c;f++)b[f>>>2]|=(a.charCodeAt(f)&255)<<24-8*(f%4);return new p.init(b,c)}},h=b.Utf8={stringify:function(a){try{return decodeURIComponent(escape(j.stringify(a)))}catch(c){throw Error("Malformed UTF-8 data");}},parse:function(a){return j.parse(unescape(encodeURIComponent(a)))}}, -r=d.BufferedBlockAlgorithm=k.extend({reset:function(){this._data=new p.init;this._nDataBytes=0},_append:function(a){"string"==typeof a&&(a=h.parse(a));this._data.concat(a);this._nDataBytes+=a.sigBytes},_process:function(a){var c=this._data,b=c.words,f=c.sigBytes,d=this.blockSize,e=f/(4*d),e=a?g.ceil(e):g.max((e|0)-this._minBufferSize,0);a=e*d;f=g.min(4*a,f);if(a){for(var k=0;k<a;k+=d)this._doProcessBlock(b,k);k=b.splice(0,a);c.sigBytes-=f}return new p.init(k,f)},clone:function(){var a=k.clone.call(this); -a._data=this._data.clone();return a},_minBufferSize:0});d.Hasher=r.extend({cfg:k.extend(),init:function(a){this.cfg=this.cfg.extend(a);this.reset()},reset:function(){r.reset.call(this);this._doReset()},update:function(a){this._append(a);this._process();return this},finalize:function(a){a&&this._append(a);return this._doFinalize()},blockSize:16,_createHelper:function(a){return function(b,d){return(new a.init(d)).finalize(b)}},_createHmacHelper:function(a){return function(b,d){return(new s.HMAC.init(a, -d)).finalize(b)}}});var s=e.algo={};return e}(Math); -(function(){var g=CryptoJS,l=g.lib,e=l.WordArray,d=l.Hasher,m=[],l=g.algo.SHA1=d.extend({_doReset:function(){this._hash=new e.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(d,e){for(var b=this._hash.words,n=b[0],j=b[1],h=b[2],g=b[3],l=b[4],a=0;80>a;a++){if(16>a)m[a]=d[e+a]|0;else{var c=m[a-3]^m[a-8]^m[a-14]^m[a-16];m[a]=c<<1|c>>>31}c=(n<<5|n>>>27)+l+m[a];c=20>a?c+((j&h|~j&g)+1518500249):40>a?c+((j^h^g)+1859775393):60>a?c+((j&h|j&g|h&g)-1894007588):c+((j^h^ -g)-899497514);l=g;g=h;h=j<<30|j>>>2;j=n;n=c}b[0]=b[0]+n|0;b[1]=b[1]+j|0;b[2]=b[2]+h|0;b[3]=b[3]+g|0;b[4]=b[4]+l|0},_doFinalize:function(){var d=this._data,e=d.words,b=8*this._nDataBytes,g=8*d.sigBytes;e[g>>>5]|=128<<24-g%32;e[(g+64>>>9<<4)+14]=Math.floor(b/4294967296);e[(g+64>>>9<<4)+15]=b;d.sigBytes=4*e.length;this._process();return this._hash},clone:function(){var e=d.clone.call(this);e._hash=this._hash.clone();return e}});g.SHA1=d._createHelper(l);g.HmacSHA1=d._createHmacHelper(l)})(); -(function(){var g=CryptoJS,l=g.enc.Utf8;g.algo.HMAC=g.lib.Base.extend({init:function(e,d){e=this._hasher=new e.init;"string"==typeof d&&(d=l.parse(d));var g=e.blockSize,k=4*g;d.sigBytes>k&&(d=e.finalize(d));d.clamp();for(var p=this._oKey=d.clone(),b=this._iKey=d.clone(),n=p.words,j=b.words,h=0;h<g;h++)n[h]^=1549556828,j[h]^=909522486;p.sigBytes=b.sigBytes=k;this.reset()},reset:function(){var e=this._hasher;e.reset();e.update(this._iKey)},update:function(e){this._hasher.update(e);return this},finalize:function(e){var d= -this._hasher;e=d.finalize(e);d.reset();return d.finalize(this._oKey.clone().concat(e))}})})(); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/crypto-js/hmac-sha256.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/crypto-js/hmac-sha256.js deleted file mode 100644 index c822cfb1f4..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/crypto-js/hmac-sha256.js +++ /dev/null @@ -1,18 +0,0 @@ -/* -CryptoJS v3.1.2 -code.google.com/p/crypto-js -(c) 2009-2013 by Jeff Mott. All rights reserved. -code.google.com/p/crypto-js/wiki/License -*/ -var CryptoJS=CryptoJS||function(h,s){var f={},g=f.lib={},q=function(){},m=g.Base={extend:function(a){q.prototype=this;var c=new q;a&&c.mixIn(a);c.hasOwnProperty("init")||(c.init=function(){c.$super.init.apply(this,arguments)});c.init.prototype=c;c.$super=this;return c},create:function(){var a=this.extend();a.init.apply(a,arguments);return a},init:function(){},mixIn:function(a){for(var c in a)a.hasOwnProperty(c)&&(this[c]=a[c]);a.hasOwnProperty("toString")&&(this.toString=a.toString)},clone:function(){return this.init.prototype.extend(this)}}, -r=g.WordArray=m.extend({init:function(a,c){a=this.words=a||[];this.sigBytes=c!=s?c:4*a.length},toString:function(a){return(a||k).stringify(this)},concat:function(a){var c=this.words,d=a.words,b=this.sigBytes;a=a.sigBytes;this.clamp();if(b%4)for(var e=0;e<a;e++)c[b+e>>>2]|=(d[e>>>2]>>>24-8*(e%4)&255)<<24-8*((b+e)%4);else if(65535<d.length)for(e=0;e<a;e+=4)c[b+e>>>2]=d[e>>>2];else c.push.apply(c,d);this.sigBytes+=a;return this},clamp:function(){var a=this.words,c=this.sigBytes;a[c>>>2]&=4294967295<< -32-8*(c%4);a.length=h.ceil(c/4)},clone:function(){var a=m.clone.call(this);a.words=this.words.slice(0);return a},random:function(a){for(var c=[],d=0;d<a;d+=4)c.push(4294967296*h.random()|0);return new r.init(c,a)}}),l=f.enc={},k=l.Hex={stringify:function(a){var c=a.words;a=a.sigBytes;for(var d=[],b=0;b<a;b++){var e=c[b>>>2]>>>24-8*(b%4)&255;d.push((e>>>4).toString(16));d.push((e&15).toString(16))}return d.join("")},parse:function(a){for(var c=a.length,d=[],b=0;b<c;b+=2)d[b>>>3]|=parseInt(a.substr(b, -2),16)<<24-4*(b%8);return new r.init(d,c/2)}},n=l.Latin1={stringify:function(a){var c=a.words;a=a.sigBytes;for(var d=[],b=0;b<a;b++)d.push(String.fromCharCode(c[b>>>2]>>>24-8*(b%4)&255));return d.join("")},parse:function(a){for(var c=a.length,d=[],b=0;b<c;b++)d[b>>>2]|=(a.charCodeAt(b)&255)<<24-8*(b%4);return new r.init(d,c)}},j=l.Utf8={stringify:function(a){try{return decodeURIComponent(escape(n.stringify(a)))}catch(c){throw Error("Malformed UTF-8 data");}},parse:function(a){return n.parse(unescape(encodeURIComponent(a)))}}, -u=g.BufferedBlockAlgorithm=m.extend({reset:function(){this._data=new r.init;this._nDataBytes=0},_append:function(a){"string"==typeof a&&(a=j.parse(a));this._data.concat(a);this._nDataBytes+=a.sigBytes},_process:function(a){var c=this._data,d=c.words,b=c.sigBytes,e=this.blockSize,f=b/(4*e),f=a?h.ceil(f):h.max((f|0)-this._minBufferSize,0);a=f*e;b=h.min(4*a,b);if(a){for(var g=0;g<a;g+=e)this._doProcessBlock(d,g);g=d.splice(0,a);c.sigBytes-=b}return new r.init(g,b)},clone:function(){var a=m.clone.call(this); -a._data=this._data.clone();return a},_minBufferSize:0});g.Hasher=u.extend({cfg:m.extend(),init:function(a){this.cfg=this.cfg.extend(a);this.reset()},reset:function(){u.reset.call(this);this._doReset()},update:function(a){this._append(a);this._process();return this},finalize:function(a){a&&this._append(a);return this._doFinalize()},blockSize:16,_createHelper:function(a){return function(c,d){return(new a.init(d)).finalize(c)}},_createHmacHelper:function(a){return function(c,d){return(new t.HMAC.init(a, -d)).finalize(c)}}});var t=f.algo={};return f}(Math); -(function(h){for(var s=CryptoJS,f=s.lib,g=f.WordArray,q=f.Hasher,f=s.algo,m=[],r=[],l=function(a){return 4294967296*(a-(a|0))|0},k=2,n=0;64>n;){var j;a:{j=k;for(var u=h.sqrt(j),t=2;t<=u;t++)if(!(j%t)){j=!1;break a}j=!0}j&&(8>n&&(m[n]=l(h.pow(k,0.5))),r[n]=l(h.pow(k,1/3)),n++);k++}var a=[],f=f.SHA256=q.extend({_doReset:function(){this._hash=new g.init(m.slice(0))},_doProcessBlock:function(c,d){for(var b=this._hash.words,e=b[0],f=b[1],g=b[2],j=b[3],h=b[4],m=b[5],n=b[6],q=b[7],p=0;64>p;p++){if(16>p)a[p]= -c[d+p]|0;else{var k=a[p-15],l=a[p-2];a[p]=((k<<25|k>>>7)^(k<<14|k>>>18)^k>>>3)+a[p-7]+((l<<15|l>>>17)^(l<<13|l>>>19)^l>>>10)+a[p-16]}k=q+((h<<26|h>>>6)^(h<<21|h>>>11)^(h<<7|h>>>25))+(h&m^~h&n)+r[p]+a[p];l=((e<<30|e>>>2)^(e<<19|e>>>13)^(e<<10|e>>>22))+(e&f^e&g^f&g);q=n;n=m;m=h;h=j+k|0;j=g;g=f;f=e;e=k+l|0}b[0]=b[0]+e|0;b[1]=b[1]+f|0;b[2]=b[2]+g|0;b[3]=b[3]+j|0;b[4]=b[4]+h|0;b[5]=b[5]+m|0;b[6]=b[6]+n|0;b[7]=b[7]+q|0},_doFinalize:function(){var a=this._data,d=a.words,b=8*this._nDataBytes,e=8*a.sigBytes; -d[e>>>5]|=128<<24-e%32;d[(e+64>>>9<<4)+14]=h.floor(b/4294967296);d[(e+64>>>9<<4)+15]=b;a.sigBytes=4*d.length;this._process();return this._hash},clone:function(){var a=q.clone.call(this);a._hash=this._hash.clone();return a}});s.SHA256=q._createHelper(f);s.HmacSHA256=q._createHmacHelper(f)})(Math); -(function(){var h=CryptoJS,s=h.enc.Utf8;h.algo.HMAC=h.lib.Base.extend({init:function(f,g){f=this._hasher=new f.init;"string"==typeof g&&(g=s.parse(g));var h=f.blockSize,m=4*h;g.sigBytes>m&&(g=f.finalize(g));g.clamp();for(var r=this._oKey=g.clone(),l=this._iKey=g.clone(),k=r.words,n=l.words,j=0;j<h;j++)k[j]^=1549556828,n[j]^=909522486;r.sigBytes=l.sigBytes=m;this.reset()},reset:function(){var f=this._hasher;f.reset();f.update(this._iKey)},update:function(f){this._hasher.update(f);return this},finalize:function(f){var g= -this._hasher;f=g.finalize(f);g.reset();return g.finalize(this._oKey.clone().concat(f))}})})(); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/authorization/checkUser.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/authorization/checkUser.js deleted file mode 100644 index be9bef3519..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/authorization/checkUser.js +++ /dev/null @@ -1,45 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -define(["dojo/dom", - "qpid/authorization/sasl", - "dijit/registry", - "dojox/html/entities", - "dojo/domReady!"], function(dom, sasl, registry, entities){ - -var updateUI = function updateUI(data) -{ - if(data.user) - { - var userName = entities.encode(String(data.user)); - var controlButton = registry.byId("authenticatedUserControls"); - if (controlButton) - { - controlButton.set("label", userName); - } - dom.byId("authenticatedUser").innerHTML = userName; - dom.byId("login").style.display = "inline"; - } -}; - -return {getUserAndUpdateUI: function(){sasl.getUser(updateUI);}} - -}); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/authorization/sasl.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/authorization/sasl.js deleted file mode 100644 index fc972f3c7e..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/authorization/sasl.js +++ /dev/null @@ -1,351 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define(["dojo/_base/xhr", "dojox/encoding/base64", "dojox/encoding/digests/_base", "dojox/encoding/digests/MD5", "dojox/uuid/generateRandomUuid", "dojo/request/script"], - function (xhr, base64, digestsBase, MD5, uuid, script) { - -var encodeUTF8 = function encodeUTF8(str) { - var byteArray = []; - for (var i = 0; i < str.length; i++) { - if (str.charCodeAt(i) <= 0x7F) { - byteArray.push(str.charCodeAt(i)); - } - else { - var h = encodeURIComponent(str.charAt(i)).substr(1).split('%'); - for (var j = 0; j < h.length; j++) - byteArray.push(parseInt(h[j], 16)); - } - } - return byteArray; -}; - -var decodeUTF8 = function decodeUTF8(byteArray) -{ - var str = ''; - for (var i = 0; i < byteArray.length; i++) - str += byteArray[i] <= 0x7F? - byteArray[i] === 0x25 ? "%25" : - String.fromCharCode(byteArray[i]) : - "%" + byteArray[i].toString(16).toUpperCase(); - return decodeURIComponent(str); -}; - -var errorHandler = function errorHandler(error) -{ - if(error.status == 401) - { - alert("Authentication Failed"); - } - else if(error.status == 403) - { - alert("Authorization Failed"); - } - else - { - alert(error); - } -} - -var saslServiceUrl="service/sasl"; - -var saslPlain = function saslPlain(user, password, callbackFunction) -{ - var responseArray = [ 0 ].concat(encodeUTF8( user )).concat( [ 0 ] ).concat( encodeUTF8( password ) ); - var plainResponse = base64.encode(responseArray); - - // Using dojo.xhrGet, as very little information is being sent - dojo.xhrPost({ - // The URL of the request - url: saslServiceUrl, - content: { - mechanism: "PLAIN", - response: plainResponse - }, - handleAs: "json", - failOk: true - }).then(callbackFunction, errorHandler); -}; - -var saslCramMD5 = function saslCramMD5(user, password, saslMechanism, callbackFunction) -{ - dojo.xhrPost({ - // The URL of the request - url: saslServiceUrl, - content: { - mechanism: saslMechanism - }, - handleAs: "json", - failOk: true - }).then(function(data) - { - - var challengeBytes = base64.decode(data.challenge); - var wa=[]; - var bitLength = challengeBytes.length*8; - for(var i=0; i<bitLength; i+=8) - { - wa[i>>5] |= (challengeBytes[i/8] & 0xFF)<<(i%32); - } - var challengeStr = digestsBase.wordToString(wa).substring(0,challengeBytes.length); - - var digest = user + " " + MD5._hmac(challengeStr, password, digestsBase.outputTypes.Hex); - var id = data.id; - - var response = base64.encode(encodeUTF8( digest )); - - dojo.xhrPost({ - // The URL of the request - url: saslServiceUrl, - content: { - id: id, - response: response - }, - handleAs: "json", - failOk: true - }).then(callbackFunction, errorHandler); - - }, - function(error) - { - if(error.status == 403) - { - alert("Authentication Failed"); - } - else - { - alert(error); - } - }); - - - -}; - - var saslScramSha1 = function saslScramSha1(user, password, saslMechanism, callbackFunction) { - saslScram("sha1",user,password,saslMechanism,callbackFunction); - }; - - var saslScramSha256 = function saslScramSha1(user, password, saslMechanism, callbackFunction) { - saslScram("sha256",user,password,saslMechanism,callbackFunction); - }; - - var saslScram = function saslScramSha1(mechanism, user, password, saslMechanism, callbackFunction) { - - var DIGEST = mechanism.toUpperCase(); - var HMAC = "Hmac"+DIGEST; - - script.get("js/crypto-js/hmac-"+mechanism+".js").then( function() - { - script.get("js/crypto-js/enc-base64-min.js").then ( function() - { - - var toBase64 = function toBase64( input ) - { - var result = []; - for(var i = 0; i < input.length; i++) - { - result[i] = input.charCodeAt(i); - } - return base64.encode( result ) - }; - - var fromBase64 = function fromBase64( input ) - { - var decoded = base64.decode( input ); - var result = ""; - for(var i = 0; i < decoded.length; i++) - { - result+= String.fromCharCode(decoded[i]); - } - return result; - }; - - var xor = function xor(lhs, rhs) { - var words = []; - for(var i = 0; i < lhs.words.length; i++) - { - words.push(lhs.words[i]^rhs.words[i]); - } - return CryptoJS.lib.WordArray.create(words); - }; - - var hasNonAscii = function hasNonAscii(name) { - for(var i = 0; i < name.length; i++) { - if(name.charCodeAt(i) > 127) { - return true; - } - } - return false; - }; - - var generateSaltedPassword = function generateSaltedPassword(salt, password, iterationCount) - { - var hmac = CryptoJS.algo.HMAC.create(CryptoJS.algo[DIGEST], password); - - hmac.update(salt); - hmac.update(CryptoJS.enc.Hex.parse("00000001")); - - var result = hmac.finalize(); - var previous = null; - for(var i = 1 ;i < iterationCount; i++) - { - hmac = CryptoJS.algo.HMAC.create(CryptoJS.algo[DIGEST], password); - hmac.update( previous != null ? previous : result ); - previous = hmac.finalize(); - result = xor(result, previous); - } - return result; - - }; - - GS2_HEADER = "n,,"; - - if(!hasNonAscii(user)) { - - user = user.replace(/=/g, "=3D"); - user = user.replace(/,/g, "=2C"); - - clientNonce = uuid(); - clientFirstMessageBare = "n=" + user + ",r=" + clientNonce; - dojo.xhrPost({ - // The URL of the request - url: saslServiceUrl, - content: { - mechanism: saslMechanism, - response: toBase64(GS2_HEADER + clientFirstMessageBare) - }, - handleAs: "json", - failOk: true - }).then(function (data) { - var serverFirstMessage = fromBase64(data.challenge); - var id = data.id; - - var parts = serverFirstMessage.split(","); - nonce = parts[0].substring(2); - if (!nonce.substr(0, clientNonce.length) == clientNonce) { - alert("Authentication error - server nonce does not start with client nonce") - } - else { - var salt = CryptoJS.enc.Base64.parse(parts[1].substring(2)); - var iterationCount = parts[2].substring(2); - var saltedPassword = generateSaltedPassword(salt, password, iterationCount) - var clientFinalMessageWithoutProof = "c=" + toBase64(GS2_HEADER) + ",r=" + nonce; - var authMessage = clientFirstMessageBare + "," + serverFirstMessage + "," + clientFinalMessageWithoutProof; - var clientKey = CryptoJS[HMAC]("Client Key", saltedPassword); - var storedKey = CryptoJS[DIGEST](clientKey); - var clientSignature = CryptoJS[HMAC](authMessage, storedKey); - var clientProof = xor(clientKey, clientSignature); - var serverKey = CryptoJS[HMAC]("Server Key", saltedPassword); - serverSignature = CryptoJS[HMAC](authMessage, serverKey); - dojo.xhrPost({ - // The URL of the request - url: saslServiceUrl, - content: { - id: id, - response: toBase64(clientFinalMessageWithoutProof - + ",p=" + clientProof.toString(CryptoJS.enc.Base64)) - }, - handleAs: "json", - failOk: true - }).then(function (data) { - var serverFinalMessage = fromBase64(data.challenge); - if (serverSignature.toString(CryptoJS.enc.Base64) == serverFinalMessage.substring(2)) { - callbackFunction(); - } - else { - errorHandler("Server signature did not match"); - } - - - }, errorHandler); - } - - }, errorHandler); - } - else - { - alert("Username '"+name+"' is invalid"); - } - - }, errorHandler); - }, errorHandler); - }; - -var containsMechanism = function containsMechanism(mechanisms, mech) -{ - for (var i = 0; i < mechanisms.length; i++) { - if (mechanisms[i] == mech) { - return true; - } - } - - return false; -}; - -var SaslClient = {}; - -SaslClient.authenticate = function(username, password, callbackFunction) -{ - dojo.xhrGet({ - url: saslServiceUrl, - handleAs: "json", - failOk: true - }).then(function(data) - { - var mechMap = data.mechanisms; - if(containsMechanism(mechMap, "SCRAM-SHA-256")) - { - saslScramSha256(username, password, "SCRAM-SHA-256", callbackFunction) - } - else if(containsMechanism(mechMap, "SCRAM-SHA-1")) - { - saslScramSha1(username, password, "SCRAM-SHA-1", callbackFunction) - } - else if (containsMechanism(mechMap, "CRAM-MD5")) - { - saslCramMD5(username, password, "CRAM-MD5", callbackFunction); - } - else if (containsMechanism(mechMap, "CRAM-MD5-HEX")) - { - var hashedPassword = MD5(password, digestsBase.outputTypes.Hex); - saslCramMD5(username, hashedPassword, "CRAM-MD5-HEX", callbackFunction); - } - else if (containsMechanism(mechMap, "PLAIN")) - { - saslPlain(username, password, callbackFunction); - } - else - { - alert("No supported SASL mechanism offered: " + mechMap); - } - }, errorHandler); -}; - -SaslClient.getUser = function(callbackFunction) -{ - dojo.xhrGet({ - url: saslServiceUrl, - handleAs: "json", - failOk: true - }).then(callbackFunction, errorHandler); -}; - -return SaslClient; -}); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/ConsoleHelper.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/ConsoleHelper.js deleted file mode 100644 index 9cebf48ce6..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/ConsoleHelper.js +++ /dev/null @@ -1,72 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define(["dojo/_base/xhr", "dojo/domReady!"], function (xhr) { - - var preferencesDialog = null; - var helpURL = null; - - return { - showPreferencesDialog: function () { - if (preferencesDialog == null) - { - require(["qpid/management/Preferences", "dojo/ready"], function(PreferencesDialog, ready){ - ready(function(){ - preferencesDialog = new PreferencesDialog(); - preferencesDialog.showDialog(); - }); - }); - } - else - { - preferencesDialog.showDialog(); - } - }, - getHelpUrl: function() - { - if (!helpURL) - { - xhr.get({ - sync: true, - url: "api/latest/broker", - content: { "depth" : 1, "includeSysContext" : true }, - handleAs: "json" - }).then(function(data) { - var broker = data[0]; - if ("context" in broker && "qpid.helpURL" in broker["context"] ) - { - helpURL = broker["context"]["qpid.helpURL"]; - } - else - { - helpURL = "http://qpid.apache.org/"; - } - }); - } - return helpURL; - }, - showHelp: function() - { - var newWindow = window.open(this.getHelpUrl(),'QpidHelp','height=600,width=600,scrollbars=1,location=1,resizable=1,status=0,toolbar=0,titlebar=1,menubar=0', true); - newWindow.focus(); - } - }; - -}); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/ContextVariablesEditor.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/ContextVariablesEditor.js deleted file mode 100644 index a3e4023273..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/ContextVariablesEditor.js +++ /dev/null @@ -1,558 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define([ - "qpid/common/util", - "dojo/_base/xhr", - "dojo/_base/declare", - "dojo/_base/array", - "dojo/_base/connect", - "dojo/_base/lang", - "dojo/dom-construct", - "dojo/parser", - "dojo/query", - "dojo/store/Memory", - "dojo/data/ObjectStore", - "dijit/_WidgetBase", - "dijit/registry", - "dojo/text!common/ContextVariablesEditor.html", - "dijit/form/Button", - "dojox/grid/EnhancedGrid", - "dojox/grid/enhanced/_Plugin", - "dijit/form/Select", - "dojox/validate/us", - "dojox/validate/web", - "dojo/domReady!"], -function (util, xhr, declare, array, connect, lang, domConstruct, parser, query, Memory, ObjectStore, _WidgetBase, registry, template) - { - - return declare("qpid.common.ContextVariablesEditor", [_WidgetBase], { - - value: null, - effectiveValues: null, - inheritedActualValues: null, - domNode: null, - _grid: null, - _addButton: null, - _deleteButton: null, - _filterBox: null, - _nextGridItemId: 0, - _dynamicInheritedContext: {}, - - constructor: function(args) - { - this._args = args; - }, - - buildRendering: function() - { - this.domNode = domConstruct.create("div", {innerHTML: template}); - parser.parse(this.domNode); - }, - - postCreate: function() - { - this.inherited(arguments); - var that = this; - var gridNode = query(".grid", this.domNode)[0]; - var addButtonNode = query(".addButton", this.domNode)[0]; - var deleteButtonNode = query(".deleteButton", this.domNode)[0]; - var addButton = registry.byNode(addButtonNode); - var deleteButton = registry.byNode(deleteButtonNode); - var layout = [[ - { name: "Name", field: "name", width: "40%", editable: true}, - { name: 'Actual Value', field: 'actualValue', width: '30%', editable: true}, - { name: 'Effective Value', field: 'effectiveValue', width: '30%', editable: false} - ]]; - var data = []; - var objectStore = new dojo.data.ObjectStore({objectStore: new Memory({data:data, idProperty: "id"})}); - var grid = new dojox.grid.EnhancedGrid({ - selectionMode: "multiple", - store: objectStore, - singleClickEdit: true, - structure: layout, - autoHeight: true, - sortFields: [{attribute: 'name', descending: false}], - plugins: {indirectSelection: true} - }, gridNode); - grid.canEdit = function(inCell, inRowIndex) - { - var item = grid.getItem(inRowIndex); - return inCell.field == "actualValue" || (inCell.field=="name" && item && item["inherited"] == false); - }; - - this._grid = grid; - this._deleteButton = deleteButton; - this._addButtonNode = addButtonNode; - - var toggleGridButtons = function(index) - { - var data = grid.selection.getSelected(); - deleteButton.set("disabled", !data || data.length==0); - }; - - connect.connect(grid.selection, 'onSelected', toggleGridButtons); - connect.connect(grid.selection, 'onDeselected', toggleGridButtons); - connect.connect(grid, 'onStyleRow' , this, function(row) { that._onStyleRow(row); }); - - deleteButton.set("disabled", true); - addButton.on("click", function(event) { that._newItem(); }); - deleteButton.on("click", function(event) { that._deleteSelected(); }); - grid.on("applyEdit", function(inRowIndex) { that._onEdit(inRowIndex); }); - grid.startup(); - this._filterBox = registry.byNode(query(".filter", this.domNode)[0]); - this._filterBox.on("change", function(value) { if (value) { that._filter(value); } }); - }, - resize: function() - { - this._grid.render(); - }, - load: function(restUrl, data) - { - data = data || {}; - var actualValues = data.actualValues; - var allEffectiveValues = data.effectiveValues; - var inheritedActualValues = data.inheritedActualValues; - if (!actualValues) - { - xhr.get( - { - url: restUrl, - sync: true, - content: { actuals: true }, - handleAs: "json", - load: function(data) - { - actualValues = data[0].context; - } - } - ); - } - if (!allEffectiveValues) - { - xhr.get( - { - url: restUrl, - sync: true, - content: { actuals: false }, - handleAs: "json", - load: function(data) - { - allEffectiveValues = data[0].context; - } - } - ); - } - if (!inheritedActualValues) - { - xhr.get( - { - url: restUrl, - sync: true, - content: { actuals: true, inheritedActuals: true}, - handleAs: "json", - load: function(data) - { - inheritedActualValues = data[0].context; - } - } - ); - } - this.setData(actualValues, allEffectiveValues, inheritedActualValues); - }, - loadInheritedData: function(restUrl) - { - var allEffectiveValues = null; - xhr.get( - { - url: restUrl, - sync: true, - content: { actuals: false }, - handleAs: "json", - load: function(data) - { - allEffectiveValues = data[0].context; - } - } - ); - - var inheritedActualValues = null; - xhr.get( - { - url: restUrl, - sync: true, - content: { actuals: true, inheritedActuals: true}, - handleAs: "json", - load: function(data) - { - inheritedActualValues = data[0].context; - } - } - ); - - this.setData({}, allEffectiveValues, inheritedActualValues); - }, - setData: function(actualValues, allEffectiveValues, inheritedActualValues) - { - this.value = actualValues; - this.effectiveValues = allEffectiveValues; - this.inheritedActualValues = inheritedActualValues; - - var values = this._mergeValues(actualValues, allEffectiveValues, inheritedActualValues); - this._originalValues = values; - - var grid = this._grid; - if (grid) - { - // delete previous store data - grid.store.fetch({ - onComplete:function(items,request) - { - if(items.length) - { - array.forEach(items, function(item) - { - grid.store.deleteItem(item); - }); - } - } - }); - - // add new data into grid store - this._nextGridItemId = 0; - for(var i=0; i<values.length; i++) - { - var item = values[i]; - var storeItem = { - id: this._nextId(), - name: item.name, - actualValue: item.actualValue, - effectiveValue: item.effectiveValue, - "inherited": item["inherited"], - changed: false - }; - grid.store.newItem(storeItem); - } - grid.store.save(); - } - this._filter(this._filterBox.value); - this._handleOnChange(actualValues); - }, - addInheritedContext: function(object) - { - if (object) - { - var grid = this._grid; - for(key in object) - { - for(var i=0;i< this._originalValues.length;i++) - { - var varExists = false; - if (this._originalValues[i].name == key) - { - varExists = true; - break; - } - } - if (!varExists && !(key in this._dynamicInheritedContext)) - { - this._dynamicInheritedContext[key] = object[key]; - var storeItem = { - id: this._nextId(), - name: key, - actualValue: object[key], - effectiveValue: "", - "inherited": true, - changed: false - }; - grid.store.newItem(storeItem); - this._originalValues.push({name: key, - actualValue: object[key], - effectiveValue: "", - "inherited": true, - changed: false}); - } - } - grid.store.save(); - this._filter(this._filterBox.value); - } - }, - removeDynamicallyAddedInheritedContext: function() - { - if (this._dynamicInheritedContext) - { - var that = this; - var grid = this._grid; - grid.store.fetch({ - onComplete:function(items,request) - { - if(items.length) - { - for(key in that._dynamicInheritedContext) - { - var item = null; - for(var i=0;i<items.length;i++) - { - if (items[i].name == key) - { - item = items[i]; - break; - } - } - if (item && !item.changed) - { - grid.store.deleteItem(item); - that._deleteOriginalItem(item); - } - } - grid.store.save(); - that._dynamicInheritedContext = {}; - } - } - }); - } - }, - destroy: function() - { - if (this.domNode) - { - this.domNode.destroy(); - this.domNode = null; - } - if (this._grid != null) - { - this._grid.destroyRecursively(); - this._grid = null; - } - if (this._addButton != null) - { - this._addButton.destroyRecursively(); - this._addButton = null; - } - if (this._deleteButton != null) - { - this._deleteButton.destroyRecursively(); - this._deleteButton = null; - } - }, - onChange: function(newValue){}, - _newItem: function() - { - var newItem = { id: this._nextId(), name: "", actualValue: "", effectiveValue: "", "inherited": false, changed: true}; - var grid = this._grid; - grid.store.newItem(newItem); - grid.store.save(); - grid.store.fetch( - { - onComplete:function(items,request) - { - var rowIndex = items.length - 1; - window.setTimeout(function() - { - grid.focus.setFocusIndex(rowIndex, 1 ); - },10); - } - }); - }, - _deleteSelected: function() - { - var that = this; - var grid = this._grid; - var data = grid.selection.getSelected(); - if(data.length > 0) - { - array.forEach(data, function(selectedItem) { - if (selectedItem !== null && !selectedItem["inherited"]) - { - grid.store.deleteItem(selectedItem); - that._deleteOriginalItem(selectedItem.name); - } - }); - grid.store.save(); - grid.selection.deselectAll(); - this._valueChanged(); - } - }, - _deleteOriginalItem: function(key) - { - for(var i=0;i< this._originalValues.length;i++) - { - if (this._originalValues[i].name == key) - { - this._originalValues = this._originalValues.splice(i, 1); - break; - } - } - }, - _onEdit:function(inRowIndex) - { - var grid = this._grid; - var item = grid.getItem(inRowIndex); - var previousItems = this._originalValues; - var previousItemActualValue = null; - for(var i=0;i<previousItems.length;i++) - { - if (previousItems[i].name == item.name) - { - previousItemActualValue = previousItems[i].actualValue; - break; - } - } - - if (item.actualValue != previousItemActualValue) - { - if (!item.changed) - { - grid.store.setValue(item, "changed", true); - grid.store.save(); - } - } - else - { - if (item["inherited"]== true && item.changed) - { - grid.store.setValue(item, "changed", false); - grid.store.save(); - } - } - this._valueChanged(); - }, - _onStyleRow: function(row) - { - var grid = this._grid; - var inRowIndex = row.index; - var item = grid.getItem(inRowIndex); - if (item && (item["inherited"] == false || item.changed)) - { - row.customClasses += " highlightedText"; - } - else - { - row.customClasses += " normalText"; - } - grid.focus.styleRow(row); - grid.edit.styleRow(row); - }, - _filter: function(value) - { - this._grid.filter({"inherited": value}); - }, - _nextId: function() - { - this._nextGridItemId = this._nextGridItemId + 1; - return this._nextGridItemId; - }, - _valueChanged: function() - { - if (this._grid) - { - var value ={}; - var grid = this._grid; - grid.store.fetch({ - onComplete:function(items,request) - { - if(items.length > 0) - { - array.forEach(items, function(item) - { - if (item !== null && item.name && ((item["inherited"] && item.changed) || !item["inherited"])) - { - value[item.name]=item.actualValue; - } - }); - } - } - }); - if (!util.equals(this.value, value)) - { - this.value = value; - this._handleOnChange(value); - } - } - }, - _setValueAttr: function(actualValues) - { - this.value = actualValues; - if (this.inheritedActualValues!=null && this.effectiveValues != null) - { - this.setData(this.value, this.effectiveValues, this.inheritedActualValues); - } - }, - _setEffectiveValuesAttr: function(effectiveValues) - { - this.effectiveValues = effectiveValues; - if (this.value != null && this.inheritedActualValues !=null) - { - this.setData(this.value, this.effectiveValues, this.inheritedActualValues); - } - }, - _setInheritedActualValues: function(inheritedActualValues) - { - this.inheritedActualValues = inheritedActualValues; - if (this.value!= null && this.effectiveValues != null) - { - this.setData(this.value, this.effectiveValues, this.inheritedActualValues); - } - }, - _mergeValues: function(actualValues, allEffectiveValues, inheritedActualValues) - { - var fields = []; - - if (allEffectiveValues) - { - for(var key in allEffectiveValues) - { - if (!actualValues || !(key in actualValues)) - { - var actualValue = inheritedActualValues && key in inheritedActualValues ? inheritedActualValues[key] : allEffectiveValues[key]; - fields.push({name: key, actualValue: actualValue, effectiveValue: allEffectiveValues[key], "inherited": true}); - } - } - } - - if (actualValues) - { - for(var key in actualValues) - { - var effectiveValue = allEffectiveValues && key in allEffectiveValues ? allEffectiveValues[key]: actualValues[key]; - fields.push({name: key, actualValue: actualValues[key], effectiveValue: effectiveValue, "inherited": false}); - } - } - return fields; - }, - _handleOnChange: function(newValue) - { - if (!util.equals(this._lastValueReported, newValue)) - { - this._lastValueReported = newValue; - if(this._onChangeHandle) - { - this._onChangeHandle.remove(); - } - this._onChangeHandle = this.defer(function() - { - this._onChangeHandle = null; - this.onChange(newValue); - }); - } - } - - }); -}); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/FormWidgetMixin.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/FormWidgetMixin.js deleted file mode 100644 index 11160e9608..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/FormWidgetMixin.js +++ /dev/null @@ -1,102 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define(["dojo/_base/declare"], function(declare) -{ - return declare("qpid.common.FormWidgetMixin", null, - { - name: "", - value: "", - _onChangeActive: false, - - compare: function(val1, val2) - { - if(typeof val1 == "number" && typeof val2 == "number") - { - return (isNaN(val1) && isNaN(val2)) ? 0 : val1 - val2; - } - else if(val1 > val2) - { - return 1; - } - else if(val1 < val2) - { - return -1; - } - else - { - return 0; - } - }, - onChange: function() - { - }, - _setValueAttr: function(newValue, priorityChange) - { - this._handleOnChange(newValue, priorityChange); - }, - _handleOnChange: function(newValue, priorityChange) - { - this._set("value", newValue); - if(this._lastValueReported == undefined && (priorityChange === null || !this._onChangeActive)) - { - this._resetValue = this._lastValueReported = newValue; - } - this._pendingOnChange = this._pendingOnChange || (typeof newValue != typeof this._lastValueReported) - || (this.compare(newValue, this._lastValueReported) != 0); - if(( priorityChange || priorityChange === undefined) && this._pendingOnChange) - { - this._lastValueReported = newValue; - this._pendingOnChange = false; - if(this._onChangeActive) - { - if(this._onChangeHandle) - { - this._onChangeHandle.remove(); - } - this._onChangeHandle = this.defer(function() { this._onChangeHandle = null; this.onChange(newValue); }); - } - } - }, - create: function() - { - this.inherited(arguments); - this._onChangeActive = true; - }, - destroy: function() - { - if(this._onChangeHandle) - { - this._onChangeHandle.remove(); - this.onChange(this._lastValueReported); - } - this.inherited(arguments); - }, - undo: function() - { - this._setValueAttr(this._lastValueReported, false); - }, - reset: function() - { - this._hasBeenBlurred = false; - this._setValueAttr(this._resetValue, true); - } - }); -});
\ No newline at end of file diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/ResourceWidget.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/ResourceWidget.js deleted file mode 100644 index bee38149da..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/ResourceWidget.js +++ /dev/null @@ -1,196 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define([ - "dojo/_base/declare", - "dojo/_base/array", - "dojo/_base/lang", - "qpid/common/util", - "dijit/_Widget", - "dijit/_TemplatedMixin", - "dijit/_WidgetsInTemplateMixin", - "qpid/common/FormWidgetMixin", - "dojo/text!common/ResourceWidget.html", - "dojox/html/entities", - "dojox/form/Uploader", - "dijit/form/Button", - "dijit/form/ValidationTextBox", - "dojox/validate/us", - "dojox/validate/web", - "dojo/domReady!"], -function (declare, array, lang, util, _WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin, FormWidgetMixin, template, entities) -{ - - return declare("qpid.common.ResourceWidget", [_WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin, FormWidgetMixin], - { - templateString: template, - fileReaderSupported: window.FileReader ? true : false, - displayWarningWhenFileReaderUnsupported: false, - isDebug: false, - uploaded: false, - - buildRendering: function() - { - //Strip out the apache comment header from the template html as comments unsupported. - this.templateString = this.templateString.replace(/<!--[\s\S]*?-->/g, ""); - this.inherited(arguments); - }, - postCreate: function() - { - this.inherited(arguments); - - if(this._resetValue === undefined) - { - this._lastValueReported = this._resetValue = this.value; - } - - var that = this; - - if (this.fileReaderSupported) - { - this.fileReader= new FileReader(); - this.fileReader.onload = function(evt) {that._uploadFileComplete(evt);}; - this.fileReader.onerror = function(ex) {console.error("Failed to load file for " + this.name, ex);}; - this.uploader.on("change", function(selected){that._fileChanged(selected)}); - this.clearButton.on("click", function(event){that._fileClearButtonClicked(event)}); - } - else - { - // Fall back for IE8/9 which do not support FileReader - this.uploadFields.style.display = "none"; - if (this.displayWarningWhenFileReaderUnsupported) - { - this.unsupportedWarning.className = this.unsupportedWarning.className.replace("hidden", ""); - } - } - this.resourceLocation.on("blur", function(){that._pathChanged()}); - this._originalValue = arguments.value; - if (this.placeHolder) - { - this.resourceLocation.set("placeHolder", this.placeHolder); - } - if (this.promptMessage) - { - this.resourceLocation.set("promptMessage", this.promptMessage); - } - if (this.title) - { - this.resourceLocation.set("title", this.title); - } - this.resourceLocation.set("required", this.required ? true : false); - this.uploadData.style.display = "none"; - }, - startup: function() - { - if (this.fileReaderSupported) - { - this.uploader.startup(); - } - }, - _fileChanged: function (evt) - { - var file = this.uploader.domNode.children[0].files[0]; - this.selectedFileName = file.name; - this.selectedFile.innerHTML = file.name; - this.selectedFileStatus.className = "loadingIcon"; - if (this.isDebug) - { - this._log("Beginning to read file " + file.name + " for " + this.name); - } - this.fileReader.readAsDataURL(file); - }, - _uploadFileComplete: function(evt) - { - var reader = evt.target; - var result = reader.result; - if (this.isDebug) - { - this._log(this.name + " file read complete, contents " + result); - } - this.set("value", result); - }, - _fileClearButtonClicked: function(event) - { - this.uploaded = false; - this.uploader.reset(); - this.set("value", this._resetValue); - }, - _pathChanged: function() - { - var serverPathValue = this.resourceLocation.get("value") || this._resetValue; - this.set("value", serverPathValue); - if (this.uploaded ) - { - this.uploaded = !serverPathValue; - } - }, - _setValueAttr: function(newValue, priorityChange) - { - var isDataUrl = this.uploaded || ( newValue && newValue.indexOf("data:") == 0 ); - if (isDataUrl) - { - this._initUploaded(true); - } - else - { - this.resourceLocation.set("value", newValue); - this.selectedFileName = null; - this.selectedFileStatus.className = ""; - this.selectedFile.innerHTML = ""; - this.resourceLocation.set("required", this.required ? true : false); - this.resourceLocation.setDisabled(false); - this.clearButton.setDisabled(true); - this.uploadData.style.display = "none"; - } - this.inherited(arguments); - }, - _log: function(message) - { - if (this.isDebug) - { - console.log(message); - } - }, - _setPlaceHolderAttr: function(newValue) - { - this.resourceLocation.set("placeHolder", newValue); - }, - _setUploadedAttr: function(uploaded) - { - this.uploaded = uploaded; - this._initUploaded(uploaded); - }, - _initUploaded: function(uploaded) - { - if (uploaded) - { - this.uploadData.style.display = "block"; - this.selectedFileStatus.className = "loadedIcon"; - this.selectedFile.innerHTML = this.selectedFileName || "uploaded data"; - this.resourceLocation.set("value", ""); - this.resourceLocation.setDisabled(true); - this.resourceLocation.set("required", false); - this.clearButton.setDisabled(false); - this.selectedFileStatus.className = "loadedIcon"; - } - } - } - ); -}); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/TimeZoneSelector.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/TimeZoneSelector.js deleted file mode 100644 index fa4bd8c873..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/TimeZoneSelector.js +++ /dev/null @@ -1,217 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define([ - "dojo/_base/declare", - "dojo/_base/array", - "dojo/dom-construct", - "dojo/parser", - "dojo/query", - "dojo/dom-style", - "dojo/store/Memory", - "dijit/_WidgetBase", - "dijit/registry", - "dojo/text!common/TimeZoneSelector.html", - "qpid/common/timezone", - "dijit/form/ComboBox", - "dijit/form/FilteringSelect", - "dijit/form/CheckBox", - "dojox/validate/us", - "dojox/validate/web", - "dojo/domReady!"], -function (declare, array, domConstruct, parser, query, domStyle, Memory, _WidgetBase, registry, template, timezone) { - - var preferencesRegions = ["Africa","America","Antarctica","Arctic","Asia","Atlantic","Australia","Europe","Indian","Pacific"]; - - function initSupportedRegions() - { - var supportedRegions = [{"id": "undefined", "name": "Undefined"}]; - for(var j = 0; j<preferencesRegions.length; j++) - { - supportedRegions.push({id: preferencesRegions[j], name: preferencesRegions[j] }); - } - return supportedRegions; - } - - return declare("qpid.common.TimeZoneSelector", [_WidgetBase], { - - value: null, - domNode: null, - _regionSelector: null, - _citySelector: null, - _utcSelector: null, - - constructor: function(args) - { - this._args = args; - }, - - buildRendering: function(){ - this.domNode = domConstruct.create("div", {innerHTML: template}); - parser.parse(this.domNode); - }, - - postCreate: function(){ - this.inherited(arguments); - - var self = this; - if (this._args.labelStyle) - { - var nl = query(".labelClass", this.domNode); - array.forEach(nl, function(entry, i){ - domStyle.set(entry, self._args.labelStyle) - }); - } - var supportedTimeZones = timezone.getAllTimeZones(); - - this._utcSelector = registry.byNode(query(".utcSelector", this.domNode)[0]); - this._citySelector = registry.byNode(query(".timezoneCity", this.domNode)[0]); - this._citySelector.set("searchAttr", "city"); - this._citySelector.set("query", {region: /.*/}); - this._citySelector.set("labelAttr", "city"); - this._citySelector.set("store", new Memory({ data: supportedTimeZones })); - if (this._args.name) - { - this._citySelector.set("name", this._args.name); - } - this._regionSelector = registry.byNode(query(".timezoneRegion", this.domNode)[0]); - var supportedRegions = initSupportedRegions(); - this._regionSelector.set("store", new Memory({ data: supportedRegions })); - - this._utcSelector.on("change", function(value){ - var checked = this.get("checked"); - if (checked) - { - self.value ="UTC"; - } - else - { - if (self._citySelector.value && self._regionSelector.value) - { - self.value = self._citySelector.value; - } - else - { - self.value = null; - } - } - self._citySelector.set("disabled", checked); - self._regionSelector.set("disabled", checked); - self._handleOnChange(self.value); - }); - this._regionSelector.on("change", function(value){ - if (value=="undefined") - { - self._citySelector.set("disabled", true); - self._citySelector.query.region = /.*/; - self.value = null; - self._citySelector.set("value", null); - self._handleOnChange(self.value); - } - else - { - self._citySelector.set("disabled", false); - self._citySelector.query.region = value || /.*/; - if (this.timeZone) - { - self._citySelector.set("value", this.timeZone); - this.timeZone = null; - } - else - { - self._citySelector.set("value", null); - } - } - }); - - this._citySelector.on("change", function(value){ - self.value = value; - self._handleOnChange(value); - }); - - this._setValueAttr(this._args.value); - }, - - _setValueAttr: function(value) - { - if (value) - { - if (value == "UTC") - { - this._utcSelector.set("checked", true); - } - else - { - this._utcSelector.set("checked", false); - var elements = value.split("/"); - if (elements.length > 1) - { - this._regionSelector.timeZone = value; - this._regionSelector.set("value", elements[0]); - this._citySelector.set("value", value); - } - else - { - this._regionSelector.set("value", "undefined"); - } - } - } - else - { - this._utcSelector.set("checked", false); - this._regionSelector.set("value", "undefined"); - } - this.value = value; - this._handleOnChange(value); - }, - - destroy: function() - { - if (this.domNode) - { - this.domNode.destroy(); - this.domNode = null; - } - _regionSelector: null; - _citySelector: null; - _utcSelector: null; - }, - - onChange: function(newValue){}, - - _handleOnChange: function(newValue) - { - if (this._lastValueReported != newValue) - { - this._lastValueReported = newValue; - if(this._onChangeHandle) - { - this._onChangeHandle.remove(); - } - this._onChangeHandle = this.defer(function() - { - this._onChangeHandle = null; - this.onChange(newValue); - }); - } - } - - }); -});
\ No newline at end of file diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/UpdatableStore.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/UpdatableStore.js deleted file mode 100644 index 64d557c242..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/UpdatableStore.js +++ /dev/null @@ -1,189 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define(["dojo/json", - "qpid/common/util", - "dojo/store/Memory", - "dojox/grid/DataGrid", - "dojo/data/ObjectStore", - "dojo/store/Observable"], function (json, util, Memory, DataGrid, ObjectStore, Observable) { - - function UpdatableStore( data, divName, structure, func, props, Grid, notObservable ) { - - var that = this; - var GridType = DataGrid; - - that.memoryStore = new Memory({data: data, idProperty: "id"}); - that.store = notObservable ? that.memoryStore : new Observable(that.memoryStore); - that.dataStore = ObjectStore({objectStore: that.store}); - - var gridProperties = { store: that.dataStore, - structure: structure, - autoHeight: true - }; - if(props) { - for(var prop in props) { - if(props.hasOwnProperty(prop)) - { - gridProperties[ prop ] = props[ prop ]; - } - } - } - - if(Grid) - { - GridType = Grid; - } - - that.grid = new GridType(gridProperties, divName); - - // since we created this grid programmatically, call startup to render it - that.grid.startup(); - - if( func ) - { - func(that); - } - - } - - UpdatableStore.prototype.update = function(data) - { - var changed = false; - var store = this.store; - var theItem; - - // handle deletes - // iterate over existing store... if not in new data then remove - store.query({ }).forEach(function(object) { - if(data) { - for(var i=0; i < data.length; i++) { - if(data[i].id == object.id) { - return; - } - } - } - store.remove(object.id); - changed = true; - }); - - // iterate over data... - if(data) { - for(var i=0; i < data.length; i++) - { - if(theItem = store.get(data[i].id)) - { - var modified = !util.equals(theItem, data[i]); - if(modified) - { - if (store.notify) - { - // Seems that we are required to update the item that the store already holds - for(var propName in data[i]) - { - if(data[i].hasOwnProperty(propName)) - { - if(theItem[ propName ] != data[i][ propName ]) - { - theItem[ propName ] = data[i][ propName ]; - } - } - } - // and tell it we have done so - store.notify(theItem, data[i].id); - } - else - { - store.put(data[i], {overwrite: true}); - } - changed = true; - } - } else { - // if not in the store then add - store.put(data[i]); - changed = true; - } - } - } - - return changed; - }; - - function removeItemsFromArray(items, numberToRemove) - { - if (items) - { - if (numberToRemove > 0 && items.length > 0) - { - if (numberToRemove >= items.length) - { - numberToRemove = numberToRemove - items.length; - items.length = 0 - } - else - { - items.splice(0, numberToRemove); - numberToRemove = 0; - } - } - } - return numberToRemove; - }; - - UpdatableStore.prototype.append = function(data, limit) - { - var changed = false; - var items = this.memoryStore.data; - - if (limit) - { - var totalSize = items.length + (data ? data.length : 0); - var numberToRemove = totalSize - limit; - - if (numberToRemove > 0) - { - changed = true; - numberToRemove = removeItemsFromArray(items, numberToRemove); - if (numberToRemove > 0) - { - removeItemsFromArray(data, numberToRemove); - } - } - } - - if (data && data.length > 0) - { - changed = true; - items.push.apply(items, data); - } - - this.memoryStore.setData(items); - return changed; - }; - - UpdatableStore.prototype.close = function() - { - this.dataStore.close(); - this.dataStore = null; - this.store = null; - this.memoryStore = null; - }; - return UpdatableStore; -}); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/footer.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/footer.js deleted file mode 100644 index ea13b1fc53..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/footer.js +++ /dev/null @@ -1,30 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define(["dojo/_base/xhr", "dojo/query", "dojo/domReady!"], function (xhr, query) { - query('div[qpid-type="footer"]').forEach(function(node, index, arr) { - xhr.get({url: "footer.html", - sync: true, - load: function(data) { - node.innerHTML = data; - } }); - }); -}); - diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/formatter.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/formatter.js deleted file mode 100644 index 2f8683ee1c..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/formatter.js +++ /dev/null @@ -1,99 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -define(function () { - return { - - formatBytes: function formatBytes(amount) - { - var returnVal = { units: "B", - value: "0"}; - - - if(amount < 1000) - { - returnVal.value = amount.toPrecision(3);; - } - else if(amount < 1000 * 1024) - { - returnVal.units = "KB"; - returnVal.value = (amount / 1024).toPrecision(3); - } - else if(amount < 1000 * 1024 * 1024) - { - returnVal.units = "MB"; - returnVal.value = (amount / (1024 * 1024)).toPrecision(3); - } - else if(amount < 1000 * 1024 * 1024 * 1024) - { - returnVal.units = "GB"; - returnVal.value = (amount / (1024 * 1024 * 1024)).toPrecision(3); - } - - return returnVal; - - }, - - formatTime: function formatTime(amount) - { - var returnVal = { units: "ms", - value: "0"}; - - if(amount < 1000) - { - returnVal.units = "ms"; - returnVal.value = amount.toString(); - } - else if(amount < 1000 * 60) - { - returnVal.units = "s"; - returnVal.value = (amount / 1000).toPrecision(3); - } - else if(amount < 1000 * 60 * 60) - { - returnVal.units = "min"; - returnVal.value = (amount / (1000 * 60)).toPrecision(3); - } - else if(amount < 1000 * 60 * 60 * 24) - { - returnVal.units = "hr"; - returnVal.value = (amount / (1000 * 60 * 60)).toPrecision(3); - } - else if(amount < 1000 * 60 * 60 * 24 * 7) - { - returnVal.units = "d"; - returnVal.value = (amount / (1000 * 60 * 60 * 24)).toPrecision(3); - } - else if(amount < 1000 * 60 * 60 * 24 * 365) - { - returnVal.units = "wk"; - returnVal.value = (amount / (1000 * 60 * 60 * 24 * 7)).toPrecision(3); - } - else - { - returnVal.units = "yr"; - returnVal.value = (amount / (1000 * 60 * 60 * 24 * 365)).toPrecision(3); - } - - return returnVal; - } - }; -});
\ No newline at end of file diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/grid/ColumnDefDialog.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/grid/ColumnDefDialog.js deleted file mode 100644 index a0b62082cb..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/grid/ColumnDefDialog.js +++ /dev/null @@ -1,145 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -define([ - "dojo/_base/declare", - "dojo/_base/event", - "dojo/_base/array", - "dojo/_base/lang", - "dojo/parser", - "dojo/dom-construct", - "dojo/query", - "dijit/registry", - "dijit/form/Button", - "dijit/form/CheckBox", - "dojox/grid/enhanced/plugins/Dialog", - "dojo/text!../../../grid/showColumnDefDialog.html", - "dojo/domReady!" -], function(declare, event, array, lang, parser, dom, query, registry, Button, CheckBox, Dialog, template ){ - - -return declare("qpid.common.grid.ColumnDefDialog", null, { - - grid: null, - containerNode: null, - _columns: [], - _dialog: null, - - constructor: function(args){ - var grid = this.grid = args.grid; - var that = this; - this.containerNode = dom.create("div", {innerHTML: template}); - parser.parse(this.containerNode).then(function(instances) - { - that._postParse(); - }); - }, - _postParse: function() - { - var submitButton = registry.byNode(query(".displayButton", this.containerNode)[0]); - this.closeButton = registry.byNode(query(".cancelButton", this.containerNode)[0]); - var columnsContainer = query(".columnList", this.containerNode)[0]; - - this._buildColumnWidgets(columnsContainer); - - this._dialog = new Dialog({ - "refNode": this.grid.domNode, - "title": "Grid Columns", - "content": this.containerNode - }); - - var self = this; - submitButton.on("click", function(e){self._onColumnsSelect(e); }); - this.closeButton.on("click", function(e){self._dialog.hide(); }); - - this._dialog.startup(); - }, - - destroy: function(){ - this._dialog.destroyRecursive(); - this._dialog = null; - this.grid = null; - this.containerNode = null; - this._columns = null; - }, - - showDialog: function(){ - this._initColumnWidgets(); - this._dialog.show(); - }, - - _initColumnWidgets: function() - { - var cells = this.grid.layout.cells; - for(var i in cells) - { - var cell = cells[i]; - this._columns[cell.name].checked = !cell.hidden; - } - }, - - _onColumnsSelect: function(evt){ - event.stop(evt); - var grid = this.grid; - grid.beginUpdate(); - var cells = grid.layout.cells; - try - { - for(var i in cells) - { - var cell = cells[i]; - var widget = this._columns[cell.name]; - grid.layout.setColumnVisibility(i, widget.checked); - } - } - finally - { - grid.endUpdate(); - this._dialog.hide(); - } - }, - - _buildColumnWidgets: function(columnsContainer) - { - var cells = this.grid.layout.cells; - for(var i in cells) - { - var cell = cells[i]; - var widget = new dijit.form.CheckBox({ - required: false, - checked: !cell.hidden, - label: cell.name, - name: this.grid.id + "_cchb_ " + i - }); - - this._columns[cell.name] = widget; - - var div = dom.create("div"); - div.appendChild(widget.domNode); - div.appendChild(dom.create("span", {innerHTML: cell.name})); - - columnsContainer.appendChild(div); - } - } - - }); - -}); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/grid/EnhancedFilter.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/grid/EnhancedFilter.js deleted file mode 100644 index 262210f879..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/grid/EnhancedFilter.js +++ /dev/null @@ -1,230 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -define([ - "dojo/_base/declare", - "dojo/_base/lang", - "dojo/_base/array", - "dijit/Toolbar", - "dojox/grid/enhanced/_Plugin", - "dojox/grid/enhanced/plugins/Dialog", - "dojox/grid/enhanced/plugins/filter/FilterLayer", - "dojox/grid/enhanced/plugins/filter/FilterDefDialog", - "dojox/grid/enhanced/plugins/filter/FilterStatusTip", - "dojox/grid/enhanced/plugins/filter/ClearFilterConfirm", - "dojox/grid/EnhancedGrid", - "dojo/i18n!dojox/grid/enhanced/nls/Filter", - "qpid/common/grid/EnhancedFilterTools" -], function(declare, lang, array, Toolbar, _Plugin, - Dialog, FilterLayer, FilterDefDialog, FilterStatusTip, ClearFilterConfirm, EnhancedGrid, nls, EnhancedFilterTools){ - - // override CriteriaBox#_getColumnOptions to show criteria for hidden columns with EnhancedFilter - dojo.extend(dojox.grid.enhanced.plugins.filter.CriteriaBox, { - _getColumnOptions: function(){ - var colIdx = this.dlg.curColIdx >= 0 ? String(this.dlg.curColIdx) : "anycolumn"; - var filterHidden = this.plugin.filterHidden; - return array.map(array.filter(this.plugin.grid.layout.cells, function(cell){ - return !(cell.filterable === false || (!filterHidden && cell.hidden)); - }), function(cell){ - return { - label: cell.name || cell.field, - value: String(cell.index), - selected: colIdx == String(cell.index) - }; - }); - } - }); - - // Enhanced filter has extra functionality for refreshing, limiting rows, displaying/hiding columns in the grid - var EnhancedFilter = declare("qpid.common.grid.EnhancedFilter", _Plugin, { - // summary: - // Accept the same plugin parameters as dojox.grid.enhanced.plugins.Filter and the following: - // - // filterHidden: boolean: - // Whether to display filtering criteria for hidden columns. Default to true. - // - // defaulGridRowLimit: int: - // Default limit for numbers of items to cache in the gris dtore - // - // disableFiltering: boolean: - // Whether to disable a filtering including filter button, clear filter button and filter summary. - // - // toolbar: dijit.Toolbar: - // An instance of toolbar to add the enhanced filter widgets. - - - // name: String - // plugin name - name: "enhancedFilter", - - // filterHidden: Boolean - // whether to filter hidden columns - filterHidden: true, - - constructor: function(grid, args){ - // summary: - // See constructor of dojox.grid.enhanced._Plugin. - this.grid = grid; - this.nls = nls; - - args = this.args = lang.isObject(args) ? args : {}; - if(typeof args.ruleCount != 'number' || args.ruleCount < 0){ - args.ruleCount = 0; - } - this.ruleCountToConfirmClearFilter = args.ruleCountToConfirmClearFilter || 5; - - if (args.filterHidden){ - this.filterHidden = args.filterHidden; - } - this.defaulGridRowLimit = args.defaulGridRowLimit; - this.disableFiltering = args.disableFiltering; - this.displayLastUpdateTime = args.displayLastUpdateTime; - - //Install UI components - var obj = { "plugin": this }; - - this.filterBar = ( args.toolbar && args.toolbar instanceof dijit.Toolbar) ? args.toolbar: new Toolbar(); - - if (!this.disableFiltering) - { - //Install filter layer - this._wrapStore(); - - this.clearFilterDialog = new Dialog({ - refNode: this.grid.domNode, - title: this.nls["clearFilterDialogTitle"], - content: new ClearFilterConfirm(obj) - }); - - this.filterDefDialog = new FilterDefDialog(obj); - this.filterDefDialog.filterDefPane._clearFilterBtn.set("label", "Clear Filter"); - - nls["statusTipTitleNoFilter"] = "Filter is not set"; - nls["statusTipMsg"] = "Click on 'Set Filter' button to specify filtering conditions"; - this.filterStatusTip = new FilterStatusTip(obj); - - var self = this; - var toggleClearFilterBtn = function (arg){ self.enhancedFilterTools.toggleClearFilterBtn(arg); }; - - this.filterBar.toggleClearFilterBtn = toggleClearFilterBtn; - - this.grid.isFilterBarShown = function (){return true}; - - this.connect(this.grid.layer("filter"), "onFilterDefined", function(filter){ - toggleClearFilterBtn(true); - }); - - //Expose the layer event to grid. - grid.onFilterDefined = function(){}; - this.connect(grid.layer("filter"), "onFilterDefined", function(filter){ - grid.onFilterDefined(grid.getFilter(), grid.getFilterRelation()); - }); - } - - // add extra buttons into toolbar - this.enhancedFilterTools = new EnhancedFilterTools({ - grid: grid, - toolbar: this.filterBar, - filterStatusTip: this.filterStatusTip, - clearFilterDialog: this.clearFilterDialog, - filterDefDialog: this.filterDefDialog, - defaulGridRowLimit: this.defaulGridRowLimit, - disableFiltering: this.disableFiltering, - displayLastUpdateTime: this.displayLastUpdateTime, - nls: nls, - ruleCountToConfirmClearFilter: this.ruleCountToConfirmClearFilter - }); - - this.filterBar.placeAt(this.grid.viewsHeaderNode, "before"); - this.filterBar.startup(); - - }, - - destroy: function(){ - this.inherited(arguments); - try - { - if (this.filterDefDialog) - { - this.filterDefDialog.destroy(); - this.filterDefDialog = null; - } - if (this.grid) - { - this.grid.unwrap("filter"); - this.grid = null; - } - if (this.filterBar) - { - this.filterBar.destroyRecursive(); - this.filterBar = null; - } - if (this.enhancedFilterTools) - { - this.enhancedFilterTools.destroy(); - this.enhancedFilterTools = null; - } - if (this.clearFilterDialog) - { - this.clearFilterDialog.destroyRecursive(); - this.clearFilterDialog = null; - } - if (this.filterStatusTip) - { - this.filterStatusTip.destroy(); - this.filterStatusTip = null; - } - this.args = null; - - }catch(e){ - console.warn("Filter.destroy() error:",e); - } - }, - - _wrapStore: function(){ - var g = this.grid; - var args = this.args; - var filterLayer = args.isServerSide ? new FilterLayer.ServerSideFilterLayer(args) : - new FilterLayer.ClientSideFilterLayer({ - cacheSize: args.filterCacheSize, - fetchAll: args.fetchAllOnFirstFilter, - getter: this._clientFilterGetter - }); - FilterLayer.wrap(g, "_storeLayerFetch", filterLayer); - - this.connect(g, "_onDelete", lang.hitch(filterLayer, "invalidate")); - }, - - onSetStore: function(store){ - this.filterDefDialog.clearFilter(true); - }, - - _clientFilterGetter: function(/* data item */ datarow,/* cell */cell, /* int */rowIndex){ - return cell.get(rowIndex, datarow); - } - - }); - - EnhancedGrid.registerPlugin(EnhancedFilter); - - return EnhancedFilter; - -}); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/grid/EnhancedFilterTools.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/grid/EnhancedFilterTools.js deleted file mode 100644 index 187ed8cfc6..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/grid/EnhancedFilterTools.js +++ /dev/null @@ -1,310 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -define([ - "dojo/_base/declare", - "dojo/_base/event", - "dojo/dom-construct", - "dojo/date/locale", - "dijit/form/Button", - "dijit/form/ToggleButton", - "qpid/common/grid/RowNumberLimitDialog", - "qpid/common/grid/ColumnDefDialog", - "qpid/common/grid/FilterSummary", - "qpid/management/UserPreferences" -], function(declare, event, domConstruct, locale, Button, ToggleButton, RowNumberLimitDialog, ColumnDefDialog, FilterSummary, UserPreferences){ - - var _stopEvent = function (evt){ - try{ - if(evt && evt.preventDefault){ - event.stop(evt); - } - }catch(e){} - }; - - return declare("qpid.common.grid.EnhancedFilterTools", null, { - - grid: null, - filterBar: null, - filterStatusTip: null, - clearFilterDialog: null, - filterDefDialog: null, - - columnDefDialog: null, - columnDefButton: null, - filterDefButton: null, - clearFilterButton: null, - filterSummary: null, - setRowNumberLimitButton: null, - setRowNumberLimitDialog: null, - refreshButton: null, - autoRefreshButton: null, - - constructor: function(params) - { - this.inherited(arguments); - - this.filterBar = params.toolbar; - this.grid = params.grid; - this.filterStatusTip= params.filterStatusTip; - this.clearFilterDialog = params.clearFilterDialog; - this.filterDefDialog = params.filterDefDialog; - this.ruleCountToConfirmClearFilter = params.ruleCountToConfirmClearFilter; - this.displayLastUpdateTime = params.hasOwnProperty("displayLastUpdateTime")?params.displayLastUpdateTime:true; - - this._addRefreshButtons(); - this._addRowLimitButton(params.defaulGridRowLimit); - this._addColumnsButton(); - - if (!params.disableFiltering) - { - this._addFilteringTools(params.nls); - } - }, - - toggleClearFilterBtn: function(clearFlag) - { - var filterLayer = this.grid.layer("filter"); - var filterSet = filterLayer && filterLayer.filterDef && filterLayer.filterDef(); - this.clearFilterButton.set("disabled", !filterSet); - }, - - destroy: function() - { - this.inherited(arguments); - - if (this.columnDefDialog) - { - this.columnDefDialog.destroy(); - this.columnDefDialog = null; - } - if (this.columnDefButton) - { - this.columnDefButton.destroy(); - this.columnDefButton = null; - } - if (this.filterDefButton) - { - this.filterDefButton.destroy(); - this.filterDefButton = null; - } - if (this.clearFilterButton) - { - this.clearFilterButton.destroy(); - this.clearFilterButton = null; - } - if (this.filterSummary) - { - this.filterSummary.destroy(); - this.filterSummary = null; - } - if (this.setRowNumberLimitButton) - { - this.setRowNumberLimitButton.destroy(); - this.setRowNumberLimitButton = null; - } - if (this.setRowNumberLimitDialog) - { - this.setRowNumberLimitDialog.destroy(); - this.setRowNumberLimitDialog = null; - } - if (this.refreshButton) - { - this.refreshButton.destroy(); - this.refreshButton = null; - } - if (this.autoRefreshButton) - { - this.autoRefreshButton.destroy(); - this.autoRefreshButton = null; - } - - this.grid = null; - this.filterBar = null; - this.filterStatusTip = null; - this.clearFilterDialog = null; - this.filterDefDialog = null; - }, - - _addRefreshButtons: function() - { - var self = this; - this.refreshButton = new dijit.form.Button({ - label: "Refresh", - type: "button", - iconClass: "gridRefreshIcon", - title: "Manual Refresh" - }); - - this.autoRefreshButton = new dijit.form.ToggleButton({ - label: "Auto Refresh", - type: "button", - iconClass: "gridAutoRefreshIcon", - title: "Auto Refresh" - }); - - this.autoRefreshButton.on("change", function(value){ - self.grid.updater.updatable=value; - self.refreshButton.set("disabled", value); - }); - - this.refreshButton.on("click", function(value){ - self.grid.updater.performUpdate(); - }); - - this.filterBar.addChild(this.autoRefreshButton); - this.filterBar.addChild(this.refreshButton); - - if (this.displayLastUpdateTime) - { - var updateStatusPanel = domConstruct.create("div"); - var updateTimeLabel = domConstruct.create("span", {innerHTML: "Update time: ", "class": "formLabel-labelCell", "style": "padding-right: 5px;padding-left: 5px"}, updateStatusPanel); - var updateTimeLabelPreferredTZ = domConstruct.create("span", {innerHTML: "Preferred timezone:", "style": "padding-right: 5px"}, updateStatusPanel); - var updateTimePreferredTZ = domConstruct.create("span", {"style": "padding-right: 5px"}, updateStatusPanel); - var updateTimeLabelBrowserTZ = domConstruct.create("span", {innerHTML: "Browser timezone:", "style": "padding-right: 5px"}, updateStatusPanel); - var updateTimeBrowserTZ = domConstruct.create("span", {"style": "padding-right: 5px"}, updateStatusPanel); - - var lastUpdateTimeUpdater = function(data) - { - var userTimeZone = UserPreferences.timeZone; - var displayStyle = userTimeZone? "inline" : "none"; - updateTimeLabelPreferredTZ.style.display = displayStyle; - updateTimePreferredTZ.style.display = displayStyle; - var formatOptions = {selector: "time", timePattern: "HH:mm:ss.SSS", appendTimeZone: true, addOffset: true}; - var updateTime = new Date(); - updateTimePreferredTZ.innerHTML = UserPreferences.formatDateTime(updateTime.getTime(), formatOptions); - updateTimeBrowserTZ.innerHTML = locale.format(updateTime, formatOptions); - }; - - if (self.grid.updater.store) - { - // data have been already provided/or fetched - // set last update time to current time - lastUpdateTimeUpdater(); - } - - self.grid.updater.addOnUpdate(lastUpdateTimeUpdater); - domConstruct.place(updateStatusPanel, this.grid.viewsHeaderNode, "before"); - } - }, - - _addRowLimitButton: function(defaulGridRowLimit) - { - var self = this; - this.setRowNumberLimitButton = new dijit.form.Button({ - label: "Set Row Limit", - type: "button", - iconClass: "rowNumberLimitIcon", - title: "Set Row Number Limit" - }); - this.setRowNumberLimitButton.set("title", "Set Row Number Limit (Current: " + defaulGridRowLimit +")"); - - this.setRowNumberLimitDialog = new RowNumberLimitDialog(this.grid.domNode, function(newLimit){ - if (newLimit > 0 && self.grid.updater.appendLimit != newLimit ) - { - self.grid.updater.appendLimit = newLimit; - self.grid.updater.performRefresh([]); - self.setRowNumberLimitButton.set("title", "Set Row Number Limit (Current: " + newLimit +")"); - } - }); - - this.setRowNumberLimitButton.on("click", function(evt){ - self.setRowNumberLimitDialog.showDialog(self.grid.updater.appendLimit); - }); - - this.filterBar.addChild(this.setRowNumberLimitButton); - }, - - _addColumnsButton: function() - { - var self = this; - this.columnDefDialog = new ColumnDefDialog({grid: this.grid}); - - this.columnDefButton = new dijit.form.Button({ - label: "Display Columns", - type: "button", - iconClass: "columnDefDialogButtonIcon", - title: "Show/Hide Columns" - }); - - this.columnDefButton.on("click", function(e){ - _stopEvent(e); - self.columnDefDialog.showDialog(); - }); - - this.filterBar.addChild(this.columnDefButton); - }, - - _addFilteringTools: function(nls) - { - var self = this; - - this.filterDefButton = new dijit.form.Button({ - "class": "dojoxGridFBarBtn", - label: "Set Filter", - iconClass: "dojoxGridFBarDefFilterBtnIcon", - showLabel: "true", - title: "Define filter" - }); - - this.clearFilterButton = new dijit.form.Button({ - "class": "dojoxGridFBarBtn", - label: "Clear filter", - iconClass: "dojoxGridFBarClearFilterButtontnIcon", - showLabel: "true", - title: "Clear filter", - disabled: true - }); - - - this.filterDefButton.on("click", function(e){ - _stopEvent(e); - - // a bit of a hack to force dialog to rebuild the criteria controls in order to get rid from empty rule controls - self.filterDefDialog._criteriasChanged = true; - self.filterDefDialog.showDialog(); - }); - - this.clearFilterButton.on("click", function(e){ - _stopEvent(e); - if (self.ruleCountToConfirmClearFilter && self.filterDefDialog.getCriteria() >= self.ruleCountToConfirmClearFilter) - { - self.clearFilterDialog.show(); - } - else - { - self.grid.layer("filter").filterDef(null); - self.toggleClearFilterBtn(true) - } - }); - - this.filterSummary = new FilterSummary({grid: this.grid, filterStatusTip: this.filterStatusTip, nls: nls}); - - this.filterBar.addChild(this.filterDefButton); - this.filterBar.addChild(this.clearFilterButton); - - this.filterBar.addChild(new dijit.ToolbarSeparator()); - this.filterBar.addChild(this.filterSummary, "last"); - this.filterBar.getColumnIdx = function(coordX){return self.filterSummary._getColumnIdx(coordX);}; - - } - }); -});
\ No newline at end of file diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/grid/FilterSummary.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/grid/FilterSummary.js deleted file mode 100644 index d29e4027df..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/grid/FilterSummary.js +++ /dev/null @@ -1,173 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -define([ - "dojo/_base/declare", - "dojo/_base/lang", - "dojo/_base/html", - "dojo/query", - "dojo/dom-construct", - "dojo/string", - "dojo/on", - "dijit/_WidgetBase" -], function(declare, lang, html, query, domConstruct, string, on, _WidgetBase){ - -return declare("qpid.common.grid.FilterSummary", [_WidgetBase], { - - domNode: null, - itemName: null, - filterStatusTip: null, - grid: null, - _handle_statusTooltip: null, - _timeout_statusTooltip: 300, - _nls: null, - - constructor: function(params) - { - this.inherited(arguments); - this.itemName = params.itemsName; - this.initialize(params.filterStatusTip, params.grid); - this._nls = params.nls; - }, - - buildRendering: function(){ - this.inherited(arguments); - var itemsName = this.itemName || this._nls["defaultItemsName"]; - var message = string.substitute(this._nls["filterBarMsgNoFilterTemplate"], [0, itemsName ]); - this.domNode = domConstruct.create("span", {innerHTML: message, "class": "dijit dijitReset dijitInline dijitButtonInline", role: "presentation" }); - }, - - postCreate: function(){ - this.inherited(arguments); - on(this.domNode, "mouseenter", lang.hitch(this, this._onMouseEnter)); - on(this.domNode, "mouseleave", lang.hitch(this, this._onMouseLeave)); - on(this.domNode, "mousemove", lang.hitch(this, this._onMouseMove)); - }, - - destroy: function() - { - this.inherited(arguments); - this.itemName = null; - this.filterStatusTip = null; - this.grid = null; - this._handle_statusTooltip = null; - this._filteredClass = null; - this._nls = null; - }, - - initialize: function(filterStatusTip, grid) - { - this.filterStatusTip = filterStatusTip; - this.grid = grid; - if (this.grid) - { - var filterLayer = grid.layer("filter"); - this.connect(filterLayer, "onFiltered", this.onFiltered); - } - }, - - onFiltered: function(filteredSize, originSize) - { - try - { - var itemsName = this.itemName || this._nls["defaultItemsName"], - msg = "", g = this.grid, - filterLayer = g.layer("filter"); - if(filterLayer.filterDef()){ - msg = string.substitute(this._nls["filterBarMsgHasFilterTemplate"], [filteredSize, originSize, itemsName]); - }else{ - msg = string.substitute(this._nls["filterBarMsgNoFilterTemplate"], [originSize, itemsName]); - } - this.domNode.innerHTML = msg; - } - catch(e) - { - // swallow and log exception - // otherwise grid rendering is screwed - console.error(e); - } - }, - - _getColumnIdx: function(coordX){ - var headers = query("[role='columnheader']", this.grid.viewsHeaderNode); - var idx = -1; - for(var i = headers.length - 1; i >= 0; --i){ - var coord = html.position(headers[i]); - if(coordX >= coord.x && coordX < coord.x + coord.w){ - idx = i; - break; - } - } - if(idx >= 0 && this.grid.layout.cells[idx].filterable !== false){ - return idx; - }else{ - return -1; - } - }, - - _setStatusTipTimeout: function(){ - this._clearStatusTipTimeout(); - this._handle_statusTooltip = setTimeout(lang.hitch(this,this._showStatusTooltip),this._timeout_statusTooltip); - }, - - _clearStatusTipTimeout: function(){ - if (this._handle_statusTooltip){ - clearTimeout(this._handle_statusTooltip); - } - this._handle_statusTooltip = null; - }, - - _showStatusTooltip: function(){ - this._handle_statusTooltip = null; - if(this.filterStatusTip){ - this.filterStatusTip.showDialog(this._tippos.x, this._tippos.y, this._getColumnIdx(this._tippos.x)); - } - }, - - _updateTipPosition: function(evt){ - this._tippos = { - x: evt.pageX, - y: evt.pageY - }; - }, - - _onMouseEnter: function(e){ - this._updateTipPosition(e); - if(this.filterStatusTip){ - this._setStatusTipTimeout(); - } - }, - - _onMouseMove: function(e){ - if(this.filterStatusTip){ - this._setStatusTipTimeout(); - if(this._handle_statusTooltip){ - this._updateTipPosition(e); - } - } - }, - - _onMouseLeave: function(e){ - this._clearStatusTipTimeout(); - } - }); - -});
\ No newline at end of file diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/grid/GridUpdater.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/grid/GridUpdater.js deleted file mode 100644 index e5d96d44e7..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/grid/GridUpdater.js +++ /dev/null @@ -1,297 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - - -define(["dojo/_base/xhr", - "dojo/parser", - "dojo/_base/array", - "dojo/_base/lang", - "qpid/common/properties", - "qpid/common/updater", - "qpid/common/UpdatableStore", - "qpid/common/util", - "dojo/store/Memory", - "dojo/data/ObjectStore", - "qpid/common/grid/EnhancedFilter", - "dojox/grid/enhanced/plugins/NestedSorting", - "dojo/domReady!"], - function (xhr, parser, array, lang, properties, updater, UpdatableStore, util, Memory, ObjectStore) { - - function GridUpdater(args, store) { - this.updatable = args.hasOwnProperty("updatable") ? args.updatable : true ; - this.serviceUrl = args.serviceUrl; - - this.onUpdate = []; - if (args.onUpdate) - { - this.onUpdate.push(args.onUpdate); - } - this.dataTransformer = args.dataTransformer; - - this.appendData = args.append; - this.appendLimit = args.appendLimit; - this.initialData = args.data; - this.initializeStore(store); - }; - - GridUpdater.prototype.buildUpdatableGridArguments = function(args) - { - var filterPluginFound = args && args.hasOwnProperty("plugins") && args.plugins.filter ? true: false; - - var gridProperties = { - autoHeight: true, - plugins: { - pagination: { - defaultPageSize: 25, - pageSizes: [10, 25, 50, 100], - description: true, - sizeSwitch: true, - pageStepper: true, - gotoButton: true, - maxPageStep: 4, - position: "bottom" - }, - enhancedFilter: { - disableFiltering: filterPluginFound - } - } - }; - - if(args) - { - for(var argProperty in args) - { - if(args.hasOwnProperty(argProperty)) - { - if (argProperty == "plugins") - { - var argPlugins = args[ argProperty ]; - for(var argPlugin in argPlugins) - { - if(argPlugins.hasOwnProperty(argPlugin)) - { - var argPluginProperties = argPlugins[ argPlugin ]; - if (argPluginProperties && gridProperties.plugins.hasOwnProperty(argPlugin)) - { - var gridPlugin = gridProperties.plugins[ argPlugin ]; - for(var pluginProperty in argPluginProperties) - { - if(argPluginProperties.hasOwnProperty(pluginProperty)) - { - gridPlugin[pluginProperty] = argPluginProperties[pluginProperty]; - } - } - } - else - { - gridProperties.plugins[ argPlugin ] = argPlugins[ argPlugin ]; - } - } - } - } - else - { - gridProperties[ argProperty ] = args[ argProperty ]; - } - } - } - } - - gridProperties.updater = this; - gridProperties.store = this.dataStore; - - return gridProperties; - }; - - GridUpdater.prototype.initializeStore = function(store) - { - var self = this; - - function processData(data) - { - if (self.dataTransformer) - { - data = self.dataTransformer(data); - } - var dataSet = false; - if (!store) - { - store = new ObjectStore({objectStore: new Memory({data: data, idProperty: "id"})}); - dataSet = true; - } - self.dataStore = store - self.store = store; - if (store instanceof ObjectStore) - { - if( store.objectStore instanceof Memory) - { - self.memoryStore = store.objectStore; - } - self.store = store.objectStore - } - - if (data) - { - if ((dataSet || self.updateOrAppend(data)) && self.onUpdate.length > 0) - { - self.fireUpdate(data); - } - } - }; - - if (this.serviceUrl) - { - var requestUrl = lang.isFunction(this.serviceUrl) ? this.serviceUrl() : this.serviceUrl; - xhr.get({url: requestUrl, sync: true, handleAs: "json"}).then(processData, util.xhrErrorHandler); - } - else - { - processData(this.initialData); - } - }; - - GridUpdater.prototype.start = function(grid) - { - this.grid = grid; - if (this.serviceUrl) - { - updater.add(this); - } - }; - - GridUpdater.prototype.destroy = function() - { - updater.remove(this); - if (this.dataStore) - { - this.dataStore.close(); - this.dataStore = null; - } - this.store = null; - this.memoryStore = null; - this.grid = null; - this.onUpdate = null; - }; - - GridUpdater.prototype.updateOrAppend = function(data) - { - return this.appendData ? - UpdatableStore.prototype.append.call(this, data, this.appendLimit): - UpdatableStore.prototype.update.call(this, data); - }; - - GridUpdater.prototype.refresh = function(data) - { - if (this.dataTransformer && data) - { - data = this.dataTransformer(data); - } - this.updating = true; - try - { - if (this.updateOrAppend(data)) - { - // EnhancedGrid with Filter plugin has "filter" layer. - // The filter expression needs to be re-applied after the data update - var filterLayer = this.grid.layer("filter"); - if ( filterLayer && filterLayer.filterDef) - { - var currentFilter = filterLayer.filterDef(); - - if (currentFilter) - { - // re-apply filter in the filter layer - filterLayer.filterDef(currentFilter); - } - } - - // refresh grid to render updates - this.grid._refresh(); - } - } - finally - { - this.updating = false; - this.fireUpdate(data); - } - } - - GridUpdater.prototype.update = function() - { - if (this.updatable) - { - this.performUpdate(); - } - }; - - GridUpdater.prototype.performUpdate = function() - { - var self = this; - var requestUrl = lang.isFunction(this.serviceUrl) ? this.serviceUrl() : this.serviceUrl; - var requestArguments = {url: requestUrl, sync: properties.useSyncGet, handleAs: "json"}; - xhr.get(requestArguments).then(function(data){self.refresh(data);}); - }; - - GridUpdater.prototype.performRefresh = function(data) - { - if (!this.updating) - { - this.refresh(data); - } - }; - - GridUpdater.prototype.fireUpdate=function(data) - { - if (this.onUpdate.length > 0) - { - for(var i=0; i<this.onUpdate.length;i++) - { - var onUpdate= this.onUpdate[i]; - try - { - onUpdate(data); - } - catch(e) - { - if (console && console.error) - { - console.error(e); - } - } - } - } - }; - - GridUpdater.prototype.addOnUpdate = function(obj) { - this.onUpdate.push(obj); - }; - - GridUpdater.prototype.removeOnUpdate = function(obj) { - for(var i = 0; i < this.onUpdate.length; i++) { - if(this.onUpdate[i] === obj) { - this.onUpdate.splice(i,1); - return; - } - } - }; - - return GridUpdater; - }); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/grid/RowNumberLimitDialog.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/grid/RowNumberLimitDialog.js deleted file mode 100644 index e78670bf57..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/grid/RowNumberLimitDialog.js +++ /dev/null @@ -1,102 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -define([ - "dojo/_base/declare", - "dojo/_base/event", - "dojo/_base/array", - "dojo/_base/lang", - "dojo/parser", - "dojo/dom-construct", - "dojo/query", - "dijit/registry", - "dijit/form/Button", - "dijit/form/CheckBox", - "dojox/grid/enhanced/plugins/Dialog", - "dojo/text!../../../grid/showRowNumberLimitDialog.html", - "dojo/domReady!" -], function(declare, event, array, lang, parser, dom, query, registry, Button, CheckBox, Dialog, template ){ - - -return declare("qpid.management.logs.RowNumberLimitDialog", null, { - - grid: null, - dialog: null, - - constructor: function(domNode, limitChangedCallback) - { - var that = this; - this.containerNode = dom.create("div", {innerHTML: template}); - parser.parse(this.containerNode).then(function(instances) - { - that._postParse(domNode, limitChangedCallback); - }); - }, - _postParse: function(domNode, limitChangedCallback) - { - this.rowNumberLimit = registry.byNode(query(".rowNumberLimit", this.containerNode)[0]) - this.submitButton = registry.byNode(query(".submitButton", this.containerNode)[0]); - this.closeButton = registry.byNode(query(".cancelButton", this.containerNode)[0]); - - this.dialog = new Dialog({ - "refNode": domNode, - "title": "Grid Rows Number", - "content": this.containerNode - }); - - var self = this; - this.submitButton.on("click", function(e){ - if (self.rowNumberLimit.value > 0) - { - try - { - limitChangedCallback(self.rowNumberLimit.value); - } - catch(e) - { - console.error(e); - } - finally - { - self.dialog.hide(); - } - } - }); - - this.closeButton.on("click", function(e){self.dialog.hide(); }); - this.dialog.startup(); - }, - - destroy: function(){ - this.submitButton.destroy(); - this.closeButton.destroy(); - this.dialog.destroy(); - this.dialog = null; - }, - - showDialog: function(currentLimit){ - this.rowNumberLimit.set("value", currentLimit); - this.dialog.show(); - } - - }); - -}); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/grid/UpdatableGrid.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/grid/UpdatableGrid.js deleted file mode 100644 index 04041388bd..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/grid/UpdatableGrid.js +++ /dev/null @@ -1,56 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -define([ - "dojo/_base/declare", - "dojox/grid/EnhancedGrid", - "dojo/domReady!"], function(declare, EnhancedGrid){ - - return declare("qpid.common.grid.UpdatableGrid", [EnhancedGrid], { - - updater: null, - - postCreate: function(){ - this.inherited(arguments); - if (this.updater) - { - this.updater.start(this); - } - }, - - destroy: function(){ - if (this.updater) - { - try - { - this.updater.destroy(); - } - catch(e) - { - console.error(e) - } - this.updater = null; - } - this.inherited(arguments); - } - }); - -}); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/metadata.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/metadata.js deleted file mode 100644 index 1a9ceb7419..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/metadata.js +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -define(["dojo/_base/xhr", - "dojo/_base/array", - "dojox/lang/functional/object", - "qpid/common/properties", - "dojo/domReady!" - ], - function (xhr, array, fobject, properties) - { - var metadata = - { - _init: function () - { - var that = this; - xhr.get({sync: true, handleAs: "json", url: "service/metadata", load: function(data){that._onMetadata(data)}}); - }, - _onMetadata: function (metadata) - { - this.metadata = metadata; - }, - getMetaData: function (category, type) - { - return this.metadata[category][type]; - }, - getDefaultValueForAttribute: function (category, type, attributeName) - { - var metaDataForInstance = this.getMetaData(category, type); - var attributesForType = metaDataForInstance["attributes"]; - var attributesForName = attributesForType[attributeName]; - return attributesForName ? attributesForName["defaultValue"] : undefined; - }, - getTypesForCategory: function (category) - { - return fobject.keys(this.metadata[category]); - }, - extractUniqueListOfValues : function(data) - { - var values = []; - for (i = 0; i < data.length; i++) - { - for (j = 0; j < data[i].length; j++) - { - var current = data[i][j]; - if (array.indexOf(values, current) == -1) - { - values.push(current); - } - } - } - return values; - }, - implementsManagedInterface: function (category, type, managedInterfaceName) - { - var md = this.getMetaData(category, type); - if (md && md.managedInterfaces) - { - return array.indexOf(md.managedInterfaces, managedInterfaceName) >= 0 ; - } - return false; - }, - validChildTypes: function (category, type, childCategory) - { - var metaData = this.getMetaData(category, type); - return metaData ? metaData.validChildTypes[childCategory] : []; - } - - }; - - metadata._init(); - - return metadata; - }); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/properties.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/properties.js deleted file mode 100644 index 8d85345b74..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/properties.js +++ /dev/null @@ -1,26 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define(["dojo/has", "dojo/_base/sniff", "dojo/domReady!"], - function (has) { - var properties = {}; - properties.useSyncGet = (has("ie") <= 8); - return properties; - });
\ No newline at end of file diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/timezone.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/timezone.js deleted file mode 100644 index f886a72daa..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/timezone.js +++ /dev/null @@ -1,95 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -define(["dojo/_base/xhr"], function (xhr) { - - var timezones = {}; - - var timeZoneSortFunction = function(a, b){ - if (a.region == b.region) - { - if (a.city == b.city) - { - return 0; - } - return a.city < b.city ? -1 : 1; - } - return a.region < b.region ? -1 : 1; - } - - function loadTimezones() - { - xhr.get({ - url: "service/helper?action=ListTimeZones", - sync: true, - handleAs: "json", - load: function(zones) - { - zones.sort(timeZoneSortFunction); - timezones.data = zones; - }, - error: function(error) - { - if (console && console.error) - { - console.error(error); - } - } - }); - } - - return { - getAllTimeZones: function() - { - if (!timezones.data) - { - loadTimezones(); - } - return timezones.data; - }, - getTimeZoneInfo: function(timeZone) { - if (timeZone == "UTC") - { - return { - "id" : "UTC", - "name" : "UTC", - "offset" : 0 - } - } - var tzi = timezones[timeZone]; - if (!tzi) - { - var data = this.getAllTimeZones(); - for(var i = 0; i < data.length; i++) - { - var zone = data[i]; - if (zone.id == timeZone) - { - tzi = zone; - timezones[timeZone] = zone; - break; - } - } - } - return tzi; - } - }; -});
\ No newline at end of file diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/updater.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/updater.js deleted file mode 100644 index f31fd1aa1f..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/updater.js +++ /dev/null @@ -1,65 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define(["qpid/management/UserPreferences"], function (UserPreferences) { - var updateList = new Array(); - - function invokeUpdates() - { - for(var i = 0; i < updateList.length; i++) - { - var obj = updateList[i]; - obj.update(); - } - } - - var updatePeriod = UserPreferences.updatePeriod ? UserPreferences.updatePeriod: 5; - - var timer = setInterval(invokeUpdates, updatePeriod * 1000); - - var updateIntervalListener = { - onPreferencesChange: function(preferences) - { - if (preferences.updatePeriod && preferences.updatePeriod != updatePeriod) - { - updatePeriod = preferences.updatePeriod; - clearInterval(timer); - timer = setInterval(invokeUpdates, updatePeriod * 1000); - } - } - }; - - UserPreferences.addListener(updateIntervalListener); - - return { - add: function(obj) { - updateList.push(obj); - }, - - remove: function(obj) { - for(var i = 0; i < updateList.length; i++) { - if(updateList[i] === obj) { - updateList.splice(i,1); - return; - } - } - } - }; -});
\ No newline at end of file diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/util.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/util.js deleted file mode 100644 index 5bf5574347..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/util.js +++ /dev/null @@ -1,842 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define(["dojo/_base/xhr", - "dojo/_base/array", - "dojo/_base/event", - "dojo/_base/lang", - "dojo/json", - "dojo/dom-construct", - "dojo/dom-geometry", - "dojo/dom-style", - "dojo/_base/window", - "dojo/query", - "dojo/parser", - "dojo/store/Memory", - "dojo/window", - "dojo/on", - "dojox/html/entities", - "qpid/common/metadata", - "qpid/common/widgetconfigurer", - "dijit/registry", - "dijit/TitlePane", - "dijit/Dialog", - "dijit/form/Form", - "dijit/form/Button", - "dijit/form/RadioButton", - "dijit/form/CheckBox", - "dijit/form/FilteringSelect", - "dijit/form/ValidationTextBox", - "dojox/layout/TableContainer", - "dijit/layout/ContentPane", - "dojox/validate/us", - "dojox/validate/web", - "dojo/domReady!" - ], - function (xhr, array, event, lang, json, dom, geometry, domStyle, win, query, parser, Memory, w, on, entities, metadata, widgetconfigurer, registry) { - var util = {}; - if (Array.isArray) { - util.isArray = function (object) { - return Array.isArray(object); - }; - } else { - util.isArray = function (object) { - return object instanceof Array; - }; - } - - util.flattenStatistics = function (data) { - var attrName, stats, propName, theList; - for(attrName in data) { - if(data.hasOwnProperty(attrName)) { - if(attrName == "statistics") { - stats = data.statistics; - for(propName in stats) { - if(stats.hasOwnProperty( propName )) { - data[ propName ] = stats[ propName ]; - } - } - } else if(data[ attrName ] instanceof Array) { - theList = data[ attrName ]; - - for(var i=0; i < theList.length; i++) { - util.flattenStatistics( theList[i] ); - } - } - } - } - }; - - util.isReservedExchangeName = function(exchangeName) - { - return exchangeName == null || exchangeName == "" || "<<default>>" == exchangeName || exchangeName.indexOf("amq.") == 0 || exchangeName.indexOf("qpid.") == 0; - }; - - util.deleteGridSelections = function(updater, grid, url, confirmationMessageStart, idParam) - { - var data = grid.selection.getSelected(); - var success = false; - if(data.length) - { - var confirmationMessage = null; - if (data.length == 1) - { - confirmationMessage = confirmationMessageStart + " '" + data[0].name + "'?"; - } - else - { - var names = ''; - for(var i = 0; i<data.length; i++) - { - if (names) - { - names += ', '; - } - names += "\""+ data[i].name + "\""; - } - confirmationMessage = confirmationMessageStart + "s " + names + "?"; - } - if(confirm(confirmationMessage)) - { - var i, queryParam; - for(i = 0; i<data.length; i++) - { - if(queryParam) - { - queryParam += "&"; - } - else - { - queryParam = "?"; - } - queryParam += ( idParam || "id" ) + "=" + encodeURIComponent(data[i].id); - } - var query = url + queryParam; - var failureReason = ""; - xhr.del({url: query, sync: true, handleAs: "json"}).then( - function(data) - { - success = true; - grid.selection.deselectAll(); - if (updater) - { - updater.update(); - } - }, - function(error) {success = false; failureReason = error;}); - if(!success ) - { - util.xhrErrorHandler(failureReason); - } - } - } - return success; - } - - util.isProviderManagingUsers = function(type) - { - return metadata.implementsManagedInterface("AuthenticationProvider", type, "PasswordCredentialManagingAuthenticationProvider"); - }; - - util.supportsPreferencesProvider = function(type) - { - return metadata.implementsManagedInterface("AuthenticationProvider", type, "PreferencesSupportingAuthenticationProvider"); - }; - - util.showSetAttributesDialog = function(attributeWidgetFactories, data, putURL, dialogTitle, category, type, appendNameToUrl) - { - var layout = new dojox.layout.TableContainer({ - cols: 1, - "labelWidth": "300", - showLabels: true, - orientation: "horiz", - customClass: "formLabel" - }); - var submitButton = new dijit.form.Button({label: "Submit", type: "submit"}); - var form = new dijit.form.Form(); - - var dialogContent = dom.create("div"); - var dialogContentArea = dom.create("div", {"style": {width: 600}}); - var dialogActionBar = dom.create("div", { "class": "dijitDialogPaneActionBar"} ); - dialogContent.appendChild(dialogContentArea); - dialogContent.appendChild(dialogActionBar); - dialogContentArea.appendChild(layout.domNode) - dialogActionBar.appendChild(submitButton.domNode); - form.domNode.appendChild(dialogContent); - - var widgets = {}; - var requiredFor ={}; - var groups = {}; - for(var i in attributeWidgetFactories) - { - var attributeWidgetFactory = attributeWidgetFactories[i]; - var widget = attributeWidgetFactory.createWidget(data); - var name = attributeWidgetFactory.name ? attributeWidgetFactory.name : widget.name; - widgets[name] = widget; - var dotPos = name.indexOf("."); - if (dotPos == -1) - { - if (widget instanceof dijit.layout.ContentPane) - { - dialogContentArea.appendChild(widget.domNode); - } - else - { - layout.addChild(widget); - } - } - else - { - var groupName = name.substring(0, dotPos); - var groupFieldContainer = null; - if (groups.hasOwnProperty(groupName)) - { - groupFieldContainer = groups[groupName]; - } - else - { - groupFieldContainer = new dojox.layout.TableContainer({ - cols: 1, - "labelWidth": "300", - showLabels: true, - orientation: "horiz", - customClass: "formLabel" - }); - groups[groupName] = groupFieldContainer; - var groupTitle = attributeWidgetFactory.groupName ? attributeWidgetFactory.groupName : - groupName.charAt(0).toUpperCase() + groupName.slice(1); - var panel = new dijit.TitlePane({title: groupTitle, content: groupFieldContainer.domNode}); - dialogContentArea.appendChild(dom.create("br")); - dialogContentArea.appendChild(panel.domNode); - } - groupFieldContainer.addChild(widget); - } - if (attributeWidgetFactory.hasOwnProperty("requiredFor") && !data[name]) - { - requiredFor[attributeWidgetFactory.requiredFor] = widget; - } - } - - this.applyMetadataToWidgets(dialogContent, category, type); - - // add onchange handler to set required property for dependent widget - for(var widgetName in requiredFor) - { - var dependent = requiredFor[widgetName]; - var widget = widgets[widgetName]; - if (widget) - { - widget.dependent = dependent; - widget.on("change", function(newValue){ - this.dependent.set("required", newValue != ""); - }); - } - } - var setAttributesDialog = new dijit.Dialog({ - title: dialogTitle, - content: form - }); - form.on("submit", function(e) - { - event.stop(e); - try - { - if(form.validate()) - { - var values = {}; - var formWidgets = form.getDescendants(); - for(var i in formWidgets) - { - var widget = formWidgets[i]; - var value = widget.value; - var propName = widget.name; - if (propName && !widget.disabled){ - if ((widget instanceof dijit.form.CheckBox || widget instanceof dijit.form.RadioButton)) { - if (widget.checked != widget.initialValue) { - values[ propName ] = widget.checked; - } - } else if (value != widget.initialValue) { - values[ propName ] = value ? value: null; - } - } - } - - var that = this; - var url = putURL; - if (appendNameToUrl){ - url = url + "/" + encodeURIComponent(values["name"]); - } - xhr.put({url: url , sync: true, handleAs: "json", - headers: { "Content-Type": "application/json"}, - putData: json.stringify(values), - load: function(x) {that.success = true; }, - error: function(error) {that.success = false; that.failureReason = error;}}); - if(this.success === true) - { - setAttributesDialog.destroy(); - } - else - { - util.xhrErrorHandler(this.failureReason); - - } - return false; - } - else - { - alert('Form contains invalid data. Please correct first'); - return false; - } - } - catch(e) - { - alert("Unexpected exception:" + e.message); - return false; - } - }); - form.connectChildren(true); - setAttributesDialog.startup(); - var formWidgets = form.getDescendants(); - var aproximateHeight = 0; - for(var i in formWidgets){ - var widget = formWidgets[i]; - var propName = widget.name; - if (propName) { - if ((widget instanceof dijit.form.CheckBox || widget instanceof dijit.form.RadioButton)) { - widget.initialValue = widget.checked; - } else { - widget.initialValue = widget.value; - } - aproximateHeight += 30; - } - } - dialogContentArea.style.overflow= "auto"; - dialogContentArea.style.height = "300"; - setAttributesDialog.on("hide", function(e){setAttributesDialog.destroy();}); - setAttributesDialog.show(); - }; - - util.findAllWidgets = function(root) - { - return query("[widgetid]", root).map(registry.byNode).filter(function(w){ return w;}); - }; - - util.xhrErrorHandler = function(error) - { - var fallback = "Unexpected error - see server logs"; - var statusCodeNode = dojo.byId("errorDialog.statusCode"); - var errorMessageNode = dojo.byId("errorDialog.errorMessage"); - var userMustReauth = false; - - if (error) - { - if (error.hasOwnProperty("status")) - { - var hasMessage = error.hasOwnProperty("message"); - var message; - - if (error.status == 0) - { - message = "Unable to contact the Broker"; - } - else if (error.status == 401) - { - message = "Authentication required"; - userMustReauth = true; - } - else if (error.status == 403) - { - message = "Access Forbidden"; - } - else - { - message = hasMessage ? error.message : fallback; - - // Try for a more detail error sent by the Broker as json - if (error.hasOwnProperty("responseText")) - { - try - { - var errorObj = json.parse(error.responseText); - message = errorObj.hasOwnProperty("errorMessage") ? errorObj.errorMessage : errorMessageNode; - } - catch (e) - { - // Ignore - } - } - } - - errorMessageNode.innerHTML = entities.encode(message ? message : fallback); - statusCodeNode.innerHTML = entities.encode(String(error.status)); - - dojo.byId("errorDialog.advice.retry").style.display = userMustReauth ? "none" : "block"; - dojo.byId("errorDialog.advice.reconnect").style.display = userMustReauth ? "block" : "none"; - - domStyle.set(registry.byId("errorDialog.button.cancel").domNode, 'display', userMustReauth ? "none" : "block"); - domStyle.set(registry.byId("errorDialog.button.relogin").domNode, 'display', userMustReauth ? "block" : "none"); - - } - else - { - statusCodeNode.innerHTML = ""; - errorMessageNode.innerHTML = fallback; - } - - var dialog = dijit.byId("errorDialog"); - if (!dialog.open) - { - dialog.show(); - } - } - }; - - util.sendRequest = function (url, method, attributes, sync) - { - var success = false; - var failureReason = ""; - var syncRequired = sync == undefined ? true : sync; - if (method == "POST" || method == "PUT") - { - xhr.put({ - url: url, - sync: syncRequired, - handleAs: "json", - headers: { "Content-Type": "application/json"}, - putData: json.stringify(attributes), - load: function(x) {success = true; }, - error: function(error) {success = false; failureReason = error;} - }); - } - else if (method == "DELETE") - { - xhr.del({url: url, sync: syncRequired, handleAs: "json"}).then( - function(data) { success = true; }, - function(error) {success = false; failureReason = error;} - ); - } - - if (syncRequired && !success) - { - util.xhrErrorHandler(failureReason); - } - return success; - } - - util.equals = function(object1, object2) - { - if (object1 && object2) - { - if (typeof object1 != typeof object2) - { - return false; - } - else - { - if (object1 instanceof Array || typeof object1 == "array") - { - if (object1.length != object2.length) - { - return false; - } - - for (var i = 0, l=object1.length; i < l; i++) - { - var item = object1[i]; - if (item && (item instanceof Array || typeof item == "array" || item instanceof Object)) - { - if (!this.equals(item, object2[i])) - { - return false; - } - } - else if (item != object2[i]) - { - return false; - } - } - - return true; - } - else if (object1 instanceof Object) - { - for (propName in object1) - { - if (object1.hasOwnProperty(propName) != object2.hasOwnProperty(propName)) - { - return false; - } - else if (typeof object1[propName] != typeof object2[propName]) - { - return false; - } - } - - for(propName in object2) - { - var object1Prop = object1[propName]; - var object2Prop = object2[propName]; - - if (object2.hasOwnProperty(propName) != object1.hasOwnProperty(propName)) - { - return false; - } - else if (typeof object1Prop != typeof object2Prop) - { - return false; - } - - if(!object2.hasOwnProperty(propName)) - { - // skip functions - continue; - } - - if (object1Prop && (object1Prop instanceof Array || typeof object1Prop == "array" || object1Prop instanceof Object)) - { - if (!this.equals(object1Prop, object2Prop)) - { - return false; - } - } - else if(object1Prop != object2Prop) - { - return false; - } - } - return true; - } - } - } - return object1 === object2; - } - - util.parseHtmlIntoDiv = function(containerNode, htmlTemplateLocation, postParseCallback) - { - xhr.get({url: htmlTemplateLocation, - sync: true, - load: function(template) { - containerNode.innerHTML = template; - parser.parse(containerNode).then(function(instances) - { - if (postParseCallback && typeof postParseCallback == "function") - { - postParseCallback(); - } - }); - }}); - } - util.buildUI = function(containerNode, parent, htmlTemplateLocation, fieldNames, obj, postParseCallback) - { - this.parseHtmlIntoDiv(containerNode, htmlTemplateLocation, - function() - { - if (fieldNames && obj) - { - for(var i=0; i<fieldNames.length;i++) - { - var fieldName = fieldNames[i]; - obj[fieldName]= query("." + fieldName, containerNode)[0]; - } - } - - if (postParseCallback && typeof postParseCallback == "function") - { - postParseCallback(); - } - }); - - } - - util.updateUI = function(data, fieldNames, obj) - { - for(var i=0; i<fieldNames.length;i++) - { - var fieldName = fieldNames[i]; - var value = data[fieldName]; - var fieldNode = obj[fieldName]; - if (fieldNode) - { - fieldNode.innerHTML= (value == undefined || value == null) ? "" : entities.encode(String(value)); - } - } - } - - util.applyMetadataToWidgets = function(domRoot, category, type) - { - this.applyToWidgets(domRoot, category, type, null); - } - - util.applyToWidgets = function(domRoot, category, type, data) - { - var widgets = util.findAllWidgets(domRoot); - array.forEach(widgets, - function (widget) - { - widgetconfigurer.config(widget, category, type, data); - }); - } - - util.getFormWidgetValues = function (form, initialData) - { - var values = {}; - var formWidgets = form.getChildren(); - for(var i in formWidgets) - { - var widget = formWidgets[i]; - var value = widget.value; - var propName = widget.name; - if (propName && (widget.required || value )) - { - if (widget.excluded) - { - continue; - } - if (widget.contextvar) - { - var context = values["context"]; - if (!context) - { - context = {}; - values["context"] = context; - } - context[propName]=String(value); - } - else if (widget instanceof dijit.form.RadioButton) - { - if (widget.checked) - { - var currentValue = values[propName]; - if (currentValue) - { - if (lang.isArray(currentValue)) - { - currentValue.push(value) - } - else - { - values[ propName ] = [currentValue, value]; - } - } - else - { - values[ propName ] = value; - } - } - } - else if (widget instanceof dijit.form.CheckBox) - { - values[ propName ] = widget.checked; - } - else - { - if (widget.get("type") == "password") - { - if (value) - { - values[ propName ] = value; - } - } - else - { - values[ propName ] = value ? value: null; - } - } - } - } - if (initialData) - { - for(var propName in values) - { - if (values[propName] == initialData[propName]) - { - delete values[propName]; - } - } - } - return values; - } - - util.updateUpdatableStore = function(updatableStore, data) - { - var currentRowCount = updatableStore.grid.rowCount; - updatableStore.grid.domNode.style.display = data ? "block" : "none"; - updatableStore.update(data || []); - if (data) - { - if (currentRowCount == 0 && data.length == 1) - { - // grid with a single row is not rendering properly after being hidden - // force rendering - updatableStore.grid.render(); - } - } - } - - util.makeTypeStore = function (types) - { - var typeData = []; - for (var i = 0; i < types.length; i++) { - var type = types[i]; - typeData.push({id: type, name: type}); - } - return new Memory({ data: typeData }); - } - - util.setMultiSelectOptions = function(multiSelectWidget, options) - { - util.addMultiSelectOptions(multiSelectWidget, options, true); - } - - util.addMultiSelectOptions = function(multiSelectWidget, options, clearExistingOptions) - { - if (clearExistingOptions) - { - var children = multiSelectWidget.children; - var initialLength = children.length; - for (var i = initialLength - 1; i >= 0 ; i--) - { - var child = children.item(i); - multiSelectWidget.removeChild(child); - } - } - for (var i = 0; i < options.length; i++) - { - // construct new option for list - var newOption = win.doc.createElement('option'); - var value = options[i]; - newOption.innerHTML = value; - newOption.value = value; - - // add new option to list - multiSelectWidget.appendChild(newOption); - } - } - - var singleContextVarRegexp = "(\\${[\\w+\\.\\-:]+})"; - - util.numericOrContextVarRegexp = function(constraints) - { - return "^(\\d+)|" + singleContextVarRegexp + "$"; - } - - util.signedOrContextVarRegexp = function(constraints) - { - return "^(-?\\d+)|" + singleContextVarRegexp + "$"; - } - - util.nameOrContextVarRegexp = function(constraints) - { - return "^(\\w+)|" + singleContextVarRegexp + "$"; - } - - util.jdbcUrlOrContextVarRegexp = function(constraints) - { - return "^(jdbc:.*:.*)|" + singleContextVarRegexp + "$"; - } - - util.nodeAddressOrContextVarRegexp = function(constraints) - { - return "^(([0-9a-zA-Z.-_]|::)+:[0-9]{1,5})|" + singleContextVarRegexp + "$"; - } - - util.resizeContentAreaAndRepositionDialog = function(contentNode, dialog) - { - var viewport = w.getBox(); - var contentDimension =dojo.position(contentNode); - var dialogDimension = dojo.position(dialog.domNode); - var dialogTitleAndFooterHeight = dialogDimension.h - contentDimension.h; - var dialogLeftRightSpaces = dialogDimension.w - contentDimension.w; - - var resize = function() - { - var viewport = w.getBox(); - var width = viewport.w * dialog.maxRatio; - var height = viewport.h * dialog.maxRatio; - var dialogDimension = dojo.position(dialog.domNode); - - var maxContentHeight = height - dialogTitleAndFooterHeight; - - // if width style is set on a dialog node, use dialog width - if (dialog.domNode.style && dialog.domNode.style.width) - { - width = dialogDimension.w; - } - var maxContentWidth = width - dialogLeftRightSpaces; - domStyle.set(contentNode, {"overflow": "auto", maxHeight: maxContentHeight + "px", maxWidth: maxContentWidth + "px"}); - - var dialogX = viewport.w/2 - dialogDimension.w/2; - var dialogY = viewport.h/2 - dialogDimension.h/2; - domStyle.set(dialog.domNode, {top: dialogY + "px", left: dialogX + "px"}); - dialog.resize(); - }; - resize(); - on(window, "resize", resize); - } - - util.submit = function(method, resourceUrl, data, successAction, failureAction) - { - var result = {success: true, failureReason: null}; - var xhrArguments = { - url: resourceUrl, - sync: true, - handleAs: "json", - headers: { "Content-Type": "application/json"}, - load: function(x) { - result.success = true; - result.data = x; - if (successAction) - { - successAction(x); - } - }, - error: function(error) { - result.success = false; - result.failureReason = error; - if (failureAction) - { - failureAction(error); - } - else - { - util.xhrErrorHandler(error); - } - } - } - if (data && method != "del") - { - xhrArguments[method + "Data"] = json.stringify(data); - } - xhr[method](xhrArguments); - return result; - } - - util.post = function(resourceUrl, data, successAction, failureAction) - { - return util.submit("post", resourceUrl, data, successAction, failureAction) - } - - util.put = function(resourceUrl, data, successAction, failureAction) - { - return util.submit("put", resourceUrl, data, successAction, failureAction) - } - - return util; - }); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/widgetconfigurer.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/widgetconfigurer.js deleted file mode 100644 index baafc6f71d..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/common/widgetconfigurer.js +++ /dev/null @@ -1,152 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -define(["dojo/_base/xhr", - "dojo/string", - "dojo/query", - "dojo/dom", - "dojo/dom-construct", - "dojo/dom-attr", - "dijit/registry", - "qpid/common/properties", - "qpid/common/metadata", - "dojo/text!strings.html", - "dojo/domReady!" - ], - function (xhr, string, query, dom, domConstruct, domAttr, registry, properties, metadata, template) - { - var widgetconfigurer = - { - _init: function () - { - var stringsTemplate = domConstruct.create("div", {innerHTML: template}); - var promptTemplateWithDefaultNode = query("[id='promptTemplateWithDefault']", stringsTemplate)[0]; - - // The following will contain ${prompt} and ${default} formatted with html elements - this.promptTemplateWithDefault = promptTemplateWithDefaultNode.innerHTML; - - domConstruct.destroy(stringsTemplate); - }, - _processWidgetPrompt: function (widget, category, type) - { - var widgetName = widget.name; - if (widgetName && (widget instanceof dijit.form.ValidationTextBox || widget instanceof dijit.form.FilteringSelect)) - { - // If not done so already, save the prompt text specified on the widget. We do this so if we - // config the same widget again, we can apply the default again (which may be different if the user - // has selected a different type within the category). - if (typeof widget.get("qpid.originalPromptMessage") == "undefined") - { - widget.set("qpid.originalPromptMessage", widget.get("promptMessage")); - } - - var promptMessage = widget.get("qpid.originalPromptMessage"); - var defaultValue = metadata.getDefaultValueForAttribute(category, type, widgetName); - if (defaultValue) - { - var newPromptMessage = string.substitute(this.promptTemplateWithDefault, { 'default': defaultValue, 'prompt': promptMessage }); - - if (promptMessage != newPromptMessage) - { - widget.set("promptMessage", newPromptMessage); - } - } - } - else if (widget instanceof dijit.Tooltip) - { - // If it is a tooltop, find the connected widget and use its name to lookup the default from the metadata. - if (typeof widget.get("qpid.originalLabel") == "undefined") - { - widget.set("qpid.originalLabel", widget.get("label")); - } - - var message = widget.get("qpid.originalLabel"); - var connectId = widget.get("connectId")[0]; - var connectWidget = registry.byId(connectId); - if (connectWidget) - { - var connectWidgetName = connectWidget.get("name"); - var defaultValue = metadata.getDefaultValueForAttribute(category, type, connectWidgetName); - if (defaultValue) - { - var newMessage = string.substitute(this.promptTemplateWithDefault, { 'default': defaultValue, 'prompt': message }); - - if (message != newMessage) - { - widget.set("label", newMessage); - } - } - } - } - }, - _processWidgetValue: function (widget, category, type, data) - { - var widgetName = widget.name; - - if (widgetName) - { - var defaultValue = metadata.getDefaultValueForAttribute(category, type, widgetName); - var dataValue = data && widgetName in data ? data[widgetName] : null; - - // Stash the default value and initial value so we can later differentiate - // when sending updates to the server - - if (defaultValue) - { - widget.defaultValue = defaultValue; - } - - if (dataValue) - { - widget.initialValue = dataValue; - } - - if (widget instanceof dijit.form.FilteringSelect || widget instanceof dojox.form.CheckedMultiSelect) - { - var widgetValue = dataValue == null ? defaultValue : dataValue; - if (widgetValue) - { - widget.set("value", widgetValue); - } - } - else if (widget instanceof dijit.form.CheckBox) - { - var widgetValue = dataValue == null ? (defaultValue == "true") : dataValue; - widget.set("checked", widgetValue ? true : false); - } - else - { - if (dataValue) - { - widget.set("value", dataValue); - } - } - } - }, - config: function (widget, category, type, data) - { - this._processWidgetPrompt(widget, category, type); - this._processWidgetValue(widget, category, type, data); - } - }; - - widgetconfigurer._init(); - - return widgetconfigurer; - }); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/AccessControlProvider.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/AccessControlProvider.js deleted file mode 100644 index cf95a23819..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/AccessControlProvider.js +++ /dev/null @@ -1,132 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define(["dojo/_base/xhr", - "dojo/parser", - "dojo/query", - "dojo/_base/connect", - "qpid/common/properties", - "qpid/common/updater", - "qpid/common/util", - "qpid/common/UpdatableStore", - "dojox/grid/EnhancedGrid", - "dijit/registry", - "dojo/_base/event", - "dojox/html/entities", - "dojox/grid/enhanced/plugins/Pagination", - "dojox/grid/enhanced/plugins/IndirectSelection", - "dojo/domReady!"], - function (xhr, parser, query, connect, properties, updater, util, UpdatableStore, EnhancedGrid, registry, event, entities) { - - function AccessControlProvider(name, parent, controller) { - this.name = name; - this.controller = controller; - this.modelObj = { type: "accesscontrolprovider", name: name, parent: parent}; - } - - AccessControlProvider.prototype.getTitle = function() { - return "AccessControlProvider: " + this.name ; - }; - - AccessControlProvider.prototype.open = function(contentPane) { - var that = this; - this.contentPane = contentPane; - xhr.get({url: "showAccessControlProvider.html", - sync: true, - load: function(data) { - contentPane.containerNode.innerHTML = data; - parser.parse(contentPane.containerNode).then(function(instances) - { - - that.accessControlProviderUpdater = new AccessControlProviderUpdater(contentPane.containerNode, that.modelObj, that.controller); - - var deleteButton = query(".deleteAccessControlProviderButton", contentPane.containerNode)[0]; - var deleteWidget = registry.byNode(deleteButton); - connect.connect(deleteWidget, "onClick", - function(evt){ - event.stop(evt); - that.deleteAccessControlProvider(); - }); - }); - }}); - }; - - AccessControlProvider.prototype.close = function() { - if (this.accessControlProviderUpdater.details) - { - this.accessControlProviderUpdater.details.close(); - } - }; - - AccessControlProvider.prototype.deleteAccessControlProvider = function() { - if(confirm("Are you sure you want to delete access control provider '" + this.name + "'?")) { - var query = "api/latest/accesscontrolprovider/" +encodeURIComponent(this.name); - this.success = true - var that = this; - xhr.del({url: query, sync: true, handleAs: "json"}).then( - function(data) { - that.close(); - that.contentPane.onClose() - that.controller.tabContainer.removeChild(that.contentPane); - that.contentPane.destroyRecursive(); - }, - function(error) {that.success = false; that.failureReason = error;}); - if(!this.success ) { - util.xhrErrorHandler(this.failureReason); - } - } - }; - - function AccessControlProviderUpdater(node, groupProviderObj, controller) - { - this.controller = controller; - this.name = query(".name", node)[0]; - this.type = query(".type", node)[0]; - this.state = query(".state", node)[0]; - this.query = "api/latest/accesscontrolprovider/"+encodeURIComponent(groupProviderObj.name); - - var that = this; - - xhr.get({url: this.query, sync: properties.useSyncGet, handleAs: "json"}) - .then(function(data) - { - that.accessControlProviderData = data[0]; - - util.flattenStatistics( that.accessControlProviderData ); - - that.updateHeader(); - - var ui = that.accessControlProviderData.type; - require(["qpid/management/accesscontrolprovider/"+ ui], - function(SpecificProvider) { - that.details = new SpecificProvider(query(".providerDetails", node)[0], groupProviderObj, controller); - }); - }); - } - - AccessControlProviderUpdater.prototype.updateHeader = function() - { - this.name.innerHTML = entities.encode(String(this.accessControlProviderData[ "name" ])); - this.type.innerHTML = entities.encode(String(this.accessControlProviderData[ "type" ])); - this.state.innerHTML = entities.encode(String(this.accessControlProviderData[ "state" ])); - }; - - return AccessControlProvider; - }); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/AuthenticationProvider.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/AuthenticationProvider.js deleted file mode 100644 index cf9c32496a..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/AuthenticationProvider.js +++ /dev/null @@ -1,243 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define(["dojo/_base/xhr", - "dojo/parser", - "dojo/query", - "dojo/_base/connect", - "qpid/common/properties", - "qpid/common/updater", - "qpid/common/util", - "qpid/common/UpdatableStore", - "dojox/grid/EnhancedGrid", - "qpid/management/addAuthenticationProvider", - "dojo/_base/event", - "dijit/registry", - "dojo/dom-style", - "dojox/html/entities", - "dojo/dom", - "qpid/management/PreferencesProvider", - "qpid/management/authenticationprovider/PrincipalDatabaseAuthenticationManager", - "dojo/domReady!"], - function (xhr, parser, query, connect, properties, updater, util, UpdatableStore, EnhancedGrid, - addAuthenticationProvider, event, registry, domStyle, entities, dom, PreferencesProvider, PrincipalDatabaseAuthenticationManager) { - - function AuthenticationProvider(name, parent, controller) { - this.name = name; - this.controller = controller; - this.modelObj = { type: "authenticationprovider", name: name, parent: parent}; - } - - AuthenticationProvider.prototype.getTitle = function() { - return "AuthenticationProvider:" + this.name; - }; - - AuthenticationProvider.prototype.open = function(contentPane) { - var that = this; - this.contentPane = contentPane; - xhr.get({url: "showAuthProvider.html", - sync: true, - load: function(data) { - contentPane.containerNode.innerHTML = data; - parser.parse(contentPane.containerNode).then(function(instances) - { - - var authProviderUpdater = new AuthProviderUpdater(contentPane.containerNode, that.modelObj, that.controller, that); - that.authProviderUpdater = authProviderUpdater; - - var editButtonNode = query(".editAuthenticationProviderButton", contentPane.containerNode)[0]; - var editButtonWidget = registry.byNode(editButtonNode); - editButtonWidget.on("click", - function(evt){ - event.stop(evt); - addAuthenticationProvider.show(authProviderUpdater.authProviderData); - }); - authProviderUpdater.editButton = editButtonWidget; - - var deleteButton = query(".deleteAuthenticationProviderButton", contentPane.containerNode)[0]; - var deleteWidget = registry.byNode(deleteButton); - connect.connect(deleteWidget, "onClick", - function(evt){ - event.stop(evt); - that.deleteAuthenticationProvider(); - }); - - authProviderUpdater.update(); - if (util.isProviderManagingUsers(authProviderUpdater.authProviderData.type)) - { - authProviderUpdater.managingUsersUI = new PrincipalDatabaseAuthenticationManager(contentPane.containerNode, authProviderUpdater.authProviderData, that.controller); - authProviderUpdater.managingUsersUI.update(authProviderUpdater.authProviderData); - } - - if (!util.supportsPreferencesProvider(authProviderUpdater.authProviderData.type)) - { - var authenticationProviderPanel = registry.byNode( query(".preferencesPanel", contentPane.containerNode)[0]); - domStyle.set(authenticationProviderPanel.domNode, "display","none"); - } - else - { - var preferencesProviderData = authProviderUpdater.authProviderData.preferencesproviders? authProviderUpdater.authProviderData.preferencesproviders[0]: null; - authProviderUpdater.updatePreferencesProvider(preferencesProviderData); - } - - updater.add( that.authProviderUpdater ); - }); - }}); - }; - - AuthenticationProvider.prototype.close = function() { - updater.remove( this.authProviderUpdater); - if (this.authProviderUpdater.details) - { - updater.remove(this.authProviderUpdater.details.authDatabaseUpdater); - } - }; - - AuthenticationProvider.prototype.deleteAuthenticationProvider = function() { - if(confirm("Are you sure you want to delete authentication provider '" + this.name + "'?")) { - var query = "api/latest/authenticationprovider/" +encodeURIComponent(this.name); - this.success = true - var that = this; - xhr.del({url: query, sync: true, handleAs: "json"}).then( - function(data) { - that.close(); - that.contentPane.onClose() - that.controller.tabContainer.removeChild(that.contentPane); - that.contentPane.destroyRecursive(); - }, - function(error) {that.success = false; that.failureReason = error;}); - if(!this.success ) { - util.xhrErrorHandler(this.failureReason); - } - } - }; - - function AuthProviderUpdater(node, authProviderObj, controller, authenticationProvider) - { - this.controller = controller; - this.name = query(".name", node)[0]; - this.type = query(".type", node)[0]; - this.state = query(".state", node)[0]; - this.authenticationProvider = authenticationProvider; - this.preferencesProviderType=dom.byId("preferencesProviderType"); - this.preferencesProviderName=dom.byId("preferencesProviderName"); - this.preferencesProviderState=dom.byId("preferencesProviderState"); - this.editPreferencesProviderButton = query(".editPreferencesProviderButton", node)[0]; - this.deletePreferencesProviderButton = query(".deletePreferencesProviderButton", node)[0]; - this.preferencesProviderAttributes = dom.byId("preferencesProviderAttributes") - this.preferencesNode = query(".preferencesProviderDetails", node)[0]; - -this.authenticationProviderDetailsContainer = query(".authenticationProviderDetails", node)[0]; - this.query = "api/latest/authenticationprovider/" + encodeURIComponent(authProviderObj.name); - - } - - AuthProviderUpdater.prototype.updatePreferencesProvider = function(preferencesProviderData) - { - if (preferencesProviderData) - { - if (!this.preferencesProvider) - { - var preferencesProvider =new PreferencesProvider(preferencesProviderData.name, this.authProviderData); - preferencesProvider.init(this.preferencesNode, this); - this.preferencesProvider = preferencesProvider; - } - this.preferencesProvider.update(preferencesProviderData); - } - else - { - if (this.preferencesProvider) - { - this.preferencesProvider.update(null); - } - } - }; - - AuthProviderUpdater.prototype.onPreferencesProviderDeleted = function() - { - this.preferencesProvider = null; - } - - AuthProviderUpdater.prototype.updateHeader = function() - { - this.authenticationProvider.name = this.authProviderData[ "name" ] - this.name.innerHTML = entities.encode(String(this.authProviderData[ "name" ])); - this.type.innerHTML = entities.encode(String(this.authProviderData[ "type" ])); - this.state.innerHTML = entities.encode(String(this.authProviderData[ "state" ])); - }; - - AuthProviderUpdater.prototype.update = function() - { - var that = this; - xhr.get({url: this.query, sync: true, handleAs: "json"}).then(function(data) {that._update(data[0]);}); - }; - - AuthProviderUpdater.prototype._update = function(data) - { - var that = this; - this.authProviderData = data; - util.flattenStatistics(data ); - this.updateHeader(); - - if (this.details) - { - this.details.update(data); - } - else - { - require(["qpid/management/authenticationprovider/" + encodeURIComponent(data.type.toLowerCase()) + "/show"], - function(DetailsUI) - { - that.details = new DetailsUI({containerNode:that.authenticationProviderDetailsContainer, parent: that}); - that.details.update(data); - } - ); - } - - if (this.managingUsersUI) - { - try - { - this.managingUsersUI.update(data); - } - catch(e) - { - if (console) - { - console.error(e); - } - } - } - var preferencesProviderData = data.preferencesproviders? data.preferencesproviders[0]: null; - try - { - this.updatePreferencesProvider(preferencesProviderData); - } - catch(e) - { - if (console) - { - console.error(e); - } - } - } - - return AuthenticationProvider; - }); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Broker.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Broker.js deleted file mode 100644 index 9720bc988b..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Broker.js +++ /dev/null @@ -1,715 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define(["dojo/_base/xhr", - "dojo/parser", - "dojo/query", - "dojo/json", - "dojo/_base/connect", - "dojo/store/Memory", - "qpid/common/properties", - "qpid/common/updater", - "qpid/common/util", - "qpid/common/UpdatableStore", - "dojox/grid/EnhancedGrid", - "dijit/registry", - "dojox/html/entities", - "qpid/management/addAuthenticationProvider", - "qpid/management/addVirtualHostNodeAndVirtualHost", - "qpid/management/addPort", - "qpid/management/addStore", - "qpid/management/addGroupProvider", - "qpid/management/addAccessControlProvider", - "qpid/management/editBroker", - "dojox/grid/enhanced/plugins/Pagination", - "dojox/grid/enhanced/plugins/IndirectSelection", - "dijit/layout/AccordionContainer", - "dijit/layout/AccordionPane", - "dijit/form/FilteringSelect", - "dijit/form/NumberSpinner", - "dijit/form/ValidationTextBox", - "dijit/form/CheckBox", - "dojo/store/Memory", - "dijit/form/DropDownButton", - "dijit/Menu", - "dijit/MenuItem", - "dojo/domReady!"], - function (xhr, parser, query, json, connect, memory, properties, updater, util, UpdatableStore, EnhancedGrid, registry, entities, - addAuthenticationProvider, addVirtualHostNodeAndVirtualHost, addPort, addStore, addGroupProvider, addAccessControlProvider, editBroker) { - - var brokerAttributeNames = ["name", "operatingSystem", "platform", "productVersion", "modelVersion", - "defaultVirtualHost", "statisticsReportingPeriod", "statisticsReportingResetEnabled", - "connection.sessionCountLimit", "connection.heartBeatDelay"]; - - function Broker(name, parent, controller) { - this.name = name; - this.controller = controller; - this.modelObj = { type: "broker", name: name }; - - if(parent) { - this.modelObj.parent = {}; - this.modelObj.parent[ parent.type] = parent; - } - } - - - Broker.prototype.getTitle = function() - { - return "Broker"; - }; - - Broker.prototype.open = function(contentPane) { - var that = this; - this.contentPane = contentPane; - xhr.get({url: "showBroker.html", - sync: true, - load: function(data) { - contentPane.containerNode.innerHTML = data; - parser.parse(contentPane.containerNode).then(function(instances) - { - that.brokerUpdater = new BrokerUpdater(contentPane.containerNode, that.modelObj, that.controller); - - var logViewerButton = query(".logViewer", contentPane.containerNode)[0]; - registry.byNode(logViewerButton).on("click", function(evt){ - that.controller.show("logViewer", ""); - }); - - - var addProviderButton = query(".addAuthenticationProvider", contentPane.containerNode)[0]; - connect.connect(registry.byNode(addProviderButton), "onClick", function(evt){ addAuthenticationProvider.show(); }); - - var deleteProviderButton = query(".deleteAuthenticationProvider", contentPane.containerNode)[0]; - connect.connect(registry.byNode(deleteProviderButton), "onClick", - function(evt){ - var warning = ""; - var data = that.brokerUpdater.authenticationProvidersGrid.grid.selection.getSelected(); - if(data.length && data.length > 0) - { - for(var i = 0; i<data.length; i++) - { - if (data[i].type.indexOf("File") != -1) - { - warning = "NOTE: provider deletion will also remove the password file on disk.\n\n" - break; - } - } - } - - util.deleteGridSelections( - that.brokerUpdater, - that.brokerUpdater.authenticationProvidersGrid.grid, - "api/latest/authenticationprovider", - warning + "Are you sure you want to delete authentication provider"); - } - ); - - var addVHNAndVHButton = query(".addVirtualHostNodeAndVirtualHostButton", contentPane.containerNode)[0]; - connect.connect(registry.byNode(addVHNAndVHButton), "onClick", function(evt){ addVirtualHostNodeAndVirtualHost.show(); }); - - var addPortButton = query(".addPort", contentPane.containerNode)[0]; - connect.connect(registry.byNode(addPortButton), "onClick", function(evt){ - addPort.show(null, "AMQP", that.brokerUpdater.brokerData.authenticationproviders, - that.brokerUpdater.brokerData.keystores, that.brokerUpdater.brokerData.truststores); - }); - - var deletePort = query(".deletePort", contentPane.containerNode)[0]; - connect.connect(registry.byNode(deletePort), "onClick", - function(evt){ - util.deleteGridSelections( - that.brokerUpdater, - that.brokerUpdater.portsGrid.grid, - "api/latest/port", - "Are you sure you want to delete port"); - } - ); - - var editButton = query(".editBroker", contentPane.containerNode)[0]; - connect.connect(registry.byNode(editButton), "onClick", - function(evt) - { - editBroker.show(that.brokerUpdater.brokerData); - } - ); - - var addKeystoreButton = query(".addKeystore", contentPane.containerNode)[0]; - connect.connect(registry.byNode(addKeystoreButton), "onClick", - function(evt) - { - addStore.setupTypeStore("KeyStore"); - addStore.show(); - }); - - var deleteKeystore = query(".deleteKeystore", contentPane.containerNode)[0]; - connect.connect(registry.byNode(deleteKeystore), "onClick", - function(evt){ - util.deleteGridSelections( - that.brokerUpdater, - that.brokerUpdater.keyStoresGrid.grid, - "api/latest/keystore", - "Are you sure you want to delete key store"); - } - ); - - var addTruststoreButton = query(".addTruststore", contentPane.containerNode)[0]; - connect.connect(registry.byNode(addTruststoreButton), "onClick", - function(evt) - { - addStore.setupTypeStore("TrustStore"); - addStore.show(); - }); - - var deleteTruststore = query(".deleteTruststore", contentPane.containerNode)[0]; - connect.connect(registry.byNode(deleteTruststore), "onClick", - function(evt){ - util.deleteGridSelections( - that.brokerUpdater, - that.brokerUpdater.trustStoresGrid.grid, - "api/latest/truststore", - "Are you sure you want to delete trust store"); - } - ); - - var addGroupProviderButton = query(".addGroupProvider", contentPane.containerNode)[0]; - connect.connect(registry.byNode(addGroupProviderButton), "onClick", - function(evt){addGroupProvider.show();}); - - var deleteGroupProvider = query(".deleteGroupProvider", contentPane.containerNode)[0]; - connect.connect(registry.byNode(deleteGroupProvider), "onClick", - function(evt){ - var warning = ""; - var data = that.brokerUpdater.groupProvidersGrid.grid.selection.getSelected(); - if(data.length && data.length > 0) - { - for(var i = 0; i<data.length; i++) - { - if (data[i].type.indexOf("File") != -1) - { - warning = "NOTE: provider deletion will also remove the group file on disk.\n\n" - break; - } - } - } - - util.deleteGridSelections( - that.brokerUpdater, - that.brokerUpdater.groupProvidersGrid.grid, - "api/latest/groupprovider", - warning + "Are you sure you want to delete group provider"); - } - ); - - var addAccessControlButton = query(".addAccessControlProvider", contentPane.containerNode)[0]; - connect.connect(registry.byNode(addAccessControlButton), "onClick", - function(evt){addAccessControlProvider.show();}); - - var deleteAccessControlProviderButton = query(".deleteAccessControlProvider", contentPane.containerNode)[0]; - connect.connect(registry.byNode(deleteAccessControlProviderButton), "onClick", - function(evt){ - util.deleteGridSelections( - that.brokerUpdater, - that.brokerUpdater.accessControlProvidersGrid.grid, - "api/latest/accesscontrolprovider", - "Are you sure you want to delete access control provider"); - } - ); - }); - }}); - }; - - Broker.prototype.close = function() { - updater.remove( this.brokerUpdater ); - }; - - function BrokerUpdater(node, brokerObj, controller) - { - this.controller = controller; - this.query = "api/latest/broker?depth=2"; - this.accessControlProvidersWarn = query(".broker-access-control-providers-warning", node)[0] - var that = this; - - xhr.get({url: this.query, sync: properties.useSyncGet, handleAs: "json"}) - .then(function(data) - { - that.brokerData= data[0]; - - util.flattenStatistics( that.brokerData); - - that.updateHeader(); - - var gridProperties = { - height: 400, - selectionMode: "single", - plugins: { - pagination: { - pageSizes: [10, 25, 50, 100], - description: true, - sizeSwitch: true, - pageStepper: true, - gotoButton: true, - maxPageStep: 4, - position: "bottom" - } - }}; - - function isActiveVH(item) - { - return item && item.virtualhosts && item.virtualhosts[0].state=="ACTIVE"; - } - - that.vhostsGrid = - new UpdatableStore(that.brokerData.virtualhostnodes, query(".broker-virtualhosts")[0], - [ - { name: "Node Name", field: "name", width: "10%"}, - { name: "Node State", field: "state", width: "10%"}, - { name: "Node Type", field: "type", width: "10%"}, - { name: "Host Name", field: "_item", width: "10%", - formatter: function(item){ - return item && item.virtualhosts? item.virtualhosts[0].name: "N/A"; - } - }, - { name: "Host State", field: "_item", width: "15%", - formatter: function(item){ - return item && item.virtualhosts? item.virtualhosts[0].state: "N/A"; - } - }, - { name: "Host Type", field: "_item", width: "15%", - formatter: function(item){ - return item && item.virtualhosts? item.virtualhosts[0].type: "N/A"; - } - }, - { name: "Connections", field: "_item", width: "8%", - formatter: function(item){ - return isActiveVH(item)? item.virtualhosts[0].statistics.connectionCount: "N/A"; - } - }, - { name: "Queues", field: "_item", width: "8%", - formatter: function(item){ - return isActiveVH(item)? item.virtualhosts[0].statistics.queueCount: "N/A"; - } - }, - { name: "Exchanges", field: "_item", width: "8%", - formatter: function(item){ - return isActiveVH(item)? item.virtualhosts[0].statistics.exchangeCount: "N/A"; - } - }, - { - name: "Default", field: "_item", width: "6%", - formatter: function(item){ - var val = item && item.virtualhosts? item.virtualhosts[0].name: null; - return "<input type='radio' disabled='disabled' "+(val == that.brokerData.defaultVirtualHost ? "checked='checked'": "")+" />"; - } - } - ], function(obj) { - connect.connect(obj.grid, "onRowDblClick", obj.grid, - function(evt){ - var idx = evt.rowIndex, - theItem = this.getItem(idx); - if (theItem.virtualhosts) - { - that.showVirtualHost(theItem, brokerObj); - } - }); - }, gridProperties, EnhancedGrid, true); - - that.virtualHostNodeMenuButton = registry.byNode(query(".virtualHostNodeMenuButton", node)[0]); - that.virtualHostMenuButton = registry.byNode(query(".virtualHostMenuButton", node)[0]); - - var hostMenuItems = that.virtualHostMenuButton.dropDown.getChildren(); - var viewVirtualHostItem = hostMenuItems[0]; - var startVirtualHostItem = hostMenuItems[1]; - var stopVirtualHostItem = hostMenuItems[2]; - - var nodeMenuItems = that.virtualHostNodeMenuButton.dropDown.getChildren(); - var viewNodeItem = nodeMenuItems[0]; - var deleteNodeItem = nodeMenuItems[1]; - var startNodeItem = nodeMenuItems[2]; - var stopNodeItem = nodeMenuItems[3]; - - var toggler = function(index){ that.toggleVirtualHostNodeNodeMenus(index);} - connect.connect(that.vhostsGrid.grid.selection, 'onSelected', toggler); - connect.connect(that.vhostsGrid.grid.selection, 'onDeselected', toggler); - - viewVirtualHostItem.on("click", function(){ - var data = that.vhostsGrid.grid.selection.getSelected(); - if (data.length == 1) - { - that.showVirtualHost(data[0], brokerObj); - that.vhostsGrid.grid.selection.clear(); - } - }); - - viewNodeItem.on("click", - function(evt){ - var data = that.vhostsGrid.grid.selection.getSelected(); - if (data.length == 1) - { - var item = data[0]; - that.controller.show("virtualhostnode", item.name, brokerObj, item.id); - that.vhostsGrid.grid.selection.clear(); - } - } - ); - - deleteNodeItem.on("click", - function(evt){ - util.deleteGridSelections( - that, - that.vhostsGrid.grid, - "api/latest/virtualhostnode", - "Deletion of virtual host node will delete both configuration and message data.\n\n Are you sure you want to delete virtual host node"); - } - ); - - startNodeItem.on("click", - function(event) - { - var data = that.vhostsGrid.grid.selection.getSelected(); - if (data.length == 1) - { - var item = data[0]; - util.sendRequest("api/latest/virtualhostnode/" + encodeURIComponent(item.name), - "PUT", {desiredState: "ACTIVE"}); - that.vhostsGrid.grid.selection.clear(); - } - }); - - stopNodeItem.on("click", - function(event) - { - var data = that.vhostsGrid.grid.selection.getSelected(); - if (data.length == 1) - { - var item = data[0]; - if (confirm("Stopping the node will also shutdown the virtual host. " - + "Are you sure you want to stop virtual host node '" - + entities.encode(String(item.name)) +"'?")) - { - util.sendRequest("api/latest/virtualhostnode/" + encodeURIComponent(item.name), - "PUT", {desiredState: "STOPPED"}); - that.vhostsGrid.grid.selection.clear(); - } - } - }); - - startVirtualHostItem.on("click", function(event) - { - var data = that.vhostsGrid.grid.selection.getSelected(); - if (data.length == 1 && data[0].virtualhosts) - { - var item = data[0]; - var host = item.virtualhosts[0]; - util.sendRequest("api/latest/virtualhost/" + encodeURIComponent(item.name) + "/" + encodeURIComponent(host.name), - "PUT", {desiredState: "ACTIVE"}); - that.vhostsGrid.grid.selection.clear(); - } - }); - - stopVirtualHostItem.on("click", function(event) - { - var data = that.vhostsGrid.grid.selection.getSelected(); - if (data.length == 1 && data[0].virtualhosts) - { - var item = data[0]; - var host = item.virtualhosts[0]; - if (confirm("Are you sure you want to stop virtual host '" - + entities.encode(String(host.name)) +"'?")) - { - util.sendRequest("api/latest/virtualhost/" + encodeURIComponent(item.name) + "/" + encodeURIComponent(host.name), - "PUT", {desiredState: "STOPPED"}); - that.vhostsGrid.grid.selection.clear(); - } - } - }); - gridProperties.selectionMode = "extended"; - gridProperties.plugins.indirectSelection = true; - - that.portsGrid = - new UpdatableStore(that.brokerData.ports, query(".broker-ports")[0], - [ { name: "Name", field: "name", width: "15%"}, - { name: "State", field: "state", width: "15%"}, - { name: "Auth Provider", field: "authenticationProvider", width: "15%"}, - { name: "Address", field: "bindingAddress", width: "15%"}, - { name: "Port", field: "port", width: "10%"}, - { name: "Transports", field: "transports", width: "15%"}, - { name: "Protocols", field: "protocols", width: "15%"} - ], function(obj) { - connect.connect(obj.grid, "onRowDblClick", obj.grid, - function(evt){ - var idx = evt.rowIndex, - theItem = this.getItem(idx); - var name = obj.dataStore.getValue(theItem,"name"); - that.controller.show("port", name, brokerObj, theItem.id); - }); - }, gridProperties, EnhancedGrid); - - gridProperties = { - keepSelection: true, - plugins: { - indirectSelection: true - }}; - - that.authenticationProvidersGrid = - new UpdatableStore(that.brokerData.authenticationproviders, query(".broker-authentication-providers")[0], - [ { name: "Name", field: "name", width: "40%"}, - { name: "State", field: "state", width: "20%"}, - { name: "Type", field: "type", width: "20%"}, - { name: "User Management", field: "type", width: "20%", - formatter: function(val){ - return "<input type='radio' disabled='disabled' "+(util.isProviderManagingUsers(val)?"checked='checked'": "")+" />"; - } - } - ], function(obj) { - connect.connect(obj.grid, "onRowDblClick", obj.grid, - function(evt){ - var idx = evt.rowIndex, - theItem = this.getItem(idx); - var name = obj.dataStore.getValue(theItem,"name"); - that.controller.show("authenticationprovider", name, brokerObj, theItem.id); - }); - }, gridProperties, EnhancedGrid); - - that.keyStoresGrid = - new UpdatableStore(that.brokerData.keystores, query(".broker-key-stores")[0], - [ { name: "Name", field: "name", width: "20%"}, - { name: "State", field: "state", width: "10%"}, - { name: "Type", field: "type", width: "10%"}, - { name: "Path", field: "path", width: "60%"} - ], function(obj) { - connect.connect(obj.grid, "onRowDblClick", obj.grid, - function(evt){ - var idx = evt.rowIndex, - theItem = this.getItem(idx); - var name = obj.dataStore.getValue(theItem,"name"); - that.controller.show("keystore", name, brokerObj, theItem.id); - }); - }, gridProperties, EnhancedGrid); - - that.trustStoresGrid = - new UpdatableStore(that.brokerData.truststores, query(".broker-trust-stores")[0], - [ { name: "Name", field: "name", width: "20%"}, - { name: "State", field: "state", width: "10%"}, - { name: "Type", field: "type", width: "10%"}, - { name: "Path", field: "path", width: "50%"}, - { name: "Peers only", field: "peersOnly", width: "10%", - formatter: function(val){ - return "<input type='radio' disabled='disabled' "+(val ? "checked='checked'": "")+" />"; - } - } - ], function(obj) { - connect.connect(obj.grid, "onRowDblClick", obj.grid, - function(evt){ - var idx = evt.rowIndex, - theItem = this.getItem(idx); - var name = obj.dataStore.getValue(theItem,"name"); - that.controller.show("truststore", name, brokerObj, theItem.id); - }); - }, gridProperties, EnhancedGrid); - that.groupProvidersGrid = - new UpdatableStore(that.brokerData.groupproviders, query(".broker-group-providers")[0], - [ { name: "Name", field: "name", width: "40%"}, - { name: "State", field: "state", width: "30%"}, - { name: "Type", field: "type", width: "30%"} - ], function(obj) { - connect.connect(obj.grid, "onRowDblClick", obj.grid, - function(evt){ - var idx = evt.rowIndex, - theItem = this.getItem(idx); - var name = obj.dataStore.getValue(theItem,"name"); - that.controller.show("groupprovider", name, brokerObj, theItem.id); - }); - }, gridProperties, EnhancedGrid); - var aclData = that.brokerData.accesscontrolproviders ? that.brokerData.accesscontrolproviders :[]; - that.accessControlProvidersGrid = - new UpdatableStore(aclData, query(".broker-access-control-providers")[0], - [ { name: "Name", field: "name", width: "40%"}, - { name: "State", field: "state", width: "30%"}, - { name: "Type", field: "type", width: "30%"} - ], function(obj) { - connect.connect(obj.grid, "onRowDblClick", obj.grid, - function(evt){ - var idx = evt.rowIndex, - theItem = this.getItem(idx); - var name = obj.dataStore.getValue(theItem,"name"); - that.controller.show("accesscontrolprovider", name, brokerObj, theItem.id); - }); - }, gridProperties, EnhancedGrid); - that.displayACLWarnMessage(aclData); - - updater.add( that); - - }); - } - - BrokerUpdater.prototype.showVirtualHost=function(item, brokerObj) - { - var nodeName = item.name; - var host = item.virtualhosts? item.virtualhosts[0]: null; - var nodeObject = { type: "virtualhostnode", name: nodeName, parent: brokerObj}; - this.controller.show("virtualhost", host?host.name:nodeName, nodeObject, host?host.id:null); - } - - BrokerUpdater.prototype.updateHeader = function() - { - var brokerData = this.brokerData; - window.document.title = "Qpid: " + brokerData.name + " Management"; - - for(var i in brokerAttributeNames) - { - var propertyName = brokerAttributeNames[i]; - var element = dojo.byId("brokerAttribute." + propertyName); - if (element) - { - if (brokerData.hasOwnProperty(propertyName)) - { - var container = dojo.byId("brokerAttribute." + propertyName + ".container"); - if (container) - { - container.style.display = "block"; - } - element.innerHTML = entities.encode(String(brokerData [propertyName])); - } - else - { - element.innerHTML = ""; - } - } - } - }; - - BrokerUpdater.prototype.displayACLWarnMessage = function(aclProviderData) - { - var message = ""; - if (aclProviderData.length > 1) - { - var aclProviders = {}; - var theSameTypeFound = false; - for(var d=0; d<aclProviderData.length; d++) - { - var acl = aclProviderData[d]; - var aclType = acl.type; - if (aclProviders[aclType]) - { - aclProviders[aclType].push(acl.name); - theSameTypeFound = true; - } - else - { - aclProviders[aclType] = [acl.name]; - } - } - - if (theSameTypeFound) - { - message = "Only one instance of a given type will be used. Please remove an instance of type(s):"; - for(var aclType in aclProviders) - { - if(aclProviders[aclType].length>1) - { - message += " " + aclType; - } - } - } - } - this.accessControlProvidersWarn.innerHTML = message; - } - - BrokerUpdater.prototype.update = function() - { - - var that = this; - - xhr.get({url: this.query, sync: properties.useSyncGet, handleAs: "json"}).then(function(data) - { - that.brokerData = data[0]; - util.flattenStatistics( that.brokerData ); - - that.updateHeader(); - - if (that.vhostsGrid.update(that.brokerData.virtualhostnodes)) - { - that.vhostsGrid.grid._refresh(); - that.toggleVirtualHostNodeNodeMenus(); - } - - that.portsGrid.update(that.brokerData.ports); - - that.authenticationProvidersGrid.update(that.brokerData.authenticationproviders); - - if (that.keyStoresGrid) - { - that.keyStoresGrid.update(that.brokerData.keystores); - } - if (that.trustStoresGrid) - { - that.trustStoresGrid.update(that.brokerData.truststores); - } - if (that.groupProvidersGrid) - { - that.groupProvidersGrid.update(that.brokerData.groupproviders); - } - if (that.accessControlProvidersGrid) - { - var data = that.brokerData.accesscontrolproviders ? that.brokerData.accesscontrolproviders :[]; - that.accessControlProvidersGrid.update(data); - that.displayACLWarnMessage(data); - } - }); - }; - - BrokerUpdater.prototype.toggleVirtualHostNodeNodeMenus = function(rowIndex) - { - var data = this.vhostsGrid.grid.selection.getSelected(); - var selected = data.length==1; - this.virtualHostNodeMenuButton.set("disabled", !selected); - this.virtualHostMenuButton.set("disabled", !selected || !data[0].virtualhosts); - if (selected) - { - var nodeMenuItems = this.virtualHostNodeMenuButton.dropDown.getChildren(); - var hostMenuItems = this.virtualHostMenuButton.dropDown.getChildren(); - - var startNodeItem = nodeMenuItems[2]; - var stopNodeItem = nodeMenuItems[3]; - - var viewVirtualHostItem = hostMenuItems[0]; - var startVirtualHostItem = hostMenuItems[1]; - var stopVirtualHostItem = hostMenuItems[2]; - - var node = data[0]; - startNodeItem.set("disabled", node.state != "STOPPED"); - stopNodeItem.set("disabled", node.state != "ACTIVE"); - - if (node.virtualhosts) - { - viewVirtualHostItem.set("disabled", false); - - var host = node.virtualhosts[0]; - startVirtualHostItem.set("disabled", host.state != "STOPPED"); - stopVirtualHostItem.set("disabled", host.state != "ACTIVE"); - } - else - { - viewVirtualHostItem.set("disabled", true); - startVirtualHostItem.set("disabled", true); - stopVirtualHostItem.set("disabled", true); - } - } - }; - return Broker; - }); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Connection.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Connection.js deleted file mode 100644 index bbb4dc8322..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Connection.js +++ /dev/null @@ -1,243 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define(["dojo/_base/xhr", - "dojo/parser", - "dojo/query", - "dojo/_base/connect", - "qpid/common/properties", - "qpid/common/updater", - "qpid/common/util", - "qpid/common/formatter", - "qpid/common/UpdatableStore", - "qpid/management/UserPreferences", - "dojox/html/entities", - "dojo/domReady!"], - function (xhr, parser, query, connect, properties, updater, util, formatter, UpdatableStore, UserPreferences, entities) { - - function Connection(name, parent, controller) { - this.name = name; - this.controller = controller; - this.modelObj = { type: "exchange", name: name, parent: parent }; - } - - Connection.prototype.getTitle = function() - { - return "Connection: " + this.name; - }; - - Connection.prototype.open = function(contentPane) { - var that = this; - this.contentPane = contentPane; - xhr.get({url: "showConnection.html", - sync: true, - load: function(data) { - contentPane.containerNode.innerHTML = data; - parser.parse(contentPane.containerNode).then(function(instances) - { - that.connectionUpdater = new ConnectionUpdater(contentPane.containerNode, that.modelObj, that.controller); - updater.add( that.connectionUpdater ); - that.connectionUpdater.update(); - }); - }}); - }; - - Connection.prototype.close = function() { - updater.remove( this.connectionUpdater ); - }; - - function ConnectionUpdater(containerNode, connectionObj, controller) - { - var that = this; - - function findNode(name) { - return query("." + name, containerNode)[0]; - } - - function storeNodes(names) - { - for(var i = 0; i < names.length; i++) { - that[names[i]] = findNode(names[i]); - } - } - - storeNodes(["name", - "clientVersion", - "clientId", - "principal", - "port", - "transport", - "remoteProcessPid", - "createdTime", - "lastIoTime", - "msgInRate", - "bytesInRate", - "bytesInRateUnits", - "msgOutRate", - "bytesOutRate", - "bytesOutRateUnits"]); - - - - this.query = "api/latest/connection/"+ encodeURIComponent(connectionObj.parent.parent.name) - + "/" + encodeURIComponent(connectionObj.parent.name) + "/" + encodeURIComponent(connectionObj.name); - - xhr.get({url: this.query, sync: properties.useSyncGet, handleAs: "json"}).then(function(data) - { - that.connectionData = data[0]; - - util.flattenStatistics( that.connectionData ); - - that.updateHeader(); - that.sessionsGrid = new UpdatableStore(that.connectionData.sessions, findNode("sessions"), - [ { name: "Name", field: "name", width: "20%"}, - { name: "Consumers", field: "consumerCount", width: "15%"}, - { name: "Unacknowledged messages", field: "unacknowledgedMessages", width: "15%"}, - { name: "Current store transaction start", field: "transactionStartTime", width: "25%", - formatter: function (transactionStartTime) - { - if (transactionStartTime > 0) - { - return UserPreferences.formatDateTime(transactionStartTime, {selector: "time", addOffset: true, appendTimeZone: true}); - } - else - { - return "N/A"; - } - } - }, - { name: "Current store transaction update", field: "transactionUpdateTime", width: "25%", - formatter: function (transactionUpdateTime) - { - if (transactionUpdateTime > 0) - { - return UserPreferences.formatDateTime(transactionUpdateTime, {selector: "time", addOffset: true, appendTimeZone: true}); - } - else - { - return "N/A"; - } - } - } - ]); - - - }); - - } - - ConnectionUpdater.prototype.updateHeader = function() - { - this.name.innerHTML = entities.encode(String(this.connectionData[ "name" ])); - this.clientId.innerHTML = entities.encode(String(this.connectionData[ "clientId" ])); - this.clientVersion.innerHTML = entities.encode(String(this.connectionData[ "clientVersion" ])); - this.principal.innerHTML = entities.encode(String(this.connectionData[ "principal" ])); - this.port.innerHTML = entities.encode(String(this.connectionData[ "port" ])); - this.transport.innerHTML = entities.encode(String(this.connectionData[ "transport" ])); - var remoteProcessPid = this.connectionData[ "remoteProcessPid" ]; - this.remoteProcessPid.innerHTML = entities.encode(String(remoteProcessPid ? remoteProcessPid : "N/A")); - this.createdTime.innerHTML = UserPreferences.formatDateTime(this.connectionData[ "createdTime" ], {addOffset: true, appendTimeZone: true}); - this.lastIoTime.innerHTML = UserPreferences.formatDateTime(this.connectionData[ "lastIoTime" ], {addOffset: true, appendTimeZone: true}); - }; - - ConnectionUpdater.prototype.update = function() - { - - var that = this; - - xhr.get({url: this.query, sync: properties.useSyncGet, handleAs: "json"}).then(function(data) - { - that.connectionData = data[0]; - - util.flattenStatistics( that.connectionData ); - - var sessions = that.connectionData[ "sessions" ]; - - that.updateHeader(); - - var sampleTime = new Date(); - var messageIn = that.connectionData["messagesIn"]; - var bytesIn = that.connectionData["bytesIn"]; - var messageOut = that.connectionData["messagesOut"]; - var bytesOut = that.connectionData["bytesOut"]; - - if(that.sampleTime) - { - var samplePeriod = sampleTime.getTime() - that.sampleTime.getTime(); - - var msgInRate = (1000 * (messageIn - that.messageIn)) / samplePeriod; - var msgOutRate = (1000 * (messageOut - that.messageOut)) / samplePeriod; - var bytesInRate = (1000 * (bytesIn - that.bytesIn)) / samplePeriod; - var bytesOutRate = (1000 * (bytesOut - that.bytesOut)) / samplePeriod; - - that.msgInRate.innerHTML = msgInRate.toFixed(0); - var bytesInFormat = formatter.formatBytes( bytesInRate ); - that.bytesInRate.innerHTML = "(" + bytesInFormat.value; - that.bytesInRateUnits.innerHTML = bytesInFormat.units + "/s)"; - - that.msgOutRate.innerHTML = msgOutRate.toFixed(0); - var bytesOutFormat = formatter.formatBytes( bytesOutRate ); - that.bytesOutRate.innerHTML = "(" + bytesOutFormat.value; - that.bytesOutRateUnits.innerHTML = bytesOutFormat.units + "/s)"; - - if(sessions && that.sessions) - { - for(var i=0; i < sessions.length; i++) - { - var session = sessions[i]; - for(var j = 0; j < that.sessions.length; j++) - { - var oldSession = that.sessions[j]; - if(oldSession.id == session.id) - { - var msgRate = (1000 * (session.messagesOut - oldSession.messagesOut)) / - samplePeriod; - session.msgRate = msgRate.toFixed(0) + "msg/s"; - - var bytesRate = (1000 * (session.bytesOut - oldSession.bytesOut)) / - samplePeriod; - var bytesRateFormat = formatter.formatBytes( bytesRate ); - session.bytesRate = bytesRateFormat.value + bytesRateFormat.units + "/s"; - } - - - } - - } - } - - } - - that.sampleTime = sampleTime; - that.messageIn = messageIn; - that.bytesIn = bytesIn; - that.messageOut = messageOut; - that.bytesOut = bytesOut; - that.sessions = sessions; - - - // update sessions - that.sessionsGrid.update(that.connectionData.sessions) - }); - }; - - - return Connection; - }); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Exchange.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Exchange.js deleted file mode 100644 index 1f1b8361a2..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Exchange.js +++ /dev/null @@ -1,301 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define(["dojo/_base/xhr", - "dojo/parser", - "dojo/query", - "dojo/_base/connect", - "dijit/registry", - "qpid/common/properties", - "qpid/common/updater", - "qpid/common/util", - "qpid/common/formatter", - "qpid/common/UpdatableStore", - "qpid/management/addBinding", - "dojox/grid/EnhancedGrid", - "dojox/html/entities", - "dojo/domReady!"], - function (xhr, parser, query, connect, registry, properties, updater, util, formatter, UpdatableStore, addBinding, EnhancedGrid, entities) { - - function Exchange(name, parent, controller) { - this.name = name; - this.controller = controller; - this.modelObj = { type: "exchange", name: name, parent: parent}; - } - - - Exchange.prototype.getExchangeName = function() - { - return this.name; - }; - - - Exchange.prototype.getVirtualHostName = function() - { - return this.modelObj.parent.name; - }; - - Exchange.prototype.getVirtualHostNodeName = function() - { - return this.modelObj.parent.parent.name; - }; - - Exchange.prototype.getTitle = function() - { - return "Exchange: " + this.name; - }; - - Exchange.prototype.open = function(contentPane) { - var that = this; - this.contentPane = contentPane; - xhr.get({url: "showExchange.html", - sync: true, - load: function(data) { - contentPane.containerNode.innerHTML = data; - parser.parse(contentPane.containerNode).then(function(instances) - { - - that.exchangeUpdater = new ExchangeUpdater(contentPane.containerNode, that.modelObj, that.controller); - - updater.add( that.exchangeUpdater ); - - that.exchangeUpdater.update(); - - - var addBindingButton = query(".addBindingButton", contentPane.containerNode)[0]; - connect.connect(registry.byNode(addBindingButton), "onClick", - function(evt){ - addBinding.show({ virtualhost: that.getVirtualHostName(), - virtualhostnode: that.getVirtualHostNodeName(), - exchange: that.getExchangeName()}); - }); - - var deleteBindingButton = query(".deleteBindingButton", contentPane.containerNode)[0]; - connect.connect(registry.byNode(deleteBindingButton), "onClick", - function(evt){ - that.deleteBindings(); - }); - - var isStandard = util.isReservedExchangeName(that.name); - var deleteExchangeButton = query(".deleteExchangeButton", contentPane.containerNode)[0]; - var node = registry.byNode(deleteExchangeButton); - if(isStandard) - { - node.set('disabled', true); - } - else - { - connect.connect(node, "onClick", - function(evt){ - that.deleteExchange(); - }); - } - }); - }}); - }; - - Exchange.prototype.close = function() { - updater.remove( this.exchangeUpdater ); - }; - - Exchange.prototype.deleteBindings = function() - { - util.deleteGridSelections( - this.exchangeUpdater, - this.exchangeUpdater.bindingsGrid.grid, - "api/latest/binding/" + encodeURIComponent(this.getVirtualHostNodeName()) - + "/" + encodeURIComponent(this.getVirtualHostName()) + "/" + encodeURIComponent(this.name), - "Are you sure you want to delete binding for queue"); - } - - function ExchangeUpdater(containerNode, exchangeObj, controller) - { - var that = this; - - function findNode(name) { - return query("." + name, containerNode)[0]; - } - - function storeNodes(names) - { - for(var i = 0; i < names.length; i++) { - that[names[i]] = findNode(names[i]); - } - } - - storeNodes(["name", - "type", - "state", - "durable", - "lifetimePolicy", - "alertRepeatGap", - "alertRepeatGapUnits", - "alertThresholdMessageAge", - "alertThresholdMessageAgeUnits", - "alertThresholdMessageSize", - "alertThresholdMessageSizeUnits", - "alertThresholdQueueDepthBytes", - "alertThresholdQueueDepthBytesUnits", - "alertThresholdQueueDepthMessages", - "msgInRate", - "bytesInRate", - "bytesInRateUnits", - "msgDropRate", - "bytesDropRate", - "bytesDropRateUnits"]); - - - - this.query = "api/latest/exchange/" + encodeURIComponent(exchangeObj.parent.parent.name) - + "/" + encodeURIComponent(exchangeObj.parent.name) + "/" + encodeURIComponent(exchangeObj.name); - - xhr.get({url: this.query, sync: properties.useSyncGet, handleAs: "json"}).then(function(data) - { - that.exchangeData = data[0]; - util.flattenStatistics( that.exchangeData ); - - that.updateHeader(); - that.bindingsGrid = new UpdatableStore(that.exchangeData.bindings, findNode("bindings"), - [ { name: "Queue", field: "queue", width: "40%"}, - { name: "Binding Key", field: "name", width: "30%"}, - { name: "Arguments", field: "argumentString", width: "30%"} - ], null, { - keepSelection: true, - plugins: { - pagination: { - pageSizes: ["10", "25", "50", "100"], - description: true, - sizeSwitch: true, - pageStepper: true, - gotoButton: true, - maxPageStep: 4, - position: "bottom" - }, - indirectSelection: true - - }}, EnhancedGrid); - - }); - - } - - ExchangeUpdater.prototype.updateHeader = function() - { - this.name.innerHTML = entities.encode(String(this.exchangeData[ "name" ])); - this["type"].innerHTML = entities.encode(String(this.exchangeData[ "type" ])); - - this.state.innerHTML = entities.encode(String(this.exchangeData[ "state" ])); - this.durable.innerHTML = entities.encode(String(this.exchangeData[ "durable" ])); - this.lifetimePolicy.innerHTML = entities.encode(String(this.exchangeData[ "lifetimePolicy" ])); - - }; - - ExchangeUpdater.prototype.update = function() - { - - var thisObj = this; - - xhr.get({url: this.query, sync: properties.useSyncGet, handleAs: "json"}).then(function(data) - { - thisObj.exchangeData = data[0]; - - util.flattenStatistics( thisObj.exchangeData ); - - var bindings = thisObj.exchangeData[ "bindings" ]; - - if(bindings) - { - for(var i=0; i < bindings.length; i++) - { - if(bindings[i].arguments) - { - bindings[i].argumentString = dojo.toJson(bindings[i].arguments); - } - else - { - bindings[i].argumentString = ""; - } - } - } - - - var sampleTime = new Date(); - - thisObj.updateHeader(); - - var messageIn = thisObj.exchangeData["messagesIn"]; - var bytesIn = thisObj.exchangeData["bytesIn"]; - var messageDrop = thisObj.exchangeData["messagesDropped"]; - var bytesDrop = thisObj.exchangeData["bytesDropped"]; - - if(thisObj.sampleTime) - { - var samplePeriod = sampleTime.getTime() - thisObj.sampleTime.getTime(); - - var msgInRate = (1000 * (messageIn - thisObj.messageIn)) / samplePeriod; - var msgDropRate = (1000 * (messageDrop - thisObj.messageDrop)) / samplePeriod; - var bytesInRate = (1000 * (bytesIn - thisObj.bytesIn)) / samplePeriod; - var bytesDropRate = (1000 * (bytesDrop - thisObj.bytesDrop)) / samplePeriod; - - thisObj.msgInRate.innerHTML = msgInRate.toFixed(0); - var bytesInFormat = formatter.formatBytes( bytesInRate ); - thisObj.bytesInRate.innerHTML = "(" + bytesInFormat.value; - thisObj.bytesInRateUnits.innerHTML = bytesInFormat.units + "/s)"; - - thisObj.msgDropRate.innerHTML = msgDropRate.toFixed(0); - var bytesDropFormat = formatter.formatBytes( bytesDropRate ); - thisObj.bytesDropRate.innerHTML = "(" + bytesDropFormat.value; - thisObj.bytesDropRateUnits.innerHTML = bytesDropFormat.units + "/s)" - - } - - thisObj.sampleTime = sampleTime; - thisObj.messageIn = messageIn; - thisObj.bytesIn = bytesIn; - thisObj.messageDrop = messageDrop; - thisObj.bytesDrop = bytesDrop; - - // update bindings - thisObj.bindingsGrid.update(thisObj.exchangeData.bindings) - - }); - }; - - Exchange.prototype.deleteExchange = function() { - if(confirm("Are you sure you want to delete exchange '" +this.name+"'?")) { - var query = "api/latest/exchange/" + encodeURIComponent(this.getVirtualHostNodeName()) - + "/" + encodeURIComponent(this.getVirtualHostName()) + "/" + encodeURIComponent(this.name); - this.success = true - var that = this; - xhr.del({url: query, sync: true, handleAs: "json"}).then( - function(data) { - that.contentPane.onClose() - that.controller.tabContainer.removeChild(that.contentPane); - that.contentPane.destroyRecursive(); - }, - function(error) {that.success = false; that.failureReason = error;}); - if(!this.success ) { - util.xhrErrorHandler(this.failureReason); - } - } - } - - return Exchange; - }); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/GroupProvider.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/GroupProvider.js deleted file mode 100644 index 9b32d0e6b2..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/GroupProvider.js +++ /dev/null @@ -1,199 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define(["dojo/_base/xhr", - "dojo/parser", - "dojo/query", - "dojo/_base/connect", - "dojo/_base/array", - "dojo/_base/event", - "qpid/common/properties", - "qpid/common/updater", - "qpid/common/util", - "qpid/common/metadata", - "qpid/common/UpdatableStore", - "dojox/grid/EnhancedGrid", - "dijit/registry", - "dojox/html/entities", - "dojo/text!showGroupProvider.html", - "qpid/management/addGroupProvider", - "dojox/grid/enhanced/plugins/Pagination", - "dojox/grid/enhanced/plugins/IndirectSelection", - "dojo/domReady!"], - function (xhr, parser, query, connect, array, event, properties, updater, util, metadata, UpdatableStore, - EnhancedGrid, registry, entities, template, addGroupProvider) - { - - function GroupProvider(name, parent, controller) { - this.name = name; - this.controller = controller; - this.modelObj = { type: "groupprovider", name: name, parent: parent}; - } - - GroupProvider.prototype.getTitle = function() { - return "GroupProvider: " + this.name ; - }; - - GroupProvider.prototype.open = function(contentPane) - { - var that = this; - this.contentPane = contentPane; - contentPane.containerNode.innerHTML = template; - parser.parse(contentPane.containerNode).then(function(instances) { that.onOpen(); }); - }; - - GroupProvider.prototype.onOpen = function() - { - var that = this; - var contentPane = this.contentPane; - this.groupProviderUpdater = new GroupProviderUpdater(contentPane.containerNode, this.modelObj, this.controller); - - // load data - this.groupProviderUpdater.update(); - - this.deleteButton = registry.byNode(query(".deleteGroupProviderButton", contentPane.containerNode)[0]); - this.deleteButton.on("click", function(evt){ event.stop(evt); that.deleteGroupProvider(); }); - - this.editButton = registry.byNode(query(".editGroupProviderButton", contentPane.containerNode)[0]); - this.editButton.on("click", function(evt){ event.stop(evt); that.editGroupProvider(); }); - - var type = this.groupProviderUpdater.groupProviderData.type; - var providerDetailsNode = query(".providerDetails", contentPane.containerNode)[0]; - - require(["qpid/management/groupprovider/"+ encodeURIComponent(type.toLowerCase()) + "/show"], - function(DetailsUI) - { - that.groupProviderUpdater.details = new DetailsUI({containerNode: providerDetailsNode, parent: that}); - that.groupProviderUpdater.details.update(that.groupProviderUpdater.groupProviderData); - }); - - var managedInterfaces = metadata.getMetaData("GroupProvider", type).managedInterfaces; - if (managedInterfaces) - { - - var managedInterfaceUI = this.groupProviderUpdater.managedInterfaces; - - array.forEach(managedInterfaces, - function(managedInterface) - { - require(["qpid/management/groupprovider/" + encodeURIComponent(managedInterface)], - function(ManagedInterface) - { - managedInterfaceUI[ManagedInterface] = new ManagedInterface(providerDetailsNode, that.modelObj, that.controller); - managedInterfaceUI[ManagedInterface].update(that.groupProviderUpdater.groupProviderData); - }); - }); - } - - updater.add( this.groupProviderUpdater ); - }; - - - GroupProvider.prototype.close = function() { - updater.remove( this.groupProviderUpdater ); - }; - - GroupProvider.prototype.deleteGroupProvider = function() { - var warnMessage = ""; - if (this.groupProviderUpdater.groupProviderData && this.groupProviderUpdater.groupProviderData.type.indexOf("File") != -1) - { - warnMessage = "NOTE: provider deletion will also remove the group file on disk.\n\n"; - } - if(confirm(warnMessage + "Are you sure you want to delete group provider '" + this.name + "'?")) { - var query = "api/latest/groupprovider/" +encodeURIComponent(this.name); - this.success = true - var that = this; - xhr.del({url: query, sync: true, handleAs: "json"}).then( - function(data) { - that.close(); - that.contentPane.onClose() - that.controller.tabContainer.removeChild(that.contentPane); - that.contentPane.destroyRecursive(); - }, - function(error) {that.success = false; that.failureReason = error;}); - if(!this.success ) { - util.xhrErrorHandler(this.failureReason); - } - } - }; - - GroupProvider.prototype.editGroupProvider = function() - { - xhr.get( - { - url: this.groupProviderUpdater.query, - sync: true, - content: { actuals: true }, - handleAs: "json", - load: function(actualData) - { - addGroupProvider.show(actualData[0]); - } - } - ); - } - - function GroupProviderUpdater(node, groupProviderObj, controller) - { - this.controller = controller; - this.name = query(".name", node)[0]; - this.type = query(".type", node)[0]; - this.state = query(".state", node)[0]; - this.query = "api/latest/groupprovider/"+encodeURIComponent(groupProviderObj.name); - this.managedInterfaces = {}; - this.details = null; - } - - GroupProviderUpdater.prototype.updateHeader = function() - { - this.name.innerHTML = entities.encode(String(this.groupProviderData[ "name" ])); - this.type.innerHTML = entities.encode(String(this.groupProviderData[ "type" ])); - this.state.innerHTML = entities.encode(String(this.groupProviderData[ "state" ])); - }; - - GroupProviderUpdater.prototype.update = function() - { - var that = this; - xhr.get({url: this.query, sync: true, handleAs: "json"}).then(function(data) {that._update(data[0]);}); - }; - - GroupProviderUpdater.prototype._update = function(data) - { - this.groupProviderData = data; - util.flattenStatistics( this.groupProviderData ); - this.updateHeader(); - - if (this.details) - { - this.details.update(this.groupProviderData); - } - - for(var managedInterface in this.managedInterfaces) - { - var managedInterfaceUI = this.managedInterfaces[managedInterface]; - if (managedInterfaceUI) - { - managedInterfaceUI.update(this.groupProviderData); - } - } - }; - - return GroupProvider; - }); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/KeyStore.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/KeyStore.js deleted file mode 100644 index dfcb712740..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/KeyStore.js +++ /dev/null @@ -1,172 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define(["dojo/dom", - "dojo/_base/xhr", - "dojo/parser", - "dojo/query", - "dojo/_base/connect", - "dijit/registry", - "dojox/html/entities", - "qpid/common/properties", - "qpid/common/updater", - "qpid/common/util", - "qpid/common/formatter", - "qpid/management/addStore", - "dojo/domReady!"], - function (dom, xhr, parser, query, connect, registry, entities, properties, updater, util, formatter, addStore) { - - function KeyStore(name, parent, controller) { - this.keyStoreName = name; - this.controller = controller; - this.modelObj = { type: "keystore", name: name, parent: parent}; - this.url = "api/latest/keystore/" + encodeURIComponent(name); - } - - KeyStore.prototype.getTitle = function() { - return "KeyStore: " + this.keyStoreName; - }; - - KeyStore.prototype.open = function(contentPane) { - var that = this; - this.contentPane = contentPane; - xhr.get({url: "showStore.html", - sync: true, - load: function(data) { - contentPane.containerNode.innerHTML = data; - parser.parse(contentPane.containerNode).then(function(instances) - { - - that.keyStoreUpdater = new KeyStoreUpdater(contentPane.containerNode, that.modelObj, that.controller, that.url); - that.keyStoreUpdater.update(); - updater.add( that.keyStoreUpdater ); - - var deleteKeyStoreButton = query(".deleteStoreButton", contentPane.containerNode)[0]; - var node = registry.byNode(deleteKeyStoreButton); - connect.connect(node, "onClick", - function(evt){ - that.deleteKeyStore(); - }); - - var editKeyStoreButton = query(".editStoreButton", contentPane.containerNode)[0]; - var node = registry.byNode(editKeyStoreButton); - connect.connect(node, "onClick", - function(evt){ - xhr.get({url: that.url, sync: properties.useSyncGet, handleAs: "json", content: { actuals: true }}) - .then(function(data) - { - addStore.setupTypeStore("KeyStore"); - addStore.show(data[0], that.url); - }); - }); - }); - }}); - }; - - KeyStore.prototype.close = function() { - updater.remove( this.keyStoreUpdater ); - }; - - function KeyStoreUpdater(containerNode, keyStoreObj, controller, url) - { - var that = this; - this.keyStoreDetailsContainer = query(".typeFieldsContainer", containerNode)[0]; - - function findNode(name) { - return query("." + name, containerNode)[0]; - } - - function storeNodes(names) - { - for(var i = 0; i < names.length; i++) { - that[names[i]] = findNode(names[i]); - } - } - - storeNodes(["name", - "type", - "state" - ]); - - this.query = url; - - xhr.get({url: this.query, sync: properties.useSyncGet, handleAs: "json"}).then(function(data) - { - that.keyStoreData = data[0]; - that.updateHeader(); - }); - - } - - KeyStoreUpdater.prototype.updateHeader = function() - { - this.name.innerHTML = entities.encode(String(this.keyStoreData[ "name" ])); - this.type.innerHTML = entities.encode(String(this.keyStoreData[ "type" ])); - this.state.innerHTML = entities.encode(String(this.keyStoreData[ "state" ])); - }; - - KeyStoreUpdater.prototype.update = function() - { - - var that = this; - - xhr.get({url: this.query, sync: properties.useSyncGet, handleAs: "json"}).then(function(data) - { - that.keyStoreData = data[0]; - that.updateHeader(); - - if (that.details) - { - that.details.update(that.keyStoreData); - } - else - { - require(["qpid/management/store/" + encodeURIComponent(that.keyStoreData.type.toLowerCase()) + "/show"], - function(DetailsUI) - { - that.details = new DetailsUI({containerNode:that.keyStoreDetailsContainer, parent: that}); - that.details.update(that.keyStoreData); - } - ); - } - }); - }; - - KeyStore.prototype.deleteKeyStore = function() { - if(confirm("Are you sure you want to delete key store '" +this.keyStoreName+"'?")) { - var query = this.url; - this.success = true - var that = this; - xhr.del({url: query, sync: true, handleAs: "json"}).then( - function(data) { - that.contentPane.onClose() - that.controller.tabContainer.removeChild(that.contentPane); - that.contentPane.destroyRecursive(); - that.close(); - }, - function(error) {that.success = false; that.failureReason = error;}); - if(!this.success ) { - util.xhrErrorHandler(this.failureReason); - } - } - } - - return KeyStore; - }); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Plugin.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Plugin.js deleted file mode 100644 index 300754ed8c..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Plugin.js +++ /dev/null @@ -1,94 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define(["dojo/_base/xhr", - "dojo/parser", - "dojo/query", - "dojo/_base/connect", - "qpid/common/properties", - "qpid/common/updater", - "qpid/common/util", - "dijit/registry", - "dojo/_base/event", - "dojox/html/entities", - "dojo/domReady!"], - function (xhr, parser, query, connect, properties, updater, util, registry, event, entities) { - - function Plugin(name, parent, controller) { - this.name = name; - this.controller = controller; - this.modelObj = { type: "plugin", name: name, parent: parent }; - } - - Plugin.prototype.getTitle = function() { - return "Plugin: " + this.name ; - }; - - Plugin.prototype.open = function(contentPane) { - var that = this; - this.contentPane = contentPane; - xhr.get({url: "showPlugin.html", - sync: true, - load: function(data) { - contentPane.containerNode.innerHTML = data; - parser.parse(contentPane.containerNode).then(function(instances) - { - that.pluginUpdater = new PluginUpdater(contentPane.containerNode, that.modelObj, that.controller); - }); - }}); - }; - - Plugin.prototype.close = function() { - updater.remove( this.pluginUpdater ); - }; - - function PluginUpdater(node, pluginObject, controller) - { - this.controller = controller; - this.name = query(".name", node)[0]; - this.type = query(".type", node)[0]; - this.query = "api/latest/plugin/"+encodeURIComponent(pluginObject.name); - - var that = this; - - xhr.get({url: this.query, sync: properties.useSyncGet, handleAs: "json"}) - .then(function(data) - { - that.pluginData = data[0]; - - that.updateHeader(); - - require(["qpid/management/plugin/"+ that.pluginData.type.toLowerCase().replace('-','')], - function(SpecificPlugin) { - that.details = new SpecificPlugin(query(".pluginDetails", node)[0], pluginObject, controller); - }); - - }); - - } - - PluginUpdater.prototype.updateHeader = function() - { - this.name.innerHTML = entities.encode(String(this.pluginData[ "name" ])); - this.type.innerHTML = entities.encode(String(this.pluginData[ "type" ])); - }; - - return Plugin; - }); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Port.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Port.js deleted file mode 100644 index 91407c0e83..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Port.js +++ /dev/null @@ -1,220 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define(["dojo/dom", - "dojo/_base/xhr", - "dojo/parser", - "dojo/query", - "dojo/_base/connect", - "dijit/registry", - "dojox/html/entities", - "qpid/common/properties", - "qpid/common/updater", - "qpid/common/util", - "qpid/common/formatter", - "qpid/management/addPort", - "qpid/common/metadata", - "dojo/domReady!"], - function (dom, xhr, parser, query, connect, registry, entities, properties, updater, util, formatter, addPort, metadata) { - - function Port(name, parent, controller) { - this.name = name; - this.controller = controller; - this.modelObj = { type: "port", name: name, parent: parent}; - } - - Port.prototype.getTitle = function() { - return "Port: " + this.name; - }; - - Port.prototype.open = function(contentPane) { - var that = this; - this.contentPane = contentPane; - xhr.get({url: "showPort.html", - sync: true, - load: function(data) { - contentPane.containerNode.innerHTML = data; - parser.parse(contentPane.containerNode).then(function(instances) - { - that.portUpdater = new PortUpdater(contentPane.containerNode, that.modelObj, that.controller, "api/latest/port/" + encodeURIComponent(that.name)); - - updater.add( that.portUpdater ); - - that.portUpdater.update(); - - var deletePortButton = query(".deletePortButton", contentPane.containerNode)[0]; - var node = registry.byNode(deletePortButton); - connect.connect(node, "onClick", - function(evt){ - that.deletePort(); - }); - - var editPortButton = query(".editPortButton", contentPane.containerNode)[0]; - var node = registry.byNode(editPortButton); - connect.connect(node, "onClick", - function(evt){ - that.showEditDialog(); - }); - }); - }}); - }; - - Port.prototype.close = function() { - updater.remove( this.portUpdater ); - }; - - - Port.prototype.deletePort = function() { - if(confirm("Are you sure you want to delete port '" +this.name+"'?")) { - var query = "api/latest/port/" + encodeURIComponent(this.name); - this.success = true - var that = this; - xhr.del({url: query, sync: true, handleAs: "json"}).then( - function(data) { - that.contentPane.onClose() - that.controller.tabContainer.removeChild(that.contentPane); - that.contentPane.destroyRecursive(); - that.close(); - }, - function(error) {that.success = false; that.failureReason = error;}); - if(!this.success ) { - util.xhrErrorHandler(this.failureReason); - } - } - } - - Port.prototype.showEditDialog = function() { - var that = this; - xhr.get({url: "api/latest/broker", sync: properties.useSyncGet, handleAs: "json"}) - .then(function(data) - { - var brokerData= data[0]; - addPort.show(that.name, that.portUpdater.portData.type, brokerData.authenticationproviders, brokerData.keystores, brokerData.truststores); - } - ); - } - - function PortUpdater(containerNode, portObj, controller, url) - { - var that = this; - - function findNode(name) { - return query("." + name, containerNode)[0]; - } - - function storeNodes(names) - { - for(var i = 0; i < names.length; i++) { - that[names[i]] = findNode(names[i]); - } - } - - storeNodes(["nameValue", - "stateValue", - "typeValue", - "portValue", - "authenticationProviderValue", - "protocolsValue", - "transportsValue", - "bindingAddressValue", - "keyStoreValue", - "needClientAuthValue", - "wantClientAuthValue", - "trustStoresValue", - "connectionCountValue", - "maxOpenConnectionsValue", - "authenticationProvider", - "bindingAddress", - "keyStore", - "needClientAuth", - "wantClientAuth", - "trustStores", - "maxOpenConnections" - ]); - - this.query = url; - - xhr.get({url: this.query, sync: properties.useSyncGet, handleAs: "json"}).then(function(data) - { - that.portData = data[0]; - util.flattenStatistics( that.portData ); - that.updateHeader(); - }); - - } - - PortUpdater.prototype.updateHeader = function() - { - function printArray(fieldName, object) - { - var array = object[fieldName]; - var data = "<div>"; - if (array) { - for(var i = 0; i < array.length; i++) { - data+= "<div>" + entities.encode(array[i]) + "</div>"; - } - } - return data + "</div>"; - } - - this.nameValue.innerHTML = entities.encode(String(this.portData[ "name" ])); - this.stateValue.innerHTML = entities.encode(String(this.portData[ "state" ])); - this.typeValue.innerHTML = entities.encode(String(this.portData[ "type" ])); - this.portValue.innerHTML = entities.encode(String(this.portData[ "port" ])); - this.authenticationProviderValue.innerHTML = this.portData[ "authenticationProvider" ] ? entities.encode(String(this.portData[ "authenticationProvider" ])) : ""; - this.protocolsValue.innerHTML = printArray( "protocols", this.portData); - this.transportsValue.innerHTML = printArray( "transports", this.portData); - this.bindingAddressValue.innerHTML = this.portData[ "bindingAddress" ] ? entities.encode(String(this.portData[ "bindingAddress" ])) : "" ; - this.connectionCountValue.innerHTML = this.portData[ "connectionCount" ] ? entities.encode(String(this.portData[ "connectionCount" ])) : "0" ; - this.maxOpenConnectionsValue.innerHTML = (this.portData[ "maxOpenConnections" ] && this.portData[ "maxOpenConnections" ] >= 0) ? entities.encode(String(this.portData[ "maxOpenConnections" ])) : "(no limit)" ; - - this.keyStoreValue.innerHTML = this.portData[ "keyStore" ] ? entities.encode(String(this.portData[ "keyStore" ])) : ""; - this.needClientAuthValue.innerHTML = "<input type='checkbox' disabled='disabled' "+(this.portData[ "needClientAuth" ] ? "checked='checked'": "")+" />" ; - this.wantClientAuthValue.innerHTML = "<input type='checkbox' disabled='disabled' "+(this.portData[ "wantClientAuth" ] ? "checked='checked'": "")+" />" ; - this.trustStoresValue.innerHTML = printArray( "trustStores", this.portData); - - var typeMetaData = metadata.getMetaData("Port", this.portData["type"]); - - this.authenticationProvider.style.display = "authenticationProvider" in typeMetaData.attributes ? "block" : "none"; - this.bindingAddress.style.display = "bindingAddress" in typeMetaData.attributes ? "block" : "none"; - this.keyStore.style.display = "keyStore" in typeMetaData.attributes ? "block" : "none"; - this.needClientAuth.style.display = "needClientAuth" in typeMetaData.attributes ? "block" : "none"; - this.wantClientAuth.style.display = "wantClientAuth" in typeMetaData.attributes ? "block" : "none"; - this.trustStores.style.display = "trustStores" in typeMetaData.attributes ? "block" : "none"; - - this.maxOpenConnections.style.display = "maxOpenConnections" in typeMetaData.attributes ? "block" : "none"; - - }; - - PortUpdater.prototype.update = function() - { - - var thisObj = this; - - xhr.get({url: this.query, sync: properties.useSyncGet, handleAs: "json"}).then(function(data) - { - thisObj.portData = data[0]; - util.flattenStatistics( thisObj.portData ); - thisObj.updateHeader(); - }); - }; - - return Port; - }); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Preferences.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Preferences.js deleted file mode 100644 index c8e1d17e06..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Preferences.js +++ /dev/null @@ -1,281 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define([ - "dojo/_base/declare", - "dojo/_base/xhr", - "dojo/_base/event", - "dojo/_base/connect", - "dojo/dom", - "dojo/dom-construct", - "dojo/parser", - "dojo/json", - "dojo/store/Memory", - "dojo/data/ObjectStore", - "dojox/html/entities", - "dijit/registry", - "qpid/common/TimeZoneSelector", - "dojo/text!../../showPreferences.html", - "qpid/common/util", - "qpid/management/UserPreferences", - "dijit/Dialog", - "dijit/form/NumberSpinner", - "dijit/form/CheckBox", - "dijit/form/Textarea", - "dijit/form/FilteringSelect", - "dijit/form/TextBox", - "dijit/form/DropDownButton", - "dijit/form/Button", - "dijit/form/Form", - "dijit/layout/BorderContainer", - "dijit/layout/TabContainer", - "dijit/layout/ContentPane", - "dojox/grid/EnhancedGrid", - "dojox/validate/us", - "dojox/validate/web", - "dojo/domReady!"], -function (declare, xhr, event, connect, dom, domConstruct, parser, json, Memory, ObjectStore, entities, registry, TimeZoneSelector, markup, util, UserPreferences) { - - var preferenceNames = ["timeZone", "updatePeriod"]; - - return declare("qpid.management.Preferences", null, { - - preferencesDialog: null, - - constructor: function() - { - var that = this; - - this.userPreferences = {}; - this.domNode = domConstruct.create("div", {innerHTML: markup}); - parser.parse(this.domNode).then(function(instances) - { - that._postParse(); - }); - }, - _postParse: function() - { - var that = this; - this.preferencesDialog = registry.byId("preferences.preferencesDialog"); - for(var i=0; i<preferenceNames.length; i++) - { - var name = preferenceNames[i]; - this[name] = registry.byId("preferences." + name); - this[name].on("change", function(val){that._toggleSetButtons();}); - } - - this.setButton = registry.byId("preferences.setButton"); - this.setAndCloseButton = registry.byId("preferences.setAndCloseButton"); - this.setButton.on("click", function(e){that._savePreferences(e, false);}); - this.setAndCloseButton.on("click", function(e){that._savePreferences(e, true);}); - this.theForm = registry.byId("preferences.preferencesForm"); - this.usersGrid = registry.byId("preferences.users"); - this.usersGrid.set("structure", [ { name: "User", field: "name", width: "50%"}, - { name: "Authentication Provider", field: "authenticationProvider", width: "50%"}]); - this.deleteButton = registry.byId("preferences.deleteButton"); - this.deleteAndCloseButton = registry.byId("preferences.deleteAndCloseButton"); - this.deleteButton.on("click", function(e){that._deletePreferences(false);}); - this.deleteAndCloseButton.on("click", function(e){that._deletePreferences(true);}); - - var deletePreferencesButtonToggler = function(rowIndex){ - var data = that.usersGrid.selection.getSelected(); - that.deleteButton.set("disabled",!data.length ); - that.deleteAndCloseButton.set("disabled",!data.length ); - }; - connect.connect(this.usersGrid.selection, 'onSelected', deletePreferencesButtonToggler); - connect.connect(this.usersGrid.selection, 'onDeselected', deletePreferencesButtonToggler); - this.theForm.on("submit", function(e){event.stop(e); return false;}); - - this._setValues(); - - deletePreferencesButtonToggler(); - this.preferencesDialog.startup(); - }, - - showDialog: function(){ - this._setValues(); - this._loadUserPreferences(); - this.preferencesDialog.show(); - }, - - destroy: function() - { - if (this.preferencesDialog) - { - this.preferencesDialog.destroyRecursevly(); - this.preferencesDialog = null; - } - }, - - _savePreferences: function(e, hideDialog) - { - var that =this; - event.stop(e); - if(this.theForm.validate()){ - var preferences = {}; - for(var i=0; i<preferenceNames.length; i++) - { - var name = preferenceNames[i]; - var preferenceWidget = this[name]; - if (preferenceWidget) - { - preferences[name] = preferenceWidget.hasOwnProperty("checked") ? preferenceWidget.checked : preferenceWidget.get("value"); - } - } - - UserPreferences.setPreferences( - preferences, - function(preferences) - { - success = true; - if (hideDialog) - { - that.preferencesDialog.hide(); - } - else - { - var reloadUsers = true; - if (that.users) - { - var authenticatedUser = dom.byId("authenticatedUser").innerHTML; - for(var i=0; i<that.users.length; i++) - { - if (that.users[i].name == authenticatedUser) - { - reloadUsers = false; - break; - } - } - } - if (reloadUsers) - { - that._loadUserPreferences(); - } - } - that._toggleSetButtons(); - }, - UserPreferences.defaultErrorHandler - ); - } - }, - - _deletePreferences: function(hideDialog){ - var data = this.usersGrid.selection.getSelected(); - if (util.deleteGridSelections( - null, - this.usersGrid, - "service/userpreferences", - "Are you sure you want to delete preferences for user", - "user")) - { - this._loadUserPreferences(); - var authenticatedUser = dom.byId("authenticatedUser").innerHTML; - for(i = 0; i<data.length; i++) - { - if (data[i].name == authenticatedUser) - { - UserPreferences.resetPreferences(); - this._setValues(); - break; - } - } - if (hideDialog) - { - this.preferencesDialog.hide(); - } - } - }, - - _setValues: function() - { - for(var i = 0; i < preferenceNames.length; i++) - { - var name = preferenceNames[i]; - var preferenceWidget = this[name]; - if (preferenceWidget) - { - var value = UserPreferences[name] - if (typeof value == "string") - { - value = entities.encode(String(value)) - } - if (!value && name == "updatePeriod") - { - // set to default - value = 5; - } - preferenceWidget.set("value", value); - if (preferenceWidget.hasOwnProperty("checked")) - { - preferenceWidget.set("checked", UserPreferences[name] ? true : false); - } - } - } - this._toggleSetButtons(); - }, - - _loadUserPreferences : function() - { - var that = this; - xhr.get({ - url: "service/userpreferences", - sync: false, - handleAs: "json" - }).then( - function(users) { - for(var i=0; i<users.length; i++) - { - users[i].id = users[i].authenticationProvider + "/" + users[i].name; - } - that.users = users; - var usersStore = new Memory({data: users, idProperty: "id"}); - var usersDataStore = new ObjectStore({objectStore: usersStore}); - if (that.usersGrid.store) - { - that.usersGrid.store.close(); - } - that.usersGrid.set("store", usersDataStore); - that.usersGrid._refresh(); - }); - }, - - _toggleSetButtons: function() - { - var changed = false; - for(var i=0; i<preferenceNames.length; i++) - { - var name = preferenceNames[i]; - var preferenceWidget = this[name]; - if (preferenceWidget) - { - var value = preferenceWidget.hasOwnProperty("checked") ? preferenceWidget.checked : preferenceWidget.get("value"); - if (value != UserPreferences[name]) - { - changed = true; - break; - } - } - } - this.setButton.set("disabled", !changed); - this.setAndCloseButton.set("disabled", !changed); - } - - }); -});
\ No newline at end of file diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/PreferencesProvider.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/PreferencesProvider.js deleted file mode 100644 index c145ba0d34..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/PreferencesProvider.js +++ /dev/null @@ -1,187 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define(["dojo/_base/xhr", - "dojo/parser", - "dojo/query", - "dojo/dom-construct", - "dojo/_base/array", - "qpid/common/properties", - "qpid/common/updater", - "qpid/common/util", - "dojo/_base/event", - "dijit/registry", - "dojo/dom-style", - "dojox/html/entities", - "qpid/management/addPreferencesProvider", - "dojo/domReady!"], - function (xhr, parser, query, construct, array, properties, updater, util, event, registry, domStyle, entities, addPreferencesProvider) { - - function PreferencesProvider(name, parent, controller) { - this.name = name; - this.controller = controller; - this.modelObj = { type: "preferencesprovider", name: name, parent: parent}; - this.authenticationProviderName = parent.name; - } - - PreferencesProvider.prototype.getTitle = function() { - return "PreferencesProvider:" + this.authenticationProviderName + "/" + this.name ; - }; - - PreferencesProvider.prototype.init = function(node, parentObject) { - var that = this; - xhr.get({url: "showPreferencesProvider.html", - sync: true, - load: function(data) { - node.innerHTML = data; - parser.parse(node).then(function(instances) - { - that.containerNode = node; - that.parentObject = parentObject; - that.preferencesProviderType=query(".preferencesProviderType", node)[0]; - that.preferencesProviderState=query(".preferencesProviderState", node)[0]; - that.editPreferencesProviderButton = query(".editPreferencesProviderButton", node)[0]; - that.deletePreferencesProviderButton = query(".deletePreferencesProviderButton", node)[0]; - that.preferencesProviderAttributes = query(".preferencesProviderAttributes", node)[0]; - that.preferencesDetailsDiv = query(".preferencesDetails", node)[0]; - var editPreferencesProviderWidget = registry.byNode(that.editPreferencesProviderButton); - editPreferencesProviderWidget.on("click", function(evt){ event.stop(evt); that.editPreferencesProvider();}); - var deletePreferencesProviderWidget = registry.byNode(that.deletePreferencesProviderButton); - deletePreferencesProviderWidget.on("click", function(evt){ event.stop(evt); that.deletePreferencesProvider();}); - }); - }}); - }; - - PreferencesProvider.prototype.open = function(contentPane) { - this.contentPane = contentPane; - this.init(contentPane.containerNode); - this.reload(); - this.updater = new PreferencesProviderUpdater(this); - updater.add(this.updater); - }; - - PreferencesProvider.prototype.close = function() { - if (this.updater) - { - updater.remove( this.updater); - } - }; - - PreferencesProvider.prototype.deletePreferencesProvider = function() { - if (this.preferencesProviderData){ - var preferencesProviderData = this.preferencesProviderData; - if(confirm("Are you sure you want to delete preferences provider '" + preferencesProviderData.name + "'?")) { - var query = "api/latest/preferencesprovider/" + encodeURIComponent(this.authenticationProviderName) + "/" + encodeURIComponent(preferencesProviderData.name); - this.success = true - var that = this; - xhr.del({url: query, sync: true, handleAs: "json"}).then( - function(data) { - that.update(null); - - // if opened in tab - if (that.contentPane) - { - that.close(); - that.contentPane.onClose() - that.controller.tabContainer.removeChild(that.contentPane); - that.contentPane.destroyRecursive(); - } - else - { - var widgets = registry.findWidgets(that.containerNode); - array.forEach(widgets, function(item) { item.destroyRecursive();}); - construct.empty(that.containerNode); - if (that.parentObject) - { - that.parentObject.onPreferencesProviderDeleted(); - } - } - }, - function(error) {that.success = false; that.failureReason = error;}); - if(!this.success ) { - util.xhrErrorHandler(this.failureReason); - } - } - } - }; - - PreferencesProvider.prototype.editPreferencesProvider = function() { - if (this.preferencesProviderData){ - addPreferencesProvider.show(this.authenticationProviderName, this.name); - } - }; - - PreferencesProvider.prototype.update = function(data) { - this.preferencesProviderData = data; - if (data) - { - this.name = data.name; - this.preferencesProviderAttributes.style.display = 'block'; - this.editPreferencesProviderButton.style.display = 'inline'; - this.deletePreferencesProviderButton.style.display = 'inline'; - this.preferencesProviderType.innerHTML = entities.encode(String(data.type)); - this.preferencesProviderState.innerHTML = entities.encode(String(data.state)); - if (!this.details) - { - var that = this; - require(["qpid/management/preferencesprovider/" + data.type.toLowerCase() + "/show"], - function(PreferencesProviderDetails) { - that.details = new PreferencesProviderDetails(that.preferencesDetailsDiv); - that.details.update(data); - }); - } - else - { - this.details.update(data); - } - } - else - { - this.editPreferencesProviderButton.style.display = 'none'; - this.deletePreferencesProviderButton.style.display = 'none'; - this.preferencesProviderAttributes.style.display = 'none'; - this.details = null; - } - }; - - PreferencesProvider.prototype.reload = function() - { - var query = "api/latest/preferencesprovider/" + encodeURIComponent(this.authenticationProviderName) + "/" + encodeURIComponent(this.name); - var that = this; - xhr.get({url: query, sync: properties.useSyncGet, handleAs: "json"}) - .then(function(data) { - var preferencesProviderData = data[0]; - util.flattenStatistics( preferencesProviderData ); - that.update(preferencesProviderData); - }); - }; - - function PreferencesProviderUpdater(preferencesProvider) - { - this.preferencesProvider = preferencesProvider; - }; - - PreferencesProviderUpdater.prototype.update = function() - { - this.preferencesProvider.reload(); - }; - - return PreferencesProvider; - }); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Queue.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Queue.js deleted file mode 100644 index 55d0df1241..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/Queue.js +++ /dev/null @@ -1,566 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define(["dojo/_base/xhr", - "dojo/parser", - "dojo/query", - "dijit/registry", - "dojo/_base/connect", - "dojo/_base/event", - "dojo/json", - "qpid/common/properties", - "qpid/common/updater", - "qpid/common/util", - "qpid/common/formatter", - "qpid/common/UpdatableStore", - "qpid/management/addBinding", - "qpid/management/moveCopyMessages", - "qpid/management/showMessage", - "qpid/management/UserPreferences", - "qpid/management/editQueue", - "dojo/store/JsonRest", - "dojox/grid/EnhancedGrid", - "dojo/data/ObjectStore", - "dojox/html/entities", - "dojox/grid/enhanced/plugins/Pagination", - "dojox/grid/enhanced/plugins/IndirectSelection", - "dojo/domReady!"], - function (xhr, parser, query, registry, connect, event, json, properties, updater, util, formatter, - UpdatableStore, addBinding, moveMessages, showMessage, UserPreferences, editQueue, JsonRest, EnhancedGrid, ObjectStore, entities) { - - function Queue(name, parent, controller) { - this.name = name; - this.controller = controller; - this.modelObj = { type: "queue", name: name, parent: parent }; - } - - Queue.prototype.getQueueName = function() - { - return this.name; - }; - - - Queue.prototype.getVirtualHostName = function() - { - return this.modelObj.parent.name; - }; - - Queue.prototype.getVirtualHostNodeName = function() - { - return this.modelObj.parent.parent.name; - }; - - Queue.prototype.getTitle = function() - { - return "Queue: " + this.name; - }; - - Queue.prototype.open = function(contentPane) { - var that = this; - this.contentPane = contentPane; - xhr.get({url: "showQueue.html", - sync: true, - load: function(data) { - contentPane.containerNode.innerHTML = data; - parser.parse(contentPane.containerNode).then(function(instances) - { - - that.queueUpdater = new QueueUpdater(contentPane.containerNode, that, that.controller); - - updater.add( that.queueUpdater ); - - that.queueUpdater.update(); - - var myStore = new JsonRest({target:"service/message/"+ encodeURIComponent(that.getVirtualHostName()) + - "/" + encodeURIComponent(that.getQueueName())}); - var messageGridDiv = query(".messages",contentPane.containerNode)[0]; - that.dataStore = new ObjectStore({objectStore: myStore}); - that.grid = new EnhancedGrid({ - store: that.dataStore, - autoHeight: 10, - keepSelection: true, - structure: [ - {name:"Size", field:"size", width: "40%"}, - {name:"State", field:"state", width: "30%"}, - - {name:"Arrival", field:"arrivalTime", width: "30%", - formatter: function(val) { - return UserPreferences.formatDateTime(val, {addOffset: true, appendTimeZone: true}); - } } - ], - plugins: { - pagination: { - pageSizes: ["10", "25", "50", "100"], - description: true, - sizeSwitch: true, - pageStepper: true, - gotoButton: true, - maxPageStep: 4, - position: "bottom" - }, - indirectSelection: true - } - }, messageGridDiv); - - connect.connect(that.grid, "onRowDblClick", that.grid, - function(evt){ - var idx = evt.rowIndex, - theItem = this.getItem(idx); - var id = that.dataStore.getValue(theItem,"id"); - showMessage.show({ messageNumber: id, - queue: that.getQueueName(), - virtualhost: that.getVirtualHostName(), - virtualhostnode: that.getVirtualHostNodeName()}); - }); - - var deleteMessagesButton = query(".deleteMessagesButton", contentPane.containerNode)[0]; - var deleteWidget = registry.byNode(deleteMessagesButton); - connect.connect(deleteWidget, "onClick", - function(evt){ - event.stop(evt); - that.deleteMessages(); - }); - var clearQueueButton = query(".clearQueueButton", contentPane.containerNode)[0]; - var clearQueueWidget = registry.byNode(clearQueueButton); - connect.connect(clearQueueWidget, "onClick", - function(evt){ - event.stop(evt); - that.clearQueue(); - }); - var moveMessagesButton = query(".moveMessagesButton", contentPane.containerNode)[0]; - connect.connect(registry.byNode(moveMessagesButton), "onClick", - function(evt){ - event.stop(evt); - that.moveOrCopyMessages({move: true}); - }); - - - var copyMessagesButton = query(".copyMessagesButton", contentPane.containerNode)[0]; - connect.connect(registry.byNode(copyMessagesButton), "onClick", - function(evt){ - event.stop(evt); - that.moveOrCopyMessages({move: false}); - }); - - var addBindingButton = query(".addBindingButton", contentPane.containerNode)[0]; - connect.connect(registry.byNode(addBindingButton), "onClick", - function(evt){ - event.stop(evt); - addBinding.show({ virtualhost: that.getVirtualHostName(), - queue: that.getQueueName(), - virtualhostnode: that.getVirtualHostNodeName()}); - }); - - var deleteQueueButton = query(".deleteQueueButton", contentPane.containerNode)[0]; - connect.connect(registry.byNode(deleteQueueButton), "onClick", - function(evt){ - event.stop(evt); - that.deleteQueue(); - }); - var editQueueButton = query(".editQueueButton", contentPane.containerNode)[0]; - connect.connect(registry.byNode(editQueueButton), "onClick", - function(evt){ - event.stop(evt); - editQueue.show({nodeName:that.modelObj.parent.parent.name, hostName:that.modelObj.parent.name,queueName:that.name}); - }); - UserPreferences.addListener(that); - - }); - }}); - - - - }; - - Queue.prototype.deleteMessages = function() { - var data = this.grid.selection.getSelected(); - if(data.length) { - var that = this; - if(confirm("Delete " + data.length + " messages?")) { - var i, queryParam; - for(i = 0; i<data.length; i++) { - if(queryParam) { - queryParam += "&"; - } else { - queryParam = "?"; - } - - queryParam += "id=" + data[i].id; - } - var query = "service/message/"+ encodeURIComponent(that.getVirtualHostName()) - + "/" + encodeURIComponent(that.getQueueName()) + queryParam; - that.success = true - xhr.del({url: query, sync: true, handleAs: "json"}).then( - function(data) { - that.grid.setQuery({id: "*"}); - that.grid.selection.deselectAll(); - that.queueUpdater.update(); - }, - function(error) {that.success = false; that.failureReason = error;}); - if(!that.success ) { - alert("Error:" + this.failureReason); - } - } - } - }; - Queue.prototype.clearQueue = function() { - var that = this; - if(confirm("Clear all messages from queue?")) { - var query = "service/message/"+ encodeURIComponent(that.getVirtualHostName()) - + "/" + encodeURIComponent(that.getQueueName()) + "?clear=true"; - that.success = true - xhr.del({url: query, sync: true, handleAs: "json"}).then( - function(data) { - that.grid.setQuery({id: "*"}); - that.grid.selection.deselectAll(); - that.queueUpdater.update(); - }, - function(error) {that.success = false; that.failureReason = error;}); - if(!that.success ) { - alert("Error:" + this.failureReason); - } - } - }; - Queue.prototype.moveOrCopyMessages = function(obj) { - var that = this; - var move = obj.move; - var data = this.grid.selection.getSelected(); - if(data.length) { - var that = this; - var i, putData = { messages:[] }; - if(move) { - putData.move = true; - } - for(i = 0; i<data.length; i++) { - putData.messages.push(data[i].id); - } - moveMessages.show({ virtualhost: this.getVirtualHostName(), - queue: this.getQueueName(), - data: putData}, function() { - if(move) - { - that.grid.setQuery({id: "*"}); - that.grid.selection.deselectAll(); - } - }); - - } - - - - }; - - Queue.prototype.startup = function() { - this.grid.startup(); - }; - - Queue.prototype.close = function() { - updater.remove( this.queueUpdater ); - UserPreferences.removeListener(this); - }; - - Queue.prototype.onPreferencesChange = function(data) - { - this.grid._refresh(); - }; - - var queueTypeKeys = { - priority: "priorities", - lvq: "lvqKey", - sorted: "sortKey" - }; - - var queueTypeKeyNames = { - priority: "Number of priorities", - lvq: "LVQ key", - sorted: "Sort key" - }; - - function QueueUpdater(containerNode, queueObj, controller) - { - var that = this; - - function findNode(name) { - return query("." + name, containerNode)[0]; - } - - function storeNodes(names) - { - for(var i = 0; i < names.length; i++) { - that[names[i]] = findNode(names[i]); - } - } - - storeNodes(["name", - "state", - "durable", - "messageDurability", - "maximumMessageTtl", - "minimumMessageTtl", - "exclusive", - "owner", - "lifetimePolicy", - "type", - "typeQualifier", - "alertRepeatGap", - "alertRepeatGapUnits", - "alertThresholdMessageAge", - "alertThresholdMessageAgeUnits", - "alertThresholdMessageSize", - "alertThresholdMessageSizeUnits", - "alertThresholdQueueDepthBytes", - "alertThresholdQueueDepthBytesUnits", - "alertThresholdQueueDepthMessages", - "alternateExchange", - "messageGroups", - "messageGroupKey", - "messageGroupSharedGroups", - "queueDepthMessages", - "queueDepthBytes", - "queueDepthBytesUnits", - "unacknowledgedMessages", - "unacknowledgedBytes", - "unacknowledgedBytesUnits", - "msgInRate", - "bytesInRate", - "bytesInRateUnits", - "msgOutRate", - "bytesOutRate", - "bytesOutRateUnits", - "queueFlowResumeSizeBytes", - "queueFlowControlSizeBytes", - "maximumDeliveryAttempts", - "oldestMessageAge"]); - - - - this.query = "api/latest/queue/" + encodeURIComponent(queueObj.getVirtualHostNodeName()) + "/" + encodeURIComponent(queueObj.getVirtualHostName()) + "/" + encodeURIComponent(queueObj.getQueueName()); - - xhr.get({url: this.query, sync: properties.useSyncGet, handleAs: "json"}).then(function(data) - { - that.queueData = data[0]; - - util.flattenStatistics( that.queueData ); - - that.updateHeader(); - that.bindingsGrid = new UpdatableStore(that.queueData.bindings, findNode("bindings"), - [ { name: "Exchange", field: "exchange", width: "40%"}, - { name: "Binding Key", field: "name", width: "30%"}, - { name: "Arguments", field: "argumentString", width: "30%"} - ]); - - that.consumersGrid = new UpdatableStore(that.queueData.consumers, findNode("consumers"), - [ { name: "Name", field: "name", width: "40%"}, - { name: "Mode", field: "distributionMode", width: "20%"}, - { name: "Msgs Rate", field: "msgRate", - width: "20%"}, - { name: "Bytes Rate", field: "bytesRate", - width: "20%"} - ]); - - - - - }); - - } - - QueueUpdater.prototype.updateHeader = function() - { - - var bytesDepth; - this.name.innerHTML = entities.encode(String(this.queueData[ "name" ])); - this.state.innerHTML = entities.encode(String(this.queueData[ "state" ])); - this.durable.innerHTML = entities.encode(String(this.queueData[ "durable" ])); - this.exclusive.innerHTML = entities.encode(String(this.queueData[ "exclusive" ])); - this.owner.innerHTML = this.queueData[ "owner" ] ? entities.encode(String(this.queueData[ "owner" ])) : "" ; - this.lifetimePolicy.innerHTML = entities.encode(String(this.queueData[ "lifetimePolicy" ])); - this.messageDurability.innerHTML = entities.encode(String(this.queueData[ "messageDurability" ])); - this.minimumMessageTtl.innerHTML = entities.encode(String(this.queueData[ "minimumMessageTtl" ])); - this.maximumMessageTtl.innerHTML = entities.encode(String(this.queueData[ "maximumMessageTtl" ])); - - this.alternateExchange.innerHTML = this.queueData[ "alternateExchange" ] ? entities.encode(String(this.queueData[ "alternateExchange" ])) : "" ; - - this.queueDepthMessages.innerHTML = entities.encode(String(this.queueData["queueDepthMessages"])); - bytesDepth = formatter.formatBytes( this.queueData["queueDepthBytes"] ); - this.queueDepthBytes.innerHTML = "(" + bytesDepth.value; - this.queueDepthBytesUnits.innerHTML = bytesDepth.units + ")"; - - this.unacknowledgedMessages.innerHTML = entities.encode(String(this.queueData["unacknowledgedMessages"])); - bytesDepth = formatter.formatBytes( this.queueData["unacknowledgedBytes"] ); - this.unacknowledgedBytes.innerHTML = "(" + bytesDepth.value; - this.unacknowledgedBytesUnits.innerHTML = bytesDepth.units + ")"; - this["type" ].innerHTML = entities.encode(this.queueData[ "type" ]); - if (this.queueData["type"] == "standard") - { - this.typeQualifier.style.display = "none"; - } - else - { - this.typeQualifier.innerHTML = entities.encode("(" + queueTypeKeyNames[this.queueData[ "type" ]] + ": " + this.queueData[queueTypeKeys[this.queueData[ "type" ]]] + ")"); - } - - if(this.queueData["messageGroupKey"]) - { - this.messageGroupKey.innerHTML = entities.encode(String(this.queueData["messageGroupKey"])); - this.messageGroupSharedGroups.innerHTML = entities.encode(String(this.queueData["messageGroupSharedGroups"])); - this.messageGroups.style.display = "block"; - } - else - { - this.messageGroups.style.display = "none"; - } - - this.queueFlowControlSizeBytes.innerHTML = entities.encode(String(this.queueData[ "queueFlowControlSizeBytes" ])); - this.queueFlowResumeSizeBytes.innerHTML = entities.encode(String(this.queueData[ "queueFlowResumeSizeBytes" ])); - - this.oldestMessageAge.innerHTML = entities.encode(String(this.queueData[ "oldestMessageAge" ] / 1000)); - var maximumDeliveryAttempts = this.queueData[ "maximumDeliveryAttempts" ]; - this.maximumDeliveryAttempts.innerHTML = entities.encode(String( maximumDeliveryAttempts == 0 ? "" : maximumDeliveryAttempts)); - }; - - QueueUpdater.prototype.update = function() - { - - var thisObj = this; - - xhr.get({url: this.query, sync: properties.useSyncGet, handleAs: "json"}).then(function(data) { - var i,j; - thisObj.queueData = data[0]; - util.flattenStatistics( thisObj.queueData ); - - var bindings = thisObj.queueData[ "bindings" ]; - var consumers = thisObj.queueData[ "consumers" ]; - - if (bindings) - { - for(i=0; i < bindings.length; i++) { - bindings[i].argumentString = json.stringify(bindings[i].arguments); - } - } - thisObj.updateHeader(); - - - // update alerting info - var alertRepeatGap = formatter.formatTime( thisObj.queueData["alertRepeatGap"] ); - - thisObj.alertRepeatGap.innerHTML = alertRepeatGap.value; - thisObj.alertRepeatGapUnits.innerHTML = alertRepeatGap.units; - - - var alertMsgAge = formatter.formatTime( thisObj.queueData["alertThresholdMessageAge"] ); - - thisObj.alertThresholdMessageAge.innerHTML = alertMsgAge.value; - thisObj.alertThresholdMessageAgeUnits.innerHTML = alertMsgAge.units; - - var alertMsgSize = formatter.formatBytes( thisObj.queueData["alertThresholdMessageSize"] ); - - thisObj.alertThresholdMessageSize.innerHTML = alertMsgSize.value; - thisObj.alertThresholdMessageSizeUnits.innerHTML = alertMsgSize.units; - - var alertQueueDepth = formatter.formatBytes( thisObj.queueData["alertThresholdQueueDepthBytes"] ); - - thisObj.alertThresholdQueueDepthBytes.innerHTML = alertQueueDepth.value; - thisObj.alertThresholdQueueDepthBytesUnits.innerHTML = alertQueueDepth.units; - - thisObj.alertThresholdQueueDepthMessages.innerHTML = entities.encode(String(thisObj.queueData["alertThresholdQueueDepthMessages"])); - - var sampleTime = new Date(); - var messageIn = thisObj.queueData["totalEnqueuedMessages"]; - var bytesIn = thisObj.queueData["totalEnqueuedBytes"]; - var messageOut = thisObj.queueData["totalDequeuedMessages"]; - var bytesOut = thisObj.queueData["totalDequeuedBytes"]; - - if(thisObj.sampleTime) { - var samplePeriod = sampleTime.getTime() - thisObj.sampleTime.getTime(); - - var msgInRate = (1000 * (messageIn - thisObj.messageIn)) / samplePeriod; - var msgOutRate = (1000 * (messageOut - thisObj.messageOut)) / samplePeriod; - var bytesInRate = (1000 * (bytesIn - thisObj.bytesIn)) / samplePeriod; - var bytesOutRate = (1000 * (bytesOut - thisObj.bytesOut)) / samplePeriod; - - thisObj.msgInRate.innerHTML = msgInRate.toFixed(0); - var bytesInFormat = formatter.formatBytes( bytesInRate ); - thisObj.bytesInRate.innerHTML = "(" + bytesInFormat.value; - thisObj.bytesInRateUnits.innerHTML = bytesInFormat.units + "/s)"; - - thisObj.msgOutRate.innerHTML = msgOutRate.toFixed(0); - var bytesOutFormat = formatter.formatBytes( bytesOutRate ); - thisObj.bytesOutRate.innerHTML = "(" + bytesOutFormat.value; - thisObj.bytesOutRateUnits.innerHTML = bytesOutFormat.units + "/s)"; - - if(consumers && thisObj.consumers) { - for(i=0; i < consumers.length; i++) { - var consumer = consumers[i]; - for(j = 0; j < thisObj.consumers.length; j++) { - var oldConsumer = thisObj.consumers[j]; - if(oldConsumer.id == consumer.id) { - var msgRate = (1000 * (consumer.messagesOut - oldConsumer.messagesOut)) / - samplePeriod; - consumer.msgRate = msgRate.toFixed(0) + "msg/s"; - - var bytesRate = (1000 * (consumer.bytesOut - oldConsumer.bytesOut)) / - samplePeriod; - var bytesRateFormat = formatter.formatBytes( bytesRate ); - consumer.bytesRate = bytesRateFormat.value + bytesRateFormat.units + "/s"; - } - } - } - } - - } - - thisObj.sampleTime = sampleTime; - thisObj.messageIn = messageIn; - thisObj.bytesIn = bytesIn; - thisObj.messageOut = messageOut; - thisObj.bytesOut = bytesOut; - thisObj.consumers = consumers; - - // update bindings - thisObj.bindingsGrid.update(thisObj.queueData.bindings); - - // update consumers - thisObj.consumersGrid.update(thisObj.queueData.consumers) - - }); - }; - - Queue.prototype.deleteQueue = function() { - if(confirm("Are you sure you want to delete queue '" +this.name+"'?")) { - var query = "api/latest/queue/" + encodeURIComponent(this.getVirtualHostNodeName()) - + "/" + encodeURIComponent(this.getVirtualHostName()) + "/" + encodeURIComponent(this.name); - this.success = true - var that = this; - xhr.del({url: query, sync: true, handleAs: "json"}).then( - function(data) { - that.contentPane.onClose() - that.controller.tabContainer.removeChild(that.contentPane); - that.contentPane.destroyRecursive(); - }, - function(error) {that.success = false; that.failureReason = error;}); - if(!this.success ) { - util.xhrErrorHandler(this.failureReason); - } - } - } - - return Queue; - }); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/TrustStore.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/TrustStore.js deleted file mode 100644 index fa6b63212e..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/TrustStore.js +++ /dev/null @@ -1,169 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define(["dojo/dom", - "dojo/_base/xhr", - "dojo/parser", - "dojo/query", - "dojo/_base/connect", - "dijit/registry", - "dojox/html/entities", - "qpid/common/properties", - "qpid/common/updater", - "qpid/common/util", - "qpid/common/formatter", - "qpid/management/addStore", - "dojo/domReady!"], - function (dom, xhr, parser, query, connect, registry, entities, properties, updater, util, formatter, addStore) { - - function TrustStore(name, parent, controller) { - this.keyStoreName = name; - this.controller = controller; - this.modelObj = { type: "truststore", name: name, parent: parent}; - this.url = "api/latest/truststore/" + encodeURIComponent(name); - } - - TrustStore.prototype.getTitle = function() { - return "TrustStore: " + this.keyStoreName; - }; - - TrustStore.prototype.open = function(contentPane) { - var that = this; - this.contentPane = contentPane; - xhr.get({url: "showStore.html", - sync: true, - load: function(data) { - contentPane.containerNode.innerHTML = data; - parser.parse(contentPane.containerNode).then(function(instances) - { - - that.keyStoreUpdater = new KeyStoreUpdater(contentPane.containerNode, that.modelObj, that.controller, that.url); - that.keyStoreUpdater.update(); - updater.add( that.keyStoreUpdater ); - - var deleteTrustStoreButton = query(".deleteStoreButton", contentPane.containerNode)[0]; - var node = registry.byNode(deleteTrustStoreButton); - connect.connect(node, "onClick", - function(evt){ - that.deleteKeyStore(); - }); - - var editTrustStoreButton = query(".editStoreButton", contentPane.containerNode)[0]; - var node = registry.byNode(editTrustStoreButton); - connect.connect(node, "onClick", - function(evt){ - xhr.get({url: that.url, sync: properties.useSyncGet, handleAs: "json", content: { actuals: true }}) - .then(function(data) - { - addStore.setupTypeStore("TrustStore"); - addStore.show(data[0], that.url); - }); - }); - }); - }}); - }; - - TrustStore.prototype.close = function() { - updater.remove( this.keyStoreUpdater ); - }; - - function KeyStoreUpdater(containerNode, keyStoreObj, controller, url) - { - var that = this; - this.keyStoreDetailsContainer = query(".typeFieldsContainer", containerNode)[0]; - - function findNode(name) { - return query("." + name , containerNode)[0]; - } - - function storeNodes(names) - { - for(var i = 0; i < names.length; i++) { - that[names[i]] = findNode(names[i]); - } - } - - storeNodes(["name", - "type", - "state" - ]); - - this.query = url; - - xhr.get({url: this.query, sync: properties.useSyncGet, handleAs: "json"}).then(function(data) - { - that.keyStoreData = data[0]; - that.updateHeader(); - }); - - } - - KeyStoreUpdater.prototype.updateHeader = function() - { - this.name.innerHTML = entities.encode(String(this.keyStoreData[ "name" ])); - this.type.innerHTML = entities.encode(String(this.keyStoreData[ "type" ])); - this.state.innerHTML = entities.encode(String(this.keyStoreData[ "state" ])); - }; - - KeyStoreUpdater.prototype.update = function() - { - var that = this; - xhr.get({url: this.query, sync: properties.useSyncGet, handleAs: "json"}).then(function(data) - { - that.trustStoreData = data[0]; - that.updateHeader(); - if (that.details) - { - that.details.update(that.trustStoreData); - } - else - { - require(["qpid/management/store/" + encodeURIComponent(that.trustStoreData.type.toLowerCase()) + "/show"], - function(DetailsUI) - { - that.details = new DetailsUI({containerNode:that.keyStoreDetailsContainer, parent: that}); - that.details.update(that.trustStoreData); - } - ); - } - }); - }; - - TrustStore.prototype.deleteKeyStore = function() { - if(confirm("Are you sure you want to delete trust store '" +this.keyStoreName+"'?")) { - var query = this.url; - this.success = true - var that = this; - xhr.del({url: query, sync: true, handleAs: "json"}).then( - function(data) { - that.contentPane.onClose() - that.controller.tabContainer.removeChild(that.contentPane); - that.contentPane.destroyRecursive(); - that.close(); - }, - function(error) {that.success = false; that.failureReason = error;}); - if(!this.success ) { - util.xhrErrorHandler(this.failureReason); - } - } - } - - return TrustStore; - }); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/UserPreferences.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/UserPreferences.js deleted file mode 100644 index 4a9dfd532a..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/UserPreferences.js +++ /dev/null @@ -1,313 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define(["dojo/_base/xhr", - "dojo/json", - "dojo/date", - "dojo/date/locale", - "dojo/number", - "qpid/common/timezone"], function (xhr, json, date, locale, number, timezone) { - - var listeners = []; - - var UserPreferences = { - - /* set time zone to 'UTC' by default*/ - timeZone: "UTC", - tabs: [], - - loadPreferences : function(callbackSuccessFunction, callbackErrorFunction) - { - var that = this; - xhr.get({ - url: "service/preferences", - sync: true, - handleAs: "json", - load: function(data) - { - for(var name in data) - { - that[name] = data[name]; - } - if (callbackSuccessFunction) - { - callbackSuccessFunction(); - } - }, - error: function(error) - { - if (callbackErrorFunction) - { - callbackErrorFunction(error); - } - } - }); - }, - - setPreferences : function(preferences, callbackSuccessFunction, callbackErrorFunction, noSync) - { - var that = this; - xhr.post({ - url: "service/preferences", - sync: !noSync, - handleAs: "json", - headers: { "Content-Type": "application/json"}, - postData: json.stringify(preferences), - load: function(x) - { - for(var name in preferences) - { - if (preferences.hasOwnProperty(name)) - that[name] = preferences[name]; - } - that._notifyListeners(preferences); - if (callbackSuccessFunction) - { - callbackSuccessFunction(preferences); - } - }, - error: function(error) - { - if (callbackErrorFunction) - { - callbackErrorFunction(error); - } - } - }); - }, - - resetPreferences : function() - { - var preferences = {}; - for(var name in this) - { - if (this.hasOwnProperty(name) && typeof this[name] != "function") - { - if (name == "preferencesError") - { - continue; - } - this[name] = null; - preferences[name] = undefined; - delete preferences[name]; - } - } - this._notifyListeners(preferences); - }, - - addListener : function(obj) - { - listeners.push(obj); - }, - - removeListener : function(obj) - { - for(var i = 0; i < listeners.length; i++) - { - if(listeners[i] === obj) - { - listeners.splice(i,1); - return; - } - } - }, - - _notifyListeners : function(preferences) - { - for(var i = 0; i < listeners.length; i++) - { - try - { - listeners[i].onPreferencesChange(preferences); - } - catch(e) - { - if (console && console.warn) - { - console.warn(e); - } - } - } - }, - - getTimeZoneInfo : function(timeZoneName) - { - if (!timeZoneName && this.timeZone) - { - timeZoneName = this.timeZone; - } - - if (!timeZoneName) - { - return null; - } - - return timezone.getTimeZoneInfo(timeZoneName); - }, - - addTimeZoneOffsetToUTC : function(utcTimeInMilliseconds, timeZone) - { - var tzi = null; - if (timeZone && timeZone.hasOwnProperty("offset")) - { - tzi = timeZone; - } - else - { - tzi = this.getTimeZoneInfo(timeZone); - } - - if (tzi) - { - var browserTimeZoneOffsetInMinutes = -new Date().getTimezoneOffset(); - return utcTimeInMilliseconds + ( tzi.offset - browserTimeZoneOffsetInMinutes ) * 60000; - } - return utcTimeInMilliseconds; - }, - - getTimeZoneDescription : function(timeZone) - { - var tzi = null; - if (timeZone && timeZone.hasOwnProperty("offset")) - { - tzi = timeZone; - } - else - { - tzi = this.getTimeZoneInfo(timeZone); - } - - if (tzi) - { - var timeZoneOfsetInMinutes = tzi.offset; - return (timeZoneOfsetInMinutes>0? "+" : "") - + number.format(timeZoneOfsetInMinutes/60, {pattern: "00"}) - + ":" + number.format(timeZoneOfsetInMinutes%60, {pattern: "00"}) - + " " + tzi.name; - } - return date.getTimezoneName(new Date()); - }, - - formatDateTime : function(utcTimeInMilliseconds, options) - { - var dateTimeOptions = options || {}; - var tzi = this.getTimeZoneInfo(dateTimeOptions.timeZoneName); - var timeInMilliseconds = utcTimeInMilliseconds; - - if (tzi && dateTimeOptions.addOffset) - { - timeInMilliseconds = this.addTimeZoneOffsetToUTC(utcTimeInMilliseconds, tzi); - } - - var d = new Date(timeInMilliseconds); - - var formatOptions = { - datePattern: dateTimeOptions.datePattern || "yyyy-MM-dd", - timePattern: dateTimeOptions.timePattern || "HH:mm:ss.SSS" - }; - - if ("date" == dateTimeOptions.selector) - { - formatOptions.selector = "date"; - } - else if ("time" == dateTimeOptions.selector) - { - formatOptions.selector = "time"; - } - - var result = locale.format(d, formatOptions); - if(dateTimeOptions.appendTimeZone) - { - result += " (" + this.getTimeZoneDescription(tzi) + ")"; - } - return result; - }, - - defaultErrorHandler: function(error) - { - if (error.status == 404) - { - alert("Cannot perform preferences operation: authentication provider is not configured"); - } - else - { - alert("Cannot perform preferences operation:" + error); - } - }, - - appendTab: function(tab) - { - if (!this.tabs) - { - this.tabs = []; - } - if (!this.isTabStored(tab)) - { - this.tabs.push(tab); - this.setPreferences({tabs: this.tabs}, null, this.defaultErrorHandler, true); - } - }, - - removeTab: function(tab) - { - if (this.tabs) - { - var index = this._getTabIndex(tab); - if (index != -1) - { - this.tabs.splice(index, 1); - this.setPreferences({tabs: this.tabs}, null, this.defaultErrorHandler, true); - } - } - }, - - isTabStored: function(tab) - { - return this._getTabIndex(tab) != -1; - }, - - _getTabIndex: function(tab) - { - var index = -1; - if (this.tabs) - { - for(var i = 0 ; i < this.tabs.length ; i++) - { - var t = this.tabs[i]; - if ( t.objectId == tab.objectId && t.objectType == tab.objectType ) - { - index = i; - break; - } - } - } - return index; - } - }; - - UserPreferences.loadPreferences(null, - function(error) - { - UserPreferences.preferencesError = error; - } - ); - - return UserPreferences; -});
\ No newline at end of file diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/VirtualHost.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/VirtualHost.js deleted file mode 100644 index e4482cc39e..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/VirtualHost.js +++ /dev/null @@ -1,483 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define(["dojo/_base/xhr", - "dojo/parser", - "dojo/query", - "dojo/_base/connect", - "dijit/registry", - "dojox/html/entities", - "qpid/common/properties", - "qpid/common/updater", - "qpid/common/util", - "qpid/common/formatter", - "qpid/common/UpdatableStore", - "qpid/management/addQueue", - "qpid/management/addExchange", - "dojox/grid/EnhancedGrid", - "qpid/management/editVirtualHost", - "dojo/domReady!"], - function (xhr, parser, query, connect, registry, entities, properties, updater, util, formatter, UpdatableStore, addQueue, addExchange, EnhancedGrid, editVirtualHost) { - - function VirtualHost(name, parent, controller) { - this.name = name; - this.controller = controller; - this.modelObj = { type: "virtualhost", name: name, parent: parent}; - } - - VirtualHost.prototype.getTitle = function() - { - return "VirtualHost: " + this.name; - }; - - VirtualHost.prototype.open = function(contentPane) { - var that = this; - this.contentPane = contentPane; - xhr.get({url: "showVirtualHost.html", - sync: true, - load: function(data) { - var containerNode = contentPane.containerNode; - containerNode.innerHTML = data; - parser.parse(containerNode).then(function(instances) - { - that.vhostUpdater = new Updater(containerNode, that.modelObj, that.controller, that); - - var addQueueButton = query(".addQueueButton", containerNode)[0]; - connect.connect(registry.byNode(addQueueButton), "onClick", function(evt){ - addQueue.show({virtualhost:that.name,virtualhostnode:that.modelObj.parent.name}) - }); - - var deleteQueueButton = query(".deleteQueueButton", containerNode)[0]; - connect.connect(registry.byNode(deleteQueueButton), "onClick", - function(evt){ - util.deleteGridSelections( - that.vhostUpdater, - that.vhostUpdater.queuesGrid.grid, - "api/latest/queue/" + encodeURIComponent(that.modelObj.parent.name) + "/" + encodeURIComponent(that.name), - "Are you sure you want to delete queue"); - } - ); - - var addExchangeButton = query(".addExchangeButton", containerNode)[0]; - connect.connect(registry.byNode(addExchangeButton), "onClick", function(evt){ addExchange.show({virtualhost:that.name,virtualhostnode:that.modelObj.parent.name}) }); - - var deleteExchangeButton = query(".deleteExchangeButton", containerNode)[0]; - connect.connect(registry.byNode(deleteExchangeButton), "onClick", - function(evt) - { - util.deleteGridSelections( - that.vhostUpdater, - that.vhostUpdater.exchangesGrid.grid, - "api/latest/exchange/"+ encodeURIComponent(that.modelObj.parent.name) + "/" + encodeURIComponent(that.name), - "Are you sure you want to delete exchange"); - } - ); - - that.stopButton = registry.byNode(query(".stopButton", containerNode)[0]); - that.startButton = registry.byNode(query(".startButton", containerNode)[0]); - that.editButton = registry.byNode(query(".editButton", containerNode)[0]); - that.downloadButton = registry.byNode(query(".downloadButton", containerNode)[0]); - that.downloadButton.on("click", - function(e) - { - var iframe = document.createElement('iframe'); - iframe.id = "downloader_" + that.name; - document.body.appendChild(iframe); - var suggestedAttachmentName = encodeURIComponent(that.name + ".json"); - iframe.src = "/api/latest/virtualhost/" + encodeURIComponent(that.modelObj.parent.name) + "/" + encodeURIComponent(that.name) + "?extractInitialConfig=true&contentDispositionAttachmentFilename=" + suggestedAttachmentName; - // It seems there is no way to remove this iframe in a manner that is cross browser compatible. - } - ); - - that.deleteButton = registry.byNode(query(".deleteButton", containerNode)[0]); - that.deleteButton.on("click", - function(e) - { - if (confirm("Deletion of virtual host will delete message data.\n\n" - + "Are you sure you want to delete virtual host '" + entities.encode(String(that.name)) + "'?")) - { - if (util.sendRequest("api/latest/virtualhost/" + encodeURIComponent(that.modelObj.parent.name) + "/" + encodeURIComponent( that.name) , "DELETE")) - { - that.destroy(); - } - } - } - ); - that.startButton.on("click", - function(event) - { - that.startButton.set("disabled", true); - util.sendRequest("api/latest/virtualhost/" + encodeURIComponent(that.modelObj.parent.name) + "/" + encodeURIComponent( that.name), - "PUT", {desiredState: "ACTIVE"}); - }); - - that.stopButton.on("click", - function(event) - { - if (confirm("Stopping the virtual host will also stop its children. " - + "Are you sure you want to stop virtual host '" - + entities.encode(String(that.name)) +"'?")) - { - that.stopButton.set("disabled", true); - util.sendRequest("api/latest/virtualhost/" + encodeURIComponent(that.modelObj.parent.name) + "/" + encodeURIComponent( that.name), - "PUT", {desiredState: "STOPPED"}); - } - }); - - that.editButton.on("click", - function(event) - { - editVirtualHost.show({nodeName:that.modelObj.parent.name,hostName:that.name}); - }); - - that.vhostUpdater.update(); - updater.add( that.vhostUpdater ); - }); - - }}); - - }; - - VirtualHost.prototype.close = function() { - updater.remove( this.vhostUpdater ); - }; - - VirtualHost.prototype.destroy = function() - { - this.close(); - this.contentPane.onClose() - this.controller.tabContainer.removeChild(this.contentPane); - this.contentPane.destroyRecursive(); - } - - function Updater(node, vhost, controller, virtualHost) - { - this.virtualHost = virtualHost; - var that = this; - - function findNode(name) { - return query("." + name, node)[0]; - } - - function storeNodes(names) - { - for(var i = 0; i < names.length; i++) { - that[names[i]] = findNode(names[i]); - } - } - - storeNodes(["name", - "type", - "state", - "durable", - "lifetimePolicy", - "msgInRate", - "bytesInRate", - "bytesInRateUnits", - "msgOutRate", - "bytesOutRate", - "bytesOutRateUnits", - "virtualHostDetailsContainer", - "deadLetterQueueEnabled", - "housekeepingCheckPeriod", - "housekeepingThreadCount", - "storeTransactionIdleTimeoutClose", - "storeTransactionIdleTimeoutWarn", - "storeTransactionOpenTimeoutClose", - "storeTransactionOpenTimeoutWarn", - "virtualHostConnections", - "virtualHostChildren" - ]); - - this.query = "api/latest/virtualhost/"+ encodeURIComponent(vhost.parent.name) + "/" + encodeURIComponent(vhost.name); - - var that = this; - - xhr.get({url: this.query, sync: properties.useSyncGet, handleAs: "json"}).then(function(data) { - that.vhostData = data[0]; - - // flatten statistics into attributes - util.flattenStatistics( that.vhostData ); - - var gridProperties = { - keepSelection: true, - plugins: { - pagination: { - pageSizes: [10, 25, 50, 100], - description: true, - sizeSwitch: true, - pageStepper: true, - gotoButton: true, - maxPageStep: 4, - position: "bottom" - }, - indirectSelection: true - - }}; - - that.updateHeader(); - that.queuesGrid = new UpdatableStore(that.vhostData.queues, findNode("queues"), - [ { name: "Name", field: "name", width: "30%"}, - { name: "Type", field: "type", width: "20%"}, - { name: "Consumers", field: "consumerCount", width: "10%"}, - { name: "Depth (msgs)", field: "queueDepthMessages", width: "20%"}, - { name: "Depth (bytes)", field: "queueDepthBytes", width: "20%", - get: function(rowIndex, item) - { - if(!item){ - return; - } - var store = this.grid.store; - var qdb = store.getValue(item, "queueDepthBytes"); - var bytesFormat = formatter.formatBytes( qdb ); - return bytesFormat.value + " " + bytesFormat.units; - } - } - ], - function(obj) - { - connect.connect(obj.grid, "onRowDblClick", obj.grid, - function(evt){ - var idx = evt.rowIndex, - theItem = this.getItem(idx); - var queueName = obj.dataStore.getValue(theItem,"name"); - controller.show("queue", queueName, vhost, theItem.id); - }); - } , gridProperties, EnhancedGrid); - - that.exchangesGrid = new UpdatableStore(that.vhostData.exchanges, findNode("exchanges"), - [ - { name: "Name", field: "name", width: "50%"}, - { name: "Type", field: "type", width: "30%"}, - { name: "Binding Count", field: "bindingCount", width: "20%"} - ], - function(obj) - { - connect.connect(obj.grid, "onRowDblClick", obj.grid, - function(evt){ - var idx = evt.rowIndex, - theItem = this.getItem(idx); - var exchangeName = obj.dataStore.getValue(theItem,"name"); - controller.show("exchange", exchangeName, vhost, theItem.id); - }); - } , gridProperties, EnhancedGrid); - - - that.connectionsGrid = new UpdatableStore(that.vhostData.connections, - findNode("connections"), - [ { name: "Name", field: "name", width: "20%"}, - { name: "User", field: "principal", width: "10%"}, - { name: "Port", field: "port", width: "10%"}, - { name: "Transport", field: "transport", width: "10%"}, - { name: "Sessions", field: "sessionCount", width: "10%"}, - { name: "Msgs In", field: "msgInRate", - width: "10%"}, - { name: "Bytes In", field: "bytesInRate", - width: "10%"}, - { name: "Msgs Out", field: "msgOutRate", - width: "10%"}, - { name: "Bytes Out", field: "bytesOutRate", - width: "10%"} - ], - function(obj) - { - connect.connect(obj.grid, "onRowDblClick", obj.grid, - function(evt){ - var idx = evt.rowIndex, - theItem = this.getItem(idx); - var connectionName = obj.dataStore.getValue(theItem,"name"); - controller.show("connection", connectionName, vhost, theItem.id); - }); - } ); - - - - }); - - } - - Updater.prototype.updateHeader = function() - { - this.name.innerHTML = entities.encode(String(this.vhostData[ "name" ])); - this.type.innerHTML = entities.encode(String(this.vhostData[ "type" ])); - this.state.innerHTML = entities.encode(String(this.vhostData[ "state" ])); - this.durable.innerHTML = entities.encode(String(this.vhostData[ "durable" ])); - this.lifetimePolicy.innerHTML = entities.encode(String(this.vhostData[ "lifetimePolicy" ])); - this.deadLetterQueueEnabled.innerHTML = entities.encode(String(this.vhostData[ "queue.deadLetterQueueEnabled" ])); - util.updateUI(this.vhostData, - ["housekeepingCheckPeriod", - "housekeepingThreadCount", - "storeTransactionIdleTimeoutClose", - "storeTransactionIdleTimeoutWarn", - "storeTransactionOpenTimeoutClose", - "storeTransactionOpenTimeoutWarn"], - this) - }; - - Updater.prototype.update = function() - { - var thisObj = this; - - xhr.get({url: this.query, sync: properties.useSyncGet, handleAs: "json"}) - .then(function(data) { - thisObj.vhostData = data[0] || {name: thisObj.virtualHost.name,statistics:{messagesIn:0,bytesIn:0,messagesOut:0,bytesOut:0}}; - try - { - thisObj._update(); - } - catch(e) - { - if (console && console.error) - { - console.error(e); - } - } - }); - } - - Updater.prototype._update = function() - { - var thisObj = this; - this.virtualHost.startButton.set("disabled", !this.vhostData.state || this.vhostData.state != "STOPPED"); - this.virtualHost.stopButton.set("disabled", !this.vhostData.state || this.vhostData.state != "ACTIVE"); - this.virtualHost.editButton.set("disabled", !this.vhostData.state || this.vhostData.state == "UNAVAILABLE"); - this.virtualHost.downloadButton.set("disabled", !this.vhostData.state || this.vhostData.state != "ACTIVE"); - this.virtualHost.deleteButton.set("disabled", !this.vhostData.state); - - util.flattenStatistics( thisObj.vhostData ); - var connections = thisObj.vhostData[ "connections" ]; - var queues = thisObj.vhostData[ "queues" ]; - var exchanges = thisObj.vhostData[ "exchanges" ]; - - thisObj.updateHeader(); - - var stats = thisObj.vhostData[ "statistics" ]; - - var sampleTime = new Date(); - var messageIn = stats["messagesIn"]; - var bytesIn = stats["bytesIn"]; - var messageOut = stats["messagesOut"]; - var bytesOut = stats["bytesOut"]; - - if(thisObj.sampleTime) - { - var samplePeriod = sampleTime.getTime() - thisObj.sampleTime.getTime(); - - var msgInRate = (1000 * (messageIn - thisObj.messageIn)) / samplePeriod; - var msgOutRate = (1000 * (messageOut - thisObj.messageOut)) / samplePeriod; - var bytesInRate = (1000 * (bytesIn - thisObj.bytesIn)) / samplePeriod; - var bytesOutRate = (1000 * (bytesOut - thisObj.bytesOut)) / samplePeriod; - - thisObj.msgInRate.innerHTML = msgInRate.toFixed(0); - var bytesInFormat = formatter.formatBytes( bytesInRate ); - thisObj.bytesInRate.innerHTML = "(" + bytesInFormat.value; - thisObj.bytesInRateUnits.innerHTML = bytesInFormat.units + "/s)"; - - thisObj.msgOutRate.innerHTML = msgOutRate.toFixed(0); - var bytesOutFormat = formatter.formatBytes( bytesOutRate ); - thisObj.bytesOutRate.innerHTML = "(" + bytesOutFormat.value; - thisObj.bytesOutRateUnits.innerHTML = bytesOutFormat.units + "/s)"; - - if(connections && thisObj.connections) - { - for(var i=0; i < connections.length; i++) - { - var connection = connections[i]; - for(var j = 0; j < thisObj.connections.length; j++) - { - var oldConnection = thisObj.connections[j]; - if(oldConnection.id == connection.id) - { - msgOutRate = (1000 * (connection.messagesOut - oldConnection.messagesOut)) / - samplePeriod; - connection.msgOutRate = msgOutRate.toFixed(0) + "msg/s"; - - bytesOutRate = (1000 * (connection.bytesOut - oldConnection.bytesOut)) / - samplePeriod; - var bytesOutRateFormat = formatter.formatBytes( bytesOutRate ); - connection.bytesOutRate = bytesOutRateFormat.value + bytesOutRateFormat.units + "/s"; - - - msgInRate = (1000 * (connection.messagesIn - oldConnection.messagesIn)) / - samplePeriod; - connection.msgInRate = msgInRate.toFixed(0) + "msg/s"; - - bytesInRate = (1000 * (connection.bytesIn - oldConnection.bytesIn)) / - samplePeriod; - var bytesInRateFormat = formatter.formatBytes( bytesInRate ); - connection.bytesInRate = bytesInRateFormat.value + bytesInRateFormat.units + "/s"; - } - - - } - - } - } - } - - thisObj.sampleTime = sampleTime; - thisObj.messageIn = messageIn; - thisObj.bytesIn = bytesIn; - thisObj.messageOut = messageOut; - thisObj.bytesOut = bytesOut; - thisObj.connections = connections; - - this._updateGrids(thisObj.vhostData) - - if (thisObj.details) - { - thisObj.details.update(thisObj.vhostData); - } - else - { - require(["qpid/management/virtualhost/" + thisObj.vhostData.type.toLowerCase() + "/show"], - function(VirtualHostDetails) - { - thisObj.details = new VirtualHostDetails({containerNode:thisObj.virtualHostDetailsContainer, parent: thisObj}); - thisObj.details.update(thisObj.vhostData); - } - ); - } - - }; - - Updater.prototype._updateGrids = function(data) - { - this.virtualHostChildren.style.display = data.state == "ACTIVE" ? "block" : "none"; - if (data.state == "ACTIVE" ) - { - util.updateUpdatableStore(this.queuesGrid, data.queues); - util.updateUpdatableStore(this.exchangesGrid, data.exchanges); - - var exchangesGrid = this.exchangesGrid.grid; - for(var i=0; i< data.exchanges.length; i++) - { - var item = exchangesGrid.getItem(i); - var isStandard = item && item.name && util.isReservedExchangeName(item.name); - exchangesGrid.rowSelectCell.setDisabled(i, isStandard); - } - this.virtualHostConnections.style.display = data.connections ? "block" : "none"; - util.updateUpdatableStore(this.connectionsGrid, data.connections); - } - }; - - - return VirtualHost; - }); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/VirtualHostNode.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/VirtualHostNode.js deleted file mode 100644 index 837ff04c78..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/VirtualHostNode.js +++ /dev/null @@ -1,220 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define(["dojo/_base/xhr", - "dojo/parser", - "dojo/query", - "dojo/_base/connect", - "dijit/registry", - "dojox/html/entities", - "qpid/common/properties", - "qpid/common/updater", - "qpid/common/util", - "qpid/common/formatter", - "qpid/common/UpdatableStore", - "qpid/management/addQueue", - "qpid/management/addExchange", - "qpid/management/editVirtualHostNode", - "dojox/grid/EnhancedGrid", - "dojo/domReady!"], - function (xhr, parser, query, connect, registry, entities, properties, updater, util, formatter, UpdatableStore, addQueue, addExchange, editVirtualHostNode, EnhancedGrid) { - - function VirtualHostNode(name, parent, controller) - { - this.name = name; - this.controller = controller; - this.modelObj = { type: "virtualhostnode", name: name, parent: parent}; - } - - VirtualHostNode.prototype.getTitle = function() - { - return "VirtualHostNode: " + this.name; - }; - - VirtualHostNode.prototype.open = function(contentPane) - { - var that = this; - this.contentPane = contentPane; - xhr.get({url: "showVirtualHostNode.html", - sync: true, - load: function(data) { - contentPane.containerNode.innerHTML = data; - parser.parse(contentPane.containerNode).then(function(instances) - { - that.onOpen(contentPane.containerNode) - }); - }}); - - }; - - VirtualHostNode.prototype.onOpen = function(containerNode) - { - var that = this; - this.stopNodeButton = registry.byNode(query(".stopNodeButton", containerNode)[0]); - this.startNodeButton = registry.byNode(query(".startNodeButton", containerNode)[0]); - this.editNodeButton = registry.byNode(query(".editNodeButton", containerNode)[0]); - this.deleteNodeButton = registry.byNode(query(".deleteNodeButton", containerNode)[0]); - this.virtualHostGridPanel = registry.byNode(query(".virtualHostGridPanel", containerNode)[0]); - this.deleteNodeButton.on("click", - function(e) - { - if (confirm("Deletion of virtual host node will delete both configuration and message data.\n\n" - + "Are you sure you want to delete virtual host node '" + entities.encode(String(that.name)) + "'?")) - { - if (util.sendRequest("api/latest/virtualhostnode/" + encodeURIComponent( that.name) , "DELETE")) - { - that.destroy(); - } - } - } - ); - this.startNodeButton.on("click", - function(event) - { - that.startNodeButton.set("disabled", true); - util.sendRequest("api/latest/virtualhostnode/" + encodeURIComponent(that.name), - "PUT", {desiredState: "ACTIVE"}); - }); - - this.stopNodeButton.on("click", - function(event) - { - if (confirm("Stopping the node will also shutdown the virtual host. " - + "Are you sure you want to stop virtual host node '" - + entities.encode(String(that.name)) +"'?")) - { - that.stopNodeButton.set("disabled", true); - util.sendRequest("api/latest/virtualhostnode/" + encodeURIComponent(that.name), - "PUT", {desiredState: "STOPPED"}); - } - }); - - this.editNodeButton.on("click", - function(event) - { - editVirtualHostNode.show(that.vhostNodeUpdater.nodeData); - } - ); - - this.vhostsGrid = new UpdatableStore([], query(".virtualHost", containerNode)[0], - [ - { name: "Name", field: "name", width: "40%"}, - { name: "State", field: "state", width: "30%"}, - { name: "Type", field: "type", width: "30%"} - ], function(obj) { - connect.connect(obj.grid, "onRowDblClick", obj.grid, - function(evt){ - var idx = evt.rowIndex, - theItem = this.getItem(idx); - that.showVirtualHost(theItem); - }); - }, {height: 200, canSort : function(col) {return false;} }, EnhancedGrid); - - this.vhostNodeUpdater = new Updater(containerNode, this.modelObj, this); - this.vhostNodeUpdater.update(); - - updater.add( this.vhostNodeUpdater ); - } - - VirtualHostNode.prototype.showVirtualHost=function(item) - { - this.controller.show("virtualhost", item.name, this.modelObj, item.id); - } - - VirtualHostNode.prototype.close = function() - { - updater.remove( this.vhostNodeUpdater ); - }; - - VirtualHostNode.prototype.destroy = function() - { - this.close(); - this.contentPane.onClose() - this.controller.tabContainer.removeChild(this.contentPane); - this.contentPane.destroyRecursive(); - } - - function Updater(domNode, nodeObject, virtualHostNode) - { - this.virtualHostNode = virtualHostNode; - var that = this; - - function findNode(name) - { - return query("." + name, domNode)[0]; - } - - function storeNodes(names) - { - for(var i = 0; i < names.length; i++) - { - that[names[i]] = findNode(names[i]); - } - } - - storeNodes(["name", "state", "type"]); - this.detailsDiv = findNode("virtualhostnodedetails"); - - this.query = "api/latest/virtualhostnode/" + encodeURIComponent(nodeObject.name); - } - - Updater.prototype.update = function() - { - var that = this; - xhr.get({url: this.query, sync: properties.useSyncGet, handleAs: "json"}).then( - function(data) - { - that.nodeData = data[0]; - that.updateUI(data[0]); - } - ); - }; - - Updater.prototype.updateUI = function(data) - { - this.virtualHostNode.startNodeButton.set("disabled", !(data.state == "STOPPED" || data.state == "ERRORED")); - this.virtualHostNode.stopNodeButton.set("disabled", data.state != "ACTIVE"); - - this.name.innerHTML = entities.encode(String(data[ "name" ])); - this.state.innerHTML = entities.encode(String(data[ "state" ])); - this.type.innerHTML = entities.encode(String(data[ "type" ])); - if (!this.details) - { - var that = this; - require(["qpid/management/virtualhostnode/" + data.type.toLowerCase() + "/show"], - function(VirtualHostNodeDetails) - { - that.details = new VirtualHostNodeDetails({containerNode:that.detailsDiv, parent: that.virtualHostNode}); - that.details.update(data); - } - ); - } - else - { - this.details.update(data); - } - - - this.virtualHostNode.virtualHostGridPanel.domNode.style.display = data.virtualhosts? "block" : "none"; - util.updateUpdatableStore(this.virtualHostNode.vhostsGrid, data.virtualhosts); - } - - return VirtualHostNode; - }); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/accesscontrolprovider/AclFile.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/accesscontrolprovider/AclFile.js deleted file mode 100644 index e8250217c6..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/accesscontrolprovider/AclFile.js +++ /dev/null @@ -1,96 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define(["dojo/_base/xhr", - "dojo/dom", - "dojo/parser", - "dojo/query", - "dojo/dom-construct", - "dojo/_base/connect", - "dojo/_base/window", - "dojo/_base/event", - "dojo/_base/json", - "dijit/registry", - "dojox/html/entities", - "qpid/common/util", - "qpid/common/properties", - "qpid/common/updater", - "qpid/common/UpdatableStore", - "dojox/grid/EnhancedGrid", - "dojox/grid/enhanced/plugins/Pagination", - "dojox/grid/enhanced/plugins/IndirectSelection", - "dojox/validate/us", "dojox/validate/web", - "dijit/Dialog", - "dijit/form/TextBox", - "dijit/form/ValidationTextBox", - "dijit/form/TimeTextBox", "dijit/form/Button", - "dijit/form/Form", - "dijit/form/DateTextBox", - "dojo/domReady!"], - function (xhr, dom, parser, query, construct, connect, win, event, json, registry, entities, util, properties, updater, UpdatableStore, EnhancedGrid) { - function AclFile(containerNode, aclProviderObj, controller) { - var node = construct.create("div", null, containerNode, "last"); - var that = this; - this.name = aclProviderObj.name; - xhr.get({url: "accesscontrolprovider/showAclFile.html", - sync: true, - load: function(data) { - node.innerHTML = data; - parser.parse(node).then(function(instances) - { - that.groupDatabaseUpdater= new AclFileUpdater(node, aclProviderObj, controller); - - updater.add( that.groupDatabaseUpdater); - - that.groupDatabaseUpdater.update(); - }); - - }}); - } - - AclFile.prototype.close = function() { - updater.remove( this.groupDatabaseUpdater ); - }; - - function AclFileUpdater(node, aclProviderObj, controller) - { - this.controller = controller; - this.query = "api/latest/accesscontrolprovider/"+encodeURIComponent(aclProviderObj.name); - this.name = aclProviderObj.name; - this.path = query(".path", node)[0]; - } - - AclFileUpdater.prototype.update = function() - { - var that = this; - - xhr.get({url: this.query, sync: properties.useSyncGet, handleAs: "json"}) - .then(function(data) { - if (data[0]) - { - that.aclProviderData = data[0]; - that.path.innerHTML = entities.encode(String(that.aclProviderData.path)); - } - }); - - }; - - return AclFile; - }); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/accesscontrolprovider/aclfile/add.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/accesscontrolprovider/aclfile/add.js deleted file mode 100644 index 2c25149091..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/accesscontrolprovider/aclfile/add.js +++ /dev/null @@ -1,125 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define(["dojo/dom","dojo/query","dijit/registry","qpid/common/util"], - function (dom, query, registry, util) - { - var addACLFileAccessControlProvider = - { - init: function() - { - // Readers are HTML5 - this.reader = window.FileReader ? new FileReader() : undefined; - }, - show: function(data) - { - var that=this; - util.parseHtmlIntoDiv(data.containerNode, "accesscontrolprovider/aclfile/add.html", function(){that._postParse(data);}); - }, - _postParse: function(data) - { - var that=this; - this.aclServerPath = registry.byId("addAccessControlProvider.serverPath"); - this.aclUploadFields = dom.byId("addAccessControlProvider.uploadFields"); - this.aclSelectedFileContainer = dom.byId("addAccessControlProvider.selectedFile"); - this.aclSelectedFileStatusContainer = dom.byId("addAccessControlProvider.selectedFileStatus"); - this.aclFile = registry.byId("addAccessControlProvider.file"); - this.aclFileClearButton = registry.byId("addAccessControlProvider.fileClearButton"); - this.aclFileOldBrowserWarning = dom.byId("addAccessControlProvider.oldBrowserWarning"); - - //Only submitted field - this.aclPath = registry.byId("addAccessControlProvider.path"); - - this.addButton = data.parent.addButton; - - if (this.reader) - { - this.reader.onload = function(evt) {that._aclUploadFileComplete(evt);}; - this.reader.onerror = function(ex) {console.error("Failed to load ACL file", ex);}; - this.aclFile.on("change", function(selected){that._aclFileChanged(selected)}); - this.aclFileClearButton.on("click", function(event){that._aclFileClearButtonClicked(event)}); - } - else - { - // Fall back for IE8/9 which do not support FileReader - this.aclUploadFields.style.display = "none"; - this.aclFileOldBrowserWarning.innerHTML = "File upload requires a more recent browser with HTML5 support"; - this.aclFileOldBrowserWarning.className = this.aclFileOldBrowserWarning.className.replace("hidden", ""); - } - - this.aclServerPath.on("blur", function(){that._aclServerPathChanged()}); - }, - _aclFileChanged: function (evt) - { - // We only ever expect a single file - var file = this.aclFile.domNode.children[0].files[0]; - - this.addButton.setDisabled(true); - this.aclSelectedFileContainer.innerHTML = file.name; - this.aclSelectedFileStatusContainer.className = "loadingIcon"; - - console.log("Beginning to read ACL file " + file.name); - this.reader.readAsDataURL(file); - }, - _aclUploadFileComplete: function(evt) - { - var reader = evt.target; - var result = reader.result; - console.log("ACL file read complete, contents " + result); - this.addButton.setDisabled(false); - this.aclSelectedFileStatusContainer.className = "loadedIcon"; - - this.aclServerPath.set("value", ""); - this.aclServerPath.setDisabled(true); - this.aclServerPath.set("required", false); - - this.aclFileClearButton.setDisabled(false); - - this.aclPath.set("value", result); - }, - _aclFileClearButtonClicked: function(event) - { - this.aclFile.reset(); - this.aclSelectedFileStatusContainer.className = ""; - this.aclSelectedFileContainer.innerHTML = ""; - this.aclServerPath.set("required", true); - this.aclServerPath.setDisabled(false); - this.aclFileClearButton.setDisabled(true); - - this.aclPath.set("value", ""); - }, - _aclServerPathChanged: function() - { - var serverPathValue = this.aclServerPath.get("value"); - this.aclPath.set("value", serverPathValue); - } - }; - - try - { - addACLFileAccessControlProvider.init(); - } - catch(e) - { - console.warn(e); - } - return addACLFileAccessControlProvider; - } -); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addAccessControlProvider.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addAccessControlProvider.js deleted file mode 100644 index d961a31e52..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addAccessControlProvider.js +++ /dev/null @@ -1,149 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define(["dojo/_base/lang", - "dojo/_base/xhr", - "dojo/dom", - "dojo/dom-construct", - "dijit/registry", - "dojo/parser", - "dojo/_base/array", - "dojo/_base/event", - 'dojo/json', - "qpid/common/util", - "qpid/common/metadata", - "dojo/text!addAccessControlProvider.html", - "dojo/store/Memory", - "dojox/validate/us", - "dojox/validate/web", - "dijit/Dialog", - "dijit/form/CheckBox", - "dijit/form/Textarea", - "dijit/form/ComboBox", - "dijit/form/TextBox", - "dijit/form/ValidationTextBox", - "dijit/form/Button", - "dijit/form/Form", - "dijit/layout/ContentPane", - "dojox/layout/TableContainer", - "dojo/domReady!"], - function (lang, xhr, dom, construct, registry, parser, array, event, json, util, metadata, template) - { - - var addAccessControlProvider = - { - init: function() - { - var that=this; - this.containerNode = construct.create("div", {innerHTML: template}); - parser.parse(this.containerNode).then(function(instances){ that._postParse(); }); - }, - _postParse: function() - { - var that=this; - this.accessControlProviderName = registry.byId("addAccessControlProvider.name"); - this.accessControlProviderName.set("regExpGen", util.nameOrContextVarRegexp); - - this.dialog = registry.byId("addAccessControlProvider"); - this.addButton = registry.byId("addAccessControlProvider.addButton"); - this.cancelButton = registry.byId("addAccessControlProvider.cancelButton"); - this.cancelButton.on("click", function(e){that._cancel(e);}); - this.addButton.on("click", function(e){that._add(e);}); - - this.accessControlProviderTypeFieldsContainer = dom.byId("addAccessControlProvider.typeFields"); - this.accessControlProviderForm = registry.byId("addAccessControlProvider.form"); - this.accessControlProviderType = registry.byId("addAccessControlProvider.type"); - this.supportedAccessControlProviderTypes = metadata.getTypesForCategory("AccessControlProvider"); - this.supportedAccessControlProviderTypes.sort(); - var accessControlProviderTypeStore = util.makeTypeStore(this.supportedAccessControlProviderTypes); - this.accessControlProviderType.set("store", accessControlProviderTypeStore); - this.accessControlProviderType.on("change", function(type){that._accessControlProviderTypeChanged(type);}); - }, - show: function(effectiveData) - { - this.accessControlProviderForm.reset(); - this.dialog.show(); - }, - _cancel: function(e) - { - event.stop(e); - if (this.reader) - { - this.reader.abort(); - } - this.dialog.hide(); - }, - _add: function(e) - { - event.stop(e); - this._submit(); - }, - _submit: function() - { - if (this.accessControlProviderForm.validate()) - { - var accessControlProviderData = util.getFormWidgetValues(this.accessControlProviderForm, this.initialData); - var that = this; - util.post("api/latest/accesscontrolprovider", accessControlProviderData, function(x){that.dialog.hide();}); - } - else - { - alert('Form contains invalid data. Please correct first'); - } - }, - _accessControlProviderTypeChanged: function(type) - { - this._typeChanged(type, this.accessControlProviderTypeFieldsContainer, "qpid/management/accesscontrolprovider/", "AccessControlProvider" ); - }, - _typeChanged: function(type, typeFieldsContainer, baseUrl, category ) - { - var widgets = registry.findWidgets(typeFieldsContainer); - array.forEach(widgets, function(item) { item.destroyRecursive();}); - construct.empty(typeFieldsContainer); - - if (type) - { - var that = this; - require([ baseUrl + type.toLowerCase() + "/add"], function(typeUI) - { - try - { - typeUI.show({containerNode:typeFieldsContainer, parent: that, data: that.initialData, effectiveData: that.effectiveData}); - util.applyMetadataToWidgets(typeFieldsContainer, category, type); - } - catch(e) - { - console.warn(e); - } - }); - } - } - }; - - try - { - addAccessControlProvider.init(); - } - catch(e) - { - console.warn(e); - } - return addAccessControlProvider; - }); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addAuthenticationProvider.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addAuthenticationProvider.js deleted file mode 100644 index 3d85239789..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addAuthenticationProvider.js +++ /dev/null @@ -1,221 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define(["dojo/_base/xhr", - "dojo/dom", - "dojo/dom-construct", - "dojo/_base/window", - "dijit/registry", - "dojo/parser", - "dojo/_base/array", - "dojo/_base/event", - 'dojo/json', - "dojo/store/Memory", - "dijit/form/FilteringSelect", - "dojo/_base/connect", - "dojo/dom-style", - "qpid/common/util", - "qpid/common/metadata", - "dojo/text!addAuthenticationProvider.html", - "qpid/management/preferencesprovider/PreferencesProviderForm", - /* dojox/ validate resources */ - "dojox/validate/us", "dojox/validate/web", - /* basic dijit classes */ - "dijit/Dialog", - "dijit/form/CheckBox", "dijit/form/Textarea", - "dijit/form/TextBox", - "dijit/form/ValidationTextBox", - "dijit/form/Button", - "dijit/form/Form", - /* basic dojox classes */ - "dojox/form/BusyButton", "dojox/form/CheckedMultiSelect", - "dojox/layout/TableContainer", - "dojo/domReady!"], - function (xhr, dom, construct, win, registry, parser, array, event, json, Memory, FilteringSelect, connect, domStyle, util, metadata, template) - { - var addAuthenticationProvider = - { - init:function() - { - var that=this; - this.containerNode = construct.create("div", {innerHTML: template}); - parser.parse(this.containerNode).then(function(instances) { that._postParse(); }); - }, - _postParse: function() - { - var that = this; - this.authenticationProviderName = registry.byId("addAuthenticationProvider.name"); - this.authenticationProviderName.set("regExpGen", util.nameOrContextVarRegexp); - this.authenticationProviderName.on("change", function(newValue){that.preferencesProviderForm.preferencesProviderNameWidget.set("value",newValue);}); - - this.dialog = registry.byId("addAuthenticationProvider"); - this.addButton = registry.byId("addAuthenticationProvider.addButton"); - this.cancelButton = registry.byId("addAuthenticationProvider.cancelButton"); - this.cancelButton.on("click", function(e){that._cancel(e);}); - this.addButton.on("click", function(e){that._add(e);}); - - this.authenticationProviderTypeFieldsContainer = dom.byId("addAuthenticationProvider.typeFields"); - this.authenticationProviderForm = registry.byId("addAuthenticationProvider.form"); - this.authenticationProviderType = registry.byId("addAuthenticationProvider.type"); - this.supportedAuthenticationProviderTypes = metadata.getTypesForCategory("AuthenticationProvider"); - this.supportedAuthenticationProviderTypes.sort(); - var authenticationProviderTypeStore = util.makeTypeStore(this.supportedAuthenticationProviderTypes); - this.authenticationProviderType.set("store", authenticationProviderTypeStore); - this.authenticationProviderType.on("change", function(type){that._authenticationProviderTypeChanged(type);}); - - this.preferencesProviderForm = new qpid.preferencesprovider.PreferencesProviderForm({disabled: true}); - this.preferencesProviderForm.placeAt(dom.byId("addPreferencesProvider.form")); - }, - show:function(effectiveData) - { - this.authenticationProviderForm.reset(); - - if (effectiveData) - { - // editing - var actualData = null; - xhr.get( - { - url: "api/latest/authenticationprovider/" + encodeURIComponent(effectiveData.name), - sync: true, - content: { actuals: true }, - handleAs: "json", - load: function(data) - { - actualData = data[0]; - } - } - ); - this.initialData = actualData; - this.effectiveData = effectiveData; - this.authenticationProviderType.set("value", actualData.type); - - this.authenticationProviderType.set("disabled", true); - this.authenticationProviderName.set("disabled", true); - if (actualData.preferencesproviders && actualData.preferencesproviders[0]) - { - this.preferencesProviderForm.setData(actualData.preferencesproviders[0]); - } - else - { - this.preferencesProviderForm.reset(); - this.preferencesProviderForm.preferencesProviderNameWidget.set("value", actualData.name); - } - this.authenticationProviderName.set("value", actualData.name); - } - else - { - this.preferencesProviderForm.reset(); - this.authenticationProviderType.set("disabled", false); - this.authenticationProviderName.set("disabled", false); - this.initialData = {}; - this.effectiveData = {}; - } - - this.dialog.show(); - if (!this.resizeEventRegistered) - { - this.resizeEventRegistered = true; - util.resizeContentAreaAndRepositionDialog(dom.byId("addAuthenticationProvider.contentPane"), this.dialog); - } - }, - _cancel: function(e) - { - event.stop(e); - this.dialog.hide(); - }, - _add: function(e) - { - event.stop(e); - this._submit(); - }, - _submit: function() - { - if(this.authenticationProviderForm.validate() && this.preferencesProviderForm.validate()) - { - var authenticationProviderData = util.getFormWidgetValues(this.authenticationProviderForm, this.initialData); - - var that = this; - var encodedAuthenticationProviderName = encodeURIComponent(this.authenticationProviderName.value); - var url = "api/latest/authenticationprovider"; - if (this.initialData && this.initialData.id) - { - // update request - url += "/" + encodedAuthenticationProviderName; - } - util.post(url, authenticationProviderData, - function(x){ - var preferencesProviderResult = that.preferencesProviderForm.submit(encodedAuthenticationProviderName); - if (preferencesProviderResult.success == true) - { - that.dialog.hide(); - } - else - { - util.xhrErrorHandler(preferencesProviderResult.failureReason); - } - }); - } - else - { - alert('Form contains invalid data. Please correct first'); - } - }, - _authenticationProviderTypeChanged: function(type) - { - this._typeChanged(type, this.authenticationProviderTypeFieldsContainer, "qpid/management/authenticationprovider/", "AuthenticationProvider" ); - }, - _typeChanged: function(type, typeFieldsContainer, baseUrl, category ) - { - var widgets = registry.findWidgets(typeFieldsContainer); - array.forEach(widgets, function(item) { item.destroyRecursive();}); - construct.empty(typeFieldsContainer); - this.preferencesProviderForm.set("disabled", !type || !util.supportsPreferencesProvider(type)); - if (type) - { - var that = this; - require([ baseUrl + type.toLowerCase() + "/add"], function(typeUI) - { - try - { - typeUI.show({containerNode:typeFieldsContainer, parent: that, data: that.initialData, effectiveData: that.effectiveData}); - util.applyMetadataToWidgets(typeFieldsContainer, category, type); - } - catch(e) - { - console.warn(e); - } - }); - } - } - }; - - try - { - addAuthenticationProvider.init(); - } - catch(e) - { - console.warn(e); - } - return addAuthenticationProvider; - } - -); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addBinding.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addBinding.js deleted file mode 100644 index 253861b5c5..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addBinding.js +++ /dev/null @@ -1,423 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -define(["dojo/_base/connect", - "dojo/_base/xhr", - "dojo/dom", - "dojo/dom-construct", - "dojo/_base/window", - "dijit/registry", - "dojo/parser", - "dojo/_base/array", - "dojo/_base/event", - 'dojo/_base/json', - "dojo/_base/lang", - "dojo/_base/declare", - "dojo/store/Memory", - "dijit/form/FilteringSelect", - "qpid/common/util", - "dijit/form/NumberSpinner", // required by the form - /* dojox/ validate resources */ - "dojox/validate/us", "dojox/validate/web", - /* basic dijit classes */ - "dijit/Dialog", - "dijit/form/CheckBox", "dijit/form/Textarea", - "dijit/form/FilteringSelect", "dijit/form/TextBox", - "dijit/form/ValidationTextBox", "dijit/form/DateTextBox", - "dijit/form/TimeTextBox", "dijit/form/Button", - "dijit/form/RadioButton", "dijit/form/Form", - "dijit/form/DateTextBox", - /* basic dojox classes */ - "dojox/form/BusyButton", "dojox/form/CheckedMultiSelect", - "dojox/grid/EnhancedGrid", - "dojo/data/ObjectStore", - "dojo/domReady!"], - function (connect, xhr, dom, construct, win, registry, parser, array, event, json, lang, declare, Memory, FilteringSelect, util) { - - var noLocalValues = new Memory({ - data: [ - {name:"true", id:true}, - {name:"false", id:false} - ] - }); - - var xMatchValues = new Memory({ - data: [ - {name:"all", id:"all"}, - {name:"any", id:"any"} - ] - }); - - var defaultBindingArguments = [ - {id: 0, name:"x-filter-jms-selector", value: null}, - {id: 1, name:"x-qpid-no-local", value: null} - ]; - - var GridWidgetProxy = declare("qpid.dojox.grid.cells.GridWidgetProxy", dojox.grid.cells._Widget, { - createWidget: function(inNode, inDatum, inRowIndex) - { - var WidgetClass = this.widgetClass; - var widgetProperties = this.getWidgetProps(inDatum); - var getWidgetProperties = widgetProperties.getWidgetProperties; - if (typeof getWidgetProperties == "function") - { - var item = this.grid.getItem(inRowIndex); - if (item) - { - var additionalWidgetProperties = getWidgetProperties(inDatum, inRowIndex, item); - if (additionalWidgetProperties) - { - WidgetClass = additionalWidgetProperties.widgetClass; - for(var prop in additionalWidgetProperties) - { - if(additionalWidgetProperties.hasOwnProperty(prop) && !widgetProperties[prop]) - { - widgetProperties[prop] = additionalWidgetProperties[ prop ]; - } - } - } - } - } - var widget = new WidgetClass(widgetProperties, inNode); - return widget; - }, - getValue: function(inRowIndex) - { - if (this.widget) - { - return this.widget.get('value'); - } - return null; - }, - _finish: function(inRowIndex) - { - if (this.widget) - { - this.inherited(arguments); - this.widget.destroyRecursive(); - this.widget = null; - } - } - }); - - var addBinding = {}; - - var node = construct.create("div", null, win.body(), "last"); - - var convertToBinding = function convertToBinding(formValues) - { - var newBinding = {}; - - newBinding.name = formValues.name; - for(var propName in formValues) - { - if(formValues.hasOwnProperty(propName)) - { - if(propName === "durable") - { - if (formValues.durable[0] && formValues.durable[0] == "durable") { - newBinding.durable = true; - } - } else { - if(formValues[ propName ] !== "") { - newBinding[ propName ] = formValues[propName]; - } - } - - } - } - if(addBinding.queue) { - newBinding.queue = addBinding.queue; - } - if(addBinding.exchange) { - newBinding.exchange = addBinding.exchange; - } - - addBinding.bindingArgumentsGrid.store.fetch({ - onComplete:function(items,request) - { - if(items.length) - { - array.forEach(items, function(item) - { - if (item && item.name && item.value) - { - var bindingArguments = newBinding.arguments; - if (!bindingArguments) - { - bindingArguments = {}; - newBinding.arguments = bindingArguments; - } - bindingArguments[item.name]=item.value; - } - }); - } - } - }); - return newBinding; - }; - - - xhr.get({url: "addBinding.html", - sync: true, - load: function(data) { - var theForm; - node.innerHTML = data; - addBinding.dialogNode = dom.byId("addBinding"); - parser.instantiate([addBinding.dialogNode]); - - theForm = registry.byId("formAddBinding"); - array.forEach(theForm.getDescendants(), function(widget) - { - if(widget.name === "type") { - widget.on("change", function(isChecked) { - - var obj = registry.byId(widget.id + ":fields"); - if(obj) { - if(isChecked) { - obj.domNode.style.display = "block"; - obj.resize(); - } else { - obj.domNode.style.display = "none"; - obj.resize(); - } - } - }) - } - - }); - - var argumentsGridNode = dom.byId("formAddbinding.bindingArguments"); - var objectStore = new dojo.data.ObjectStore({objectStore: new Memory({data:lang.clone(defaultBindingArguments), idProperty: "id"})}); - - var layout = [[ - { name: "Argument Name", field: "name", width: "50%", editable: true }, - { name: 'Argument Value', field: 'value', width: '50%', editable: true, type: GridWidgetProxy, - widgetProps: { - getWidgetProperties: function(inDatum, inRowIndex, item) - { - if (item.name == "x-qpid-no-local") - { - return { - labelAttr: "name", - searchAttr: "id", - selectOnClick: false, - query: { id: "*"}, - required: false, - store: noLocalValues, - widgetClass: dijit.form.FilteringSelect - }; - } - else if (item.name && item.name.toLowerCase() == "x-match") - { - return { - labelAttr: "name", - searchAttr: "id", - selectOnClick: false, - query: { id: "*"}, - required: false, - store: xMatchValues, - widgetClass: dijit.form.FilteringSelect - }; - } - return {widgetClass: dijit.form.TextBox }; - } - } - } - ]]; - - var grid = new dojox.grid.EnhancedGrid({ - selectionMode: "multiple", - store: objectStore, - singleClickEdit: true, - structure: layout, - autoHeight: true, - plugins: {indirectSelection: true} - }, argumentsGridNode); - grid.startup(); - - addBinding.bindingArgumentsGrid = grid; - addBinding.idGenerator = 1; - var addArgumentButton = registry.byId("formAddbinding.addArgumentButton"); - var deleteArgumentButton = registry.byId("formAddbinding.deleteArgumentButton"); - - var toggleGridButtons = function(index) - { - var data = grid.selection.getSelected(); - deleteArgumentButton.set("disabled", !data || data.length==0); - }; - connect.connect(grid.selection, 'onSelected', toggleGridButtons); - connect.connect(grid.selection, 'onDeselected', toggleGridButtons); - deleteArgumentButton.set("disabled", true); - - addArgumentButton.on("click", - function(event) - { - addBinding.idGenerator = addBinding.idGenerator + 1; - var newItem = {id:addBinding.idGenerator, name: "", value: ""}; - grid.store.newItem(newItem); - grid.store.save(); - grid.store.fetch( - { - onComplete:function(items,request) - { - var rowIndex = items.length - 1; - window.setTimeout(function() - { - grid.focus.setFocusIndex(rowIndex, 1 ); - },10); - } - }); - } - ); - - deleteArgumentButton.on("click", - function(event) - { - var data = grid.selection.getSelected(); - if(data.length) - { - array.forEach(data, function(selectedItem) { - if (selectedItem !== null) - { - grid.store.deleteItem(selectedItem); - } - }); - grid.store.save(); - } - } - ); - - theForm.on("submit", function(e) { - - event.stop(e); - if(theForm.validate()){ - - var newBinding = convertToBinding(theForm.getValues()); - var that = this; - var url = "api/latest/binding/"+encodeURIComponent(addBinding.vhostnode) - + "/"+encodeURIComponent(addBinding.vhost) - + "/"+encodeURIComponent(newBinding.exchange) - + "/"+encodeURIComponent(newBinding.queue); - util.post(url, newBinding, function(x){registry.byId("addBinding").hide();}); - return false; - }else{ - alert('Form contains invalid data. Please correct first'); - return false; - } - - }); - }}); - - addBinding.show = function(obj) { - var that = this; - - addBinding.vhostnode = obj.virtualhostnode; - addBinding.vhost = obj.virtualhost; - addBinding.queue = obj.queue; - addBinding.exchange = obj.exchange; - registry.byId("formAddBinding").reset(); - - var grid = addBinding.bindingArgumentsGrid; - grid.store.fetch({ - onComplete:function(items,request) - { - if(items.length) - { - array.forEach(items, function(item) - { - if (item !== null) - { - grid.store.deleteItem(item); - } - }); - } - } - }); - array.forEach(lang.clone(defaultBindingArguments), function(item) {grid.store.newItem(item); }); - grid.store.save(); - - xhr.get({url: "api/latest/queue/" + encodeURIComponent(obj.virtualhostnode) + "/" + encodeURIComponent(obj.virtualhost) + "?depth=0", - handleAs: "json"}).then( - function(data) { - var queues = []; - for(var i=0; i < data.length; i++) { - queues[i] = {id: data[i].name, name: data[i].name}; - } - var queueStore = new Memory({ data: queues }); - - - if(that.queueChooser) { - that.queueChooser.destroy( false ); - } - var queueDiv = dom.byId("addBinding.selectQueueDiv"); - var input = construct.create("input", {id: "addBindingSelectQueue"}, queueDiv); - - that.queueChooser = new FilteringSelect({ id: "addBindingSelectQueue", - name: "queue", - store: queueStore, - searchAttr: "name", - promptMessage: "Name of the queue", - title: "Select the name of the queue"}, input); - - if(obj.queue) - { - that.queueChooser.set("value", obj.queue); - that.queueChooser.set("disabled", true); - } - - xhr.get({url: "api/latest/exchange/" + encodeURIComponent(obj.virtualhostnode) + "/" + encodeURIComponent(obj.virtualhost) + "?depth=0", - handleAs: "json"}).then( - function(data) { - - var exchanges = []; - for(var i=0; i < data.length; i++) { - exchanges[i] = {id: data[i].name, name: data[i].name}; - } - var exchangeStore = new Memory({ data: exchanges }); - - - if(that.exchangeChooser) { - that.exchangeChooser.destroy( false ); - } - var exchangeDiv = dom.byId("addBinding.selectExchangeDiv"); - var input = construct.create("input", {id: "addBindingSelectExchange"}, exchangeDiv); - - that.exchangeChooser = new FilteringSelect({ id: "addBindingSelectExchange", - name: "exchange", - store: exchangeStore, - searchAttr: "name", - promptMessage: "Name of the exchange", - title: "Select the name of the exchange"}, input); - - if(obj.exchange) - { - that.exchangeChooser.set("value", obj.exchange); - that.exchangeChooser.set("disabled", true); - } - - - registry.byId("addBinding").show(); - }); - - - }); - - - }; - - return addBinding; - }); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addExchange.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addExchange.js deleted file mode 100644 index 0385768889..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addExchange.js +++ /dev/null @@ -1,135 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define(["dojo/_base/xhr", - "dojo/dom", - "dojo/dom-construct", - "dojo/_base/window", - "dijit/registry", - "dojo/parser", - "dojo/_base/array", - "dojo/_base/event", - "dojo/_base/json", - "qpid/common/util", - "dijit/form/NumberSpinner", // required by the form - /* dojox/ validate resources */ - "dojox/validate/us", "dojox/validate/web", - /* basic dijit classes */ - "dijit/Dialog", - "dijit/form/CheckBox", "dijit/form/Textarea", - "dijit/form/FilteringSelect", "dijit/form/TextBox", - "dijit/form/ValidationTextBox", "dijit/form/DateTextBox", - "dijit/form/TimeTextBox", "dijit/form/Button", - "dijit/form/RadioButton", "dijit/form/Form", - "dijit/form/DateTextBox", - /* basic dojox classes */ - "dojox/form/BusyButton", "dojox/form/CheckedMultiSelect", - "dojo/domReady!"], - function (xhr, dom, construct, win, registry, parser, array, event, json, util) { - - var addExchange = {}; - - var node = construct.create("div", null, win.body(), "last"); - - var convertToExchange = function convertToExchange(formValues) - { - var newExchange = {}; - newExchange.name = formValues.name; - for(var propName in formValues) - { - if(formValues.hasOwnProperty(propName)) - { - if(propName === "durable") - { - if (formValues.durable[0] && formValues.durable[0] == "durable") { - newExchange.durable = true; - } - } else { - if(formValues[ propName ] !== "") { - newExchange[ propName ] = formValues[propName]; - } - } - - } - } - - return newExchange; - }; - - - xhr.get({url: "addExchange.html", - sync: true, - load: function(data) { - var theForm; - node.innerHTML = data; - addExchange.dialogNode = dom.byId("addExchange"); - parser.instantiate([addExchange.dialogNode]); - - theForm = registry.byId("formAddExchange"); - array.forEach(theForm.getDescendants(), function(widget) - { - if(widget.name === "type") { - widget.on("change", function(isChecked) { - - var obj = registry.byId(widget.id + ":fields"); - if(obj) { - if(isChecked) { - obj.domNode.style.display = "block"; - obj.resize(); - } else { - obj.domNode.style.display = "none"; - obj.resize(); - } - } - }) - } - - }); - - theForm.on("submit", function(e) { - - event.stop(e); - if(theForm.validate()){ - - var newExchange = convertToExchange(theForm.getValues()); - var that = this; - util.post("api/latest/exchange/" + encodeURIComponent(addExchange.vhostnode) - + "/" + encodeURIComponent(addExchange.vhost), - newExchange, function(x){ registry.byId("addExchange").hide(); }); - return false; - - - }else{ - alert('Form contains invalid data. Please correct first'); - return false; - } - - }); - }}); - - addExchange.show = function(data) { - addExchange.vhost = data.virtualhost; - addExchange.vhostnode = data.virtualhostnode; - registry.byId("formAddExchange").reset(); - registry.byId("addExchange").show(); - }; - - return addExchange; - });
\ No newline at end of file diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addGroupProvider.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addGroupProvider.js deleted file mode 100644 index b5491b4a6e..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addGroupProvider.js +++ /dev/null @@ -1,178 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define([ - "dojo/_base/xhr", - "dojo/dom", - "dojo/dom-construct", - "dijit/registry", - "dojo/parser", - "dojo/_base/array", - "dojo/_base/event", - 'dojo/json', - "qpid/common/util", - "qpid/common/metadata", - "dojo/text!addGroupProvider.html", - "dojo/store/Memory", - "dojox/validate/us", - "dojox/validate/web", - "dijit/Dialog", - "dijit/form/CheckBox", - "dijit/form/Textarea", - "dijit/form/ComboBox", - "dijit/form/TextBox", - "dijit/form/ValidationTextBox", - "dijit/form/Button", - "dijit/form/Form", - "dijit/layout/ContentPane", - "dojox/layout/TableContainer", - "dojo/domReady!"], - function (xhr, dom, construct, registry, parser, array, event, json, util, metadata, template) - { - - var addGroupProvider = - { - init: function() - { - var that=this; - this.containerNode = construct.create("div", {innerHTML: template}); - parser.parse(this.containerNode).then(function(instances) { that._postParse(); }); - }, - _postParse: function() - { - var that=this; - this.groupProviderName = registry.byId("addGroupProvider.name"); - this.groupProviderName.set("regExpGen", util.nameOrContextVarRegexp); - - this.dialog = registry.byId("addGroupProvider"); - this.addButton = registry.byId("addGroupProvider.addButton"); - this.cancelButton = registry.byId("addGroupProvider.cancelButton"); - this.cancelButton.on("click", function(e){that._cancel(e);}); - this.addButton.on("click", function(e){that._add(e);}); - - this.groupProviderTypeFieldsContainer = dom.byId("addGroupProvider.typeFields"); - this.groupProviderForm = registry.byId("addGroupProvider.form"); - - this.groupProviderType = registry.byId("addGroupProvider.type"); - this.groupProviderType.on("change", function(type){that._groupProviderTypeChanged(type);}); - - var supportedTypes = metadata.getTypesForCategory("GroupProvider"); - supportedTypes.sort(); - var supportedTypesStore = util.makeTypeStore(supportedTypes); - this.groupProviderType.set("store", supportedTypesStore); - }, - show: function(actualData) - { - this.initialData = actualData; - this.groupProviderForm.reset(); - - if (actualData) - { - this._destroyTypeFields(this.containerNode); - this._initFields(actualData); - } - this.groupProviderName.set("disabled", actualData == null ? false : true); - this.groupProviderType.set("disabled", actualData == null ? false : true); - this.dialog.set("title", actualData == null ? "Add Group Provider" : "Edit Group Provider - " + actualData.name) - this.dialog.show(); - }, - _initFields:function(data) - { - var type = data["type"]; - var attributes = metadata.getMetaData("GroupProvider", type).attributes; - for(var name in attributes) - { - var widget = registry.byId("addGroupProvider."+name); - if (widget) - { - widget.set("value", data[name]); - } - } - }, - _cancel: function(e) - { - event.stop(e); - this.dialog.hide(); - }, - _add: function(e) - { - event.stop(e); - this._submit(); - }, - _submit: function() - { - if (this.groupProviderForm.validate()) - { - var groupProviderData = util.getFormWidgetValues(this.groupProviderForm, this.initialData); - - var that = this; - var url = "api/latest/groupprovider"; - if (this.initialData) - { - // update request - url += "/" + encodeURIComponent(this.groupProviderName.value) - } - - util.post( url,groupProviderData, function(x){that.dialog.hide();}); - } - else - { - alert('Form contains invalid data. Please correct first'); - } - }, - _groupProviderTypeChanged: function(type) - { - this._destroyTypeFields(this.groupProviderTypeFieldsContainer); - if (type) - { - var that = this; - require([ "qpid/management/groupprovider/" + type.toLowerCase() + "/add"], function(typeUI) - { - try - { - typeUI.show({containerNode: that.groupProviderTypeFieldsContainer, parent: that, data: that.initialData}); - util.applyMetadataToWidgets(that.groupProviderTypeFieldsContainer, "GroupProvider", type); - } - catch(e) - { - console.warn(e); - } - }); - } - }, - _destroyTypeFields: function(typeFieldsContainer) - { - var widgets = registry.findWidgets(typeFieldsContainer); - array.forEach(widgets, function(item) { item.destroyRecursive();}); - construct.empty(typeFieldsContainer); - } - }; - - try - { - addGroupProvider.init(); - } - catch(e) - { - console.warn(e); - } - return addGroupProvider; - - });
\ No newline at end of file diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addPort.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addPort.js deleted file mode 100644 index aa3e43d604..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addPort.js +++ /dev/null @@ -1,476 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define(["dojo/_base/xhr", - "dojo/dom", - "dojo/dom-construct", - "dojo/_base/window", - "dijit/registry", - "dojo/_base/array", - "dojo/_base/event", - 'dojo/_base/json', - "dojo/store/Memory", - "dojo/data/ObjectStore", - "dijit/form/FilteringSelect", - "dojo/dom-style", - "dojo/_base/lang", - "qpid/common/util", - "qpid/common/metadata", - /* dojox/ validate resources */ - "dojox/validate/us", - "dojox/validate/web", - /* basic dijit classes */ - "dijit/Dialog", - "dijit/form/CheckBox", - "dijit/form/Textarea", - "dijit/form/TextBox", - "dijit/form/ValidationTextBox", - "dijit/form/DateTextBox", - "dijit/form/TimeTextBox", - "dijit/form/Button", - "dijit/form/RadioButton", - "dijit/form/Form", - "dijit/form/DateTextBox", - "dijit/form/MultiSelect", - "dijit/form/Select", - "dijit/form/NumberSpinner", - /* basic dojox classes */ - "dojox/grid/EnhancedGrid", - "dojox/grid/enhanced/plugins/IndirectSelection", - "dojo/domReady!"], - function (xhr, dom, construct, win, registry, array, event, json, Memory, ObjectStore, FilteringSelect, domStyle, lang, util, metadata) { - - var addPort = {}; - - var node = construct.create("div", null, win.body(), "last"); - - addPort._typeChanged = function (newValue) - { - var typeMetaData = metadata.getMetaData("Port", newValue); - - //protocols - var protocolsMultiSelect = dom.byId("formAddPort.protocols"); - var protocolValidValues = typeMetaData.attributes.protocols.validValues; - var protocolValues = metadata.extractUniqueListOfValues(protocolValidValues); - util.setMultiSelectOptions(protocolsMultiSelect, protocolValues.sort()); - - //authenticationProvider - registry.byId("formAddPort.authenticationProvider").set("disabled", ! ("authenticationProvider" in typeMetaData.attributes)); - dom.byId("formAddPort:fieldsAuthenticationProvider").style.display = "authenticationProvider" in typeMetaData.attributes ? "block" : "none"; - - //bindingAddress - registry.byId("formAddPort.bindingAddress").set("disabled", ! ("bindingAddress" in typeMetaData.attributes)); - dom.byId("formAddPort:fieldsBindingAddress").style.display = "bindingAddress" in typeMetaData.attributes ? "block" : "none"; - - //maxOpenConnections - registry.byId("formAddPort.maxOpenConnections").set("disabled", ! ("maxOpenConnections" in typeMetaData.attributes)); - dom.byId("formAddPort:maxOpenConnections").style.display = "maxOpenConnections" in typeMetaData.attributes ? "block" : "none"; - - //transports - var transportsMultiSelect = dom.byId("formAddPort.transports"); - var transportsValidValues = typeMetaData.attributes.transports.validValues; - var transportsValues = metadata.extractUniqueListOfValues(transportsValidValues); - util.setMultiSelectOptions(transportsMultiSelect, transportsValues.sort()); - - addPort._toggleSslWidgets(newValue, transportsMultiSelect.value); - util.applyMetadataToWidgets(registry.byId("addPort").domNode, "Port", newValue); - - }; - - addPort._isSecure = function(currentTransport) - { - return currentTransport == "SSL" || (lang.isArray(currentTransport) && array.indexOf(currentTransport, "SSL")>=0) - || currentTransport == "WSS" || (lang.isArray(currentTransport) && array.indexOf(currentTransport, "WSS")>=0); - } - - addPort._convertToPort = function(formValues) - { - var newPort = {}; - newPort.name = dijit.byId("formAddPort.name").value; - var id = dojo.byId("formAddPort.id").value; - if (id) - { - newPort.id = id; - } - for(var propName in formValues) - { - if(formValues.hasOwnProperty(propName) && formValues[propName]) - { - if (propName == "needClientAuth" || propName == "wantClientAuth") - { - continue; - } - else if (propName === "protocols") - { - var val = formValues[propName]; - - if(val === "" || (lang.isArray(val) && val.length == 0) ) - { - continue; - } - - if (!lang.isArray(val)) - { - val = [ val ]; - } - newPort[ propName ] = val; - } - else if (propName === "transports") - { - var val = formValues[propName]; - - if(val === "" || (lang.isArray(val) && val.length == 0) ) - { - continue; - } - - if (!lang.isArray(val)) - { - val = [ val ]; - } - newPort[ propName ] = val; - } - else if(formValues[ propName ] !== "") - { - newPort[ propName ] = formValues[propName]; - } - - } - } - - var type = dijit.byId("formAddPort.type").value; - if (type == "AMQP" || type == "HTTP") - { - var transportWidget = registry.byId("formAddPort.transports"); - var needClientAuth = dijit.byId("formAddPort.needClientAuth"); - var wantClientAuth = dijit.byId("formAddPort.wantClientAuth"); - var trustStoreWidget = dijit.byId("formAddPort.trustStores"); - - var initialTransport = transportWidget.initialValue; - var currentTransport = transportWidget.value; - if (addPort._isSecure(currentTransport)) - { - newPort.needClientAuth = needClientAuth.checked; - newPort.wantClientAuth = wantClientAuth.checked - - var items = trustStoreWidget.selection.getSelected(); - var trustStores = []; - if(items.length > 0){ - for(var i in items) - { - var item = items[i]; - trustStores.push(trustStoreWidget.store.getValue(item, "name")); - } - newPort.trustStores = trustStores; - } - else if (trustStoreWidget.initialValue && trustStoreWidget.initialValue.length > 0) - { - newPort.trustStores = null; - } - } - else if (initialTransport && currentTransport != initialTransport) - { - newPort.needClientAuth = false; - newPort.wantClientAuth = false; - newPort.trustStores = null; - } - } - - return newPort; - }; - - addPort._toggleSslWidgets = function(portType, transportType) - { - var clientAuthPanel = dojo.byId("formAddPort:fieldsClientAuth"); - var transportSSLPanelNode = dom.byId("formAddPort:fieldsTransportSSL"); - - if (addPort._isSecure(transportType)) - { - var typeMetaData = metadata.getMetaData("Port", portType); - var clientAuth = "needClientAuth" in typeMetaData.attributes || "wantClientAuth" in typeMetaData.attributes; - clientAuthPanel.style.display = clientAuth ? "block" : "none"; - if (clientAuth) - { - registry.byId("formAddPort.needClientAuth").set("disabled", !("needClientAuth" in typeMetaData.attributes)); - registry.byId("formAddPort.wantClientAuth").set("disabled", !("wantClientAuth" in typeMetaData.attributes)); - registry.byId("formAddPort.trustStores").resize(); - } - - transportSSLPanelNode.style.display = "block"; - registry.byId("formAddPort.keyStore").set("disabled", false); - } - else - { - clientAuthPanel.style.display = "none"; - registry.byId("formAddPort.needClientAuth").set("disabled", true); - registry.byId("formAddPort.wantClientAuth").set("disabled", true); - - transportSSLPanelNode.style.display = "none"; - registry.byId("formAddPort.keyStore").set("disabled", true); - } - - }; - - addPort._init = function() - { - xhr.get({url: "addPort.html", sync: true, load: function (data) - { - var theForm; - node.innerHTML = data; - addPort.dialogNode = dom.byId("addPort"); - }}); - } - - addPort._prepareForm = function() - { - //add the port types to formAddPort.type - var portTypeSelect = registry.byId("formAddPort.type"); - var supportedPortTypes = metadata.getTypesForCategory("Port"); - var portTypeSelectStore = util.makeTypeStore(supportedPortTypes); - portTypeSelect.set("store", portTypeSelectStore); - - //add handler for transports change - registry.byId("formAddPort.transports").on("change", function (newValue) - { - var portType = portTypeSelect.get("value"); - addPort._toggleSslWidgets(portType, newValue); - }); - - theForm = registry.byId("formAddPort"); - theForm.on("submit", function (e) - { - - event.stop(e); - if (theForm.validate()) - { - - var newPort = addPort._convertToPort(theForm.getValues()); - if ((newPort.needClientAuth || newPort.wantClientAuth) && (!newPort.hasOwnProperty("trustStores") || newPort.trustStores.length == 0)) - { - alert("A trust store must be selected when requesting client certificates."); - return false; - } - var url = "api/latest/port"; - if (registry.byId("formAddPort.name").get("disabled")) - { - // update request - url += "/" + encodeURIComponent(newPort.name); - } - util.post(url, newPort, function(x){registry.byId("addPort").hide()}); - return false; - } else - { - alert('Form contains invalid data. Please correct first'); - return false; - } - - }); - } - - addPort.show = function(portName, portType, providers, keystores, truststores) - { - - if (!this.formPrepared) - { - this._prepareForm(); - this.formPrepared = true; - } - - registry.byId("formAddPort").reset(); - dojo.byId("formAddPort.id").value = ""; - - var nameWidget = registry.byId("formAddPort.name"); - var typeWidget = registry.byId("formAddPort.type"); - var portWidget = registry.byId("formAddPort.port"); - var maxOpenConnectionsWidget = registry.byId("formAddPort.maxOpenConnections"); - var editWarning = dojo.byId("portEditWarning"); - - var providerWidget = registry.byId("formAddPort.authenticationProvider"); - if (providers) - { - var data = []; - for (var i=0; i< providers.length; i++) - { - data.push( {id: providers[i].name, name: providers[i].name} ); - } - var providersStore = new Memory({ data: data }); - providerWidget.set("store", providersStore); - providerWidget.startup(); - } - - var keystoreWidget = registry.byId("formAddPort.keyStore"); - if (keystores) - { - var data = []; - for (var i=0; i< keystores.length; i++) - { - data.push( {id: keystores[i].name, name: keystores[i].name} ); - } - var keystoresStore = new Memory({ data: data }); - keystoreWidget.set("store", keystoresStore); - keystoreWidget.startup(); - } - - var truststoreWidget = registry.byId("formAddPort.trustStores"); - if (truststores) - { - var layout = [[{name: "Name", field: "name", width: "80%"}, - {name: "Peers only", field: "peersOnly", width: "20%", - formatter: function(val){ - return "<input type='radio' disabled='disabled' "+(val?"checked='checked'": "")+" />" - } - }]]; - - var mem = new Memory({ data: truststores, idProperty: "id"}); - truststoreWidget.set("store", new ObjectStore({objectStore: mem})); - truststoreWidget.set("structure", layout); - truststoreWidget.rowSelectCell.toggleAllSelection(false); - truststoreWidget.startup(); - } - - // Editing existing port, de-register existing on change handler if set - if (this.typeChangeHandler) - { - this.typeChangeHandler.remove(); - } - - if (portName) - { - editWarning.style.display = "block"; - - xhr.get({ - url: "api/latest/port/" + encodeURIComponent(portName), - content: { actuals: true }, - handleAs: "json" - }).then( - function(data){ - var port = data[0]; - nameWidget.set("value", port.name); - nameWidget.set("disabled", true); - - dom.byId("formAddPort.id").value=port.id; - - //type - typeWidget.set("value", portType); - typeWidget.set("disabled", true); - var typeMetaData = metadata.getMetaData("Port", portType); - - //port number - portWidget.set("value", port.port); - portWidget.set("regExpGen", util.numericOrContextVarRegexp); - - //protocols - var protocolsMultiSelect = dom.byId("formAddPort.protocols"); - var protocolValidValues = typeMetaData.attributes.protocols.validValues; - var protocolValues = metadata.extractUniqueListOfValues(protocolValidValues); - util.setMultiSelectOptions(protocolsMultiSelect, protocolValues.sort()); - - var protocolsMultiSelectWidget = registry.byId("formAddPort.protocols"); - protocolsMultiSelectWidget.set("value", port.protocols); - - //authenticationProvider - providerWidget.set("value", port.authenticationProvider ? port.authenticationProvider : ""); - providerWidget.set("disabled", ! ("authenticationProvider" in typeMetaData.attributes)); - dom.byId("formAddPort:fieldsAuthenticationProvider").style.display = "authenticationProvider" in typeMetaData.attributes ? "block" : "none"; - - //transports - var transportsMultiSelect = dom.byId("formAddPort.transports"); - var transportsValidValues = typeMetaData.attributes.transports.validValues; - var transportsValues = metadata.extractUniqueListOfValues(transportsValidValues); - util.setMultiSelectOptions(transportsMultiSelect, transportsValues.sort()); - var transportWidget = registry.byId("formAddPort.transports"); - transportWidget.set("value", port.transports); - - //binding address - var bindAddressWidget = registry.byId("formAddPort.bindingAddress"); - bindAddressWidget.set("value", port.bindingAddress ? port.bindingAddress : ""); - bindAddressWidget.set("disabled", ! ("bindingAddress" in typeMetaData.attributes)); - dom.byId("formAddPort:fieldsBindingAddress").style.display = "bindingAddress" in typeMetaData.attributes ? "block" : "none"; - - //maxOpenConnections - var maxOpenConnectionsWidget = registry.byId("formAddPort.maxOpenConnections"); - maxOpenConnectionsWidget.set("regExpGen", util.signedOrContextVarRegexp); - maxOpenConnectionsWidget.set("value", port.maxOpenConnections ? port.maxOpenConnections : ""); - maxOpenConnectionsWidget.set("disabled", ! ("maxOpenConnections" in typeMetaData.attributes)); - dom.byId("formAddPort:maxOpenConnections").style.display = "maxOpenConnections" in typeMetaData.attributes ? "block" : "none"; - - //ssl - keystoreWidget.set("value", port.keyStore ? port.keyStore : ""); - if (port.trustStores) - { - var items = truststoreWidget.store.objectStore.data; - for (var j=0; j< items.length; j++) - { - var selected = false; - for (var i=0; i< port.trustStores.length; i++) - { - var trustStore = port.trustStores[i]; - if (items[j].name == trustStore) - { - selected = true; - break; - } - } - truststoreWidget.selection.setSelected(j,selected); - } - } - - // want/need client auth - registry.byId("formAddPort.needClientAuth").set("checked", port.needClientAuth); - registry.byId("formAddPort.wantClientAuth").set("checked", port.wantClientAuth); - - keystoreWidget.initialValue = port.keyStore; - truststoreWidget.initialValue = port.trustStores; - transportWidget.initialValue = transportWidget.value; - providerWidget.initialValue = providerWidget.value; - maxOpenConnectionsWidget.initialValue = maxOpenConnectionsWidget.value; - - registry.byId("addPort").show(); - util.applyMetadataToWidgets(registry.byId("addPort").domNode, "Port", portType); - }); - } - else - { - // Adding new port, register the on change handler - this.typeChangeHandler = typeWidget.on("change", addPort._typeChanged); - - if (typeWidget.get("disabled")) - { - typeWidget.set("disabled", false); - } - typeWidget.set("value", portType); - - nameWidget.set("disabled", false); - nameWidget.set("regExpGen", util.nameOrContextVarRegexp); - portWidget.set("regExpGen", util.numericOrContextVarRegexp); - maxOpenConnectionsWidget.set("regExpGen", util.signedOrContextVarRegexp); - - editWarning.style.display = "none"; - registry.byId("addPort").show(); - - util.applyMetadataToWidgets(registry.byId("addPort").domNode, "Port", portType); - } - - }; - - addPort._init(); - - return addPort; - }); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addPreferencesProvider.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addPreferencesProvider.js deleted file mode 100644 index 2136318dfb..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addPreferencesProvider.js +++ /dev/null @@ -1,94 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define([ - "dojo/_base/event", - "dojo/dom-construct", - "dojo/parser", - "dijit/registry", - "qpid/management/preferencesprovider/PreferencesProviderForm", - "qpid/common/util", - "dojo/text!addPreferencesProvider.html", - "dojox/html/entities", - "dojox/validate/us", - "dojox/validate/web", - "dijit/Dialog", - "dijit/form/Button", - "dojo/domReady!"], - function ( event, construct, parser, registry, PreferencesProviderForm, util, template, entities) { - - var addPreferencesProvider = - { - init: function() - { - var that=this; - this.containerNode = construct.create("div", {innerHTML: template}); - parser.parse(this.containerNode).then(function(instances) { that._postParse(); }); - }, - _postParse: function() - { - var that=this; - this.preferencesProviderForm = registry.byId("addPreferencesProvider.preferencesProvider"); - this.dialog = registry.byId("addPreferencesProvider"); - - var cancelButton = registry.byId("addPreferencesProvider.cancelButton"); - cancelButton.on("click", function() { that.dialog.hide(); }); - - var saveButton = registry.byId("addPreferencesProvider.saveButton"); - saveButton.on("click", function() - { - var result = that.preferencesProviderForm.submit(encodeURIComponent(addPreferencesProvider.authenticationProviderName)); - if (result.success) - { - that.dialog.hide(); - } - else - { - util.xhrErrorHandler(result.failureReason); - } - }); - }, - show: function(authenticationProviderName, providerName) - { - this.authenticationProviderName = authenticationProviderName; - this.dialog.set("title", (providerName ? "Edit preferences provider '" + entities.encode(String(providerName)) + "' " : "Add preferences provider ") + " for '" + entities.encode(String(authenticationProviderName)) + "' "); - if (providerName) - { - this.preferencesProviderForm.load(authenticationProviderName, providerName); - } - else - { - this.preferencesProviderForm.reset(); - } - this.dialog.show(); - } - }; - - try - { - addPreferencesProvider.init(); - } - catch(e) - { - console.warn("Initialisation of add preferences dialog failed", e); - } - - return addPreferencesProvider; - }); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addQueue.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addQueue.js deleted file mode 100644 index 8b2c60933d..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addQueue.js +++ /dev/null @@ -1,185 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define(["dojo/_base/xhr", - "dojo/dom", - "dojo/dom-construct", - "dojo/_base/window", - "dijit/registry", - "dojo/parser", - "dojo/_base/array", - "dojo/_base/event", - 'dojo/_base/json', - "dojo/query", - 'qpid/common/util', - "qpid/common/ContextVariablesEditor", - "dijit/form/NumberSpinner", // required by the form - /* dojox/ validate resources */ - "dojox/validate/us", "dojox/validate/web", - /* basic dijit classes */ - "dijit/Dialog", - "dijit/form/CheckBox", "dijit/form/Textarea", - "dijit/form/FilteringSelect", "dijit/form/TextBox", - "dijit/form/ValidationTextBox", "dijit/form/DateTextBox", - "dijit/form/TimeTextBox", "dijit/form/Button", - "dijit/form/RadioButton", "dijit/form/Form", - "dijit/form/DateTextBox", - /* basic dojox classes */ - "dojox/form/BusyButton", "dojox/form/CheckedMultiSelect", - "dojo/domReady!"], - function (xhr, dom, construct, win, registry, parser, array, event, json, query, util) { - - var addQueue = {}; - - var node = construct.create("div", null, win.body(), "last"); - - var typeSpecificFields = { priorities: "priority", lvqKey: "lvq", sortKey: "sorted" }; - var requiredFields = { sorted: "sortKey"}; - - var fieldConverters = { - queueFlowControlSizeBytes: parseInt, - queueFlowResumeSizeBytes: parseInt, - alertThresholdMessageSize: parseInt, - alertThresholdQueueDepthMessages: parseInt, - alertThresholdQueueDepthBytes: parseInt, - maximumDeliveryAttempts: parseInt, - alertThresholdMessageAge: parseInt, - alertRepeatGap: parseInt - } - - var convertToQueue = function convertToQueue(formValues) - { - var newQueue = {}; - newQueue.name = formValues.name; - for(var propName in formValues) - { - if(formValues.hasOwnProperty(propName)) - { - if(propName === "durable") - { - if (formValues.durable[0] && formValues.durable[0] == "durable") { - newQueue.durable = true; - } - } - else if(propName === "dlqEnabled") - { - if (formValues.dlqEnabled[0] && formValues.dlqEnabled[0] == "dlqEnabled") { - newQueue["x-qpid-dlq-enabled"] = true; - } - } - else if(propName === "messageGroupSharedGroups") - { - if (formValues.messageGroupSharedGroups[0] && formValues.messageGroupSharedGroups[0] == "messageGroupSharedGroups") { - newQueue["messageGroupSharedGroups"] = true; - } - } - else if (!typeSpecificFields.hasOwnProperty(propName) || formValues[ "type" ] === typeSpecificFields[ propName ]) - { - if(formValues[ propName ] !== "") { - if (fieldConverters.hasOwnProperty(propName)) - { - newQueue[ propName ] = fieldConverters[propName](formValues[propName]); - } - else - { - newQueue[ propName ] = formValues[propName]; - } - } - } - - } - } - - return newQueue; - }; - - - xhr.get({url: "addQueue.html", - sync: true, - load: function(data) { - var theForm; - node.innerHTML = data; - addQueue.dialogNode = dom.byId("addQueue"); - parser.instantiate([addQueue.dialogNode]); - - // for children which have name type, add a function to make all the associated atrributes - // visible / invisible as the select is changed - theForm = registry.byId("formAddQueue"); - var typeSelector = registry.byId("formAddQueue.type"); - typeSelector.on("change", function(value) - { - query(".typeSpecificDiv").forEach(function(node, index, arr) - { - if (node.id === "formAddQueueType:" + value) - { - node.style.display = "block"; - util.applyMetadataToWidgets(node, "Queue", value); - } - else - { - node.style.display = "none"; - } - }); - for(var requiredField in requiredFields) - { - dijit.byId('formAddQueue.' + requiredFields[requiredField]).required = (requiredField == value); - } - }); - - theForm.on("submit", function(e) { - - event.stop(e); - if(theForm.validate()){ - - var newQueue = convertToQueue(theForm.getValues()); - util.post("api/latest/queue/" + encodeURIComponent(addQueue.vhostnode) - + "/"+encodeURIComponent(addQueue.vhost), - newQueue, function(x){registry.byId("addQueue").hide();}); - return false; - - - }else{ - alert('Form contains invalid data. Please correct first'); - return false; - } - - }); - }}); - - addQueue.show = function(data) { - addQueue.vhost = data.virtualhost; - addQueue.vhostnode = data.virtualhostnode; - var form = registry.byId("formAddQueue"); - form.reset(); - registry.byId("addQueue").show(); - util.applyMetadataToWidgets(form.domNode, "Queue", "standard"); - - if (!this.context) - { - this.context = new qpid.common.ContextVariablesEditor({name: 'context', title: 'Context variables'}); - this.context.placeAt(dom.byId("formAddQueue.context")); - } - - var escapedUrl = "api/latest/virtualhost/" + encodeURIComponent(addQueue.vhostnode) + "/" + encodeURIComponent(addQueue.vhost); - this.context.loadInheritedData(escapedUrl); - }; - - return addQueue; - }); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addStore.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addStore.js deleted file mode 100644 index f0bdb0cefa..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addStore.js +++ /dev/null @@ -1,189 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define(["dojo/_base/lang", - "dojo/dom", - "dojo/dom-construct", - "dijit/registry", - "dojo/parser", - "dojo/store/Memory", - "dojo/_base/array", - "dojo/_base/event", - 'dojo/json', - "qpid/common/util", - "qpid/common/metadata", - "dojo/text!addStore.html", - "dojo/store/Memory", - "dojox/validate/us", - "dojox/validate/web", - "dijit/Dialog", - "dijit/form/CheckBox", - "dijit/form/Textarea", - "dijit/form/ComboBox", - "dijit/form/TextBox", - "dijit/form/ValidationTextBox", - "dijit/form/Button", - "dijit/form/Form", - "dijit/layout/ContentPane", - "dojox/layout/TableContainer", - "dojo/domReady!"], - function (lang, dom, construct, registry, parser, memory, array, event, json, util, metadata, template) - { - var addStore = - { - init: function() - { - var that=this; - this.containerNode = construct.create("div", {innerHTML: template}); - parser.parse(this.containerNode).then(function(instances) { that._postParse(); }); - }, - _postParse: function() - { - var that=this; - this.storeName = registry.byId("addStore.name"); - this.storeName.set("regExpGen", util.nameOrContextVarRegexp); - - this.dialog = registry.byId("addStore"); - this.addButton = registry.byId("addStore.addButton"); - this.cancelButton = registry.byId("addStore.cancelButton"); - this.cancelButton.on("click", function(e){that._cancel(e);}); - this.addButton.on("click", function(e){that._add(e);}); - - this.storeTypeFieldsContainer = dom.byId("addStore.typeFields"); - this.storeForm = registry.byId("addStore.form"); - - this.storeType = registry.byId("addStore.type"); - this.storeType.on("change", function(type){that._storeTypeChanged(type);}); - }, - setupTypeStore: function(category) - { - this.category = category; - var storeTypeSupportedTypes = metadata.getTypesForCategory(category); - storeTypeSupportedTypes.sort(); - var storeTypeStore = util.makeTypeStore(storeTypeSupportedTypes); - this.storeType.set("store", storeTypeStore); - }, - show: function(effectiveData) - { - this.effectiveData = effectiveData; - this._destroyTypeFields(this.containerNode); - this.storeForm.reset(); - - if (effectiveData) - { - this._initFields(effectiveData); - } - this.storeName.set("disabled", effectiveData == null ? false : true); - this.storeType.set("disabled", effectiveData == null ? false : true); - this.dialog.set("title", effectiveData == null ? "Add Key Store" : "Edit Key Store - " + effectiveData.name) - this.dialog.show(); - }, - _initFields:function(data) - { - var type = data["type"]; - var attributes = metadata.getMetaData(this.category, type).attributes; - for(var name in attributes) - { - var widget = registry.byId("addStore."+name); - if (widget) - { - widget.set("value", data[name]); - } - } - }, - _cancel: function(e) - { - event.stop(e); - if (this.reader) - { - this.reader.abort(); - } - this.dialog.hide(); - }, - _add: function(e) - { - event.stop(e); - this._submit(); - }, - _submit: function() - { - if (this.storeForm.validate()) - { - var success = false,failureReason=null; - - var storeData = util.getFormWidgetValues(this.storeForm, this.initialData); - var that = this; - var url = "api/latest/" + encodeURIComponent(this.category.toLowerCase()); - - if (this.effectiveData) - { - // update request - url += "/" + encodeURIComponent(this.storeName.value); - } - util.post(url, storeData, function(x){that.dialog.hide();}); - } - else - { - alert('Form contains invalid data. Please correct first'); - } - }, - _storeTypeChanged: function(type) - { - this._typeChanged(type, this.storeTypeFieldsContainer, "qpid/management/store/", this.category ); - }, - _destroyTypeFields: function(typeFieldsContainer) - { - var widgets = registry.findWidgets(typeFieldsContainer); - array.forEach(widgets, function(item) { item.destroyRecursive();}); - construct.empty(typeFieldsContainer); - }, - _typeChanged: function(type, typeFieldsContainer, baseUrl, category ) - { - this._destroyTypeFields(typeFieldsContainer); - - if (type) - { - var that = this; - require([ baseUrl + type.toLowerCase() + "/add"], function(typeUI) - { - try - { - typeUI.show({containerNode:typeFieldsContainer, parent: that, data: that.initialData, effectiveData: that.effectiveData}); - util.applyMetadataToWidgets(typeFieldsContainer, category, type); - } - catch(e) - { - console.warn(e); - } - }); - } - } - }; - - try - { - addStore.init(); - } - catch(e) - { - console.warn(e); - } - return addStore; - }); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addVirtualHostNodeAndVirtualHost.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addVirtualHostNodeAndVirtualHost.js deleted file mode 100644 index 9131df0582..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addVirtualHostNodeAndVirtualHost.js +++ /dev/null @@ -1,409 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define([ - "dojo/_base/event", - "dojo/_base/lang", - "dojo/_base/array", - "dojo/dom", - "dojo/dom-construct", - "dojo/json", - "dojo/parser", - "dojo/store/Memory", - "dojo/window", - "dojo/on", - "dojox/lang/functional/object", - "dijit/registry", - "dijit/Dialog", - "dijit/form/Button", - "dijit/form/FilteringSelect", - "qpid/common/properties", - "qpid/common/util", - "qpid/common/metadata", - "dojo/text!addVirtualHostNodeAndVirtualHost.html", - "qpid/common/ContextVariablesEditor", - "dijit/TitlePane", - "dijit/layout/ContentPane", - "dijit/form/Form", - "dijit/form/CheckBox", - "dijit/form/RadioButton", - "dojox/form/Uploader", - "dojox/validate/us", - "dojox/validate/web", - "dojo/domReady!"], - function (event, lang, array, dom, domConstruct, json, parser, Memory, win, on, fobject, registry, Dialog, Button, FilteringSelect, properties, util, metadata, template) - { - - var addVirtualHostNodeAndVirtualHost = - { - init: function() - { - var that=this; - this.containerNode = domConstruct.create("div", {innerHTML: template}); - parser.parse(this.containerNode).then(function(instances) { that._postParse(); }); - }, - _postParse: function() - { - var that=this; - var virtualHostNodeName = registry.byId("addVirtualHostNode.nodeName"); - virtualHostNodeName.set("regExpGen", util.nameOrContextVarRegexp); - - // Readers are HTML5 - this.reader = window.FileReader ? new FileReader() : undefined; - - this.dialog = registry.byId("addVirtualHostNodeAndVirtualHost"); - this.addButton = registry.byId("addVirtualHostNodeAndVirtualHost.addButton"); - this.cancelButton = registry.byId("addVirtualHostNodeAndVirtualHost.cancelButton"); - this.cancelButton.on("click", function(e){that._cancel(e);}); - this.addButton.on("click", function(e){that._add(e);}); - - this.virtualHostNodeTypeFieldsContainer = dom.byId("addVirtualHostNode.typeFields"); - this.virtualHostNodeSelectedFileContainer = dom.byId("addVirtualHostNode.selectedFile"); - this.virtualHostNodeSelectedFileStatusContainer = dom.byId("addVirtualHostNode.selectedFileStatus"); - this.virtualHostNodeUploadFields = dom.byId("addVirtualHostNode.uploadFields"); - this.virtualHostNodeFileFields = dom.byId("addVirtualHostNode.fileFields"); - - this.virtualHostNodeForm = registry.byId("addVirtualHostNode.form"); - this.virtualHostNodeType = registry.byId("addVirtualHostNode.type"); - this.virtualHostNodeFileCheck = registry.byId("addVirtualHostNode.upload"); - this.virtualHostNodeFile = registry.byId("addVirtualHostNode.file"); - - this.virtualHostNodeType.set("disabled", true); - - this.virtualHostTypeFieldsContainer = dom.byId("addVirtualHost.typeFields"); - this.virtualHostForm = registry.byId("addVirtualHost.form"); - this.virtualHostType = registry.byId("addVirtualHost.type"); - - this.virtualHostType.set("disabled", true); - - var supportedVirtualHostNodeTypes = metadata.getTypesForCategory("VirtualHostNode"); - supportedVirtualHostNodeTypes.sort(); - - var virtualHostNodeTypeStore = util.makeTypeStore(supportedVirtualHostNodeTypes); - this.virtualHostNodeType.set("store", virtualHostNodeTypeStore); - this.virtualHostNodeType.set("disabled", false); - this.virtualHostNodeType.on("change", function(type){that._vhnTypeChanged(type, that.virtualHostNodeTypeFieldsContainer, "qpid/management/virtualhostnode/");}); - - this.virtualHostType.set("disabled", true); - this.virtualHostType.on("change", function(type){that._vhTypeChanged(type, that.virtualHostTypeFieldsContainer, "qpid/management/virtualhost/");}); - - if (this.reader) - { - this.reader.onload = function(evt) {that._vhnUploadFileComplete(evt);}; - this.reader.onerror = function(ex) {console.error("Failed to load JSON file", ex);}; - this.virtualHostNodeFile.on("change", function(selected){that._vhnFileChanged(selected)}); - this.virtualHostNodeFileCheck.on("change", function(selected){that._vhnFileFlagChanged(selected)}); - } - else - { - // Fall back for IE8/9 which do not support FileReader - this.virtualHostNodeFileCheck.set("disabled", "disabled"); - this.virtualHostNodeFileCheck.set("title", "Requires a more recent browser with HTML5 support"); - this.virtualHostNodeFileFields.style.display = "none"; - } - - this.virtualHostNodeUploadFields.style.display = "none"; - }, - show: function() - { - this.virtualHostNodeForm.reset(); - this.virtualHostNodeType.set("value", null); - - this.virtualHostForm.reset(); - this.virtualHostType.set("value", null); - if (!this.virtualHostNodeContext) - { - this.virtualHostNodeContext = new qpid.common.ContextVariablesEditor({name: 'context', title: 'Context variables'}); - this.virtualHostNodeContext.placeAt(dom.byId("addVirtualHostNode.context")); - var that = this; - this.virtualHostNodeContext.on("change", function(value){ - var inherited = that.virtualHostContext.inheritedActualValues; - var effective = that.virtualHostContext.effectiveValues; - var actuals = that.virtualHostContext.value; - for(var key in value) - { - var val = value[key]; - if (!(key in actuals)) - { - inherited[key] = val; - if (!(key in effective)) - { - effective[key] = val.indexOf("${") == -1 ? val : ""; - } - } - } - that.virtualHostContext.setData(that.virtualHostContext.value,effective,inherited); - }); - } - if (!this.virtualHostContext) - { - this.virtualHostContext = new qpid.common.ContextVariablesEditor({name: 'context', title: 'Context variables'}); - this.virtualHostContext.placeAt(dom.byId("addVirtualHost.context")); - - } - - this.virtualHostNodeContext.loadInheritedData("api/latest/broker"); - this.virtualHostContext.setData({}, this.virtualHostNodeContext.effectiveValues,this.virtualHostNodeContext.inheritedActualValues); - - this.dialog.show(); - if (!this.resizeEventRegistered) - { - this.resizeEventRegistered = true; - util.resizeContentAreaAndRepositionDialog(dom.byId("addVirtualHostNodeAndVirtualHost.contentPane"), this.dialog); - } - }, - destroy: function() - { - if (this.dialog) - { - this.dialog.destroyRecursive(); - this.dialog = null; - } - - if (this.containerNode) - { - domConstruct.destroy(this.containerNode); - this.containerNode = null; - } - }, - _vhnTypeChanged: function (type, typeFieldsContainer, urlStem) - { - var validChildTypes = metadata.validChildTypes("VirtualHostNode", type, "VirtualHost"); - validChildTypes.sort(); - - var virtualHostTypeStore = util.makeTypeStore( validChildTypes ); - - this.virtualHostType.set("store", virtualHostTypeStore); - this.virtualHostType.set("disabled", validChildTypes.length <= 1); - if (validChildTypes.length == 1) - { - this.virtualHostType.set("value", validChildTypes[0]); - } - else - { - this.virtualHostType.reset(); - } - - var vhnTypeSelected = !(type == ''); - this.virtualHostNodeUploadFields.style.display = vhnTypeSelected ? "block" : "none"; - - if (!vhnTypeSelected) - { - this._vhnFileFlagChanged(false); - } - - this._typeChanged(type, typeFieldsContainer, urlStem, "VirtualHostNode"); - }, - _vhTypeChanged: function (type, typeFieldsContainer, urlStem) - { - this._typeChanged(type, typeFieldsContainer, urlStem, "VirtualHost"); - }, - _typeChanged: function (type, typeFieldsContainer, urlStem, category) - { - var widgets = registry.findWidgets(typeFieldsContainer); - array.forEach(widgets, function(item) { item.destroyRecursive();}); - domConstruct.empty(typeFieldsContainer); - if (category) - { - var context = this["v" + category.substring(1) + "Context"]; - if (context) - { - context.removeDynamicallyAddedInheritedContext(); - } - } - if (type) - { - var that = this; - require([urlStem + type.toLowerCase() + "/add"], - function(typeUI) - { - try - { - typeUI.show({containerNode:typeFieldsContainer, parent: that}); - - util.applyMetadataToWidgets(typeFieldsContainer,category, type); - } - catch(e) - { - console.warn(e); - } - } - ); - } - }, - _vhnFileFlagChanged: function (selected) - { - this.virtualHostForm.domNode.style.display = selected ? "none" : "block"; - this.virtualHostNodeFileFields.style.display = selected ? "block" : "none"; - this.virtualHostType.set("required", !selected); - this.virtualHostNodeFile.reset(); - this.virtualHostInitialConfiguration = undefined; - this.virtualHostNodeSelectedFileContainer.innerHTML = ""; - this.virtualHostNodeSelectedFileStatusContainer.className = ""; - }, - _vhnFileChanged: function (evt) - { - // We only ever expect a single file - var file = this.virtualHostNodeFile.domNode.children[0].files[0]; - - this.addButton.set("disabled", true); - this.virtualHostNodeSelectedFileContainer.innerHTML = file.name; - this.virtualHostNodeSelectedFileStatusContainer.className = "loadingIcon"; - - console.log("Beginning to read file " + file.name); - this.reader.readAsDataURL(file); - }, - _vhnUploadFileComplete: function(evt) - { - var reader = evt.target; - var result = reader.result; - console.log("File read complete, contents " + result); - this.virtualHostInitialConfiguration = result; - this.addButton.set("disabled", false); - this.virtualHostNodeSelectedFileStatusContainer.className = "loadedIcon"; - }, - _cancel: function(e) - { - if (this.reader) - { - this.reader.abort(); - } - this.dialog.hide(); - }, - _add: function(e) - { - event.stop(e); - this._submit(); - }, - _submit: function() - { - - var uploadVHConfig = this.virtualHostNodeFileCheck.get("checked"); - var virtualHostNodeData = undefined; - - if (uploadVHConfig && this.virtualHostNodeFile.getFileList().length > 0 && this.virtualHostNodeForm.validate()) - { - // VH config is being uploaded - virtualHostNodeData = this._getValues(this.virtualHostNodeForm); - var virtualHostNodeContext = this.virtualHostNodeContext.get("value"); - if (virtualHostNodeContext) - { - virtualHostNodeData["context"] = virtualHostNodeContext; - } - - // Add the loaded virtualhost configuration - virtualHostNodeData["virtualHostInitialConfiguration"] = this.virtualHostInitialConfiguration; - } - else if (!uploadVHConfig && this.virtualHostNodeForm.validate() && this.virtualHostForm.validate()) - { - virtualHostNodeData = this._getValues(this.virtualHostNodeForm); - var virtualHostNodeContext = this.virtualHostNodeContext.get("value"); - if (virtualHostNodeContext) - { - virtualHostNodeData["context"] = virtualHostNodeContext; - } - - var virtualHostData = this._getValues(this.virtualHostForm); - var virtualHostContext = this.virtualHostContext.get("value"); - if (virtualHostContext) - { - virtualHostData["context"] = virtualHostContext; - } - - //Default the VH name to be the same as the VHN name. - virtualHostData["name"] = virtualHostNodeData["name"]; - - virtualHostNodeData["virtualHostInitialConfiguration"] = json.stringify(virtualHostData) - - } - else - { - alert('Form contains invalid data. Please correct first'); - return; - } - - var that = this; - util.post("api/latest/virtualhostnode", virtualHostNodeData, function(x){that.dialog.hide();}); - }, - _getValues: function (form) - { - var values = {}; - var contextMap = {}; - - var formWidgets = form.getChildren(); - for(var i in formWidgets) - { - var widget = formWidgets[i]; - var value = widget.value; - var propName = widget.name; - if (propName && (widget.required || value )) - { - if (widget.contextvar) - { - contextMap [propName] = String(value); // Broker requires that context values are Strings - } - else - { - if (widget instanceof dijit.form.CheckBox) - { - values[ propName ] = widget.checked; - } - else if (widget instanceof dijit.form.RadioButton && value) - { - var currentValue = values[propName]; - if (currentValue) - { - if (lang.isArray(currentValue)) - { - currentValue.push(value) - } - else - { - values[ propName ] = [currentValue, value]; - } - } - else - { - values[ propName ] = value; - } - } - else - { - values[ propName ] = value ? value: null; - } - - } - } - } - - // One or more context variables were defined on form - if (fobject.keys(contextMap).length > 0) - { - values ["context"] = contextMap; - } - return values; - } - }; - - addVirtualHostNodeAndVirtualHost.init(); - - return addVirtualHostNodeAndVirtualHost; - } -); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/PrincipalDatabaseAuthenticationManager.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/PrincipalDatabaseAuthenticationManager.js deleted file mode 100644 index 8eaaa0e463..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/PrincipalDatabaseAuthenticationManager.js +++ /dev/null @@ -1,279 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define(["dojo/_base/xhr", - "dojo/dom", - "dojo/parser", - "dojo/query", - "dojo/dom-construct", - "dojo/_base/connect", - "dojo/_base/window", - "dojo/_base/event", - "dojo/_base/json", - "dijit/registry", - "qpid/common/util", - "qpid/common/properties", - "qpid/common/UpdatableStore", - "dojox/grid/EnhancedGrid", - "dojox/grid/enhanced/plugins/Pagination", - "dojox/grid/enhanced/plugins/IndirectSelection", - "dojox/validate/us", "dojox/validate/web", - "dijit/Dialog", - "dijit/form/TextBox", - "dijit/form/ValidationTextBox", - "dijit/form/TimeTextBox", "dijit/form/Button", - "dijit/form/Form", - "dijit/form/DateTextBox", - "dojo/domReady!"], - function (xhr, dom, parser, query, construct, connect, win, event, json, registry, util, properties, UpdatableStore, EnhancedGrid) { - function DatabaseAuthManager(containerNode, authProviderObj, controller) { - var node = construct.create("div", null, containerNode, "last"); - var that = this; - this.name = authProviderObj.name; - xhr.get({url: "authenticationprovider/showPrincipalDatabaseAuthenticationManager.html", - sync: true, - load: function(data) { - node.innerHTML = data; - parser.parse(node).then(function(instances) - { - that.init(node, authProviderObj, controller); - }); - }}); - } - - DatabaseAuthManager.prototype.update = function() { - this.authDatabaseUpdater.update(); - }; - - DatabaseAuthManager.prototype.close = function() { - updater.remove( this.authDatabaseUpdater ); - }; - - DatabaseAuthManager.prototype.init = function(node, authProviderObj, controller) - { - this.controller = controller; - var that = this; - - that.authProviderData = authProviderObj; - - var userDiv = query(".users")[0]; - - var gridProperties = { - height: 400, - keepSelection: true, - plugins: { - pagination: { - pageSizes: ["10", "25", "50", "100"], - description: true, - sizeSwitch: true, - pageStepper: true, - gotoButton: true, - maxPageStep: 4, - position: "bottom" - }, - indirectSelection: true - - }}; - - - that.usersGrid = - new UpdatableStore(that.authProviderData.users, userDiv, - [ { name: "User Name", field: "name", width: "100%" } - ], function(obj) { - connect.connect(obj.grid, "onRowDblClick", obj.grid, - function(evt){ - var idx = evt.rowIndex, - theItem = this.getItem(idx); - var name = obj.dataStore.getValue(theItem,"name"); - var id = obj.dataStore.getValue(theItem,"id"); - setPassword.show(that.name, {name: name, id: id}); - }); - }, gridProperties, EnhancedGrid); - - - var addUserButton = query(".addUserButton", node)[0]; - connect.connect(registry.byNode(addUserButton), "onClick", function(evt){ addUser.show(that.name) }); - - var deleteUserButton = query(".deleteUserButton", node)[0]; - var deleteWidget = registry.byNode(deleteUserButton); - connect.connect(deleteWidget, "onClick", - function(evt){ - event.stop(evt); - that.deleteUsers(); - }); -} - - DatabaseAuthManager.prototype.deleteUsers = function() - { - var grid = this.usersGrid.grid; - var data = grid.selection.getSelected(); - if(data.length) { - var that = this; - if(confirm("Delete " + data.length + " users?")) { - var i, queryParam; - for(i = 0; i<data.length; i++) { - if(queryParam) { - queryParam += "&"; - } else { - queryParam = "?"; - } - - queryParam += "id=" + data[i].id; - } - var query = "api/latest/user/"+ encodeURIComponent(that.name) - + queryParam; - that.success = true - xhr.del({url: query, sync: true, handleAs: "json"}).then( - function(data) { - grid.setQuery({id: "*"}); - grid.selection.deselectAll(); - that.update(); - }, - function(error) {that.success = false; that.failureReason = error;}); - if(!that.success ) { - util.xhrErrorHandler(this.failureReason); - } - } -} - }; - - DatabaseAuthManager.prototype.update = function(data) - { - this.authProviderData = data; - this.name = data.name - this.usersGrid.update(this.authProviderData.users); - }; - - var addUser = {}; - - var node = construct.create("div", null, win.body(), "last"); - - var convertToUser = function convertToUser(formValues) { - var newUser = {}; - newUser.name = formValues.name; - for(var propName in formValues) - { - if(formValues.hasOwnProperty(propName)) { - if(formValues[ propName ] !== "") { - newUser[ propName ] = formValues[propName]; - } - } - } - - return newUser; - }; - - - xhr.get({url: "authenticationprovider/addUser.html", - sync: true, - load: function(data) { - var theForm; - node.innerHTML = data; - addUser.dialogNode = dom.byId("addUser"); - parser.instantiate([addUser.dialogNode]); - - var that = this; - - theForm = registry.byId("formAddUser"); - theForm.on("submit", function(e) { - - event.stop(e); - if(theForm.validate()){ - - var newUser = convertToUser(theForm.getValues()); - - - var url = "api/latest/user/"+encodeURIComponent(addUser.authProvider); - util.post(url, newUser, function(x){registry.byId("addUser").hide();}); - return false; - - - }else{ - alert('Form contains invalid data. Please correct first'); - return false; - } - - }); - }}); - - addUser.show = function(authProvider) { - addUser.authProvider = authProvider; - registry.byId("formAddUser").reset(); - registry.byId("addUser").show(); - }; - - - var setPassword = {}; - - var setPasswordNode = construct.create("div", null, win.body(), "last"); - - xhr.get({url: "authenticationprovider/setPassword.html", - sync: true, - load: function(data) { - var theForm; - setPasswordNode.innerHTML = data; - setPassword.dialogNode = dom.byId("setPassword"); - parser.instantiate([setPassword.dialogNode]); - - var that = this; - - theForm = registry.byId("formSetPassword"); - theForm.on("submit", function(e) { - - event.stop(e); - if(theForm.validate()){ - - var newUser = convertToUser(theForm.getValues()); - newUser.name = setPassword.name; - newUser.id = setPassword.id; - - var url = "api/latest/user/"+encodeURIComponent(setPassword.authProvider) + - "/"+encodeURIComponent(newUser.name); - - util.post(url, newUser, function(x){registry.byId("setPassword").hide();}); - return false; - - - }else{ - alert('Form contains invalid data. Please correct first'); - return false; - } - - }); - }}); - - setPassword.show = function(authProvider, user) { - setPassword.authProvider = authProvider; - setPassword.name = user.name; - setPassword.id = user.id; - registry.byId("formSetPassword").reset(); - - var namebox = registry.byId("formSetPassword.name"); - namebox.set("value", user.name); - namebox.set("disabled", true); - - registry.byId("setPassword").show(); - - }; - - - - return DatabaseAuthManager; - }); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/anonymous/add.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/anonymous/add.js deleted file mode 100644 index 73022a0855..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/anonymous/add.js +++ /dev/null @@ -1,21 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define([], function () { return { show: function(data){} }; }); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/anonymous/show.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/anonymous/show.js deleted file mode 100644 index ca2b56fda0..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/anonymous/show.js +++ /dev/null @@ -1,35 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define([], - function () - { - - function NoFieldAuthenticationProvider(data) - { - } - - NoFieldAuthenticationProvider.prototype.update = function(data) - { - } - - return NoFieldAuthenticationProvider; - } -); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/base64md5passwordfile/add.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/base64md5passwordfile/add.js deleted file mode 100644 index cbc5ce356d..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/base64md5passwordfile/add.js +++ /dev/null @@ -1,40 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define(["dojo/query","dijit/registry","qpid/common/util"], - function (query, registry, util) - { - return { - show: function(data) - { - util.parseHtmlIntoDiv(data.containerNode, "authenticationprovider/filebased/add.html", - function() - { - if (data.data) - { - var path = registry.byNode(query(".path", data.containerNode)[0]); - path.set("value", data.data.path); - } - }); - } - }; - } -); - diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/base64md5passwordfile/show.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/base64md5passwordfile/show.js deleted file mode 100644 index 1456a4847c..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/base64md5passwordfile/show.js +++ /dev/null @@ -1,38 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define(["qpid/common/util", "dojo/domReady!"], - function (util, metadata) - { - - function Base64MD5PasswordFile(data) - { - util.buildUI(data.containerNode, data.parent, "authenticationprovider/filebased/show.html", ["path"], this); - data.parent.editButton.set("disabled", false); - } - - Base64MD5PasswordFile.prototype.update = function(data) - { - util.updateUI(data, ["path"], this); - } - - return Base64MD5PasswordFile; - } -); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/external/add.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/external/add.js deleted file mode 100644 index 979a10cae9..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/external/add.js +++ /dev/null @@ -1,40 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define(["dojo/query","dijit/registry","qpid/common/util"], - function (query, registry, util) - { - return { - show: function(data) - { - util.parseHtmlIntoDiv(data.containerNode, "authenticationprovider/external/add.html", - function() - { - if (data.data) - { - var useFullDN = registry.byNode(query(".useFullDN", data.containerNode)[0]); - useFullDN.set("value", data.data.useFullDN); - } - }); - } - }; - } -); - diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/external/show.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/external/show.js deleted file mode 100644 index 84b1ed387d..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/external/show.js +++ /dev/null @@ -1,38 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define(["qpid/common/util", "dojo/domReady!"], - function (util, metadata) - { - - function External(data) - { - util.buildUI(data.containerNode, data.parent, "authenticationprovider/external/show.html", ["useFullDN"], this); - data.parent.editButton.set("disabled", false); - } - - External.prototype.update = function(data) - { - util.updateUI(data, ["useFullDN"], this); - } - - return External; - } -); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/kerberos/add.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/kerberos/add.js deleted file mode 100644 index f76c75f05e..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/kerberos/add.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define([], function () { return { show: function(data){} }; }); - diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/kerberos/show.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/kerberos/show.js deleted file mode 100644 index ca2b56fda0..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/kerberos/show.js +++ /dev/null @@ -1,35 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define([], - function () - { - - function NoFieldAuthenticationProvider(data) - { - } - - NoFieldAuthenticationProvider.prototype.update = function(data) - { - } - - return NoFieldAuthenticationProvider; - } -); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/md5/add.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/md5/add.js deleted file mode 100644 index 73022a0855..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/md5/add.js +++ /dev/null @@ -1,21 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define([], function () { return { show: function(data){} }; }); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/md5/show.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/md5/show.js deleted file mode 100644 index ca2b56fda0..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/md5/show.js +++ /dev/null @@ -1,35 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define([], - function () - { - - function NoFieldAuthenticationProvider(data) - { - } - - NoFieldAuthenticationProvider.prototype.update = function(data) - { - } - - return NoFieldAuthenticationProvider; - } -); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/plain/add.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/plain/add.js deleted file mode 100644 index 73022a0855..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/plain/add.js +++ /dev/null @@ -1,21 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define([], function () { return { show: function(data){} }; }); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/plain/show.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/plain/show.js deleted file mode 100644 index ca2b56fda0..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/plain/show.js +++ /dev/null @@ -1,35 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define([], - function () - { - - function NoFieldAuthenticationProvider(data) - { - } - - NoFieldAuthenticationProvider.prototype.update = function(data) - { - } - - return NoFieldAuthenticationProvider; - } -); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/plainpasswordfile/add.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/plainpasswordfile/add.js deleted file mode 100644 index cbc5ce356d..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/plainpasswordfile/add.js +++ /dev/null @@ -1,40 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define(["dojo/query","dijit/registry","qpid/common/util"], - function (query, registry, util) - { - return { - show: function(data) - { - util.parseHtmlIntoDiv(data.containerNode, "authenticationprovider/filebased/add.html", - function() - { - if (data.data) - { - var path = registry.byNode(query(".path", data.containerNode)[0]); - path.set("value", data.data.path); - } - }); - } - }; - } -); - diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/plainpasswordfile/show.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/plainpasswordfile/show.js deleted file mode 100644 index f428a8ec55..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/plainpasswordfile/show.js +++ /dev/null @@ -1,38 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define(["qpid/common/util", "dojo/domReady!"], - function (util, metadata) - { - - function PlainPasswordFile(data) - { - util.buildUI(data.containerNode, data.parent, "authenticationprovider/filebased/show.html", ["path"], this); - data.parent.editButton.set("disabled", false); - } - - PlainPasswordFile.prototype.update = function(data) - { - util.updateUI(data, ["path"], this); - } - - return PlainPasswordFile; - } -); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/scram-sha-1/add.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/scram-sha-1/add.js deleted file mode 100644 index 73022a0855..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/scram-sha-1/add.js +++ /dev/null @@ -1,21 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define([], function () { return { show: function(data){} }; }); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/scram-sha-1/show.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/scram-sha-1/show.js deleted file mode 100644 index ca2b56fda0..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/scram-sha-1/show.js +++ /dev/null @@ -1,35 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define([], - function () - { - - function NoFieldAuthenticationProvider(data) - { - } - - NoFieldAuthenticationProvider.prototype.update = function(data) - { - } - - return NoFieldAuthenticationProvider; - } -); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/scram-sha-256/add.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/scram-sha-256/add.js deleted file mode 100644 index 73022a0855..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/scram-sha-256/add.js +++ /dev/null @@ -1,21 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define([], function () { return { show: function(data){} }; }); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/scram-sha-256/show.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/scram-sha-256/show.js deleted file mode 100644 index ca2b56fda0..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/scram-sha-256/show.js +++ /dev/null @@ -1,35 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define([], - function () - { - - function NoFieldAuthenticationProvider(data) - { - } - - NoFieldAuthenticationProvider.prototype.update = function(data) - { - } - - return NoFieldAuthenticationProvider; - } -); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/simpleldap/add.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/simpleldap/add.js deleted file mode 100644 index 4e04bfd6f0..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/simpleldap/add.js +++ /dev/null @@ -1,82 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define(["dojo/_base/xhr","dojo/query","dijit/registry","qpid/common/util","qpid/common/metadata","dojo/store/Memory","dijit/form/FilteringSelect","dijit/form/ValidationTextBox","dijit/form/CheckBox"], - function (xhr, query, registry, util, metadata, Memory) - { - return { - show: function(data) - { - var that = this; - util.parseHtmlIntoDiv(data.containerNode, "authenticationprovider/simpleldap/add.html", function(){that._postParse(data);}); - }, - _postParse: function(data) - { - var that = this; - xhr.get({url: "api/latest/truststore", sync: true, handleAs: "json"}).then( - function(trustStores) - { - that._initTrustStores(trustStores, data.containerNode); - } - ); - - if (data.data) - { - this._initFields(data.data, data.containerNode ); - } - }, - _initTrustStores: function(trustStores, containerNode) - { - var data = []; - for (var i=0; i< trustStores.length; i++) - { - data.push( {id: trustStores[i].name, name: trustStores[i].name} ); - } - var trustStoresStore = new Memory({ data: data }); - - var trustStore = registry.byNode(query(".trustStore", containerNode)[0]); - trustStore.set("store", trustStoresStore); - }, - _initFields:function(data, containerNode) - { - var attributes = metadata.getMetaData("AuthenticationProvider", "SimpleLDAP").attributes; - for(var name in attributes) - { - var domNode = query("." + name, containerNode)[0]; - if (domNode) - { - var widget = registry.byNode(domNode); - if (widget) - { - if (widget instanceof dijit.form.CheckBox) - { - widget.set("checked", data[name]); - } - else - { - widget.set("value", data[name]); - } - } - } - } - } - }; - } -); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/simpleldap/show.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/simpleldap/show.js deleted file mode 100644 index 554e856035..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/simpleldap/show.js +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -define(["qpid/common/util", "qpid/common/metadata", "dojo/domReady!"], - function (util, metadata) - { - - function SimpleLdapAuthenticationProvider(data) - { - this.fields = []; - var attributes = metadata.getMetaData("AuthenticationProvider", "SimpleLDAP").attributes; - for(var name in attributes) - { - this.fields.push(name); - } - util.buildUI(data.containerNode, data.parent, "authenticationprovider/simpleldap/show.html", this.fields, this); - data.parent.editButton.set("disabled", false); - } - - SimpleLdapAuthenticationProvider.prototype.update = function(data) - { - util.updateUI(data, this.fields, this); - } - - return SimpleLdapAuthenticationProvider; - } -); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/controller.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/controller.js deleted file mode 100644 index 4b8e9db4b0..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/controller.js +++ /dev/null @@ -1,140 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define(["dojo/dom", - "dijit/registry", - "dijit/layout/ContentPane", - "dijit/form/CheckBox", - "qpid/management/UserPreferences", - "dojox/html/entities", - "qpid/management/Broker", - "qpid/management/VirtualHost", - "qpid/management/Exchange", - "qpid/management/Queue", - "qpid/management/Connection", - "qpid/management/AuthenticationProvider", - "qpid/management/GroupProvider", - "qpid/management/group/Group", - "qpid/management/KeyStore", - "qpid/management/TrustStore", - "qpid/management/AccessControlProvider", - "qpid/management/Port", - "qpid/management/Plugin", - "qpid/management/logs/LogViewer", - "qpid/management/PreferencesProvider", - "qpid/management/VirtualHostNode", - "dojo/ready", - "dojo/domReady!"], - function (dom, registry, ContentPane, CheckBox, UserPreferences, entities, Broker, VirtualHost, Exchange, Queue, Connection, AuthProvider, - GroupProvider, Group, KeyStore, TrustStore, AccessControlProvider, Port, Plugin, LogViewer, PreferencesProvider, VirtualHostNode, ready) { - var controller = {}; - - var constructors = { broker: Broker, virtualhost: VirtualHost, exchange: Exchange, - queue: Queue, connection: Connection, - authenticationprovider: AuthProvider, groupprovider: GroupProvider, - group: Group, keystore: KeyStore, truststore: TrustStore, - accesscontrolprovider: AccessControlProvider, port: Port, - plugin: Plugin, logViewer: LogViewer, preferencesprovider: PreferencesProvider, - virtualhostnode: VirtualHostNode}; - - var tabDiv = dom.byId("managedViews"); - - ready(function() { - controller.tabContainer = registry.byId("managedViews"); - }); - - - controller.viewedObjects = {}; - - controller.show = function(objType, name, parent, objectId) { - - function generateName(obj) - { - if(obj) { - var name = obj.type + (obj.type == "broker" ? "" : ":" + obj.name); - if (obj.parent) - { - name = generateName(obj.parent) + "/" + name; - } - return name; - } - return ""; - } - - var that = this; - var objId = (parent ? generateName(parent) + "/" : "") + objType + ":" + name; - - var obj = this.viewedObjects[ objId ]; - if(obj) { - this.tabContainer.selectChild(obj.contentPane); - } else { - var Constructor = constructors[ objType ]; - if(Constructor) { - obj = new Constructor(name, parent, this); - obj.tabData = { - objectId: objectId, - objectType: objType - }; - this.viewedObjects[ objId ] = obj; - - var contentPane = new ContentPane({ region: "center" , - title: entities.encode(obj.getTitle()), - closable: true, - onClose: function() { - obj.close(); - delete that.viewedObjects[ objId ]; - return true; - } - }); - this.tabContainer.addChild( contentPane ); - if (objType != "broker") - { - var preferencesCheckBox = new dijit.form.CheckBox({ - checked: UserPreferences.isTabStored(obj.tabData), - title: "If checked the tab is saved in user preferences and restored on next login" - }); - var tabs = this.tabContainer.tablist.getChildren(); - preferencesCheckBox.placeAt(tabs[tabs.length-1].titleNode, "first"); - preferencesCheckBox.on("change", function(value){ - if (value) - { - UserPreferences.appendTab(obj.tabData); - } - else - { - UserPreferences.removeTab(obj.tabData); - } - }); - } - obj.open(contentPane); - contentPane.startup(); - if(obj.startup) { - obj.startup(); - } - this.tabContainer.selectChild( contentPane ); - } - - } - - }; - - - return controller; - }); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/editBroker.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/editBroker.js deleted file mode 100644 index 66eb907c69..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/editBroker.js +++ /dev/null @@ -1,188 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define(["dojo/_base/xhr", - "dojox/html/entities", - "dojo/_base/array", - "dojo/_base/event", - "dojo/_base/lang", - "dojo/_base/window", - "dojo/dom", - "dojo/dom-construct", - "dijit/registry", - "dojo/parser", - 'dojo/json', - "dojo/query", - "dojo/store/Memory", - "dojo/data/ObjectStore", - "qpid/common/util", - "dojo/text!editBroker.html", - "qpid/common/ContextVariablesEditor", - "dijit/Dialog", - "dijit/form/CheckBox", - "dijit/form/FilteringSelect", - "dijit/form/ValidationTextBox", - "dijit/form/Button", - "dijit/form/Form", - "dojox/validate/us", - "dojox/validate/web", - "dojo/domReady!"], - function (xhr, entities, array, event, lang, win, dom, domConstruct, registry, parser, json, query, Memory, ObjectStore, util, template) - { - var fields = [ "name", "defaultVirtualHost", "statisticsReportingPeriod", "statisticsReportingResetEnabled", "connection.sessionCountLimit", "connection.heartBeatDelay"]; - var numericFieldNames = ["statisticsReportingPeriod", "connection.sessionCountLimit", "connection.heartBeatDelay"]; - - var brokerEditor = - { - init: function() - { - var that=this; - this.containerNode = domConstruct.create("div", {innerHTML: template}); - parser.parse(this.containerNode).then(function(instances){ that._postParse();}); - }, - _postParse: function() - { - var that=this; - this.dialog = registry.byId("editBrokerDialog"); - this.saveButton = registry.byId("editBroker.saveButton"); - this.cancelButton = registry.byId("editBroker.cancelButton"); - this.cancelButton.on("click", function(e){that._cancel(e);}); - this.saveButton.on("click", function(e){that._save(e);}); - for(var i = 0; i < fields.length; i++) - { - var fieldName = fields[i]; - this[fieldName] = registry.byId("editBroker." + fieldName); - } - this.form = registry.byId("editBrokerForm"); - this.form.on("submit", function(){return false;}); - this.context = registry.byId("editBroker.context"); - util.applyMetadataToWidgets(dom.byId("editBroker.allFields"), "Broker", "broker"); - - for(var i = 0; i < numericFieldNames.length; i++) - { - this[numericFieldNames[i]].set("regExpGen", util.numericOrContextVarRegexp); - } - }, - show: function(brokerData) - { - var that=this; - this.query = "api/latest/broker"; - this.dialog.set("title", "Edit Broker - " + entities.encode(String(brokerData.name))); - xhr.get( - { - url: this.query, - sync: true, - content: { actuals: true }, - handleAs: "json", - load: function(data) - { - that._show(data[0], brokerData); - } - } - ); - }, - destroy: function() - { - if (this.dialog) - { - this.dialog.destroyRecursive(); - this.dialog = null; - } - - if (this.containerNode) - { - domConstruct.destroy(this.containerNode); - this.containerNode = null; - } - }, - _cancel: function(e) - { - this.dialog.hide(); - }, - _save: function(e) - { - event.stop(e); - if(this.form.validate()) - { - var data = util.getFormWidgetValues(this.form, this.initialData); - var context = this.context.get("value"); - if (context && !util.equals(context, this.initialData.context)) - { - data["context"] = context; - } - - var that = this; - util.post(this.query, data, function(x){that.dialog.hide()}) - } - else - { - alert('Form contains invalid data. Please correct first'); - } - }, - _show:function(actualData, effectiveData) - { - this.initialData = actualData; - var nodes = effectiveData.virtualhostnodes - var data = []; - if (nodes) - { - for (var i=0; i< nodes.length; i++) - { - if (nodes[i].virtualhosts) - { - data.push({id: nodes[i].virtualhosts[0].name, name: nodes[i].virtualhosts[0].name}); - } - } - } - var hostsStore = new dojo.store.Memory({ data: data }); - this["defaultVirtualHost"].set("store", hostsStore); - - - for(var i = 0; i < fields.length; i++) - { - var fieldName = fields[i]; - var widget = this[fieldName]; - widget.reset(); - - if (widget instanceof dijit.form.CheckBox) - { - widget.set("checked", actualData[fieldName]); - } - else - { - widget.set("value", actualData[fieldName]); - } - } - this.context.load(this.query, {actualValues: actualData.context, effectiveValues: effectiveData.context}); - this.dialog.startup(); - this.dialog.show(); - if (!this.resizeEventRegistered) - { - this.resizeEventRegistered = true; - util.resizeContentAreaAndRepositionDialog(dom.byId("editBroker.contentPane"), this.dialog); - } - } - }; - - brokerEditor.init(); - - return brokerEditor; - } -); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/editQueue.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/editQueue.js deleted file mode 100644 index cf3f171536..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/editQueue.js +++ /dev/null @@ -1,219 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define(["dojo/_base/xhr", - "dojox/html/entities", - "dojo/_base/array", - "dojo/_base/event", - "dojo/_base/lang", - "dojo/_base/window", - "dojo/dom", - "dojo/dom-construct", - "dijit/registry", - "dojo/parser", - 'dojo/json', - "dojo/query", - "qpid/common/util", - "dojo/text!editQueue.html", - "qpid/common/ContextVariablesEditor", - "dijit/Dialog", - "dijit/form/CheckBox", - "dijit/form/FilteringSelect", - "dijit/form/ValidationTextBox", - "dijit/form/Button", - "dijit/form/Form", - "dojox/validate/us", - "dojox/validate/web", - "dojo/domReady!"], - function (xhr, entities, array, event, lang, win, dom, domConstruct, registry, parser, json, query, util, template) - { - var fields = ["name", - "type", - "durable", - "messageDurability", - "maximumMessageTtl", - "minimumMessageTtl", - "queueFlowControlSizeBytes", - "queueFlowResumeSizeBytes", - "alertThresholdQueueDepthMessages", - "alertThresholdQueueDepthBytes", - "alertThresholdMessageAge", - "alertThresholdMessageSize", - "alertRepeatGap", - "maximumDeliveryAttempts", - "priorities", - "lvqKey", - "sortKey"]; - - var numericFieldNames = ["maximumMessageTtl", - "minimumMessageTtl", - "queueFlowControlSizeBytes", - "queueFlowResumeSizeBytes", - "alertThresholdQueueDepthMessages", - "alertThresholdQueueDepthBytes", - "alertThresholdMessageAge", - "alertThresholdMessageSize", - "alertRepeatGap", - "maximumDeliveryAttempts"]; - - var queueEditor = - { - init: function() - { - var that=this; - this.containerNode = domConstruct.create("div", {innerHTML: template}); - parser.parse(this.containerNode).then(function(instances){ that._postParse();}); - }, - _postParse: function() - { - var that=this; - this.allFieldsContainer = dom.byId("formEditQueue.allFields"); - this.dialog = registry.byId("editQueue"); - this.saveButton = registry.byId("formEditQueue.saveButton"); - this.cancelButton = registry.byId("formEditQueue.cancelButton"); - this.cancelButton.on("click", function(e){that._cancel(e);}); - this.saveButton.on("click", function(e){that._save(e);}); - for(var i = 0; i < fields.length; i++) - { - var fieldName = fields[i]; - this[fieldName] = registry.byId("formEditQueue." + fieldName); - } - this.form = registry.byId("formEditQueue"); - this.form.on("submit", function(){return false;}); - this.typeSelector = registry.byId("formEditQueue.type"); - }, - show: function(hostData) - { - var that=this; - if (!this.context) - { - this.context = new qpid.common.ContextVariablesEditor({name: 'context', title: 'Context variables'}); - this.context.placeAt(dom.byId("formEditQueue.context")); - } - this.query = "api/latest/queue/" + encodeURIComponent(hostData.nodeName) + "/" + encodeURIComponent(hostData.hostName) + "/" + encodeURIComponent(hostData.queueName); - this.dialog.set("title", "Edit Queue - " + entities.encode(String(hostData.queueName))); - xhr.get( - { - url: this.query, - sync: true, - content: { actuals: true }, - handleAs: "json", - load: function(data) - { - that._show(data[0], hostData); - } - } - ); - var queueType = this.typeSelector.get("value"); - query(".typeSpecificDiv").forEach(function(node, index, arr){ - if (node.id === "formEditQueueType:" + queueType) - { - node.style.display = "block"; - util.applyMetadataToWidgets(node, "Queue", queueType); - } - else - { - node.style.display = "none"; - } - }); - }, - destroy: function() - { - if (this.dialog) - { - this.dialog.destroyRecursive(); - this.dialog = null; - } - - if (this.containerNode) - { - domConstruct.destroy(this.containerNode); - this.containerNode = null; - } - }, - _cancel: function(e) - { - this.dialog.hide(); - }, - _save: function(e) - { - event.stop(e); - if(this.form.validate()) - { - var data = util.getFormWidgetValues(this.form, this.initialData); - var context = this.context.get("value"); - if (context && !util.equals(context, this.initialData.context)) - { - data["context"] = context; - } - var that = this; - util.post(this.query, data, function(x){that.dialog.hide()}); - } - else - { - alert('Form contains invalid data. Please correct first'); - } - }, - _show:function(actualData, effectiveData) - { - - this.initialData = actualData; - for(var i = 0; i < fields.length; i++) - { - var fieldName = fields[i]; - var widget = this[fieldName]; - widget.reset(); - - if (widget instanceof dijit.form.CheckBox) - { - widget.set("checked", actualData[fieldName]); - } - else - { - widget.set("value", actualData[fieldName]); - } - } - - var that = this; - util.applyMetadataToWidgets(that.allFieldsContainer, "Queue", actualData.type); - - this.context.load(this.query, {actualValues:actualData.context, effectiveValues:effectiveData.context}); - - // Add regexp to the numeric fields - for(var i = 0; i < numericFieldNames.length; i++) - { - this[numericFieldNames[i]].set("regExpGen", util.numericOrContextVarRegexp); - } - - this.dialog.startup(); - this.dialog.show(); - if (!this.resizeEventRegistered) - { - this.resizeEventRegistered = true; - util.resizeContentAreaAndRepositionDialog(dom.byId("formEditQueue.contentPane"), this.dialog); - } - } - }; - - queueEditor.init(); - - return queueEditor; - } -); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/editVirtualHost.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/editVirtualHost.js deleted file mode 100644 index cf038826ae..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/editVirtualHost.js +++ /dev/null @@ -1,207 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define(["dojo/_base/xhr", - "dojox/html/entities", - "dojo/_base/array", - "dojo/_base/event", - "dojo/_base/lang", - "dojo/_base/window", - "dojo/dom", - "dojo/dom-construct", - "dijit/registry", - "dojo/parser", - 'dojo/json', - "dojo/query", - "dojo/store/Memory", - "dojo/data/ObjectStore", - "qpid/common/util", - "dojo/text!editVirtualHost.html", - "qpid/common/ContextVariablesEditor", - "dijit/Dialog", - "dijit/form/CheckBox", - "dijit/form/FilteringSelect", - "dijit/form/ValidationTextBox", - "dijit/form/Button", - "dijit/form/Form", - "dojox/validate/us", - "dojox/validate/web", - "dojo/domReady!"], - function (xhr, entities, array, event, lang, win, dom, domConstruct, registry, parser, json, query, Memory, ObjectStore, util, template) - { - var fields = [ "name", "queue.deadLetterQueueEnabled", "storeTransactionIdleTimeoutWarn", "storeTransactionIdleTimeoutClose", "storeTransactionOpenTimeoutWarn", "storeTransactionOpenTimeoutClose", "housekeepingCheckPeriod", "housekeepingThreadCount"]; - var numericFieldNames = ["storeTransactionIdleTimeoutWarn", "storeTransactionIdleTimeoutClose", "storeTransactionOpenTimeoutWarn", "storeTransactionOpenTimeoutClose", "housekeepingCheckPeriod", "housekeepingThreadCount"]; - - - var virtualHostEditor = - { - init: function() - { - var that=this; - this.containerNode = domConstruct.create("div", {innerHTML: template}); - parser.parse(this.containerNode).then(function(instances){ that._postParse();}); - }, - _postParse: function() - { - var that=this; - this.allFieldsContainer = dom.byId("editVirtualHost.allFields"); - this.typeFieldsContainer = dom.byId("editVirtualHost.typeFields"); - this.dialog = registry.byId("editVirtualHostDialog"); - this.saveButton = registry.byId("editVirtualHost.saveButton"); - this.cancelButton = registry.byId("editVirtualHost.cancelButton"); - this.cancelButton.on("click", function(e){that._cancel(e);}); - this.saveButton.on("click", function(e){that._save(e);}); - for(var i = 0; i < fields.length; i++) - { - var fieldName = fields[i]; - this[fieldName] = registry.byId("editVirtualHost." + fieldName); - } - this.form = registry.byId("editVirtualHostForm"); - this.form.on("submit", function(){return false;}); - }, - show: function(hostData) - { - var that=this; - if (!this.context) - { - this.context = new qpid.common.ContextVariablesEditor({name: 'context', title: 'Context variables'}); - this.context.placeAt(dom.byId("editVirtualHost.context")); - } - this.query = "api/latest/virtualhost/" + encodeURIComponent(hostData.nodeName) + "/" + encodeURIComponent(hostData.hostName); - this.dialog.set("title", "Edit Virtual Host - " + entities.encode(String(hostData.hostName))); - xhr.get( - { - url: this.query, - sync: true, - content: { actuals: true }, - handleAs: "json", - load: function(data) - { - that._show(data[0], hostData); - } - } - ); - }, - destroy: function() - { - if (this.dialog) - { - this.dialog.destroyRecursive(); - this.dialog = null; - } - - if (this.containerNode) - { - domConstruct.destroy(this.containerNode); - this.containerNode = null; - } - }, - _cancel: function(e) - { - this.dialog.hide(); - }, - _save: function(e) - { - event.stop(e); - if(this.form.validate()) - { - var data = util.getFormWidgetValues(this.form, this.initialData); - var context = this.context.get("value"); - if (context && !util.equals(context, this.initialData.context)) - { - data["context"] = context; - } - var that=this; - util.post(this.query, data, function(x){ that.dialog.hide();} ); - } - else - { - alert('Form contains invalid data. Please correct first'); - } - }, - _show:function(actualData, effectiveData) - { - - this.initialData = actualData; - for(var i = 0; i < fields.length; i++) - { - var fieldName = fields[i]; - var widget = this[fieldName]; - widget.reset(); - - if (widget instanceof dijit.form.CheckBox) - { - widget.set("checked", actualData[fieldName]); - } - else - { - widget.set("value", actualData[fieldName]); - } - } - - this.context.load(this.query, {actualValues:actualData.context, effectiveValues:effectiveData.context}); - - // Add regexp to the numeric fields - for(var i = 0; i < numericFieldNames.length; i++) - { - this[numericFieldNames[i]].set("regExpGen", util.numericOrContextVarRegexp); - } - - var that = this; - - var widgets = registry.findWidgets(this.typeFieldsContainer); - array.forEach(widgets, function(item) { item.destroyRecursive();}); - domConstruct.empty(this.typeFieldsContainer); - - require(["qpid/management/virtualhost/" + actualData.type.toLowerCase() + "/edit"], - function(TypeUI) - { - try - { - TypeUI.show({containerNode:that.typeFieldsContainer, parent: that, data: actualData}); - that.form.connectChildren(); - - util.applyToWidgets(that.allFieldsContainer, "VirtualHost", actualData.type, actualData); - } - catch(e) - { - if (console && console.warn ) - { - console.warn(e); - } - } - } - ); - - this.dialog.startup(); - this.dialog.show(); - if (!this.resizeEventRegistered) - { - this.resizeEventRegistered = true; - util.resizeContentAreaAndRepositionDialog(dom.byId("editVirtualHost.contentPane"), this.dialog); - } - } - }; - - virtualHostEditor.init(); - - return virtualHostEditor; - } -); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/editVirtualHostNode.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/editVirtualHostNode.js deleted file mode 100644 index c9dc9d2029..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/editVirtualHostNode.js +++ /dev/null @@ -1,177 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define(["dojo/_base/xhr", - "dojox/html/entities", - "dojo/_base/array", - "dojo/_base/event", - "dojo/_base/lang", - "dojo/_base/window", - "dojo/dom", - "dojo/dom-construct", - "dijit/registry", - "dojo/parser", - 'dojo/json', - "dojo/query", - "dojo/store/Memory", - "dojo/data/ObjectStore", - "qpid/common/util", - "dojo/text!editVirtualHostNode.html", - "qpid/common/ContextVariablesEditor", - "dijit/Dialog", - "dijit/form/CheckBox", - "dijit/form/FilteringSelect", - "dijit/form/ValidationTextBox", - "dijit/form/Button", - "dijit/form/Form", - "dojox/validate/us", - "dojox/validate/web", - "dojo/domReady!"], - function (xhr, entities, array, event, lang, win, dom, domConstruct, registry, parser, json, query, Memory, ObjectStore, util, template) - { - var virtualHostNodeEditor = - { - init: function() - { - var that=this; - this.containerNode = domConstruct.create("div", {innerHTML: template}); - parser.parse(this.containerNode).then(function(instances){ that._postParse();}); - }, - _postParse: function() - { - var that=this; - this.allFieldsContainer = dom.byId("editVirtualHostNode.allFields"); - this.typeFieldsContainer = dom.byId("editVirtualHostNode.typeFields"); - this.dialog = registry.byId("editVirtualHostNodeDialog"); - this.saveButton = registry.byId("editVirtualHostNode.saveButton"); - this.cancelButton = registry.byId("editVirtualHostNode.cancelButton"); - this.cancelButton.on("click", function(e){that._cancel(e);}); - this.saveButton.on("click", function(e){that._save(e);}); - this.name = registry.byId("editVirtualHostNode.name"); - this.form = registry.byId("editVirtualHostNodeForm"); - this.form.on("submit", function(){return false;}); - }, - show: function(effectiveData) - { - var that=this; - if (!this.context) - { - this.context = new qpid.common.ContextVariablesEditor({name: 'context', title: 'Context variables'}); - this.context.placeAt(dom.byId("editVirtualHostNode.context")); - } - this.query = "api/latest/virtualhostnode/" + encodeURIComponent(effectiveData.name); - this.dialog.set("title", "Edit Virtual Host Node - " + entities.encode(String(effectiveData.name))); - xhr.get( - { - url: this.query, - sync: true, - content: { actuals: true }, - handleAs: "json", - load: function(data) - { - that._show(data[0], effectiveData); - } - } - ); - }, - destroy: function() - { - if (this.dialog) - { - this.dialog.destroyRecursive(); - this.dialog = null; - } - - if (this.containerNode) - { - domConstruct.destroy(this.containerNode); - this.containerNode = null; - } - }, - _cancel: function(e) - { - this.dialog.hide(); - }, - _save: function(e) - { - event.stop(e); - if(this.form.validate()) - { - var data = util.getFormWidgetValues(this.form, this.initialData); - var context = this.context.get("value"); - if (context && !util.equals(context, this.initialData.context)) - { - data["context"] = context; - } - var that = this; - util.post(this.query, data, function(x){ that.dialog.hide();} ); - } - else - { - alert('Form contains invalid data. Please correct first'); - } - }, - _show:function(actualData, effectiveData) - { - this.initialData = actualData; - this.name.set("value", actualData.name); - this.context.load( this.query, {actualValues: actualData.context, effectiveValues: effectiveData.context}); - - var that = this; - - var widgets = registry.findWidgets(this.typeFieldsContainer); - array.forEach(widgets, function(item) { item.destroyRecursive();}); - domConstruct.empty(this.typeFieldsContainer); - - require(["qpid/management/virtualhostnode/" + actualData.type.toLowerCase() + "/edit"], - function(TypeUI) - { - try - { - TypeUI.show({containerNode:that.typeFieldsContainer, parent: that, data: actualData, effectiveData: effectiveData}); - that.form.connectChildren(); - - util.applyToWidgets(that.allFieldsContainer, "VirtualHostNode", actualData.type, actualData); - } - catch(e) - { - if (console && console.warn ) - { - console.warn(e); - } - } - } - ); - - this.dialog.startup(); - this.dialog.show(); - if (!this.resizeEventRegistered) - { - this.resizeEventRegistered = true; - util.resizeContentAreaAndRepositionDialog(dom.byId("editVirtualHostNode.contentPane"), this.dialog); - } - } - }; - - virtualHostNodeEditor.init(); - - return virtualHostNodeEditor; - } -); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/group/Group.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/group/Group.js deleted file mode 100644 index 7832941e71..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/group/Group.js +++ /dev/null @@ -1,204 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define(["dojo/_base/xhr", - "dojo/parser", - "dojo/query", - "dijit/registry", - "dojo/_base/connect", - "dojo/_base/event", - "dojo/json", - "qpid/common/properties", - "qpid/common/updater", - "qpid/common/util", - "qpid/common/formatter", - "qpid/common/UpdatableStore", - "dojo/store/JsonRest", - "dojox/grid/EnhancedGrid", - "dojo/data/ObjectStore", - "qpid/management/group/addGroupMember", - "dojox/html/entities", - "dojox/grid/enhanced/plugins/Pagination", - "dojox/grid/enhanced/plugins/IndirectSelection", - "dojo/domReady!"], - function (xhr, parser, query, registry, connect, event, json, properties, updater, util, formatter, - UpdatableStore, JsonRest, EnhancedGrid, ObjectStore, addGroupMember, entities) { - - function Group(name, parent, controller) { - this.name = name; - this.controller = controller; - this.modelObj = { type: "group", name: name }; - - if(parent) { - this.modelObj.parent = {}; - this.modelObj.parent[ parent.type] = parent; - } - } - - Group.prototype.getGroupName = function() - { - return this.name; - }; - - - Group.prototype.getGroupProviderName = function() - { - return this.modelObj.parent.groupprovider.name; - }; - - Group.prototype.getTitle = function() - { - return "Group: " + this.name; - }; - - Group.prototype.open = function(contentPane) { - var that = this; - this.contentPane = contentPane; - - xhr.get({url: "group/showGroup.html", - sync: true, - load: function(data) { - contentPane.containerNode.innerHTML = data; - parser.parse(contentPane.containerNode).then(function(instances) - { - that.groupUpdater = new GroupUpdater(contentPane.containerNode, that, that.controller); - that.groupUpdater.update(); - updater.add( that.groupUpdater ); - - var addGroupMemberButton = query(".addGroupMemberButton", contentPane.containerNode)[0]; - connect.connect(registry.byNode(addGroupMemberButton), "onClick", - function(evt){ - addGroupMember.show(that.getGroupProviderName(), that.getGroupName()) - } - ); - - var removeGroupMemberButton = query(".removeGroupMemberButton", contentPane.containerNode)[0]; - connect.connect(registry.byNode(removeGroupMemberButton), "onClick", - function(evt){ - util.deleteGridSelections( - that.groupUpdater, - that.groupUpdater.groupMembersUpdatableStore.grid, - "api/latest/groupmember/"+ encodeURIComponent(that.getGroupProviderName()) + - "/" + encodeURIComponent(that.getGroupName()), - "Are you sure you want to remove group member"); - } - ); - }); - }}); - }; - - Group.prototype.close = function() { - updater.remove( this.groupUpdater ); - }; - - function GroupUpdater(containerNode, groupObj, controller) - { - var that = this; - - function findNode(name) { - return query("." + name, containerNode)[0]; - } - - function storeNodes(names) - { - for(var i = 0; i < names.length; i++) { - that[names[i]] = findNode(names[i]); - } - } - - storeNodes(["name", - "state", - "durable", - "lifetimePolicy", - "type"]); - this.name.innerHTML = entities.encode(String(groupObj.getGroupName())); - this.query = "api/latest/groupmember/"+ encodeURIComponent(groupObj.getGroupProviderName()) + "/" + encodeURIComponent(groupObj.getGroupName()); - - xhr.get({url: this.query, sync: properties.useSyncGet, handleAs: "json"}).then(function(data) - { - that.groupMemberData = data; - - util.flattenStatistics( that.groupMemberData ); - - var gridProperties = { - keepSelection: true, - plugins: { - pagination: { - pageSizes: ["10", "25", "50", "100"], - description: true, - sizeSwitch: true, - pageStepper: true, - gotoButton: true, - maxPageStep: 4, - position: "bottom" - }, - indirectSelection: true - - }}; - - that.groupMembersUpdatableStore = new UpdatableStore(that.groupMemberData, findNode("groupMembers"), - [ { name: "Group Member Name", field: "name", width: "100%" }], - function(obj) - { - connect.connect(obj.grid, "onRowDblClick", obj.grid, - function(evt){ - - }); - } , gridProperties, EnhancedGrid); - - }); - - } - - GroupUpdater.prototype.update = function() - { - - var that = this; - - xhr.get({url: this.query, sync: properties.useSyncGet, handleAs: "json"}) - .then(function(data) { - that.groupMemberData = data; - - util.flattenStatistics( that.groupMemberData ); - - that.groupMembersUpdatableStore.update(that.groupMemberData); - }); - }; - - Group.prototype.deleteGroupMember = function() { - if(confirm("Are you sure you want to delete group member'" +this.name+"'?")) { - var query = "api/latest/groupmember/"+ encodeURIComponent(this.getGroupProviderName()) + "/" + encodeURIComponent(this.name); - this.success = true - var that = this; - xhr.del({url: query, sync: true, handleAs: "json"}).then( - function(data) { - that.contentPane.onClose() - that.controller.tabContainer.removeChild(that.contentPane); - that.contentPane.destroyRecursive(); - }, - function(error) {that.success = false; that.failureReason = error;}); - if(!this.success ) { - util.xhrErrorHandler(this.failureReason); - } - } - } - - return Group; - }); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/group/addGroupMember.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/group/addGroupMember.js deleted file mode 100644 index e653eb8ac1..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/group/addGroupMember.js +++ /dev/null @@ -1,97 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define(["dojo/_base/xhr", - "dojo/dom", - "dojo/dom-construct", - "dojo/_base/window", - "dijit/registry", - "dojo/parser", - "dojo/_base/array", - "dojo/_base/event", - "dojo/_base/json", - "qpid/common/util", - "dijit/form/NumberSpinner", // required by the form - /* dojox/ validate resources */ - "dojox/validate/us", "dojox/validate/web", - /* basic dijit classes */ - "dijit/Dialog", - "dijit/form/CheckBox", "dijit/form/Textarea", - "dijit/form/FilteringSelect", "dijit/form/TextBox", - "dijit/form/ValidationTextBox", "dijit/form/DateTextBox", - "dijit/form/TimeTextBox", "dijit/form/Button", - "dijit/form/RadioButton", "dijit/form/Form", - "dijit/form/DateTextBox", - /* basic dojox classes */ - "dojox/form/BusyButton", "dojox/form/CheckedMultiSelect", - "dojo/domReady!"], - function (xhr, dom, construct, win, registry, parser, array, event, json, util) { - - var addGroupMember = {}; - - var node = construct.create("div", null, win.body(), "last"); - - var convertToGroupMember = function convertToGroupMember(formValues) - { - var newGroupMember = {}; - newGroupMember.name = formValues.name; - return newGroupMember; - }; - - xhr.get({url: "group/addGroupMember.html", - sync: true, - load: function(data) { - var theForm; - node.innerHTML = data; - addGroupMember.dialogNode = dom.byId("addGroupMember"); - parser.instantiate([addGroupMember.dialogNode]); - - theForm = registry.byId("formAddGroupMember"); - theForm.on("submit", function(e) { - - event.stop(e); - if(theForm.validate()){ - - var newGroupMember = convertToGroupMember(theForm.getValues()); - var that = this; - - var url = "api/latest/groupmember/"+encodeURIComponent(addGroupMember.groupProvider) + - "/" + encodeURIComponent(addGroupMember.group); - util.post(url, newGroupMember, function(x){registry.byId("addGroupMember").hide();}); - return false; - - - }else{ - alert('Form contains invalid data. Please correct first'); - return false; - } - - }); - }}); - - addGroupMember.show = function(groupProvider, group) { - addGroupMember.groupProvider = groupProvider; - addGroupMember.group = group; - registry.byId("formAddGroupMember").reset(); - registry.byId("addGroupMember").show(); - }; - - return addGroupMember; - });
\ No newline at end of file diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/groupprovider/GroupManagingGroupProvider.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/groupprovider/GroupManagingGroupProvider.js deleted file mode 100644 index 418e04d34c..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/groupprovider/GroupManagingGroupProvider.js +++ /dev/null @@ -1,196 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define(["dojo/_base/xhr", - "dojo/dom", - "dojo/parser", - "dojo/query", - "dojo/dom-construct", - "dojo/_base/connect", - "dojo/_base/window", - "dojo/_base/event", - "dojo/_base/json", - "dijit/registry", - "dojox/html/entities", - "qpid/common/util", - "qpid/common/properties", - "qpid/common/updater", - "qpid/common/UpdatableStore", - "dojox/grid/EnhancedGrid", - "dojo/text!groupprovider/showGroupManagingGroupProvider.html", - "dojox/grid/enhanced/plugins/Pagination", - "dojox/grid/enhanced/plugins/IndirectSelection", - "dojox/validate/us", "dojox/validate/web", - "dijit/Dialog", - "dijit/form/TextBox", - "dijit/form/ValidationTextBox", - "dijit/form/TimeTextBox", "dijit/form/Button", - "dijit/form/Form", - "dijit/form/DateTextBox", - "dojo/domReady!"], - function (xhr, dom, parser, query, construct, connect, win, event, json, registry, entities, util, properties, - updater, UpdatableStore, EnhancedGrid, template) - { - function GroupManagingGroupProvider(containerNode, groupProviderObj, controller) - { - var node = construct.create("div", null, containerNode, "last"); - var that = this; - this.name = groupProviderObj.name; - node.innerHTML = template; - this.controller = controller; - parser.parse(node).then(function(instances) - { - var groupDiv = query(".groups", node)[0]; - - var gridProperties = { - height: 400, - keepSelection: true, - plugins: { - pagination: { - pageSizes: [10, 25, 50, 100], - description: true, - sizeSwitch: true, - pageStepper: true, - gotoButton: true, - maxPageStep: 4, - position: "bottom" - }, - indirectSelection: true - - }}; - that.groupsGrid = new UpdatableStore([], groupDiv, - [ { name: "Group Name", field: "name", width: "100%" } - ], function(obj) { - connect.connect(obj.grid, "onRowDblClick", obj.grid, - function(evt){ - var idx = evt.rowIndex, - theItem = this.getItem(idx); - var name = obj.dataStore.getValue(theItem,"name"); - that.controller.show("group", name, groupProviderObj, theItem.id); - }); - }, gridProperties, EnhancedGrid); - var addGroupButton = query(".addGroupButton", node)[0]; - registry.byNode(addGroupButton).on("click", function(evt){ addGroup.show(groupProviderObj.name) }); - var deleteWidget = registry.byNode(query(".deleteGroupButton", node)[0]); - deleteWidget.on("click", function(evt){ event.stop(evt); that.deleteGroups(); }); - }); - } - - GroupManagingGroupProvider.prototype.deleteGroups = function() - { - var grid = this.groupsGrid.grid; - var data = grid.selection.getSelected(); - if(data.length) { - var that = this; - if(confirm("Delete " + data.length + " groups?")) { - var i, queryParam; - for(i = 0; i<data.length; i++) { - if(queryParam) { - queryParam += "&"; - } else { - queryParam = "?"; - } - - queryParam += "id=" + data[i].id; - } - var query = "api/latest/group/"+ encodeURIComponent(that.name) - + queryParam; - that.success = true - xhr.del({url: query, sync: true, handleAs: "json"}).then( - function(data) { - grid.setQuery({id: "*"}); - grid.selection.deselectAll(); - that.update(); - }, - function(error) {that.success = false; that.failureReason = error;}); - if(!that.success ) { - util.xhrErrorHandler(this.failureReason); - } - } -} - }; - - GroupManagingGroupProvider.prototype.update = function(data) - { - if (data) - { - this.groupsGrid.update(data.groups); - } - }; - - var addGroup = {}; - - var node = construct.create("div", null, win.body(), "last"); - - var convertToGroup = function convertToGroup(formValues) { - var newGroup = {}; - newGroup.name = formValues.name; - for(var propName in formValues) - { - if(formValues.hasOwnProperty(propName)) { - if(formValues[ propName ] !== "") { - newGroup[ propName ] = formValues[propName]; - } - } - } - - return newGroup; - }; - - - xhr.get({url: "groupprovider/addGroup.html", - sync: true, - load: function(data) { - var theForm; - node.innerHTML = data; - addGroup.dialogNode = dom.byId("addGroup"); - parser.instantiate([addGroup.dialogNode]); - - var that = this; - - theForm = registry.byId("formAddGroup"); - theForm.on("submit", function(e) { - - event.stop(e); - if(theForm.validate()){ - - var newGroup = convertToGroup(theForm.getValues()); - - var url = "api/latest/group/"+encodeURIComponent(addGroup.groupProvider); - util.post(url, newGroup, function(x){registry.byId("addGroup").hide();}); - return false; - - - }else{ - alert('Form contains invalid data. Please correct first'); - return false; - } - - }); - }}); - - addGroup.show = function(groupProvider) { - addGroup.groupProvider = groupProvider; - registry.byId("formAddGroup").reset(); - registry.byId("addGroup").show(); - }; - - return GroupManagingGroupProvider; - }); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/groupprovider/groupfile/add.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/groupprovider/groupfile/add.js deleted file mode 100644 index 6543d6a797..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/groupprovider/groupfile/add.js +++ /dev/null @@ -1,40 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define(["dojo/dom","dojo/query", "dojo/_base/array", "dijit/registry","qpid/common/util", "qpid/common/metadata"], - function (dom, query, array, registry, util, metadata) - { - - return { show: function(data) - { - var that=this; - util.parseHtmlIntoDiv(data.containerNode, "groupprovider/groupfile/add.html", - function() - { - if (data.data) - { - var pathWidget = registry.byNode(query(".addGroupProviderPath", data.containerNode)[0]); - pathWidget.set("value", data.data.path); - } - }); - } - }; - } -); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/groupprovider/groupfile/show.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/groupprovider/groupfile/show.js deleted file mode 100644 index a559140898..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/groupprovider/groupfile/show.js +++ /dev/null @@ -1,37 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define(["qpid/common/util", "dojo/domReady!"], - function (util, metadata) - { - - function GroupFile(data) - { - util.buildUI(data.containerNode, data.parent, "groupprovider/groupfile/show.html", ["path"], this); - } - - GroupFile.prototype.update = function(data) - { - util.updateUI(data, ["path"], this); - } - - return GroupFile; - } -); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/groupprovider/managedgroupprovider/add.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/groupprovider/managedgroupprovider/add.js deleted file mode 100644 index fd8e09dcda..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/groupprovider/managedgroupprovider/add.js +++ /dev/null @@ -1,26 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define([], - function (dom, query, array, registry, util, metadata) - { - return { show: function(data) { /* nothing to do */ } }; - } -); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/groupprovider/managedgroupprovider/show.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/groupprovider/managedgroupprovider/show.js deleted file mode 100644 index ed6a0e155b..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/groupprovider/managedgroupprovider/show.js +++ /dev/null @@ -1,35 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define([], - function () - { - - function ManagedGroupProvider(data) - { - } - - ManagedGroupProvider.prototype.update = function(data) - { - } - - return ManagedGroupProvider; - } -); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/logs/LogFileDownloadDialog.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/logs/LogFileDownloadDialog.js deleted file mode 100644 index c013a88d0a..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/logs/LogFileDownloadDialog.js +++ /dev/null @@ -1,178 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define([ - "dojo/_base/declare", - "dojo/_base/event", - "dojo/_base/xhr", - "dojo/_base/connect", - "dojo/dom-construct", - "dojo/query", - "dojo/parser", - "dojo/store/Memory", - "dojo/data/ObjectStore", - "qpid/management/UserPreferences", - "dojo/number", - "dijit/registry", - "dijit/Dialog", - "dijit/form/Button", - "dojox/grid/EnhancedGrid", - "dojo/text!../../../logs/showLogFileDownloadDialog.html", - "dojo/domReady!" -], function(declare, event, xhr, connect, domConstruct, query, parser, Memory, ObjectStore, UserPreferences, number, - registry, Dialog, Button, EnhancedGrid, template){ - - -return declare("qpid.management.logs.LogFileDownloadDialog", null, { - - templateString: template, - containerNode: null, - widgetsInTemplate: true, - logFileDialog: null, - logFilesGrid: null, - downloadLogsButton: null, - closeButton: null, - - constructor: function(args){ - var that = this; - this.containerNode = domConstruct.create("div", {innerHTML: template}); - parser.parse(this.containerNode).then(function(instances){that._postParse();}); - }, - _postParse: function() - { - var that = this; - this.logFileTreeDiv = query(".logFilesGrid", this.containerNode)[0]; - this.downloadLogsButton = registry.byNode(query(".downloadLogsButton", this.containerNode)[0]); - this.closeButton = registry.byNode(query(".downloadLogsDialogCloseButton", this.containerNode)[0]); - - var self = this; - this.closeButton.on("click", function(e){self._onCloseButtonClick(e);}); - this.downloadLogsButton.on("click", function(e){self._onDownloadButtonClick(e);}); - this.downloadLogsButton.set("disabled", true) - - this.logFileDialog = new Dialog({ - title:"Broker Log Files", - style: "width: 600px", - content: this.containerNode - }); - - var layout = [ - { name: "Appender", field: "appenderName", width: "auto"}, - { name: "Name", field: "name", width: "auto"}, - { name: "Size", field: "size", width: "60px", - formatter: function(val){ - return val > 1024 ? (val > 1048576? number.round(val/1048576) + "MB": number.round(val/1024) + "KB") : val + "bytes"; - } - }, - { name: "Last Modified", field: "lastModified", width: "250px", - formatter: function(val) { - return UserPreferences.formatDateTime(val, {addOffset: true, appendTimeZone: true}); - } - } - ]; - - var gridProperties = { - store: new ObjectStore({objectStore: new Memory({data: [], idProperty: "id"}) }), - structure: layout, - autoHeight: true, - plugins: { - pagination: { - pageSizes: [10, 25, 50, 100], - description: true, - sizeSwitch: true, - pageStepper: true, - gotoButton: true, - maxPageStep: 4, - position: "bottom" - }, - indirectSelection: { - headerSelector:true, - width:"20px", - styles:"text-align: center;" - } - } - }; - - this.logFilesGrid = new EnhancedGrid(gridProperties, this.logFileTreeDiv); - var self = this; - var downloadButtonToggler = function(rowIndex){ - var data = self.logFilesGrid.selection.getSelected(); - self.downloadLogsButton.set("disabled",!data.length ); - }; - connect.connect(this.logFilesGrid.selection, 'onSelected', downloadButtonToggler); - connect.connect(this.logFilesGrid.selection, 'onDeselected', downloadButtonToggler); - }, - - _onCloseButtonClick: function(evt){ - event.stop(evt); - this.logFileDialog.hide(); - }, - - _onDownloadButtonClick: function(evt){ - event.stop(evt); - var data = this.logFilesGrid.selection.getSelected(); - if (data.length) - { - var query = ""; - for(var i = 0 ; i< data.length; i++) - { - if (i>0) - { - query+="&"; - } - query+="l="+encodeURIComponent(data[i].appenderName +'/' + data[i].name); - } - window.location="service/logfile?" + query; - this.logFileDialog.hide(); - } - }, - - destroy: function(){ - this.inherited(arguments); - if (this.logFileDialog) - { - this.logFileDialog.destroyRecursive(); - this.logFileDialog = null; - } - }, - - showDialog: function(){ - var self = this; - var requestArguments = {url: "service/logfilenames", sync: true, handleAs: "json"}; - xhr.get(requestArguments).then(function(data){ - try - { - self.logFilesGrid.store.objectStore.setData(data); - self.logFilesGrid.startup(); - self.logFileDialog.startup(); - self.logFileDialog.show(); - self.logFilesGrid._refresh(); - - } - catch(e) - { - console.error(e); - } - }); - } - - }); - -}); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/logs/LogViewer.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/logs/LogViewer.js deleted file mode 100644 index 4a76110a58..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/logs/LogViewer.js +++ /dev/null @@ -1,228 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define(["dojo/_base/xhr", - "dojo/parser", - "dojo/query", - "dojo/date/locale", - "dijit/registry", - "qpid/management/UserPreferences", - "qpid/common/grid/GridUpdater", - "qpid/common/grid/UpdatableGrid", - "qpid/management/logs/LogFileDownloadDialog", - "dojo/text!../../../logs/showLogViewer.html", - "dojo/domReady!"], - function (xhr, parser, query, locale, registry, UserPreferences, GridUpdater, UpdatableGrid, LogFileDownloadDialog, markup) { - - var defaulGridRowLimit = 4096; - var currentTimeZone; - - function dataTransformer(data) - { - for(var i=0; i < data.length; i++) - { - data[i].time = UserPreferences.addTimeZoneOffsetToUTC(data[i].timestamp); - } - return data; - } - - function LogViewer(name, parent, controller) { - var self = this; - - this.name = name; - this.lastLogId = 0; - this.contentPane = null; - this.downloadLogsButton = null; - this.downloadLogDialog = null; - } - - LogViewer.prototype.getTitle = function() { - return "Log Viewer"; - }; - - LogViewer.prototype.open = function(contentPane) { - var self = this; - this.contentPane = contentPane; - this.contentPane.containerNode.innerHTML = markup; - - parser.parse(this.contentPane.containerNode).then(function(instances){self._postParse();}); - }; - LogViewer.prototype._postParse = function() - { - var self = this; - - this.downloadLogsButton = registry.byNode(query(".downloadLogs", this.contentPane.containerNode)[0]); - this.downloadLogDialog = new LogFileDownloadDialog(); - - this.downloadLogsButton.on("click", function(evt){ - self.downloadLogDialog.showDialog(); - }); - this._buildGrid(); - }; - - LogViewer.prototype._buildGrid = function() { - var self = this; - currentTimeZone = UserPreferences.getTimeZoneDescription(); - - var gridStructure = [ - { - hidden: false, - name: "ID", - field: "id", - width: "50px", - datatype: "number", - filterable: true - }, - { - name: "Date", field: "time", width: "100px", datatype: "date", - formatter: function(val) { - return UserPreferences.formatDateTime(val, {selector:"date"}); - } - }, - { name: "Time ", field: "time", width: "100px", datatype: "time", - formatter: function(val) { - return UserPreferences.formatDateTime(val, {selector:"time"}); - } - }, - { - name: "Time zone", - field: "time", - width: "80px", - datatype: "string", - hidden: true, - filterable: false, - formatter: function(val) { - return currentTimeZone; - } - }, - { name: "Level", field: "level", width: "50px", datatype: "string", autoComplete: true, hidden: true}, - { name: "Logger", field: "logger", width: "150px", datatype: "string", autoComplete: false, hidden: true}, - { name: "Thread", field: "thread", width: "100px", datatype: "string", hidden: true}, - { name: "Log Message", field: "message", width: "auto", datatype: "string"} - ]; - - var gridNode = query("#broker-logfile", this.contentPane.containerNode)[0]; - try - { - var updater = new GridUpdater({ - updatable: false, - serviceUrl: function() - { - return "service/logrecords?lastLogId=" + self.lastLogId; - }, - onUpdate: function(items) - { - if (items) - { - var maxId = -1; - for(var i in items) - { - var item = items[i]; - if (item.id > maxId) - { - maxId = item.id - } - } - if (maxId != -1) - { - self.lastLogId = maxId - } - } - }, - append: true, - appendLimit: defaulGridRowLimit, - dataTransformer: dataTransformer - }); - this.grid = new UpdatableGrid(updater.buildUpdatableGridArguments({ - structure: gridStructure, - selectable: true, - selectionMode: "none", - sortInfo: -1, - sortFields: [{attribute: 'id', descending: true}], - plugins:{ - nestedSorting:true, - enhancedFilter:{defaulGridRowLimit: defaulGridRowLimit,displayLastUpdateTime:true}, - indirectSelection: false, - pagination: {defaultPageSize: 10} - } - }), gridNode); - var onStyleRow = function(row) - { - var item = self.grid.getItem(row.index); - if(item){ - var level = self.grid.store.getValue(item, "level", null); - var changed = false; - if(level == "ERROR"){ - row.customClasses += " redBackground"; - changed = true; - } else if(level == "WARN"){ - row.customClasses += " yellowBackground"; - changed = true; - } else if(level == "DEBUG"){ - row.customClasses += " grayBackground"; - changed = true; - } - if (changed) - { - self.grid.focus.styleRow(row); - } - } - }; - this.grid.on("styleRow", onStyleRow); - this.grid.startup(); - UserPreferences.addListener(this); - } - catch(err) - { - if (console && console.error) - { - console.error(err); - } - } - }; - - LogViewer.prototype.close = function() { - UserPreferences.removeListener(this); - if (this.grid) - { - this.grid.destroy(); - this.grid = null; - } - if (this.downloadLogDialog) - { - this.downloadLogDialog.destroy(); - this.downloadLogDialog = null; - } - if (this.downloadLogsButton) - { - this.downloadLogsButton.destroy(); - this.downloadLogsButton = null; - } - }; - - LogViewer.prototype.onPreferencesChange = function(data) - { - currentTimeZone = UserPreferences.getTimeZoneDescription(); - dataTransformer(this.grid.updater.memoryStore.data); - this.grid._refresh(); - }; - - return LogViewer; - }); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/moveCopyMessages.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/moveCopyMessages.js deleted file mode 100644 index f1afff9c03..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/moveCopyMessages.js +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -define(["dojo/_base/xhr", - "dojo/dom", - "dojo/dom-construct", - "dojo/_base/window", - "dijit/registry", - "dojo/parser", - "dojo/_base/array", - "dojo/_base/event", - 'dojo/_base/json', - "dojo/store/Memory", - "dijit/form/FilteringSelect", - "dojo/query", - "dojo/_base/connect", - "dojo/domReady!"], - function (xhr, dom, construct, win, registry, parser, array, event, json, Memory, FilteringSelect, query, connect) { - - var moveMessages = {}; - - var node = construct.create("div", null, win.body(), "last"); - - xhr.get({url: "moveCopyMessages.html", - sync: true, - load: function(data) { - var theForm; - node.innerHTML = data; - moveMessages.dialogNode = dom.byId("moveMessages"); - parser.instantiate([moveMessages.dialogNode]); - - theForm = registry.byId("formMoveMessages"); - - - var cancelButton = query(".moveMessageCancel")[0]; - connect.connect(registry.byNode(cancelButton), "onClick", - function(evt){ - event.stop(evt); - registry.byId("moveMessages").hide(); - }); - - - theForm.on("submit", function(e) { - - event.stop(e); - if(theForm.validate()){ - - moveMessages.data.destinationQueue = theForm.getValues()["queue"]; - var that = this; - - xhr.post({url: "service/message/"+encodeURIComponent(moveMessages.vhost) - +"/"+encodeURIComponent(moveMessages.queue), - sync: true, handleAs: "json", - headers: { "Content-Type": "application/json"}, - postData: json.toJson(moveMessages.data), - load: function(x) {that.success = true; }, - error: function(error) {that.success = false; that.failureReason = error;}}); - - if(this.success === true) { - registry.byId("moveMessages").hide(); - if(moveMessages.next) { - moveMessages.next(); - } - } else { - alert("Error:" + this.failureReason); - } - - return false; - - - }else{ - alert('Form contains invalid data. Please correct first'); - return false; - } - - }); - - }}); - - moveMessages.show = function(obj, next) { - var that = this; - - moveMessages.vhost = obj.virtualhost; - moveMessages.queue = obj.queue; - moveMessages.data = obj.data; - moveMessages.next = next; - registry.byId("formMoveMessages").reset(); - - - - xhr.get({url: "api/latest/queue/" + encodeURIComponent(obj.virtualhost) + "?depth=0", - handleAs: "json"}).then( - function(data) { - var queues = []; - for(var i=0; i < data.length; i++) { - queues[i] = {id: data[i].name, name: data[i].name}; - } - var queueStore = new Memory({ data: queues }); - - - if(that.queueChooser) { - that.queueChooser.destroy( false ); - } - var queueDiv = dom.byId("moveMessages.selectQueueDiv"); - var input = construct.create("input", {id: "moveMessagesSelectQueue"}, queueDiv); - - that.queueChooser = new FilteringSelect({ id: "moveMessagesSelectQueue", - name: "queue", - store: queueStore, - searchAttr: "name"}, input); - - - - registry.byId("moveMessages").show(); - - - }); - - - }; - - return moveMessages; - }); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/plugin/managementhttp.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/plugin/managementhttp.js deleted file mode 100644 index 4c32cce7cd..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/plugin/managementhttp.js +++ /dev/null @@ -1,185 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define(["dojo/_base/xhr", - "dojo/dom", - "dojo/parser", - "dojo/query", - "dojo/dom-construct", - "dojo/_base/connect", - "dojo/_base/window", - "dojo/_base/event", - "dojo/_base/json", - "dijit/registry", - "qpid/common/util", - "qpid/common/properties", - "qpid/common/updater", - "dijit/form/Button", - "dijit/form/ValidationTextBox", - "dijit/form/CheckBox", - "dijit/form/NumberSpinner", - "dojo/domReady!"], - function (xhr, dom, parser, query, construct, connect, win, event, json, registry, util, properties, updater) { - - function ManagementHttp(containerNode, pluginObject, controller) { - var node = construct.create("div", null, containerNode, "last"); - var that = this; - this.name = pluginObject.name; - xhr.get({ - url: "plugin/showManagementHttp.html", - sync: true, - load: function(data) { - node.innerHTML = data; - parser.parse(node).then(function(instances) - { - that.managementHttpUpdater= new ManagementHttpUpdater(node, pluginObject, controller); - that.managementHttpUpdater.update(true); - updater.add( that.managementHttpUpdater); - - var editButton = query(".editPluginButton", node)[0]; - connect.connect(registry.byNode(editButton), "onClick", function(evt){ that.edit(); }); - }); - }}); - } - - ManagementHttp.prototype.close = function() { - updater.remove( this.managementHttpUpdater ); - }; - - ManagementHttp.prototype.edit = function() { - var widgetFactories = [{ - name: "name", - createWidget: function(plugin) { - return new dijit.form.ValidationTextBox({ - required: true, - value: plugin.name, - disabled: true, - label: "Name:", - regexp: "^[\x20-\x2e\x30-\x7F]{1,255}$", - name: "name"}); - } - }, { - name: "httpBasicAuthenticationEnabled", - createWidget: function(plugin) { - return new dijit.form.CheckBox({ - required: false, - checked: plugin.httpBasicAuthenticationEnabled, - label: "HTTP Basic Authentication Enabled:", - name: "httpBasicAuthenticationEnabled"}); - } - }, { - name: "httpsBasicAuthenticationEnabled", - createWidget: function(plugin) { - return new dijit.form.CheckBox({ - required: false, - checked: plugin.httpsBasicAuthenticationEnabled, - label: "HTTPS Basic Authentication Enabled:", - name: "httpsBasicAuthenticationEnabled"}); - } - }, { - name: "httpSaslAuthenticationEnabled", - createWidget: function(plugin) { - return new dijit.form.CheckBox({ - required: false, - checked: plugin.httpSaslAuthenticationEnabled, - label: "HTTP SASL Authentication Enabled:", - name: "httpSaslAuthenticationEnabled"}); - } - }, { - name: "httpsSaslAuthenticationEnabled", - createWidget: function(plugin) { - return new dijit.form.CheckBox({ - required: false, - checked: plugin.httpsSaslAuthenticationEnabled, - label: "HTTPS SASL Authentication Enabled:", - name: "httpsSaslAuthenticationEnabled"}); - } - }, { - name: "sessionTimeout", - createWidget: function(plugin) { - return new dijit.form.NumberSpinner({ - invalidMessage: "Invalid value", - required: false, - value: plugin.sessionTimeout, - smallDelta: 1, - constraints: {min:1,places:0, pattern: "#####"}, - label: "Session timeout (s):", - name: "sessionTimeout" - }); - } - }, { - name: "compressResponses", - createWidget: function(plugin) { - return new dijit.form.CheckBox({ - required: false, - checked: plugin.compressResponses, - label: "Compress responses:", - name: "compressResponses"}); - } - } - ]; - var data = this.managementHttpUpdater.pluginData; - util.showSetAttributesDialog( - widgetFactories, - data, - "api/latest/plugin/" + encodeURIComponent(data.name), - "Edit plugin - " + data.name, - "Plugin", - "MANAGEMENT-HTTP"); - }; - - function ManagementHttpUpdater(node, pluginObject, controller) - { - this.controller = controller; - this.query = "api/latest/plugin/"+encodeURIComponent(pluginObject.name); - this.name = pluginObject.name; - this.httpBasicAuthenticationEnabled = query(".httpBasicAuthenticationEnabled", node)[0]; - this.httpsBasicAuthenticationEnabled = query(".httpsBasicAuthenticationEnabled", node)[0]; - this.sessionTimeout = query(".sessionTimeout", node)[0]; - this.httpsSaslAuthenticationEnabled = query(".httpsSaslAuthenticationEnabled", node)[0]; - this.httpSaslAuthenticationEnabled = query(".httpSaslAuthenticationEnabled", node)[0]; - this.compressResponses = query(".compressResponses", node)[0]; - - } - - ManagementHttpUpdater.prototype.update = function(syncRequest) - { - var that = this; - - function showBoolean(val) - { - return "<input type='checkbox' disabled='disabled' "+(val ? "checked='checked'": "")+" />" ; - } - - xhr.get({url: this.query, sync: syncRequest ? syncRequest : properties.useSyncGet, handleAs: "json"}) - .then(function(data) { - that.pluginData = data[0]; - that.httpBasicAuthenticationEnabled.innerHTML = showBoolean(that.pluginData.httpBasicAuthenticationEnabled); - that.httpsBasicAuthenticationEnabled.innerHTML = showBoolean(that.pluginData.httpsBasicAuthenticationEnabled); - that.httpsSaslAuthenticationEnabled.innerHTML = showBoolean(that.pluginData.httpsSaslAuthenticationEnabled); - that.httpSaslAuthenticationEnabled.innerHTML = showBoolean(that.pluginData.httpSaslAuthenticationEnabled); - that.compressResponses.innerHTML = showBoolean(that.pluginData.compressResponses); - that.sessionTimeout.innerHTML = that.pluginData.sessionTimeout; - }); - - }; - - return ManagementHttp; - }); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/plugin/managementjmx.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/plugin/managementjmx.js deleted file mode 100644 index 4141b6b670..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/plugin/managementjmx.js +++ /dev/null @@ -1,121 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define(["dojo/_base/xhr", - "dojo/dom", - "dojo/parser", - "dojo/query", - "dojo/dom-construct", - "dojo/_base/connect", - "dojo/_base/window", - "dojo/_base/event", - "dojo/_base/json", - "dijit/registry", - "qpid/common/util", - "qpid/common/properties", - "qpid/common/updater", - "dojo/domReady!"], - function (xhr, dom, parser, query, construct, connect, win, event, json, registry, util, properties, updater) { - - function ManagementJmx(containerNode, pluginObject, controller) { - var node = construct.create("div", null, containerNode, "last"); - var that = this; - this.name = pluginObject.name; - xhr.get({ - url: "plugin/showManagementJmx.html", - sync: true, - load: function(data) { - node.innerHTML = data; - parser.parse(node).then(function(instances) - { - that.managementJmxUpdater= new ManagementJmxUpdater(node, pluginObject, controller); - that.managementJmxUpdater.update(true); - updater.add( that.managementJmxUpdater); - - var editButton = query(".editPluginButton", node)[0]; - connect.connect(registry.byNode(editButton), "onClick", function(evt){ that.edit(); }); - }); - }}); - } - - ManagementJmx.prototype.close = function() { - updater.remove( this.managementJmxUpdater ); - }; - - ManagementJmx.prototype.edit = function() { - var widgetFactories = [{ - name: "name", - createWidget: function(plugin) { - return new dijit.form.ValidationTextBox({ - required: true, - value: plugin.name, - disabled: true, - label: "Name:", - regexp: "^[\x20-\x2e\x30-\x7F]{1,255}$", - name: "name"}); - } - }, { - name: "usePlatformMBeanServer", - createWidget: function(plugin) { - return new dijit.form.CheckBox({ - required: false, - checked: plugin.usePlatformMBeanServer, - label: "Use Platform MBean Server:", - name: "usePlatformMBeanServer"}); - } - } - ]; - var data = this.managementJmxUpdater.pluginData; - util.showSetAttributesDialog( - widgetFactories, - data, - "api/latest/plugin/" + encodeURIComponent(data.name), - "Edit plugin - " + data.name, - "Plugin", - "MANAGEMENT-JMX"); - }; - - function ManagementJmxUpdater(node, pluginObject, controller) - { - this.controller = controller; - this.query = "api/latest/plugin/"+encodeURIComponent(pluginObject.name); - this.name = pluginObject.name; - this.usePlatformMBeanServer = query(".usePlatformMBeanServer", node)[0]; - } - - ManagementJmxUpdater.prototype.update = function(syncRequest) - { - var that = this; - - function showBoolean(val) - { - return "<input type='checkbox' disabled='disabled' "+(val ? "checked='checked'": "")+" />" ; - } - - xhr.get({url: this.query, sync: syncRequest ? syncRequest : properties.useSyncGet, handleAs: "json"}) - .then(function(data) { - that.pluginData = data[0]; - that.usePlatformMBeanServer.innerHTML = showBoolean(that.pluginData.usePlatformMBeanServer); - }); - - }; - - return ManagementJmx; - }); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/preferencesprovider/PreferencesProviderForm.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/preferencesprovider/PreferencesProviderForm.js deleted file mode 100644 index 994c748803..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/preferencesprovider/PreferencesProviderForm.js +++ /dev/null @@ -1,198 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define([ - "qpid/common/util", - "qpid/common/metadata", - "dojo/_base/xhr", - "dojo/_base/declare", - "dojo/_base/array", - "dojo/dom-construct", - "dojo/_base/window", - "dojo/query", - "dojo/json", - "dijit/_WidgetBase", - "dijit/_OnDijitClickMixin", - "dijit/_TemplatedMixin", - "dijit/_WidgetsInTemplateMixin", - "dijit/registry", - "dojo/text!preferencesprovider/preferencesProviderForm.html", - "dojox/html/entities", - "dijit/form/ValidationTextBox", - "dijit/form/FilteringSelect", - "dojox/validate/us", - "dojox/validate/web", - "dojo/domReady!"], -function (util, metadata, xhr, declare, array, domConstruct, win, query, json, _WidgetBase, - _OnDijitClickMixin, _TemplatedMixin, _WidgetsInTemplateMixin, registry, template, entities) - { - - return declare("qpid.preferencesprovider.PreferencesProviderForm", - [_WidgetBase, _OnDijitClickMixin, _TemplatedMixin, _WidgetsInTemplateMixin], { - - templateString: template, - domNode: null, - preferencesProviderForm : null, - preferencesProviderNameWidget : null, - preferencesProviderTypeWidget : null, - preferencesProviderTypeFieldsContainer: null, - - buildRendering: function() - { - //Strip out the apache comment header from the template html as comments unsupported. - this.templateString = this.templateString.replace(/<!--[\s\S]*?-->/g, ""); - this.inherited(arguments); - }, - postCreate: function() - { - this.inherited(arguments); - var that = this; - - this.preferencesProviderNameWidget.set("regExpGen", util.nameOrContextVarRegexp); - - var supportedPreferencesProviderTypes = metadata.getTypesForCategory("PreferencesProvider"); - supportedPreferencesProviderTypes.sort(); - supportedPreferencesProviderTypes.splice(0,0,"None"); - var preferencesProviderTypeStore = util.makeTypeStore(supportedPreferencesProviderTypes); - this.preferencesProviderTypeWidget.set("store", preferencesProviderTypeStore); - this.preferencesProviderTypeWidget.on("change", function(type){that._preferencesProviderTypeChanged(type);}); - this.preferencesProviderForm.on("submit", function() { return false; }) - }, - reset: function() - { - this.data = null; - this.preferencesProviderForm.reset(); - this.preferencesProviderTypeWidget.set("value", "None"); - }, - submit: function(encodedAuthenticationProviderName) - { - if (this.preferencesProviderTypeWidget.get("value") != "None") - { - var preferencesProviderData = util.getFormWidgetValues(this.preferencesProviderForm, this.data) - var encodedPreferencesProviderName = encodeURIComponent(this.preferencesProviderNameWidget.get("value")); - var url = "api/latest/preferencesprovider/" + encodedAuthenticationProviderName; - if (this.data) - { - // update request - url += "/" + encodedPreferencesProviderName; - } - return util.post(url, preferencesProviderData); - } - return { success: true, failureReason: null }; - }, - validate: function() - { - return this.preferencesProviderForm.validate(); - }, - load: function(authenticationProviderName, providerName) - { - var that = this; - xhr.get({ - url: "api/latest/preferencesprovider/" + encodeURIComponent(authenticationProviderName) + "/" + encodeURIComponent(providerName), - handleAs: "json" - }).then(function(data){that._load(data[0])}); - }, - setData: function(data) - { - this._load(data); - }, - _load:function(data) - { - data = data || {} - this.data = data; - this.preferencesProviderNameWidget.set("value", data.name); - if (data.type == this.preferencesProviderTypeWidget.get("value")) - { - // re-create UI anyway - this._preferencesProviderTypeChanged(data.type); - } - else - { - this.preferencesProviderTypeWidget.set("value", data.type); - } - }, - _preferencesProviderTypeChanged: function(type) - { - var typeFieldsContainer = this.preferencesProviderTypeFieldsContainer; - var widgets = registry.findWidgets(typeFieldsContainer); - array.forEach(widgets, function(item) { item.destroyRecursive();}); - domConstruct.empty(typeFieldsContainer); - this._toggleWidgets(type); - if (type) - { - if (type == "None") - { - this.preferencesProviderNameWidget.set("value", ""); - } - else - { - var that = this; - require([ "qpid/management/preferencesprovider/" + type.toLowerCase() + "/add"], function(typeUI) - { - try - { - typeUI.show({containerNode:typeFieldsContainer, parent: that, data: that.data}); - util.applyMetadataToWidgets(typeFieldsContainer, "PreferencesProvider", type); - } - catch(e) - { - console.warn(e); - } - }); - } - } - }, - _toggleWidgets: function(type) - { - if (this.disabled) - { - this.preferencesProviderNameWidget.set("disabled", true); - this.preferencesProviderTypeWidget.set("disabled", true); - } - else - { - if (this.data) - { - // editing - this.preferencesProviderNameWidget.set("disabled", true); - this.preferencesProviderTypeWidget.set("disabled", true); - } - else - { - this.preferencesProviderNameWidget.set("disabled", !type || type == "None"); - this.preferencesProviderTypeWidget.set("disabled", false); - } - } - }, - _setDisabledAttr: function(disabled) - { - this.inherited(arguments); - this.disabled = disabled; - if (disabled) - { - this.reset(); - } - else - { - this._toggleWidgets(this.preferencesProviderTypeWidget.value); - } - }, - }); -}); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/preferencesprovider/filesystempreferences/add.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/preferencesprovider/filesystempreferences/add.js deleted file mode 100644 index 929d318b4f..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/preferencesprovider/filesystempreferences/add.js +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -define(["dojo/query", "dijit/registry", "qpid/common/util"], - function (query, registry, util) - { - return { - show: function (data) - { - util.parseHtmlIntoDiv(data.containerNode, "preferencesprovider/filesystempreferences/add.html", - function() - { - if (data.data) - { - var pathWidget = registry.byNode(query(".addPreferencesProviderPath", data.containerNode)[0]); - pathWidget.set("value", data.data.path); - } - }); - } - }; - } -); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/preferencesprovider/filesystempreferences/show.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/preferencesprovider/filesystempreferences/show.js deleted file mode 100644 index 660b6673f2..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/preferencesprovider/filesystempreferences/show.js +++ /dev/null @@ -1,48 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define(["dojo/_base/xhr", - "dojo/parser", - "dojo/string", - "dojox/html/entities", - "dojo/query", - "dojo/domReady!"], - function (xhr, parser, json, entities, query) { - - function FileSystemPreferences(containerNode) { - var that = this; - xhr.get({url: "preferencesprovider/filesystempreferences/show.html", - sync: true, - load: function(template) { - containerNode.innerHTML = template; - parser.parse(containerNode).then(function(instances) - { - that.preferencesProviderPath=query(".fileSystemPreferencesProviderPath", containerNode)[0]; - }); - }}); - } - - FileSystemPreferences.prototype.update=function(data) - { - this.preferencesProviderPath.innerHTML = entities.encode(String(data["path"])); - }; - - return FileSystemPreferences; -}); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/showMessage.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/showMessage.js deleted file mode 100644 index cc6242b976..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/showMessage.js +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -define(["dojo/_base/xhr", - "dojo/dom", - "dojo/dom-construct", - "dojo/dom-class", - "dojo/_base/window", - "dijit/registry", - "dojo/parser", - "dojo/_base/array", - "dojo/_base/event", - 'dojo/_base/json', - "dojo/query", - "dojo/_base/connect", - "qpid/common/properties", - "dojox/html/entities", - "qpid/management/UserPreferences", - "dojo/domReady!"], - function (xhr, dom, construct, domClass, win, registry, parser, array, event, json, query, connect, properties, entities, UserPreferences) { - - - function encode(val){ - return typeof val === 'string' ? entities.encode(val) : val; - } - - var populatedFields = []; - var showMessage = {}; - - showMessage.hide = function () { - registry.byId("showMessage").hide(); - }; - - showMessage.loadViewMessage = function(data) { - var that = this; - node.innerHTML = data; - showMessage.dialogNode = dom.byId("showMessage"); - parser.instantiate([showMessage.dialogNode]); - - var closeButton = query(".closeViewMessage")[0]; - connect.connect(closeButton, "onclick", - function (evt) { - event.stop(evt); - showMessage.hide(); - }); - }; - - showMessage.populateShowMessage = function(data) { - - // clear fields set by previous invocation. - if(populatedFields) { - for(var i = 0 ; i < populatedFields.length; i++) { - populatedFields[i].innerHTML = ""; - } - populatedFields = []; - } - - for(var attrName in data) { - if(data.hasOwnProperty(attrName)) { - var fields = query(".message-"+attrName, this.dialogNode); - if(fields && fields.length != 0) { - var field = fields[0]; - populatedFields.push(field); - var val = data[attrName]; - if(val != null) { - if(domClass.contains(field,"map")) { - var tableStr = "<table style='border: 1pt'><tr><th style='width: 6em; font-weight: bold'>Header</th><th style='font-weight: bold'>Value</th></tr>"; - for(var name in val) { - if(val.hasOwnProperty(name)) { - - tableStr += "<tr><td>"+encode(name)+"</td>"; - tableStr += "<td>"+encode(val[ name ])+"</td></tr>"; - } - field.innerHTML = tableStr; - } - tableStr += "</table>"; - } else if(domClass.contains(field,"datetime")) { - field.innerHTML = UserPreferences.formatDateTime(val, {addOffset: true, appendTimeZone: true}); - } else { - field.innerHTML = encode(val); - } - } - } - } - } - var contentField = query(".message-content", this.dialogNode)[0]; - - if(data.mimeType && data.mimeType.match(/text\/.*/)) { - xhr.get({url: "service/message-content/" + encodeURIComponent(showMessage.virtualhost) - + "/" + encodeURIComponent(showMessage.queue) - + "/" + encodeURIComponent(showMessage.messageNumber), - sync: true - - }).then(function(obj) { contentField.innerHTML = encode(obj) }); - } else { - contentField.innerHTML = "<a href=\"" + "service/message-content/" + encodeURIComponent(showMessage.virtualhost) - + "/" + encodeURIComponent(showMessage.queue) - + "/" + encodeURIComponent(showMessage.messageNumber) - + "\" target=\"_blank\">Download</a>"; - } - populatedFields.push(contentField); - - registry.byId("showMessage").show(); - }; - - showMessage.show = function(obj) { - showMessage.virtualhost = obj.virtualhost; - showMessage.queue = obj.queue; - showMessage.messageNumber = obj.messageNumber; - - xhr.get({url: "service/message/" + encodeURIComponent(obj.virtualhost) - + "/" + encodeURIComponent(obj.queue) - + "/" + encodeURIComponent(obj.messageNumber), - sync: properties.useSyncGet, - handleAs: "json", - load: this.populateShowMessage - }); - }; - - var node = construct.create("div", null, win.body(), "last"); - - xhr.get({url: "showMessage.html", - sync: true, - load: showMessage.loadViewMessage - }); - - return showMessage; - }); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/store/filekeystore/add.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/store/filekeystore/add.js deleted file mode 100644 index dfe8e5059a..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/store/filekeystore/add.js +++ /dev/null @@ -1,101 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define(["dojo/dom", - "dojo/query", - "dojo/_base/array", - "dijit/registry", - "qpid/common/util", - "qpid/common/metadata", - "dojo/parser", - "dojo/text!store/filekeystore/add.html", - "dojo/domReady!"], - function (dom, query, array, registry, util, metadata, parser, template) - { - var addKeyStore = - { - show: function(data) - { - var that=this; - this.containerNode = data.containerNode; - data.containerNode.innerHTML = template; - parser.parse(this.containerNode).then(function(instances) - { - that.keyStoreOldBrowserWarning = dom.byId("addStore.oldBrowserWarning"); - - if (!window.FileReader) - { - that.keyStoreOldBrowserWarning.innerHTML = "File upload requires a more recent browser with HTML5 support"; - that.keyStoreOldBrowserWarning.className = that.keyStoreOldBrowserWarning.className.replace("hidden", ""); - } - - if (data.effectiveData) - { - that.update(data.effectiveData); - } - - util.applyMetadataToWidgets(data.containerNode, "KeyStore", "FileKeyStore"); - }); - }, - update: function(effectiveData) - { - var attributes = metadata.getMetaData("KeyStore", "FileKeyStore").attributes; - var widgets = registry.findWidgets(this.containerNode); - array.forEach(widgets, function(item) - { - var name = item.id.replace("addStore.",""); - if (name in attributes ) - { - var attribute = attributes[name]; - var value = effectiveData[name]; - if (value) - { - if (attribute.secure) - { - if (!/^\*+/.test(value) ) - { - item.set("value", value); - } - else - { - item.set("required", false); - if (name == "storeUrl") - { - item.set("uploaded", true) - } - else - { - item.set("placeHolder", value); - } - } - } - else - { - item.set("value", value); - } - } - } - }); - } - }; - - return addKeyStore; - } -); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/store/filekeystore/show.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/store/filekeystore/show.js deleted file mode 100644 index fbe2bbc9c2..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/store/filekeystore/show.js +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -define(["qpid/common/util", "qpid/common/metadata", "dojo/domReady!"], - function (util, metadata) - { - - function FileKeyStoreProvider(data) - { - this.fields = []; - var attributes = metadata.getMetaData("KeyStore", "FileKeyStore").attributes; - for(var name in attributes) - { - this.fields.push(name); - } - util.buildUI(data.containerNode, data.parent, "store/filekeystore/show.html", this.fields, this); - } - - FileKeyStoreProvider.prototype.update = function(data) - { - util.updateUI(data, this.fields, this); - } - - return FileKeyStoreProvider; - } -); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/store/filetruststore/add.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/store/filetruststore/add.js deleted file mode 100644 index 5893ce0d2d..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/store/filetruststore/add.js +++ /dev/null @@ -1,96 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define(["dojo/dom", - "dojo/query", - "dojo/_base/array", - "dijit/registry", - "qpid/common/util", - "qpid/common/metadata", - "dojo/parser", - "dojo/text!store/filetruststore/add.html", - "dojo/domReady!"], - function (dom, query, array, registry, util, metadata, parser, template) - { - var addTrustStore = - { - show: function(data) - { - var that=this; - this.containerNode = data.containerNode; - data.containerNode.innerHTML = template; - parser.parse(this.containerNode).then(function(instances) - { - that.keyStoreOldBrowserWarning = dom.byId("addStore.oldBrowserWarning"); - - if (!window.FileReader) - { - // Fall back for IE8/9 which do not support FileReader - that.keyStoreOldBrowserWarning.innerHTML = "File upload requires a more recent browser with HTML5 support"; - that.keyStoreOldBrowserWarning.className = that.keyStoreOldBrowserWarning.className.replace("hidden", ""); - } - - if (data.effectiveData) - { - that.update(data.effectiveData); - } - - util.applyMetadataToWidgets(data.containerNode, "TrustStore", "FileTrustStore"); - }); - }, - update: function(effectiveData) - { - var attributes = metadata.getMetaData("TrustStore", "FileTrustStore").attributes; - var widgets = registry.findWidgets(this.containerNode); - array.forEach(widgets, function(item) - { - var name = item.id.replace("addStore.",""); - if (name in attributes ) - { - var attribute = attributes[name]; - var value = effectiveData[name]; - if (value) - { - if (attribute.secure) - { - if (!/^\*+/.test(value) ) - { - item.set("value", value); - } - else - { - item.set("placeHolder", value); - item.set("required", false); - } - } - else - { - item.set("value", value); - } - } - } - }); - - } - }; - - return addTrustStore; - } -); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/store/filetruststore/show.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/store/filetruststore/show.js deleted file mode 100644 index b03199021d..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/store/filetruststore/show.js +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -define(["qpid/common/util", "qpid/common/metadata", "dojo/domReady!"], - function (util, metadata) - { - - function FileTrustStoreProvider(data) - { - this.fields = []; - var attributes = metadata.getMetaData("TrustStore", "FileTrustStore").attributes; - for(var name in attributes) - { - this.fields.push(name); - } - util.buildUI(data.containerNode, data.parent, "store/filetruststore/show.html", this.fields, this); - } - - FileTrustStoreProvider.prototype.update = function(data) - { - util.updateUI(data, this.fields, this); - } - - return FileTrustStoreProvider; - } -); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/store/nonjavakeystore/add.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/store/nonjavakeystore/add.js deleted file mode 100644 index 5c25ae2cc6..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/store/nonjavakeystore/add.js +++ /dev/null @@ -1,102 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define(["dojo/dom", - "dojo/query", - "dojo/_base/array", - "dijit/registry", - "qpid/common/util", - "qpid/common/metadata", - "dojo/parser", - "dojo/text!store/nonjavakeystore/add.html", - "qpid/common/ResourceWidget", - "dojo/domReady!"], - function (dom, query, array, registry, util, metadata, parser, template) - { - var addKeyStore = - { - show: function(data) - { - var that=this; - this.containerNode = data.containerNode; - data.containerNode.innerHTML = template; - parser.parse(this.containerNode).then(function(instances) - { - that.keyStoreOldBrowserWarning = dom.byId("addStore.oldBrowserWarning"); - - if (!window.FileReader) - { - that.keyStoreOldBrowserWarning.innerHTML = "File upload requires a more recent browser with HTML5 support"; - that.keyStoreOldBrowserWarning.className = that.keyStoreOldBrowserWarning.className.replace("hidden", ""); - } - - if (data.effectiveData) - { - that.update(data.effectiveData); - } - - util.applyMetadataToWidgets(data.containerNode, "KeyStore", "NonJavaKeyStore"); - }); - }, - update: function(effectiveData) - { - var attributes = metadata.getMetaData("KeyStore", "NonJavaKeyStore").attributes; - var widgets = registry.findWidgets(this.containerNode); - array.forEach(widgets, function(item) - { - var name = item.id.replace("addStore.",""); - if (name in attributes ) - { - var attribute = attributes[name]; - var value = effectiveData[name]; - if (value) - { - if (attribute.secure) - { - if (!/^\*+/.test(value) ) - { - item.set("value", value); - } - else - { - item.set("required", false); - if (name == "privateKeyUrl") - { - item.set("uploaded", true) - } - else - { - item.set("placeHolder", value); - } - } - } - else - { - item.set("value", value); - } - } - } - }); - } - }; - - return addKeyStore; - } -); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/store/nonjavakeystore/show.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/store/nonjavakeystore/show.js deleted file mode 100644 index c31b020e3e..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/store/nonjavakeystore/show.js +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -define(["qpid/common/util", "qpid/common/metadata", "qpid/management/UserPreferences", "dojox/html/entities", "dojo/domReady!"], - function (util, metadata, UserPreferences, entities) - { - - function toDate(value) - { - return value ? entities.encode(String(UserPreferences.formatDateTime(value, {addOffset: true, appendTimeZone: true}))) : ""; - } - - var dateFields = ["certificateValidEnd","certificateValidStart"]; - - function NonJavaKeyStore(data) - { - this.fields = []; - var attributes = metadata.getMetaData("KeyStore", "NonJavaKeyStore").attributes; - for(var name in attributes) - { - if (dateFields.indexOf(name) == -1) - { - this.fields.push(name); - } - } - var allFields = this.fields.concat(dateFields); - util.buildUI(data.containerNode, data.parent, "store/nonjavakeystore/show.html",allFields, this); - } - - NonJavaKeyStore.prototype.update = function(data) - { - util.updateUI(data, this.fields, this); - if (data) - { - for(var idx in dateFields) - { - var name = dateFields[idx]; - this[name].innerHTML = toDate(data[name]); - } - } - } - - return NonJavaKeyStore; - } -); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/store/nonjavatruststore/add.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/store/nonjavatruststore/add.js deleted file mode 100644 index 550c388910..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/store/nonjavatruststore/add.js +++ /dev/null @@ -1,94 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define(["dojo/dom", - "dojo/query", - "dojo/_base/array", - "dijit/registry", - "qpid/common/util", - "qpid/common/metadata", - "dojo/parser", - "dojo/text!store/nonjavatruststore/add.html", - "dojo/domReady!"], - function (dom, query, array, registry, util, metadata, parser, template) - { - var addKeyStore = - { - show: function(data) - { - var that=this; - this.containerNode = data.containerNode; - data.containerNode.innerHTML = template; - parser.parse(this.containerNode).then(function(instances) - { - that.keyStoreOldBrowserWarning = dom.byId("addStore.oldBrowserWarning"); - - if (!window.FileReader) - { - that.keyStoreOldBrowserWarning.innerHTML = "File upload requires a more recent browser with HTML5 support"; - that.keyStoreOldBrowserWarning.className = that.keyStoreOldBrowserWarning.className.replace("hidden", ""); - } - - if (data.effectiveData) - { - that.update(data.effectiveData); - } - - util.applyMetadataToWidgets(data.containerNode, "TrustStore", "NonJavaTrustStore"); - }); - }, - update: function(effectiveData) - { - var attributes = metadata.getMetaData("TrustStore", "NonJavaTrustStore").attributes; - var widgets = registry.findWidgets(this.containerNode); - array.forEach(widgets, function(item) - { - var name = item.id.replace("addStore.",""); - if (name in attributes ) - { - var attribute = attributes[name]; - var value = effectiveData[name]; - if (value) - { - if (attribute.secure) - { - if (!/^\*+/.test(value) ) - { - item.set("value", value); - } - else - { - item.set("placeHolder", value); - item.set("required", false); - } - } - else - { - item.set("value", value); - } - } - } - }); - } - }; - - return addKeyStore; - } -); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/store/nonjavatruststore/show.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/store/nonjavatruststore/show.js deleted file mode 100644 index 7d78026d05..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/store/nonjavatruststore/show.js +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -define(["dojo/query", - "qpid/common/util", - "qpid/common/metadata", - "dojox/grid/DataGrid", - "qpid/common/UpdatableStore", - "qpid/management/UserPreferences", - "dojo/domReady!"], - function (query, util, metadata, DataGrid, UpdatableStore, UserPreferences) - { - - - function NonJavaTrustStore(data) - { - this.fields = []; - var attributes = metadata.getMetaData("TrustStore", "NonJavaTrustStore").attributes; - for(var name in attributes) - { - this.fields.push(name); - } - var that = this; - util.buildUI(data.containerNode, data.parent, "store/nonjavatruststore/show.html", this.fields, this, function() - { - var gridNode = query(".details", data.containerNode)[0]; - var dateTimeFormatter = function(value){ return value ? UserPreferences.formatDateTime(value, {addOffset: true, appendTimeZone: true}) : "";}; - that.detailsGrid = new UpdatableStore([], - gridNode, - [ - { name: 'Subject', field: 'SUBJECT_NAME', width: '25%' }, - { name: 'Issuer', field: 'ISSUER_NAME', width: '25%' }, - { name: 'Valid from', field: 'VALID_START', width: '25%', formatter: dateTimeFormatter }, - { name: 'Valid to', field: 'VALID_END', width: '25%', formatter: dateTimeFormatter} - ]); - }); - } - - NonJavaTrustStore.prototype.update = function(data) - { - util.updateUI(data, this.fields, this); - var details = data.certificateDetails; - for(var i=0; i < details.length; i++) - { - details[i].id = details[i].SUBJECT_NAME + "_" + details[i].ISSUER_NAME + "_" + details[i].VALID_START + "_" + details[i].VALID_END; - } - this.detailsGrid.grid.beginUpdate(); - this.detailsGrid.update(details); - this.detailsGrid.grid.endUpdate(); - } - - return NonJavaTrustStore; - } -); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/treeView.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/treeView.js deleted file mode 100644 index 06faf3c9da..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/treeView.js +++ /dev/null @@ -1,365 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define(["dojo/_base/xhr", - "dojo/query", - "dojo/io-query", - "dijit/Tree", - "qpid/common/util", - "qpid/common/updater", - "qpid/management/controller", - "qpid/management/UserPreferences", - "dojo/ready", - "dojo/domReady!"], - function (xhr, query, ioQuery, Tree, util, updater, controller, UserPreferences, ready) { - - function TreeViewModel(queryString) { - this.query = queryString; - - this.onChildrenChange = function (parent, children) { - // fired when the set of children for an object change - }; - - this.onChange = function (object) { - // fired when the properties of an object change - }; - - this.onDelete = function (object) { - // fired when an object is deleted - }; - } - - - TreeViewModel.prototype.buildModel = function (data) { - this.model = data; - - }; - - TreeViewModel.prototype.updateModel = function (data) { - var that = this; - - function checkForChanges(oldData, data) { - var propName; - if (oldData.name != data.name) { - that.onChange(data); - } - - var childChanges = false; - // Iterate over old childTypes, check all are in new - for (propName in oldData) { - if (oldData.hasOwnProperty(propName)) { - var oldChildren = oldData[ propName ]; - if (util.isArray(oldChildren)) { - - var newChildren = data[ propName ]; - - if (!(newChildren && util.isArray(newChildren))) { - childChanges = true; - } else { - var subChanges = false; - // iterate over elements in array, make sure in both, in which case recurse - for (var i = 0; i < oldChildren.length; i++) { - var matched = false; - for (var j = 0; j < newChildren.length; j++) { - if (oldChildren[i].id == newChildren[j].id) { - checkForChanges(oldChildren[i], newChildren[j]); - matched = true; - break; - } - } - if (!matched) { - subChanges = true; - } - } - if (subChanges == true || oldChildren.length != newChildren.length) { - that.onChildrenChange({ id:data.id + propName, _dummyChild:propName, data:data }, - newChildren); - } - } - } - } - } - - for (propName in data) { - if (data.hasOwnProperty(propName)) { - var prop = data[ propName ]; - if (util.isArray(prop)) { - if (!(oldData[ propName ] && util.isArray(oldData[propName]))) { - childChanges = true; - } - } - } - } - - if (childChanges) { - var children = []; - that.getChildren(data, function (theChildren) { - children = theChildren - }); - that.onChildrenChange(data, children); - } - } - - var oldData = this.model; - this.model = data; - - checkForChanges(oldData, data); - }; - - - TreeViewModel.prototype.fetchItemByIdentity = function (id) { - - function fetchItem(id, data) { - var propName; - - if (data.id == id) { - return data; - } else if (id.indexOf(data.id) == 0) { - return { id:id, _dummyChild:id.substring(id.length), data:data }; - } else { - for (propName in data) { - if (data.hasOwnProperty(propName)) { - var prop = data[ propName ]; - if (util.isArray(prop)) { - for (var i = 0; i < prop.length; i++) { - var theItem = fetchItem(id, prop[i]); - if (theItem) { - return theItem; - } - } - } - } - } - return null; - } - } - - return fetchItem(id, this.model); - }; - - TreeViewModel.prototype.getChildren = function (parentItem, onComplete) { - - if (parentItem) { - if (parentItem._dummyChild) { - onComplete(parentItem.data[ parentItem._dummyChild ]); - } else { - var children = []; - for (var propName in parentItem) { - if (parentItem.hasOwnProperty(propName)) { - var prop = parentItem[ propName ]; - - if (util.isArray(prop)) { - children.push({ id:parentItem.id - + propName, _dummyChild:propName, data:parentItem }); - } - } - } - onComplete(children); - } - } else { - onComplete([]); - } - }; - - TreeViewModel.prototype.getIdentity = function (theItem) { - if (theItem) { - return theItem.id; - } - - }; - - TreeViewModel.prototype.getLabel = function (theItem) { - if (theItem) { - if (theItem._dummyChild) { - return theItem._dummyChild; - } else { - return theItem.name; - } - } else { - return ""; - } - }; - - TreeViewModel.prototype.getRoot = function (onItem) { - onItem(this.model); - }; - - TreeViewModel.prototype.mayHaveChildren = function (theItem) { - if (theItem) { - if (theItem._dummyChild) { - return true; - } else { - for (var propName in theItem) { - if (theItem.hasOwnProperty(propName)) { - var prop = theItem[ propName ]; - if (util.isArray(prop)) { - return true; - } - } - } - return false; - } - } else { - return false; - } - }; - - TreeViewModel.prototype.relocate = function (theItem) { - - function findItemDetails(theItem, details, type, object, parent) { - if (theItem.id == object.id) { - details.type = type; - details[ type ] = object.name; - details.parent = parent; - } else { - var parentObject ={ - type: type, - name: object.name - }; - if (parent) - { - parentObject.parent = parent; - } - // iterate over children - for (var propName in object) { - if (object.hasOwnProperty(propName)) { - var prop = object[ propName ]; - if (util.isArray(prop)) { - for (var i = 0; i < prop.length; i++) { - findItemDetails(theItem, details, propName.substring(0, propName.length - 1), - prop[i], parentObject); - - if (details.type) { - break; - } - } - } - if (details.type) { - break; - } - } - } - - if (!details.type) { - details[ type ] = null; - } - } - } - - var details = new Object(); - findItemDetails(theItem, details, "broker", this.model, null); - - if (details.type == "broker") { - controller.show("broker", "", null, theItem.id); - } else if (details.type == "virtualhost") { - controller.show("virtualhost", details.virtualhost, details.parent, theItem.id); - } else if (details.type == "exchange") { - controller.show("exchange", details.exchange, details.parent, theItem.id); - } else if (details.type == "queue") { - controller.show("queue", details.queue, details.parent, theItem.id); - } else if (details.type == "connection") { - controller.show("connection", details.connection, details.parent, theItem.id); - } else if (details.type == 'port') { - controller.show("port", details.port, details.parent, theItem.id); - } else if (details.type == 'authenticationprovider') { - controller.show("authenticationprovider", details.authenticationprovider, details.parent, theItem.id); - } else if (details.type == 'groupprovider') { - controller.show("groupprovider", details.groupprovider, details.parent, theItem.id); - } else if (details.type == 'group') { - controller.show("group", details.group, details.parent, theItem.id); - } else if (details.type == 'keystore') { - controller.show("keystore", details.keystore, details.parent, theItem.id); - } else if (details.type == 'truststore') { - controller.show("truststore", details.truststore, details.parent, theItem.id); - } else if (details.type == 'accesscontrolprovider') { - controller.show("accesscontrolprovider", details.accesscontrolprovider, details.parent, theItem.id); - } else if (details.type == 'plugin') { - controller.show("plugin", details.plugin, {type:"broker", name:""}, theItem.id); - } else if (details.type == "preferencesprovider") { - controller.show("preferencesprovider", details.preferencesprovider, details.parent, theItem.id); - } else if (details.type == "virtualhostnode") { - controller.show("virtualhostnode", details.virtualhostnode, details.parent, theItem.id); - } - }; - - TreeViewModel.prototype.update = function () { - var thisObj = this; - - xhr.get({url:this.query, sync: true, handleAs:"json"}) - .then(function (data) { - if (thisObj.model) { - thisObj.updateModel(data); - } - else { - thisObj.buildModel(data); - } - }, util.xhrErrorHandler); - - }; - - query('div[qpid-type="treeView"]').forEach(function(node, index, arr) { - var treeModel = new TreeViewModel("service/structure"); - treeModel.update(); - var tree = new Tree({ model: treeModel }, node); - tree.on("dblclick", - function (object) { - if (object && !object._dummyChild) { - treeModel.relocate(object); - } - - }, true); - tree.startup(); - updater.add( treeModel ); - - ready(function() { - controller.show("broker",""); - - var tabs = UserPreferences.tabs; - if (tabs) - { - for(var i in tabs) - { - var tab = tabs[i], modelObject; - if (tab.objectType != "broker") - { - if (tab.objectId) - { - modelObject = treeModel.fetchItemByIdentity(tab.objectId); - if (modelObject) - { - treeModel.relocate(modelObject); - } - else - { - UserPreferences.removeTab(tab); - } - } - else - { - controller.show(tab.objectType, ""); - } - } - } - } - }); - }); - - return TreeViewModel; - });
\ No newline at end of file diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/virtualhost/providedstore/add.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/virtualhost/providedstore/add.js deleted file mode 100644 index c4e44f5027..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/virtualhost/providedstore/add.js +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -define(["dojo/_base/xhr", - "dojo/parser", - "dojo/dom", - "dojo/dom-construct", - "dojo/json", - "dijit/registry", - "dojo/text!virtualhost/providedstore/add.html", - "qpid/common/util", - "dijit/form/ValidationTextBox", - "dojo/domReady!"], - function (xhr, parser, dom, domConstruct, json, registry, template, util) - { - return { - show: function (data) - { - var that= this; - this.containerNode = domConstruct.create("div", {innerHTML: template}, data.containerNode); - parser.parse(this.containerNode).then(function(instances) {that._postParse(data);}); - }, - _postParse: function(data) - { - registry.byId("addVirtualHost.storeUnderfullSize").set("regExpGen", util.numericOrContextVarRegexp); - registry.byId("addVirtualHost.storeOverfullSize").set("regExpGen", util.numericOrContextVarRegexp); - - if (data.parent.virtualHostNodeType.value == "JDBC") - { - dom.byId("addVirtualHost.diskFlowControls").style.display = "none"; - } - - } - }; - } -); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/virtualhost/providedstore/edit.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/virtualhost/providedstore/edit.js deleted file mode 100644 index 3a305fb016..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/virtualhost/providedstore/edit.js +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -define(["dijit/registry", "qpid/common/util", "dojo/domReady!"], - function (registry, util) - { - return { - show: function(data) - { - util.parseHtmlIntoDiv(data.containerNode, "virtualhost/providedstore/edit.html", - function() - { - registry.byId("editVirtualHost.storeUnderfullSize").set("regExpGen", util.numericOrContextVarRegexp); - registry.byId("editVirtualHost.storeOverfullSize").set("regExpGen", util.numericOrContextVarRegexp); - }); - } - }; - } -); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/virtualhost/providedstore/show.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/virtualhost/providedstore/show.js deleted file mode 100644 index 8416211c62..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/virtualhost/providedstore/show.js +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -define(["qpid/common/util", "dojo/domReady!"], - function (util) - { - var fields = ["storeUnderfullSize", "storeOverfullSize"]; - - function ProvidedStore(data) - { - util.buildUI(data.containerNode, data.parent, "virtualhost/providedstore/show.html", fields, this); - } - - ProvidedStore.prototype.update = function(data) - { - util.updateUI(data, fields, this); - } - - return ProvidedStore; - } -); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/virtualhostnode/json/add.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/virtualhostnode/json/add.js deleted file mode 100644 index 17d20fde32..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/virtualhostnode/json/add.js +++ /dev/null @@ -1,41 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -define(["dojo/_base/xhr", - "dojo/parser", - "dojo/dom", - "dojo/dom-construct", - "dojo/json", - "dijit/registry", - "dojo/text!virtualhostnode/json/add.html", - "dijit/form/ValidationTextBox", - "dijit/form/CheckBox", - "dojo/domReady!"], - function (xhr, parser, dom, domConstruct, json, registry, template) - { - return { - show: function(data) - { - this.containerNode = domConstruct.create("div", {innerHTML: template}, data.containerNode); - parser.parse(this.containerNode); - } - }; - } -); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/virtualhostnode/json/edit.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/virtualhostnode/json/edit.js deleted file mode 100644 index 4c70b4a22d..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/virtualhostnode/json/edit.js +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -define(["qpid/common/util", "dijit/registry", "dojo/domReady!"], - function (util, registry) - { - return { - show: function(data) - { - util.parseHtmlIntoDiv(data.containerNode, "virtualhostnode/filebased/edit.html", - function() - { - registry.byId("editVirtualHostNode.storePath").set("disabled", !(data.data.state == "STOPPED" || data.data.state == "ERRORED")); - }); - } - }; - } -); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/virtualhostnode/json/show.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/virtualhostnode/json/show.js deleted file mode 100644 index 80e3ce26f1..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/virtualhostnode/json/show.js +++ /dev/null @@ -1,39 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - define(["qpid/common/util", - "dojo/domReady!"], - function (util) - { - var fields = ["storePath"]; - - function JSON(data) - { - util.buildUI(data.containerNode, data.parent, "virtualhostnode/json/show.html", fields, this); - } - - JSON.prototype.update = function(data) - { - util.updateUI(data, fields, this); - } - - return JSON; - } - ); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/login.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/login.html deleted file mode 100644 index 6e7f05e41b..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/login.html +++ /dev/null @@ -1,120 +0,0 @@ -<!DOCTYPE HTML> -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one or more - ~ contributor license agreements. See the NOTICE file distributed with - ~ this work for additional information regarding copyright ownership. - ~ The ASF licenses this file to You under the Apache License, Version 2.0 - ~ (the "License"); you may not use this file except in compliance with - ~ the License. You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --> -<html lang="en"> -<head> - <meta charset="utf-8"> - <title>Qpid Management Login</title> - <link rel="stylesheet" href="dojo/dojo/resources/dojo.css"> - <link rel="stylesheet" href="dojo/dijit/themes/claro/claro.css"> - <link rel="stylesheet" href="css/common.css" media="screen"> - <script> - function getContextPath() - { - var contextPath = "/"; - var documentURL = document.URL; - var managementPageStart = documentURL.lastIndexOf("/"); - var firstSlashPos = documentURL.indexOf("/", documentURL.indexOf("//") + 2); - if (managementPageStart > firstSlashPos) - { - contextPath = documentURL.substring(firstSlashPos, managementPageStart); - } - return contextPath; - } - - var dojoConfig = { - tlmSiblingOfDojo:false, - parseOnLoad:true, - async:true, - baseUrl: getContextPath(), - packages:[ - { name:"dojo", location:"dojo/dojo" }, - { name:"dijit", location:"dojo/dijit" }, - { name:"dojox", location:"dojo/dojox" }, - { name:"qpid", location:"js/qpid" } - ] - }; - - </script> - <script src="dojo/dojo/dojo.js"> - </script> - - <script> - require(["dojo/_base/xhr", - "dojo/parser", - "dijit/form/Form", - "dijit/form/Button", - "dijit/form/TextBox", - "dijit/form/ValidationTextBox", - "dijit/layout/BorderContainer", - "dijit/layout/ContentPane", - "dijit/TitlePane", - "dojox/layout/TableContainer", - "dojox/validate/us", - "dojox/validate/web", - "qpid/common/footer"]); - </script> - -</head> -<body class="claro"> - -<div id="pageLayout" data-dojo-type="dijit.layout.BorderContainer" data-dojo-props="design: 'headline', gutters: false"> - <div data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'top'"> - <div id="header" class="header" style="float: left; width: 300px"></div> - <div id="login" style="float: right"></div> - </div> - <div data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'center'"> - <div style="width:350px; margin-left: auto; margin-right: auto;"> - <div data-dojo-type="dijit.form.Form" method="POST" id="loginForm"> - <script type="dojo/on" data-dojo-event="submit" data-dojo-args="e"> - e.preventDefault() - if(this.validate()){ - require(["qpid/authorization/sasl"], function(sasl){ - var redirectIfAuthenticated = function redirectIfAuthenticated(){ - sasl.getUser(function(data){ - if(data.user){ - window.location = "index.html"; - } - }); - }; - - sasl.authenticate(dijit.byId("username").value, dijit.byId("password").value, redirectIfAuthenticated); - }); - } - return false; - </script> - <div data-dojo-type="dijit.TitlePane" data-dojo-props="title:'Login', toggleable: false" > - <div class="dijitDialogPaneContentArea"> - <div data-dojo-type="dojox.layout.TableContainer" data-dojo-props="cols:1,labelWidth:'100',showLabels:true,orientation:'horiz',customClass:'formLabel'"> - <div data-dojo-type="dijit.form.ValidationTextBox" id="username" name="username" data-dojo-props="label:'User name:',required:true, intermediateChanges:true"></div> - <div data-dojo-type="dijit.form.ValidationTextBox" type="password" id="password" name="password" data-dojo-props="label:'Password:',required:true, intermediateChanges:true"></div> - </div> - </div> - <div class="dijitDialogPaneActionBar qpidDialogPaneActionBar"> - <button data-dojo-type="dijit.form.Button" type="submit" id="loginButton">Login</button> - </div> - </div> - </div> - </div> - </div> - <div data-dojo-type="dijit.layout.ContentPane" data-dojo-props="region:'bottom'"> - <div qpid-type="footer"></div> - </div> -</div> - -</body> -</html>
\ No newline at end of file diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/logs/showLogFileDownloadDialog.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/logs/showLogFileDownloadDialog.html deleted file mode 100644 index d48682a566..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/logs/showLogFileDownloadDialog.html +++ /dev/null @@ -1,33 +0,0 @@ -<!-- - - - - Licensed to the Apache Software Foundation (ASF) under one - - or more contributor license agreements. See the NOTICE file - - distributed with this work for additional information - - regarding copyright ownership. The ASF licenses this file - - to you under the Apache License, Version 2.0 (the - - "License"); you may not use this file except in compliance - - with the License. You may obtain a copy of the License at - - - - http://www.apache.org/licenses/LICENSE-2.0 - - - - Unless required by applicable law or agreed to in writing, - - software distributed under the License is distributed on an - - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - - KIND, either express or implied. See the License for the - - specific language governing permissions and limitations - - under the License. - - - --> -<div> - <div class="contentArea" style="height:320px;overflow:auto"> - <div><b>Select log files to download</b></div> - <div class="logFilesGrid" style='height:300px;width: 580px'></div> - </div> - <div class="dijitDialogPaneActionBar qpidDialogPaneActionBar"> - <button value="Download" data-dojo-type="dijit.form.Button" - class="downloadLogsButton" - data-dojo-props="iconClass: 'downloadLogsIcon', label: 'Download' "></button> - <button value="Close" data-dojo-type="dijit.form.Button" data-dojo-props="label: 'Close'" - class="downloadLogsDialogCloseButton"></button> - </div> -</div> diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/logs/showLogViewer.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/logs/showLogViewer.html deleted file mode 100644 index ab927153fa..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/logs/showLogViewer.html +++ /dev/null @@ -1,29 +0,0 @@ -<!-- - - - - Licensed to the Apache Software Foundation (ASF) under one - - or more contributor license agreements. See the NOTICE file - - distributed with this work for additional information - - regarding copyright ownership. The ASF licenses this file - - to you under the Apache License, Version 2.0 (the - - "License"); you may not use this file except in compliance - - with the License. You may obtain a copy of the License at - - - - http://www.apache.org/licenses/LICENSE-2.0 - - - - Unless required by applicable law or agreed to in writing, - - software distributed under the License is distributed on an - - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - - KIND, either express or implied. See the License for the - - specific language governing permissions and limitations - - under the License. - - - --> -<div class="logViewer"> - - <div id="broker-logfile"></div> - <br/> - <button data-dojo-type="dijit.form.Button" class="downloadLogs" - data-dojo-props="iconClass: 'downloadLogsIcon', title:'Download Log Files', name: 'downloadLogs'">Download Log Files</button> - <br/> -</div> - diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/moveCopyMessages.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/moveCopyMessages.html deleted file mode 100644 index f188c3001c..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/moveCopyMessages.html +++ /dev/null @@ -1,36 +0,0 @@ -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one or more - ~ contributor license agreements. See the NOTICE file distributed with - ~ this work for additional information regarding copyright ownership. - ~ The ASF licenses this file to You under the Apache License, Version 2.0 - ~ (the "License"); you may not use this file except in compliance with - ~ the License. You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --> - -<div class="dijitHidden"> - <div data-dojo-type="dijit.Dialog" style="width:600px;" data-dojo-props="title:'Move/Copy Messages'" id="moveMessages"> - <form id="formMoveMessages" method="post" dojoType="dijit.form.Form"> - <table cellpadding="0" cellspacing="2"> - <tr> - <td valign="top"><strong>Queue: </strong></td> - <td><div id="moveMessages.selectQueueDiv"></div></td> - </tr> - </table> - <br/> - - <!-- submit buttons --> - - <input type="button" value="Cancel" label="Cancel" dojoType="dijit.form.Button" class="moveMessageCancel"/> - <input type="submit" value="Move Messages" label="Move Messages" dojoType="dijit.form.Button" /> - - </form> - </div> -</div> diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/plugin/showManagementHttp.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/plugin/showManagementHttp.html deleted file mode 100644 index b12869981d..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/plugin/showManagementHttp.html +++ /dev/null @@ -1,52 +0,0 @@ -<!-- - - - - Licensed to the Apache Software Foundation (ASF) under one - - or more contributor license agreements. See the NOTICE file - - distributed with this work for additional information - - regarding copyright ownership. The ASF licenses this file - - to you under the Apache License, Version 2.0 (the - - "License"); you may not use this file except in compliance - - with the License. You may obtain a copy of the License at - - - - http://www.apache.org/licenses/LICENSE-2.0 - - - - Unless required by applicable law or agreed to in writing, - - software distributed under the License is distributed on an - - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - - KIND, either express or implied. See the License for the - - specific language governing permissions and limitations - - under the License. - - - --> -<div> - <div> - <div class="clear"> - <div class="formLabel-labelCell">Basic Authentication for HTTP enabled:</div> - <div class="httpBasicAuthenticationEnabled"></div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">Basic Authentication for HTTPS enabled:</div> - <div class="httpsBasicAuthenticationEnabled"></div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">SASL Authentication for HTTP enabled:</div> - <div class="httpSaslAuthenticationEnabled"></div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">SASL Authentication for HTTPS enabled:</div> - <div class="httpsSaslAuthenticationEnabled"></div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">Session timeout (s):</div> - <div class="sessionTimeout"></div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">Compress content:</div> - <div class="compressResponses"></div> - </div> - </div> - <br/> - <div class="dijitDialogPaneActionBar"> - <button data-dojo-type="dijit.form.Button" class="editPluginButton" type="button">Edit</button> - </div> -</div> diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/plugin/showManagementJmx.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/plugin/showManagementJmx.html deleted file mode 100644 index f70b126277..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/plugin/showManagementJmx.html +++ /dev/null @@ -1,32 +0,0 @@ -<!-- - - - - Licensed to the Apache Software Foundation (ASF) under one - - or more contributor license agreements. See the NOTICE file - - distributed with this work for additional information - - regarding copyright ownership. The ASF licenses this file - - to you under the Apache License, Version 2.0 (the - - "License"); you may not use this file except in compliance - - with the License. You may obtain a copy of the License at - - - - http://www.apache.org/licenses/LICENSE-2.0 - - - - Unless required by applicable law or agreed to in writing, - - software distributed under the License is distributed on an - - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - - KIND, either express or implied. See the License for the - - specific language governing permissions and limitations - - under the License. - - - --> -<div> - <div> - <div class="clear"> - <div class="formLabel-labelCell">Use Platform MBean Server:</div> - <div class="usePlatformMBeanServer"></div> - </div> - </div> - <br/> - <div class="dijitDialogPaneActionBar"> - <button data-dojo-type="dijit.form.Button" class="editPluginButton" type="button">Edit</button> - </div> -</div> diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/preferencesprovider/filesystempreferences/add.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/preferencesprovider/filesystempreferences/add.html deleted file mode 100644 index 5990b43b98..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/preferencesprovider/filesystempreferences/add.html +++ /dev/null @@ -1,37 +0,0 @@ -<!-- - - - - Licensed to the Apache Software Foundation (ASF) under one - - or more contributor license agreements. See the NOTICE file - - distributed with this work for additional information - - regarding copyright ownership. The ASF licenses this file - - to you under the Apache License, Version 2.0 (the - - "License"); you may not use this file except in compliance - - with the License. You may obtain a copy of the License at - - - - http://www.apache.org/licenses/LICENSE-2.0 - - - - Unless required by applicable law or agreed to in writing, - - software distributed under the License is distributed on an - - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - - KIND, either express or implied. See the License for the - - specific language governing permissions and limitations - - under the License. - - - --> -<div> - <div class="clear"> - <div class="formLabel-labelCell tableContainer-labelCell">Path*:</div> - <div class="formLabel-controlCell tableContainer-valueCell"> - <input type="text" class="addPreferencesProviderPath" - data-dojo-type="dijit/form/ValidationTextBox" - data-dojo-props=" - name: 'path', - required: true, - placeHolder: 'path/to/store', - title: 'Enter preferences store path', - promptMessage: 'File system location for the preferences store.'"/> - </div> - </div> - - <div class="clear"></div> -</div> diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/preferencesprovider/filesystempreferences/show.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/preferencesprovider/filesystempreferences/show.html deleted file mode 100644 index 663415e6d5..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/preferencesprovider/filesystempreferences/show.html +++ /dev/null @@ -1,21 +0,0 @@ -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one or more - ~ contributor license agreements. See the NOTICE file distributed with - ~ this work for additional information regarding copyright ownership. - ~ The ASF licenses this file to You under the Apache License, Version 2.0 - ~ (the "License"); you may not use this file except in compliance with - ~ the License. You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --> - -<div class="clear"> - <div class="formLabel-labelCell">Path:</div> - <div class="fileSystemPreferencesProviderPath"></div> -</div> diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/preferencesprovider/preferencesProviderForm.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/preferencesprovider/preferencesProviderForm.html deleted file mode 100644 index b995d4e8dd..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/preferencesprovider/preferencesProviderForm.html +++ /dev/null @@ -1,62 +0,0 @@ -<!-- - - - - Licensed to the Apache Software Foundation (ASF) under one - - or more contributor license agreements. See the NOTICE file - - distributed with this work for additional information - - regarding copyright ownership. The ASF licenses this file - - to you under the Apache License, Version 2.0 (the - - "License"); you may not use this file except in compliance - - with the License. You may obtain a copy of the License at - - - - http://www.apache.org/licenses/LICENSE-2.0 - - - - Unless required by applicable law or agreed to in writing, - - software distributed under the License is distributed on an - - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - - KIND, either express or implied. See the License for the - - specific language governing permissions and limitations - - under the License. - - - --> -<div> -<form class="addPreferencesProviderForm" method="post" data-dojo-type="dijit/form/Form" data-dojo-attach-point="preferencesProviderForm"> - <div class="formBox"> - <fieldset> - <legend>Preferences Provider</legend> - <div class="clear hidden"> - <div class="formLabel-labelCell tableContainer-labelCell">Name*:</div> - <div class="formLabel-controlCell tableContainer-valueCell"> - <input type="text" - data-dojo-attach-point="preferencesProviderNameWidget" - data-dojo-type="dijit/form/ValidationTextBox" - data-dojo-props=" - name: 'name', - required: true, - disabled: true, - placeHolder: 'preferences provider name', - promptMessage: 'Name of preferences provider, must be unique', - title: 'Enter a unique preferences provider name per broker'" /> - </div> - </div> - <div class="clear"> - <div class="formLabel-labelCell tableContainer-labelCell">Type*:</div> - <div class="tableContainer-valueCell formLabel-controlCell"> - <select data-dojo-attach-point="preferencesProviderTypeWidget" - data-dojo-type="dijit/form/FilteringSelect" - data-dojo-props=" - name: 'type', - required: true, - disabled: true, - placeHolder: 'select preferences provider type', - promptMessage: 'Type of preferences provider', - title: 'Select preferences provider type', - searchAttr: 'name'"> - </select> - </div> - </div> - <div class="clear"></div> - <div data-dojo-attach-point="preferencesProviderTypeFieldsContainer"></div> - </fieldset> - </div> -</form> -</div> diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/showAccessControlProvider.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/showAccessControlProvider.html deleted file mode 100644 index b65154e83b..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/showAccessControlProvider.html +++ /dev/null @@ -1,44 +0,0 @@ -<!-- - - - - Licensed to the Apache Software Foundation (ASF) under one - - or more contributor license agreements. See the NOTICE file - - distributed with this work for additional information - - regarding copyright ownership. The ASF licenses this file - - to you under the Apache License, Version 2.0 (the - - "License"); you may not use this file except in compliance - - with the License. You may obtain a copy of the License at - - - - http://www.apache.org/licenses/LICENSE-2.0 - - - - Unless required by applicable law or agreed to in writing, - - software distributed under the License is distributed on an - - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - - KIND, either express or implied. See the License for the - - specific language governing permissions and limitations - - under the License. - - - --> -<div> - <div class="accessControlProvider" data-dojo-type="dijit.TitlePane" data-dojo-props="title: 'Access Control Provider Attributes', open: true"> - <div class="clear"> - <div class="formLabel-labelCell">Name:</div> - <div class="name"></div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">Type:</div> - <div class="type"></div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">State:</div> - <div class="state"></div> - </div> - <div class="clear"></div> - - <div class="providerDetails"></div> - - - <div class="dijitDialogPaneActionBar"> - <input class="deleteAccessControlProviderButton" type="button" value="Delete Access Control provider" label="Delete Access Control Provider" dojoType="dijit.form.Button" /> - </div> - </div> -</div> diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/showAuthProvider.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/showAuthProvider.html deleted file mode 100644 index 992da02027..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/showAuthProvider.html +++ /dev/null @@ -1,45 +0,0 @@ -<!-- - - - - Licensed to the Apache Software Foundation (ASF) under one - - or more contributor license agreements. See the NOTICE file - - distributed with this work for additional information - - regarding copyright ownership. The ASF licenses this file - - to you under the Apache License, Version 2.0 (the - - "License"); you may not use this file except in compliance - - with the License. You may obtain a copy of the License at - - - - http://www.apache.org/licenses/LICENSE-2.0 - - - - Unless required by applicable law or agreed to in writing, - - software distributed under the License is distributed on an - - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - - KIND, either express or implied. See the License for the - - specific language governing permissions and limitations - - under the License. - - - --> -<div> - <div class="authorizationProvider" data-dojo-type="dijit.TitlePane" data-dojo-props="title: 'Authentication Provider Attributes', open: true"> - <div class="clear"> - <div class="formLabel-labelCell">Name:</div> - <div class="name"></div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">Type:</div> - <div class="type"></div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">State:</div> - <div class="state"></div> - </div> - <div class="clear authenticationProviderDetails"></div> - <div class="clear"></div> - <div class="clear dijitDialogPaneActionBar"> - <button data-dojo-type="dijit.form.Button" class="editAuthenticationProviderButton" type="button" data-dojo-props="disabled: true">Edit</button> - <button data-dojo-type="dijit.form.Button" class="deleteAuthenticationProviderButton" type="button">Delete</button> - </div> - </div> - <br/> - <div class="preferencesProviderDetails"></div> - <br/> -</div> diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/showBroker.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/showBroker.html deleted file mode 100644 index 08b01e98bc..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/showBroker.html +++ /dev/null @@ -1,136 +0,0 @@ -<!-- - - - - Licensed to the Apache Software Foundation (ASF) under one - - or more contributor license agreements. See the NOTICE file - - distributed with this work for additional information - - regarding copyright ownership. The ASF licenses this file - - to you under the Apache License, Version 2.0 (the - - "License"); you may not use this file except in compliance - - with the License. You may obtain a copy of the License at - - - - http://www.apache.org/licenses/LICENSE-2.0 - - - - Unless required by applicable law or agreed to in writing, - - software distributed under the License is distributed on an - - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - - KIND, either express or implied. See the License for the - - specific language governing permissions and limitations - - under the License. - - - --> -<div class="broker"> - <div data-dojo-type="dijit.TitlePane" data-dojo-props="title: 'Broker Attributes', open: false"> - <div id="brokerAttributes" class="clear"> - <div id="brokerAttribute.name.container" class="clear"> - <div class="formLabel-labelCell">Broker name:</div> - <div id="brokerAttribute.name"></div> - </div> - <div id="brokerAttribute.operatingSystem.container" class="clear"> - <div class="formLabel-labelCell">Operation system:</div> - <div id="brokerAttribute.operatingSystem"></div> - </div> - <div id="brokerAttribute.platform.container" class="clear"> - <div class="formLabel-labelCell">Platform:</div> - <div id="brokerAttribute.platform"></div> - </div> - <div id="brokerAttribute.productVersion.container" class="clear"> - <div class="formLabel-labelCell">Broker version:</div> - <div id="brokerAttribute.productVersion"></div> - </div> - <div id="brokerAttribute.modelVersion.container" class="clear"> - <div class="formLabel-labelCell">Broker model version:</div> - <div id="brokerAttribute.modelVersion"></div> - </div> - <div id="brokerAttribute.defaultVirtualHost.container" class="hidden clear"> - <div class="formLabel-labelCell">Default virtual host:</div> - <div id="brokerAttribute.defaultVirtualHost"></div> - </div> - <div id="brokerAttribute.statisticsReportingPeriod.container" class="hidden clear"> - <div class="formLabel-labelCell">Statistics reporting period (ms):</div> - <div id="brokerAttribute.statisticsReportingPeriod"></div> - </div> - <div id="brokerAttribute.statisticsReportingResetEnabled.container" class="hidden clear"> - <div class="formLabel-labelCell">Statistics reporting period enabled:</div> - <div id="brokerAttribute.statisticsReportingResetEnabled"></div> - </div> - <div class="clear"></div> - <br/> - <div data-dojo-type="dijit.TitlePane" data-dojo-props="title: 'Global Connection Defaults', open: true"> - <div id="brokerAttribute.connection.sessionCountLimit.container" class="clear"> - <div class="formLabel-labelCell">Maximum number of sessions:</div> - <div id="brokerAttribute.connection.sessionCountLimit"></div> - </div> - <div id="brokerAttribute.connection.heartBeatDelay.container" class="clear"> - <div class="formLabel-labelCell">Heart beat delay (ms):</div> - <div id="brokerAttribute.connection.heartBeatDelay"></div> - </div> - <div class="clear"></div> - </div> - </div> - <br/> - <button data-dojo-type="dijit.form.Button" class="editBroker">Edit</button> - </div> - <br/> - <div data-dojo-type="dijit.TitlePane" data-dojo-props="title: 'Virtual Hosts'"> - <div class="broker-virtualhosts"></div> - <button data-dojo-type="dijit.form.Button" class="addVirtualHostNodeAndVirtualHostButton">Add</button> - <div data-dojo-type="dijit.form.DropDownButton" class="virtualHostNodeMenuButton" data-dojo-props="iconClass: 'dijitIconConnector',disabled:true"> - <span>Virtual Host Node</span> - <div data-dojo-type="dijit.Menu"> - <div data-dojo-type="dijit.MenuItem">View</div> - <div data-dojo-type="dijit.MenuItem">Delete</div> - <div data-dojo-type="dijit.MenuItem" data-dojo-props="disabled:true">Start</div> - <div data-dojo-type="dijit.MenuItem" data-dojo-props="disabled:true">Stop</div> - </div> - </div> - <div data-dojo-type="dijit.form.DropDownButton" class="virtualHostMenuButton" data-dojo-props="iconClass: 'dijitIconPackage',disabled:true"> - <span>Virtual Host</span> - <div data-dojo-type="dijit.Menu" class="virtualHostMenu"> - <div data-dojo-type="dijit.MenuItem" class="viewVirtualHost" >View</div> - <div data-dojo-type="dijit.MenuItem" data-dojo-props="disabled:true">Start</div> - <div data-dojo-type="dijit.MenuItem" data-dojo-props="disabled:true">Stop</div> - </div> - </div> - </div> - <br/> - <div data-dojo-type="dijit.TitlePane" data-dojo-props="title: 'Ports'"> - <div class="broker-ports"></div> - <button data-dojo-type="dijit.form.Button" class="addPort">Add Port</button> - <button data-dojo-type="dijit.form.Button" class="deletePort">Delete Port</button> - </div> - <br/> - <div data-dojo-type="dijit.TitlePane" data-dojo-props="title: 'Authentication Providers'"> - <div class="broker-authentication-providers"></div> - <button data-dojo-type="dijit.form.Button" class="addAuthenticationProvider">Add Provider</button> - <button data-dojo-type="dijit.form.Button" class="deleteAuthenticationProvider">Delete Provider</button> - </div> - <br/> - <div data-dojo-type="dijit.TitlePane" data-dojo-props="title: 'Key stores'"> - <div class="broker-key-stores"></div> - <button data-dojo-type="dijit.form.Button" class="addKeystore">Add Key Store</button> - <button data-dojo-type="dijit.form.Button" class="deleteKeystore">Delete Key Store</button> - </div> - <br/> - <div data-dojo-type="dijit.TitlePane" data-dojo-props="title: 'Trust stores'"> - <div class="broker-trust-stores"></div> - <button data-dojo-type="dijit.form.Button" class="addTruststore">Add Trust Store</button> - <button data-dojo-type="dijit.form.Button" class="deleteTruststore">Delete Trust Store</button> - </div> - <br/> - <div data-dojo-type="dijit.TitlePane" data-dojo-props="title: 'Group Providers'"> - <div class="broker-group-providers"></div> - <button data-dojo-type="dijit.form.Button" class="addGroupProvider">Add Group Provider</button> - <button data-dojo-type="dijit.form.Button" class="deleteGroupProvider">Delete Group Provider</button> - </div> - <br/> - <div data-dojo-type="dijit.TitlePane" data-dojo-props="title: 'Access Control Providers'"> - <div class="broker-access-control-providers-warning" style="color: red"></div> - <div class="broker-access-control-providers"></div> - <button data-dojo-type="dijit.form.Button" class="addAccessControlProvider">Add Access Control Provider</button> - <button data-dojo-type="dijit.form.Button" class="deleteAccessControlProvider">Delete Access Control Provider</button> - </div> - <br/> - <button data-dojo-type="dijit.form.Button" class="logViewer" data-dojo-props="iconClass: 'logViewerIcon'">Log Viewer</button> - <br/><br/> -</div> - diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/showConnection.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/showConnection.html deleted file mode 100644 index cd04b962ce..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/showConnection.html +++ /dev/null @@ -1,96 +0,0 @@ -<!-- - - - - Licensed to the Apache Software Foundation (ASF) under one - - or more contributor license agreements. See the NOTICE file - - distributed with this work for additional information - - regarding copyright ownership. The ASF licenses this file - - to you under the Apache License, Version 2.0 (the - - "License"); you may not use this file except in compliance - - with the License. You may obtain a copy of the License at - - - - http://www.apache.org/licenses/LICENSE-2.0 - - - - Unless required by applicable law or agreed to in writing, - - software distributed under the License is distributed on an - - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - - KIND, either express or implied. See the License for the - - specific language governing permissions and limitations - - under the License. - - - --> -<div class="connection"> - <div data-dojo-type="dijit.TitlePane" data-dojo-props="title: 'Connection Attributes', open: true"> - <div class="alignLeft"> - <div class="clear"> - <div class="formLabel-labelCell">Name:</div> - <div class="name formValue-valueCell"></div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">User:</div> - <div class="principal formValue-valueCell"></div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">Client ID:</div> - <div class="clientId formValue-valueCell"></div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">Client Version:</div> - <div class="clientVersion formValue-valueCell"></div> - </div> - </div> - <div class="alignRight"> - <div class="clear"> - <div class="formLabel-labelCell">Inbound:</div> - <div class="formValue-valueCell"> - <span class="msgInRate"></span> - <span> msg/s</span> - <span class="bytesInRate"></span> - <span class="bytesInRateUnits"></span> - </div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">Outbound:</div> - <div class="formValue-valueCell"> - <span class="msgOutRate"></span> - <span> msg/s</span> - <span class="bytesOutRate"></span> - <span class="bytesOutRateUnits"></span> - </div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">Connect Time:</div> - <div class="formValue-valueCell"> - <div class="createdTime"></div> - </div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">Last I/O Time:</div> - <div class="formValue-valueCell"> - <div class="lastIoTime"></div> - </div> - </div> - </div> - <div class="clear"></div> - <div class="clear"> - <div class="formLabel-labelCell">Remote Process (PID):</div> - <div class="remoteProcessPid"></div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">Port:</div> - <div class="port"></div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">Transport:</div> - <div class="transport"></div> - </div> - </div> - <div class="clear"/> - - <br/> - - <div data-dojo-type="dijit.TitlePane" data-dojo-props="title: 'Sessions'"> - <div class="sessions"></div> - </div> - <br/> - -</div> diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/showExchange.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/showExchange.html deleted file mode 100644 index b67ea2f590..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/showExchange.html +++ /dev/null @@ -1,83 +0,0 @@ -<!-- - - - - Licensed to the Apache Software Foundation (ASF) under one - - or more contributor license agreements. See the NOTICE file - - distributed with this work for additional information - - regarding copyright ownership. The ASF licenses this file - - to you under the Apache License, Version 2.0 (the - - "License"); you may not use this file except in compliance - - with the License. You may obtain a copy of the License at - - - - http://www.apache.org/licenses/LICENSE-2.0 - - - - Unless required by applicable law or agreed to in writing, - - software distributed under the License is distributed on an - - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - - KIND, either express or implied. See the License for the - - specific language governing permissions and limitations - - under the License. - - - --> -<div class="exchange"> - <div data-dojo-type="dijit.TitlePane" data-dojo-props="title: 'Exchange Attributes', open: true"> - <div class="clear"> - <div class="formLabel-labelCell">Name:</div> - <div class="name"></div> - </div> - <div class="clear"> - <div class="alignLeft"> - - <div class="clear"> - <div class="formLabel-labelCell">Type:</div> - <div class="type formValue-valueCell"></div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">State:</div> - <div class="state formValue-valueCell"></div> - </div> - </div> - <div class="alignRight"> - <div class="clear"> - <div class="formLabel-labelCell">Inbound:</div> - <div class="formValue-valueCell"> - <span class="msgInRate"></span> - <span> msg/s</span> - <span class="bytesInRate">(</span> - <span class="bytesInRateUnits">)</span> - </div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">Dropped:</div> - <div class="formValue-valueCell"> - <span class="msgDropRate"></span> - <span> msg/s</span> - <span class="bytesDropRate">(</span> - <span class="bytesDropRateUnits">)</span> - </div> - </div> - </div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">Durable:</div> - <div class="durable"></div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">Lifespan:</div> - <div class="lifetimePolicy"></div> - </div> - - <div class="clear"></div> - </div> - <br/> - - <div data-dojo-type="dijit.TitlePane" data-dojo-props="title: 'Bindings'"> - <div class="bindings"></div> - <button data-dojo-type="dijit.form.Button" class="addBindingButton">Add Binding</button> - <button data-dojo-type="dijit.form.Button" class="deleteBindingButton">Delete Binding</button> - </div> - <br/> - - <div class="dijitDialogPaneActionBar"> - <button data-dojo-type="dijit.form.Button" class="deleteExchangeButton" type="button">Delete Exchange</button> - </div> -</div> diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/showGroupProvider.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/showGroupProvider.html deleted file mode 100644 index 3793a4407a..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/showGroupProvider.html +++ /dev/null @@ -1,45 +0,0 @@ -<!-- - - - - Licensed to the Apache Software Foundation (ASF) under one - - or more contributor license agreements. See the NOTICE file - - distributed with this work for additional information - - regarding copyright ownership. The ASF licenses this file - - to you under the Apache License, Version 2.0 (the - - "License"); you may not use this file except in compliance - - with the License. You may obtain a copy of the License at - - - - http://www.apache.org/licenses/LICENSE-2.0 - - - - Unless required by applicable law or agreed to in writing, - - software distributed under the License is distributed on an - - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - - KIND, either express or implied. See the License for the - - specific language governing permissions and limitations - - under the License. - - - --> -<div> - <div class="groupProvider" data-dojo-type="dijit.TitlePane" data-dojo-props="title: 'Group Provider', open: true"> - <div class="clear"> - <div class="formLabel-labelCell">Name:</div> - <div class="name"></div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">Type:</div> - <div class="type"></div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">State:</div> - <div class="state"></div> - </div> - <div class="clear"></div> - - <div class="providerDetails"></div> - <br/> - <div class="dijitDialogPaneActionBar"> - <input class="deleteGroupProviderButton" type="button" value="Delete" label="Delete" data-dojo-type="dijit.form.Button" /> - <input class="editGroupProviderButton" type="button" value="Edit" label="Edit" data-dojo-type="dijit.form.Button" data-dojo-props="disabled:true"/> - </div> - </div> -</div> - diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/showMessage.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/showMessage.html deleted file mode 100644 index caf26bc075..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/showMessage.html +++ /dev/null @@ -1,81 +0,0 @@ -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one or more - ~ contributor license agreements. See the NOTICE file distributed with - ~ this work for additional information regarding copyright ownership. - ~ The ASF licenses this file to You under the Apache License, Version 2.0 - ~ (the "License"); you may not use this file except in compliance with - ~ the License. You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --> - -<div class="dijitHidden"> - <div data-dojo-type="dijit.Dialog" style="width:600px;" data-dojo-props="title:'View Message'" id="showMessage"> - - <table style="border: 0;"> - <tr style="margin-bottom: 4pt"> - <td style="width: 10em; vertical-align: top"><span style="font-weight: bold;">Message Number:</span></td> - <td><span class="message-id"></span></td> - </tr> - <tr style="margin-bottom: 4pt"> - <td style="width: 10em; vertical-align: top"><span style="font-weight: bold;">Size:</span></td> - <td><span class="message-size"></span> bytes</td> - </tr> - <tr style="margin-bottom: 4pt"> - <td style="width: 10em; vertical-align: top"><span style="font-weight: bold;">Message Id:</span></td> - <td><span class="message-messageId"></span></td> - </tr> - <tr style="margin-bottom: 4pt"> - <td style="width: 10em; vertical-align: top"><span style="font-weight: bold;">Correlation Id:</span></td> - <td><span class="message-correlationId"></span></td> - </tr> - <tr style="margin-bottom: 4pt"> - <td style="width: 10em; vertical-align: top"><span style="font-weight: bold;">State:</span></td> - <td><span class="message-state"></span></td> - </tr> - <tr style="margin-bottom: 4pt"> - <td style="width: 10em; vertical-align: top"><span style="font-weight: bold;">Persistent:</span></td> - <td><span class="message-persistent boolean"></span></td> - </tr> - <tr style="margin-bottom: 4pt"> - <td style="width: 10em; vertical-align: top"><span style="font-weight: bold;">Priority:</span></td> - <td><span class="message-priority"></span></td> - </tr> - <tr style="margin-bottom: 4pt"> - <td style="width: 10em; vertical-align: top"><span style="font-weight: bold;">Arrival Time:</span> - </td><td><span class="message-arrivalTime datetime"></span></td> - </tr> - <tr style="margin-bottom: 4pt"> - <td style="width: 10em; vertical-align: top"><span style="font-weight: bold;">Expiration:</span></td> - <td><span class="message-expirationTime datetime"></span></td> - </tr> - <tr style="margin-bottom: 4pt"> - <td style="width: 10em; vertical-align: top"><span style="font-weight: bold;">MIME Type:</span></td> - <td><span class="message-mimeType"></span></td> - </tr> - <tr style="margin-bottom: 4pt"> - <td style="width: 10em; vertical-align: top"><span style="font-weight: bold;">User:</span></td> - <td><span class="message-userId"></span></td> - </tr> - <tr style="margin-bottom: 4pt"> - <td style="width: 10em; vertical-align: top"><span style="font-weight: bold;">Headers:</span></td> - <td><div class="message-headers map"></div></td> - </tr> - - <tr style="margin-bottom: 4pt"> - <td style="width: 10em; vertical-align: top"><span style="font-weight: bold;">Content:</span></td> - <td><div class="message-content"></div></td> - </tr> - </table> - <br/> - <input type="button" value="Close" label="Close" dojoType="dijit.form.Button" class="closeViewMessage"/> - - </div> -</div> - diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/showPlugin.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/showPlugin.html deleted file mode 100644 index 72f0f22a0d..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/showPlugin.html +++ /dev/null @@ -1,33 +0,0 @@ -<!-- - - - - Licensed to the Apache Software Foundation (ASF) under one - - or more contributor license agreements. See the NOTICE file - - distributed with this work for additional information - - regarding copyright ownership. The ASF licenses this file - - to you under the Apache License, Version 2.0 (the - - "License"); you may not use this file except in compliance - - with the License. You may obtain a copy of the License at - - - - http://www.apache.org/licenses/LICENSE-2.0 - - - - Unless required by applicable law or agreed to in writing, - - software distributed under the License is distributed on an - - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - - KIND, either express or implied. See the License for the - - specific language governing permissions and limitations - - under the License. - - - --> -<div class="plugin"> - <div> - <div style="both:clear"> - <div class="formLabel-labelCell">Name:</div> - <div class="name"></div> - </div> - <div style="both:clear"> - <div class="formLabel-labelCell">Type:</div> - <div class="type"></div> - </div> - </div> - <div class="pluginDetails"></div> -</div> diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/showPort.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/showPort.html deleted file mode 100644 index 5e324bd219..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/showPort.html +++ /dev/null @@ -1,102 +0,0 @@ -<!-- - - - - Licensed to the Apache Software Foundation (ASF) under one - - or more contributor license agreements. See the NOTICE file - - distributed with this work for additional information - - regarding copyright ownership. The ASF licenses this file - - to you under the Apache License, Version 2.0 (the - - "License"); you may not use this file except in compliance - - with the License. You may obtain a copy of the License at - - - - http://www.apache.org/licenses/LICENSE-2.0 - - - - Unless required by applicable law or agreed to in writing, - - software distributed under the License is distributed on an - - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - - KIND, either express or implied. See the License for the - - specific language governing permissions and limitations - - under the License. - - - --> -<div> - <div class="portContainer" data-dojo-type="dijit.TitlePane" data-dojo-props="title: 'Port Attributes', open: true"> - - <div class="clear name"> - <div class="formLabel-labelCell">Name:</div> - <div class="nameValue"></div> - </div> - <div class="clear"></div> - <div class="alignLeft"> - <div class="clear type"> - <div class="formLabel-labelCell">Port Type:</div> - <div class="formValue-valueCell typeValue"></div> - </div> - </div> - <div class="alignRight"> - <div class="clear maxOpenConnections"> - <div class="formLabel-labelCell">Open connections (current/maximum):</div> - <div class="formValue-valueCell"> - <span class="connectionCountValue"></span><span>/</span><span class="maxOpenConnectionsValue"></span> - </div> - </div> - </div> - - <div class="clear state"> - <div class="formLabel-labelCell">State:</div> - <div class="formValue-valueCell stateValue"></div> - </div> - - <div class="clear port"> - <div class="formLabel-labelCell">Port Number:</div> - <div class="formValue-valueCell portValue"></div> - </div> - - <div class="clear protocols"> - <div class="formLabel-labelCell">Protocols:</div> - <div class="formValue-valueCell protocolsValue multiLineValue"></div> - </div> - - <div class="clear authenticationProvider"> - <div class="formLabel-labelCell">Authentication Provider:</div> - <div class="formValue-valueCell authenticationProviderValue"></div> - </div> - - <div class="clear bindingAddress"> - <div class="formLabel-labelCell">Binding address:</div> - <div class="formValue-valueCell bindingAddressValue"></div> - </div> - - <div class="clear transports"> - <div class="formLabel-labelCell">Transports:</div> - <div class="formValue-valueCell transportsValue multiLineValue"></div> - </div> - - <div class="clear keyStore"> - <div class="formLabel-labelCell">Key Store:</div> - <div class="formValue-valueCell keyStoreValue"></div> - </div> - - <div class="clear needClientAuth"> - <div class="formLabel-labelCell">Need SSL Client Certificate:</div> - <div class="formValue-valueCell needClientAuthValue"></div> - </div> - - <div class="clear wantClientAuth"> - <div class="formLabel-labelCell">Want SSL Client Certificate:</div> - <div class="formValue-valueCell wantClientAuthValue"></div> - </div> - - <div class="clear trustStores"> - <div class="formLabel-labelCell">Trust Stores:</div> - <div class="formValue-valueCell trustStoresValue multiLineValue"></div> - </div> - - <div class="clear"></div> - </div> - <br/> - - <div class="dijitDialogPaneActionBar"> - <button data-dojo-type="dijit.form.Button" class="editPortButton" type="button">Edit</button> - <button data-dojo-type="dijit.form.Button" class="deletePortButton" type="button">Delete</button> - </div> -</div> diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/showPreferences.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/showPreferences.html deleted file mode 100644 index 8dff5132bd..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/showPreferences.html +++ /dev/null @@ -1,79 +0,0 @@ -<!-- - - - - Licensed to the Apache Software Foundation (ASF) under one - - or more contributor license agreements. See the NOTICE file - - distributed with this work for additional information - - regarding copyright ownership. The ASF licenses this file - - to you under the Apache License, Version 2.0 (the - - "License"); you may not use this file except in compliance - - with the License. You may obtain a copy of the License at - - - - http://www.apache.org/licenses/LICENSE-2.0 - - - - Unless required by applicable law or agreed to in writing, - - software distributed under the License is distributed on an - - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - - KIND, either express or implied. See the License for the - - specific language governing permissions and limitations - - under the License. - - - --> -<div data-dojo-type="dijit/Dialog" data-dojo-props="title:'Preferences'" id="preferences.preferencesDialog"> - <div data-dojo-type="dijit/layout/TabContainer" style="width: 600px; height: 400px"> - <div data-dojo-type="dijit/layout/ContentPane" title="Own Preferences" data-dojo-props="selected:true" id="preferences.preferencesTab"> - <form method="post" data-dojo-type="dijit/form/Form" id="preferences.preferencesForm"> - <div style="height:300px"> - <table cellpadding="0" cellspacing="2"> - <tr> - <td colspan="2"><span id="preferences.timeZone" data-dojo-type="qpid/common/TimeZoneSelector" data-dojo-props="name: 'timeZone', labelStyle: {width: '105px'}"></span></td> - </tr> - <tr> - <td style="width: 105px"><strong>Update period:</strong></td> - <td><input id="preferences.updatePeriod" name="updatePeriod" data-dojo-type="dijit/form/NumberSpinner" data-dojo-props=" - invalidMessage: 'Invalid value', - required: false, - smallDelta: 1, - value: 5, - constraints: {min:1,max:65535,places:0, pattern: '#####'} - "/> - </td> - </tr> - </table> - </div> - <div class="dijitDialogPaneActionBar qpidDialogPaneActionBar"> - <button data-dojo-type="dijit/form/Button" data-dojo-props="label: 'Set'" id="preferences.setButton">Set</button> - <button data-dojo-type="dijit/form/Button" data-dojo-props="label: 'Set and Close'" id="preferences.setAndCloseButton">Set and Close</button> - </div> - </form> - </div> - <div data-dojo-type="dijit/layout/ContentPane" title="Users with Preferences" id="preferences.usersTab"> - <table id="preferences.users" data-dojo-type="dojox/grid/EnhancedGrid" data-dojo-props=" - label:'Trust Stores:', - plugins:{ - indirectSelection: true, - pagination: { - pageSizes: [10, 25, 50, 100], - description: true, - sizeSwitch: true, - pageStepper: true, - gotoButton: true, - maxPageStep: 4, - position: 'bottom' - } - }, - rowSelector:'0px' - " style="height: 300px;"> - <thead> - <tr> - <th field="name" style="width:50%">User</th> - <th field="authenticationProvider" style="width:50%">Authentication Provider</th> - </tr> - </thead> - </table> - <div class="dijitDialogPaneActionBar qpidDialogPaneActionBar"> - <button id="preferences.deleteButton" data-dojo-type="dijit/form/Button" data-dojo-props="label:'Delete', title:'Delete preferences for selected users'">Delete</button> - <button id="preferences.deleteAndCloseButton" data-dojo-type="dijit/form/Button" data-dojo-props="label: 'Delete and Close', title:'Delete preferences for selected users and close the dialog'">Delete and Close</button> - </div> - </div> - </div> -</div> diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/showPreferencesProvider.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/showPreferencesProvider.html deleted file mode 100644 index 49eb355ff3..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/showPreferencesProvider.html +++ /dev/null @@ -1,38 +0,0 @@ -<!-- - - - - Licensed to the Apache Software Foundation (ASF) under one - - or more contributor license agreements. See the NOTICE file - - distributed with this work for additional information - - regarding copyright ownership. The ASF licenses this file - - to you under the Apache License, Version 2.0 (the - - "License"); you may not use this file except in compliance - - with the License. You may obtain a copy of the License at - - - - http://www.apache.org/licenses/LICENSE-2.0 - - - - Unless required by applicable law or agreed to in writing, - - software distributed under the License is distributed on an - - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - - KIND, either express or implied. See the License for the - - specific language governing permissions and limitations - - under the License. - - - --> -<div class="preferencesProvider"> - <div class="preferencesProviderAttributes" data-dojo-type="dijit.TitlePane" data-dojo-props="title: 'Preferences Provider Attributes', open: true"> - <div class="clear"> - <div class="formLabel-labelCell">Type:</div> - <div class="preferencesProviderType"></div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">State:</div> - <div class="preferencesProviderState"></div> - </div> - <div class="preferencesDetails"></div> - <div class="clear"></div> - <div class="clear dijitDialogPaneActionBar"> - <button data-dojo-type="dijit.form.Button" class="editPreferencesProviderButton">Edit</button> - <button data-dojo-type="dijit.form.Button" class="deletePreferencesProviderButton">Delete</button> - </div> - </div> -</div> diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/showQueue.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/showQueue.html deleted file mode 100644 index 7132dd8105..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/showQueue.html +++ /dev/null @@ -1,215 +0,0 @@ -<!-- - - - - Licensed to the Apache Software Foundation (ASF) under one - - or more contributor license agreements. See the NOTICE file - - distributed with this work for additional information - - regarding copyright ownership. The ASF licenses this file - - to you under the Apache License, Version 2.0 (the - - "License"); you may not use this file except in compliance - - with the License. You may obtain a copy of the License at - - - - http://www.apache.org/licenses/LICENSE-2.0 - - - - Unless required by applicable law or agreed to in writing, - - software distributed under the License is distributed on an - - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - - KIND, either express or implied. See the License for the - - specific language governing permissions and limitations - - under the License. - - - --> -<div class="queue"> - <div data-dojo-type="dijit.TitlePane" data-dojo-props="title: 'Queue Attributes', open: true"> - - <div class="clear"> - <div class="formLabel-labelCell">Name:</div> - <div class="name formValue-valueCell"></div> - </div> - <div class="clear"></div> - <div class="alignLeft"> - <div class="clear"> - <div class="formLabel-labelCell">Type:</div> - <div class="type formValue-valueCell"></div> - <div class="typeQualifier formValue-valueCell"></div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">State:</div> - <div class="state formValue-valueCell"></div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">Durable:</div> - <div class="durable formValue-valueCell"></div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">Lifespan:</div> - <div class="lifetimePolicy formValue-valueCell"></div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">Persist Messages:</div> - <div class="messageDurability formValue-valueCell"></div> - </div> - </div> - <div class="alignRight"> - <div class="clear"> - <div class="formLabel-labelCell">Inbound:</div> - <div class="formValue-valueCell"> - <span class="msgInRate"></span> - <span> msg/s</span> - <span class="bytesInRate"></span> - <span class="bytesInRateUnits"></span> - </div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">Outbound:</div> - <div class="formValue-valueCell"> - <span class="msgOutRate"></span> - <span> msg/s</span> - <span class="bytesOutRate"></span> - <span class="bytesOutRateUnits"></span> - </div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">Size:</div> - <div class="formValue-valueCell"> - <span class="queueDepthMessages"></span> - <span> msgs</span> - <span class="queueDepthBytes">(</span> - <span class="queueDepthBytesUnits">)</span> - </div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">Pre-fetched:</div> - <div class="formValue-valueCell"> - <span class="unacknowledgedMessages"></span> - <span> msgs</span> - <span class="unacknowledgedBytes">(</span> - <span class="unacknowledgedBytesUnits">)</span> - </div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">Oldest Message Age:</div> - <div class="formValue-valueCell"> - <span class="oldestMessageAge"></span> - <span> secs</span> - </div> - </div> - </div> - <div class="clear"></div> - <div class="clear"> - <div class="formLabel-labelCell">Enforced Max. Ttl(ms):</div> - <div class="maximumMessageTtl"></div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">Enforced Min. Ttl(ms):</div> - <div class="minimumMessageTtl"></div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">Exclusive:</div> - <div class="exclusive"></div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">Owner:</div> - <div class="owner"></div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">Alternate Exchange:</div> - <div class="alternateExchange"></div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">Maximum Delivery Attempts:</div> - <div class="maximumDeliveryAttempts"></div> - </div> - <div class="clear messageGroups"> - <div class="clear"> - <div class="messageGroupKeyLabel formLabel-labelCell ">Message Group Key:</div> - <div class="messageGroupKey"></div> - </div> - <div class="clear"> - <div class="messageGroupSharedGroupsLabel formLabel-labelCell">Shared Message Groups:</div> - <div class="messageGroupSharedGroups"></div> - </div> - </div> - <div class="clear"></div> - </div> - <br/> - <div data-dojo-type="dijit.TitlePane" data-dojo-props="title: 'Bindings'"> - <div class="bindings"></div> - <button data-dojo-type="dijit.form.Button" class="addBindingButton" type="button">Add Binding</button> - </div> - <br/> - <div data-dojo-type="dijit.TitlePane" data-dojo-props="title: 'Consumers'"> - <div class="consumers"></div> - </div> - <br/> - <div data-dojo-type="dijit.TitlePane" data-dojo-props="title: 'Messages'"> - <div class="messages"></div> - <button data-dojo-type="dijit.form.Button" class="deleteMessagesButton" type="button">Delete Messages</button> - <button data-dojo-type="dijit.form.Button" class="clearQueueButton" type="button">Clear Queue</button> - <button data-dojo-type="dijit.form.Button" class="moveMessagesButton" type="button">Move Messages</button> - <button data-dojo-type="dijit.form.Button" class="copyMessagesButton" type="button">Copy Messages</button> - </div> - <br/> - <div data-dojo-type="dijit.TitlePane" data-dojo-props="title: 'Flow Control Settings', open: false"> - <div class="clear"> - <div class="formLabel-labelCell">Capacity:</div> - <div> - <span class="queueFlowControlSizeBytes"></span> - <span>B</span> - </div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">Resume Capacity:</div> - <div> - <span class="queueFlowResumeSizeBytes"></span> - <span>B</span> - </div> - </div> - <div class="clear"></div> - </div> - - <br/> - <div data-dojo-type="dijit.TitlePane" data-dojo-props="title: 'Alerting Thresholds', open: false"> - <div class="clear"> - <div class="formLabel-labelCell">Queue Depth:</div> - <div> - <span class="alertThresholdQueueDepthMessages"></span> - <span>msgs</span> - </div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">Queue Depth:</div> - <div> - <span class="alertThresholdQueueDepthBytes"></span> - <span class="alertThresholdQueueDepthBytesUnits"></span> - </div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">Message Age:</div> - <div> - <span class="alertThresholdMessageAge"></span> - <span class="alertThresholdMessageAgeUnits"></span> - </div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">Message Size:</div> - <div> - <span class="alertThresholdMessageSize"></span> - <span class="alertThresholdMessageSizeUnits"></span> - </div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">Gap between alerts:</div> - <div> - <span class="alertRepeatGap"></span> - <span class="alertRepeatGapUnits"></span> - </div> - </div> - <div class="clear"></div> - </div> - - <div class="dijitDialogPaneActionBar"> - <button data-dojo-type="dijit.form.Button" class="editQueueButton" type="button">Edit Queue</button> - <button data-dojo-type="dijit.form.Button" class="deleteQueueButton" type="button">Delete Queue</button> - </div> -</div> - diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/showStore.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/showStore.html deleted file mode 100644 index e564726cbb..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/showStore.html +++ /dev/null @@ -1,46 +0,0 @@ -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one - ~ or more contributor license agreements. See the NOTICE file - ~ distributed with this work for additional information - ~ regarding copyright ownership. The ASF licenses this file - ~ to you under the Apache License, Version 2.0 (the - ~ "License"); you may not use this file except in compliance - ~ with the License. You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, - ~ software distributed under the License is distributed on an - ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - ~ KIND, either express or implied. See the License for the - ~ specific language governing permissions and limitations - ~ under the License. - --> -<div> - <div data-dojo-type="dijit.TitlePane" data-dojo-props="title: 'Show Store', open: true"> - <div id="showStore.contentPane"> - <div class="clear"> - <div class="formLabel-labelCell">Name:</div> - <div class="name"></div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">Type:</div> - <div class="type"></div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">State:</div> - <div class="state"></div> - </div> - <div class="clear"> - <div class="typeFieldsContainer"></div> - </div> - <div class="clear"> - </div> - </div> - - <div class="dijitDialogPaneActionBar"> - <button data-dojo-type="dijit.form.Button" class="editStoreButton" type="button">Edit</button> - <button data-dojo-type="dijit.form.Button" class="deleteStoreButton" type="button">Delete</button> - </div> - </div> -</div> diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/showVirtualHost.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/showVirtualHost.html deleted file mode 100644 index 1a2b5293b6..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/showVirtualHost.html +++ /dev/null @@ -1,140 +0,0 @@ -<!DOCTYPE HTML> -<!-- - - - - Licensed to the Apache Software Foundation (ASF) under one - - or more contributor license agreements. See the NOTICE file - - distributed with this work for additional information - - regarding copyright ownership. The ASF licenses this file - - to you under the Apache License, Version 2.0 (the - - "License"); you may not use this file except in compliance - - with the License. You may obtain a copy of the License at - - - - http://www.apache.org/licenses/LICENSE-2.0 - - - - Unless required by applicable law or agreed to in writing, - - software distributed under the License is distributed on an - - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - - KIND, either express or implied. See the License for the - - specific language governing permissions and limitations - - under the License. - - - --> - -<div class="virtualhost"> - <div data-dojo-type="dijit.TitlePane" data-dojo-props="title: 'Virtual Host Attributes', open: true"> - <div class="alignLeft"> - <div class="clear"> - <div class="formLabel-labelCell">Name:</div> - <div class="name formValue-valueCell"></div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">Type:</div> - <div class="type formValue-valueCell"></div> - </div> - </div> - <div class="alignRight"> - <div class="clear"> - <div class="formLabel-labelCell">Inbound:</div> - <div class="formValue-valueCell"> - <span class="msgInRate"></span> - <span> msg/s</span> - <span class="bytesInRate"></span> - <span class="bytesInRateUnits"></span> - </div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">Outbound:</div> - <div class="formValue-valueCell"> - <span class="msgOutRate"></span> - <span> msg/s</span> - <span class="bytesOutRate"></span> - <span class="bytesOutRateUnits"></span> - </div> - </div> - </div> - <div class="clear"></div> - <div class="clear"> - <div class="formLabel-labelCell">State:</div> - <div class="state"></div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">Durable:</div> - <div class="durable"></div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">Lifespan:</div> - <div class="lifetimePolicy"></div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">Dead letter queue enabled:</div> - <div class="deadLetterQueueEnabled"></div> - </div> - <div class="clear virtualHostDetailsContainer"></div> - <div class="clear"></div> - - <br/> - - <div data-dojo-type="dijit.TitlePane" data-dojo-props="title: 'Store Transaction Settings', open: false"> - <div class="clear"> - <div class="formLabel-labelCell">Idle timeout before a warning (ms) :</div> - <div class="storeTransactionIdleTimeoutWarn"></div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">Idle timeout before closing (ms) :</div> - <div class="storeTransactionIdleTimeoutClose"></div> - </div> - <div class="clear"> - <div class="formLabel-labelCell" >Open timeout before warning (ms) :</div> - <div class="storeTransactionOpenTimeoutWarn"></div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">Open timeout before closing (ms) :</div> - <div class="storeTransactionOpenTimeoutClose"></div> - </div> - <div class="clear"></div> - </div> - - <br/> - - <div data-dojo-type="dijit.TitlePane" data-dojo-props="title: 'House Keeping Settings', open: false"> - <div class="clear"> - <div class="formLabel-labelCell">House keeping check period (ms):</div> - <div class="housekeepingCheckPeriod"></div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">House keeping thread count:</div> - <div class="housekeepingThreadCount"></div> - </div> - <div class="clear"></div> - </div> - - </div> - - <div class="dijitDialogPaneActionBar"> - <button data-dojo-type="dijit.form.Button" class="startButton" type="button" data-dojo-props="disabled: true">Start</button> - <button data-dojo-type="dijit.form.Button" class="stopButton" type="button" data-dojo-props="disabled: true">Stop</button> - <button data-dojo-type="dijit.form.Button" class="editButton" type="button" data-dojo-props="disabled: true">Edit</button> - <button data-dojo-type="dijit.form.Button" class="downloadButton" type="button" data-dojo-props="disabled: true">Download</button> - <button data-dojo-type="dijit.form.Button" class="deleteButton" data-dojo-props="iconClass: 'dijitIconDelete'">Delete</button> - </div> - - <br/> - <div class="virtualHostChildren"> - <div data-dojo-type="dijit.TitlePane" data-dojo-props="title: 'Exchanges'"> - <div class="exchanges"></div> - <button data-dojo-type="dijit.form.Button" class="addExchangeButton">Add Exchange</button> - <button data-dojo-type="dijit.form.Button" class="deleteExchangeButton">Delete Exchange</button> - </div> - <br/> - <div data-dojo-type="dijit.TitlePane" data-dojo-props="title: 'Queues'"> - <div class="queues"></div> - <button data-dojo-type="dijit.form.Button" class="addQueueButton">Add Queue</button> - <button data-dojo-type="dijit.form.Button" class="deleteQueueButton">Delete Queue</button> - </div> - <br/> - <div data-dojo-type="dijit.TitlePane" data-dojo-props="title: 'Connections'" class="virtualHostConnections"> - <div class="connections"></div> - </div> - </div> -</div> - diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/showVirtualHostNode.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/showVirtualHostNode.html deleted file mode 100644 index 4c32a9ace7..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/showVirtualHostNode.html +++ /dev/null @@ -1,52 +0,0 @@ -<!DOCTYPE HTML> -<!-- - - - - Licensed to the Apache Software Foundation (ASF) under one - - or more contributor license agreements. See the NOTICE file - - distributed with this work for additional information - - regarding copyright ownership. The ASF licenses this file - - to you under the Apache License, Version 2.0 (the - - "License"); you may not use this file except in compliance - - with the License. You may obtain a copy of the License at - - - - http://www.apache.org/licenses/LICENSE-2.0 - - - - Unless required by applicable law or agreed to in writing, - - software distributed under the License is distributed on an - - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - - KIND, either express or implied. See the License for the - - specific language governing permissions and limitations - - under the License. - - - --> - -<div class="virtualhostnode"> - <div data-dojo-type="dijit.TitlePane" data-dojo-props="title: 'Virtual Host Node Attributes', open: true"> - <div class="clear"> - <div class="formLabel-labelCell">Name:</div> - <div class="name"></div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">Type:</div> - <div class="type"></div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">State:</div> - <div class="state"></div> - </div> - <div class="clear virtualhostnodedetails"> - </div> - <div class="clear"></div> - </div> - <div class="dijitDialogPaneActionBar"> - <button data-dojo-type="dijit.form.Button" class="startNodeButton" type="button" data-dojo-props="disabled: true">Start</button> - <button data-dojo-type="dijit.form.Button" class="stopNodeButton" type="button" data-dojo-props="disabled: true">Stop</button> - <button data-dojo-type="dijit.form.Button" class="editNodeButton" type="button" data-dojo-props="disabled: true">Edit</button> - <button data-dojo-type="dijit.form.Button" class="deleteNodeButton" data-dojo-props="iconClass: 'dijitIconDelete'">Delete</button> - </div> - <br/> - <div data-dojo-type="dijit.TitlePane" data-dojo-props="title: 'Virtual Host'" class="clear virtualHostGridPanel"> - <div class="virtualHost"></div> - </div> -</div> - diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/store/filekeystore/add.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/store/filekeystore/add.html deleted file mode 100644 index 676ae4007b..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/store/filekeystore/add.html +++ /dev/null @@ -1,86 +0,0 @@ -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one - ~ or more contributor license agreements. See the NOTICE file - ~ distributed with this work for additional information - ~ regarding copyright ownership. The ASF licenses this file - ~ to you under the Apache License, Version 2.0 (the - ~ "License"); you may not use this file except in compliance - ~ with the License. You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, - ~ software distributed under the License is distributed on an - ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - ~ KIND, either express or implied. See the License for the - ~ specific language governing permissions and limitations - ~ under the License. - --> - -<div> - <div id="addStore.oldBrowserWarning" class="infoMessage hidden clear"></div> - <div class="clear"> - <div id="addStore.serverPathLabel" class="formLabel-labelCell tableContainer-labelCell">Server path or upload*:</div> - <div class="formLabel-controlCell tableContainer-valueCell"> - <input type="text" id="addStore.storeUrl" - data-dojo-type="qpid/common/ResourceWidget" - data-dojo-props=" - name: 'storeUrl', - placeHolder: 'key store file server path', - required: true, - promptMessage: 'Location of the key store file on the server', - title: 'Enter the key store file path'" /> - </div> - - <div class="clear"> - <div class="formLabel-labelCell tableContainer-labelCell">Password*:</div> - <div class="formLabel-controlCell tableContainer-valueCell"> - <input type="password" id="addStore.password" - data-dojo-type="dijit/form/ValidationTextBox" - data-dojo-props=" - name: 'password', - placeHolder: 'store password', - required: true, - promptMessage: 'password for store', - title: 'Enter a password for the store'" /> - </div> - </div> - <div class="clear"> - <div class="formLabel-labelCell tableContainer-labelCell">Certificate alias:</div> - <div class="formLabel-controlCell tableContainer-valueCell"> - <input type="text" id="addStore.certificateAlias" - data-dojo-type="dijit/form/ValidationTextBox" - data-dojo-props=" - name: 'certificateAlias', - placeHolder: 'certificate alias', - promptMessage: 'Used to identify one certificate in a store that has many', - title: 'Enter an alias to identify one certificate in a store with many'" /> - </div> - </div> - <div class="clear"> - <div class="formLabel-labelCell tableContainer-labelCell clear">Key manager factory algorithm:</div> - <div class="formLabel-controlCell tableContainer-valueCell"> - <input type="text" id="addStore.keyManagerFactoryAlgorithm" - data-dojo-type="dijit/form/ValidationTextBox" - data-dojo-props=" - name: 'keyManagerFactoryAlgorithm', - placeHolder: 'key manager factory algorithm', - promptMessage: 'Name of the key manager algorithm known to Java', - title: 'Enter the key manager algorithm known to Java'" /> - </div> - </div> - <div class="clear"> - <div class="formLabel-labelCell tableContainer-labelCell">Java key store type:</div> - <div class="formLabel-controlCell tableContainer-valueCell"> - <input type="text" id="addStore.keyStoreType" - data-dojo-type="dijit/form/ValidationTextBox" - data-dojo-props=" - name: 'keyStoreType', - placeHolder: 'java key store type', - promptMessage: 'Name of the store type known to Java', - title: 'Enter the store type known to Java'" /> - </div> - </div> - - </div> -</div> diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/store/filekeystore/show.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/store/filekeystore/show.html deleted file mode 100644 index 9a1d93d83a..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/store/filekeystore/show.html +++ /dev/null @@ -1,39 +0,0 @@ -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one - ~ or more contributor license agreements. See the NOTICE file - ~ distributed with this work for additional information - ~ regarding copyright ownership. The ASF licenses this file - ~ to you under the Apache License, Version 2.0 (the - ~ "License"); you may not use this file except in compliance - ~ with the License. You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, - ~ software distributed under the License is distributed on an - ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - ~ KIND, either express or implied. See the License for the - ~ specific language governing permissions and limitations - ~ under the License. - --> - -<div> - <div class="clear"> - <div class="formLabel-labelCell">Path:</div> - <div ><span class="path" ></span></div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">Certificate alias:</div> - <div><span class="certificateAlias" ></span></div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">Java key store type:</div> - <div><span class="keyStoreType" ></span></div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">Key manager factory algorithm:</div> - <div><span class="keyManagerFactoryAlgorithm" ></span></div> - </div> - <div class="clear"></div> -</div> - diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/store/filetruststore/add.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/store/filetruststore/add.html deleted file mode 100644 index 15b1692300..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/store/filetruststore/add.html +++ /dev/null @@ -1,84 +0,0 @@ -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one - ~ or more contributor license agreements. See the NOTICE file - ~ distributed with this work for additional information - ~ regarding copyright ownership. The ASF licenses this file - ~ to you under the Apache License, Version 2.0 (the - ~ "License"); you may not use this file except in compliance - ~ with the License. You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, - ~ software distributed under the License is distributed on an - ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - ~ KIND, either express or implied. See the License for the - ~ specific language governing permissions and limitations - ~ under the License. - --> - -<div> - <div id="addStore.oldBrowserWarning" class="infoMessage hidden clear"></div> - <div class="clear"> - <div id="addStore.serverPathLabel" class="formLabel-labelCell tableContainer-labelCell">Server path or upload*:</div> - <div class="formLabel-controlCell tableContainer-valueCell"> - <input type="text" id="addStore.storeUrl" - data-dojo-type="qpid/common/ResourceWidget" - data-dojo-props=" - name: 'storeUrl', - placeHolder: 'trust store file server path', - required: true, - promptMessage: 'Location of the trust store file on the server', - title: 'Enter the store file path'" /> - </div> - <div class="clear"> - <div class="formLabel-labelCell tableContainer-labelCell">Password*:</div> - <div class="formLabel-controlCell tableContainer-valueCell"> - <input type="password" id="addStore.password" - data-dojo-type="dijit/form/ValidationTextBox" - data-dojo-props=" - name: 'password', - placeHolder: 'store password', - required: true, - promptMessage: 'password for store', - title: 'Enter a password for the store'" /> - </div> - </div> - <div class="clear"> - <div class="formLabel-labelCell tableContainer-labelCell">Peers only:</div> - <div class="formLabel-controlCell tableContainer-valueCell"> - <input type="text" id="addStore.peersOnly" - data-dojo-type="dijit/form/CheckBox" - data-dojo-props=" - name: 'peersOnly', - promptMessage: 'Peers only or not', - title: 'Tick if peers only'" /> - </div> - </div> - <div class="clear"> - <div class="formLabel-labelCell tableContainer-labelCell">Trust manager factory algorithm:</div> - <div class="formLabel-controlCell tableContainer-valueCell"> - <input type="text" id="addStore.keyManagerFactoryAlgorithm" - data-dojo-type="dijit/form/ValidationTextBox" - data-dojo-props=" - name: 'trustManagerFactoryAlgorithm', - placeHolder: 'trust manager factory algorithm', - promptMessage: 'Name of the trust manager algorithm known to Java', - title: 'Enter the trust manager algorithm known to Java'" /> - </div> - </div> - <div class="clear"> - <div class="formLabel-labelCell tableContainer-labelCell">Java trust store type:</div> - <div class="formLabel-controlCell tableContainer-valueCell"> - <input type="text" id="addStore.trustStoreType" - data-dojo-type="dijit/form/ValidationTextBox" - data-dojo-props=" - name: 'trustStoreType', - placeHolder: 'java trust store type', - promptMessage: 'Name of the store type known to Java', - title: 'Enter the store type known to Java'" /> - </div> - </div> - - </div> -</div> diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/store/filetruststore/show.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/store/filetruststore/show.html deleted file mode 100644 index 99190d1f90..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/store/filetruststore/show.html +++ /dev/null @@ -1,39 +0,0 @@ -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one - ~ or more contributor license agreements. See the NOTICE file - ~ distributed with this work for additional information - ~ regarding copyright ownership. The ASF licenses this file - ~ to you under the Apache License, Version 2.0 (the - ~ "License"); you may not use this file except in compliance - ~ with the License. You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, - ~ software distributed under the License is distributed on an - ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - ~ KIND, either express or implied. See the License for the - ~ specific language governing permissions and limitations - ~ under the License. - --> - -<div> - <div class="clear"> - <div class="formLabel-labelCell">Store Url:</div> - <div ><span class="storeUrl" ></span></div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">Peers only:</div> - <div><span class="peersOnly" ></span></div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">Java trust store type:</div> - <div><span class="trustStoreType" ></span></div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">Trust manager factory algorithm:</div> - <div><span class="trustManagerFactoryAlgorithm" ></span></div> - </div> - <div class="clear"></div> -</div> - diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/store/nonjavakeystore/add.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/store/nonjavakeystore/add.html deleted file mode 100644 index b7af1c6b47..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/store/nonjavakeystore/add.html +++ /dev/null @@ -1,66 +0,0 @@ -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one - ~ or more contributor license agreements. See the NOTICE file - ~ distributed with this work for additional information - ~ regarding copyright ownership. The ASF licenses this file - ~ to you under the Apache License, Version 2.0 (the - ~ "License"); you may not use this file except in compliance - ~ with the License. You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, - ~ software distributed under the License is distributed on an - ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - ~ KIND, either express or implied. See the License for the - ~ specific language governing permissions and limitations - ~ under the License. - --> - - -<div> - <div id="addStore.oldBrowserWarning" class="infoMessage hidden clear"></div> - - <div class="clear"> - <div id="addStore.privateKeyLabel" class="formLabel-labelCell tableContainer-labelCell">Private Key (Server path or upload)*:</div> - <div class="formLabel-controlCell tableContainer-valueCell"> - <input type="text" id="addStore.privateKeyUrl" - data-dojo-type="qpid/common/ResourceWidget" - data-dojo-props=" - name: 'privateKeyUrl', - placeHolder: 'path to file with private key in PEM/DER format', - required: true, - promptMessage: 'Enter broker server path to file containing unencrypted private key in DER or PEM format', - title: 'Enter broker server path to file containing unencrypted private key in DER or PEM format'" /> - - </div> - </div> - - <div class="clear"> - <div id="addStore.serverPathLabel" class="formLabel-labelCell tableContainer-labelCell">Certificate (Server path or upload)*:</div> - <div class="formLabel-controlCell tableContainer-valueCell"> - <input type="text" id="addStore.certificateUrl" - data-dojo-type="qpid/common/ResourceWidget" - data-dojo-props=" - name: 'certificateUrl', - placeHolder: 'path to file with certificate in PEM/DER format', - required: true, - promptMessage: 'Enter broker server path to file containing certificate in DER or PEM format', - title: 'Enter broker server path to file containing certificate in DER or PEM format'" /> - </div> - </div> - - <div class="clear"> - <div id="addStore.intermediateCertificateLabel" class="formLabel-labelCell tableContainer-labelCell">Intermediate Certificates (Server path or upload):</div> - <div class="formLabel-controlCell tableContainer-valueCell"> - <input type="text" id="addStore.intermediateCertificateUrl" - data-dojo-type="qpid/common/ResourceWidget" - data-dojo-props=" - name: 'intermediateCertificateUrl', - placeHolder: 'path to file with certificates in PEM/DER format', - required: false, - promptMessage: 'Enter broker server path to file containing intermediate certificates in DER or PEM format', - title: 'Enter path to file containing intermediate certificates in format DER or PEM'" /> - </div> - </div> -</div> diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/store/nonjavakeystore/show.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/store/nonjavakeystore/show.html deleted file mode 100644 index 51ebd06012..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/store/nonjavakeystore/show.html +++ /dev/null @@ -1,47 +0,0 @@ -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one - ~ or more contributor license agreements. See the NOTICE file - ~ distributed with this work for additional information - ~ regarding copyright ownership. The ASF licenses this file - ~ to you under the Apache License, Version 2.0 (the - ~ "License"); you may not use this file except in compliance - ~ with the License. You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, - ~ software distributed under the License is distributed on an - ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - ~ KIND, either express or implied. See the License for the - ~ specific language governing permissions and limitations - ~ under the License. - --> - -<div> - <div class="clear privateKeyUrlContainer"> - <div class="formLabel-labelCell">Private Key:</div> - <div ><span class="privateKeyUrl" ></span></div> - </div> - <div class="clear certificateUrlContainer"> - <div class="formLabel-labelCell">Certificate:</div> - <div><span class="certificateUrl" ></span></div> - </div> - <div class="clear intermediateCertificateUrlContainer"> - <div class="formLabel-labelCell">Intermediate Certificate:</div> - <div><span class="intermediateCertificateUrl" ></span></div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">Subject:</div> - <div><span class="subjectName" ></span></div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">Certificate valid to:</div> - <div><span class="certificateValidEnd" ></span></div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">Certificate valid from:</div> - <div><span class="certificateValidStart" ></span></div> - </div> - <div class="clear"></div> -</div> - diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/store/nonjavatruststore/add.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/store/nonjavatruststore/add.html deleted file mode 100644 index 4ec2678575..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/store/nonjavatruststore/add.html +++ /dev/null @@ -1,38 +0,0 @@ -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one - ~ or more contributor license agreements. See the NOTICE file - ~ distributed with this work for additional information - ~ regarding copyright ownership. The ASF licenses this file - ~ to you under the Apache License, Version 2.0 (the - ~ "License"); you may not use this file except in compliance - ~ with the License. You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, - ~ software distributed under the License is distributed on an - ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - ~ KIND, either express or implied. See the License for the - ~ specific language governing permissions and limitations - ~ under the License. - --> - - -<div> - <div id="addStore.oldBrowserWarning" class="infoMessage hidden clear"></div> - - <div class="clear"> - <div id="addStore.certificatesLabel" class="formLabel-labelCell tableContainer-labelCell">Certificates (Server path or upload)*:</div> - <div class="formLabel-controlCell tableContainer-valueCell"> - <input type="text" id="addStore.certificatesUrl" - data-dojo-type="qpid/common/ResourceWidget" - data-dojo-props=" - name: 'certificatesUrl', - placeHolder: 'path to file with certificate(s) in PEM/DER format', - required: true, - promptMessage: 'Enter broker server path to file containing certificate(s) in DER or PEM format', - title: 'Enter broker server path to file containing certificate(s) in DER or PEM format'" /> - </div> - </div> - -</div> diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/store/nonjavatruststore/show.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/store/nonjavatruststore/show.html deleted file mode 100644 index b45f457e41..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/store/nonjavatruststore/show.html +++ /dev/null @@ -1,31 +0,0 @@ -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one - ~ or more contributor license agreements. See the NOTICE file - ~ distributed with this work for additional information - ~ regarding copyright ownership. The ASF licenses this file - ~ to you under the Apache License, Version 2.0 (the - ~ "License"); you may not use this file except in compliance - ~ with the License. You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, - ~ software distributed under the License is distributed on an - ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - ~ KIND, either express or implied. See the License for the - ~ specific language governing permissions and limitations - ~ under the License. - --> - -<div> - <div class="clear certificatesUrlContainer"> - <div class="formLabel-labelCell">Certificate:</div> - <div><span class="certificatesUrl" ></span></div> - </div> - <div class="clear"></div> - <div data-dojo-type="dijit.TitlePane" data-dojo-props="title: 'Certificate details'" class="detailsGridPanel"> - <div class="details"></div> - </div> - <div></div> -</div> - diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/strings.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/strings.html deleted file mode 100644 index d29ef5c21c..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/strings.html +++ /dev/null @@ -1,21 +0,0 @@ -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one - ~ or more contributor license agreements. See the NOTICE file - ~ distributed with this work for additional information - ~ regarding copyright ownership. The ASF licenses this file - ~ to you under the Apache License, Version 2.0 (the - ~ "License"); you may not use this file except in compliance - ~ with the License. You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, - ~ software distributed under the License is distributed on an - ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - ~ KIND, either express or implied. See the License for the - ~ specific language governing permissions and limitations - ~ under the License. - --> -<div> - <div id="promptTemplateWithDefault"><i>Optional:</i> ${prompt}.<br/>Defaults to <code>${default}</code></div> -</div> diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhost/providedstore/add.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhost/providedstore/add.html deleted file mode 100644 index c0cd3f5653..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhost/providedstore/add.html +++ /dev/null @@ -1,51 +0,0 @@ -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one - ~ or more contributor license agreements. See the NOTICE file - ~ distributed with this work for additional information - ~ regarding copyright ownership. The ASF licenses this file - ~ to you under the Apache License, Version 2.0 (the - ~ "License"); you may not use this file except in compliance - ~ with the License. You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, - ~ software distributed under the License is distributed on an - ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - ~ KIND, either express or implied. See the License for the - ~ specific language governing permissions and limitations - ~ under the License. - --> - -<div> - <div id="addVirtualHost.diskFlowControls"> - <div class="clear"> - <div class="formLabel-labelCell tableContainer-labelCell">Store overfull size:</div> - <div class="formLabel-controlCell tableContainer-valueCell"> - <input type="text" id="addVirtualHost.storeOverfullSize" - data-dojo-type="dijit/form/ValidationTextBox" - data-dojo-props=" - name: 'storeOverfullSize', - placeHolder: 'size in bytes', - required: false, - title: 'Enter ceiling (in bytes) at which store will begin to throttle sessions producing messages', - promptMessage: 'Ceiling (in bytes) at which store will begin to throttle sessions producing messages'" /> - </div> - </div> - <div class="clear"> - <div class="formLabel-labelCell tableContainer-labelCell">Store underfull size:</div> - <div class="formLabel-controlCell tableContainer-valueCell"> - <input type="text" id="addVirtualHost.storeUnderfullSize" - data-dojo-type="dijit/form/ValidationTextBox" - data-dojo-props=" - name: 'storeUnderfullSize', - placeHolder: 'size in bytes', - required: false, - title: 'Enter floor (in bytes) at which store will cease to throttle sessions producing messages', - promptMessage: 'Floor (in bytes) at which store will cease to throttle sessions producing messages'" /> - </div> - </div> - </div> - <div class="clear"></div> - <div class="infoMessage">The virtual host will have the same name as the node.</div> -</div> diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhost/providedstore/edit.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhost/providedstore/edit.html deleted file mode 100644 index 427a1bab86..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhost/providedstore/edit.html +++ /dev/null @@ -1,53 +0,0 @@ -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one - ~ or more contributor license agreements. See the NOTICE file - ~ distributed with this work for additional information - ~ regarding copyright ownership. The ASF licenses this file - ~ to you under the Apache License, Version 2.0 (the - ~ "License"); you may not use this file except in compliance - ~ with the License. You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, - ~ software distributed under the License is distributed on an - ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - ~ KIND, either express or implied. See the License for the - ~ specific language governing permissions and limitations - ~ under the License. - --> - -<div> - - <div class="clear"> - <div class="formLabel-labelCell tableContainer-labelCell">Store overfull size (bytes):</div> - <div class="tableContainer-valueCell formLabel-controlCell"> - <input data-dojo-type="dijit/form/ValidationTextBox" - id="editVirtualHost.storeOverfullSize" - data-dojo-props=" - name: 'storeOverfullSize', - placeHolder: 'size in bytes', - required: false, - title: 'Enter ceiling (in bytes) at which store will begin to throttle sessions producing messages', - promptMessage: 'Ceiling (in bytes) at which store will begin to throttle sessions producing messages'" - /> - </div> - </div> - <div class="clear"> - <div class="formLabel-labelCell tableContainer-labelCell">Store underfull size (bytes):</div> - <div class="tableContainer-valueCell formLabel-controlCell"> - <input data-dojo-type="dijit/form/ValidationTextBox" - id="editVirtualHost.storeUnderfullSize" - data-dojo-props=" - name: 'storeUnderfullSize', - placeHolder: 'size in bytes', - required: false, - title: 'Enter floor (in bytes) at which store will cease to throttle sessions producing messages', - promptMessage: 'Floor (in bytes) at which store will cease to throttle sessions producing messages'" - /> - </div> - </div> - - <div class="clear"></div> - -</div> diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhost/providedstore/show.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhost/providedstore/show.html deleted file mode 100644 index e889149e99..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhost/providedstore/show.html +++ /dev/null @@ -1,30 +0,0 @@ -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one - ~ or more contributor license agreements. See the NOTICE file - ~ distributed with this work for additional information - ~ regarding copyright ownership. The ASF licenses this file - ~ to you under the Apache License, Version 2.0 (the - ~ "License"); you may not use this file except in compliance - ~ with the License. You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, - ~ software distributed under the License is distributed on an - ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - ~ KIND, either express or implied. See the License for the - ~ specific language governing permissions and limitations - ~ under the License. - --> - -<div> - <div class="clear"> - <div class="formLabel-labelCell">Store overfull size:</div> - <div ><span class="storeOverfullSize" ></span> bytes</div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">Store underfull size:</div> - <div><span class="storeUnderfullSize" ></span> bytes</div> - </div> - <div class="clear"></div> -</div> diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhost/sizemonitoring/add.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhost/sizemonitoring/add.html deleted file mode 100644 index 484a85b965..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhost/sizemonitoring/add.html +++ /dev/null @@ -1,61 +0,0 @@ -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one - ~ or more contributor license agreements. See the NOTICE file - ~ distributed with this work for additional information - ~ regarding copyright ownership. The ASF licenses this file - ~ to you under the Apache License, Version 2.0 (the - ~ "License"); you may not use this file except in compliance - ~ with the License. You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, - ~ software distributed under the License is distributed on an - ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - ~ KIND, either express or implied. See the License for the - ~ specific language governing permissions and limitations - ~ under the License. - --> - -<div> - <div class="clear"> - <div class="formLabel-labelCell tableContainer-labelCell">Message store path:</div> - <div class="formLabel-controlCell tableContainer-valueCell"> - <input type="text" id="addVirtualHost.storePath" - data-dojo-type="dijit/form/ValidationTextBox" - data-dojo-props=" - name: 'storePath', - placeHolder: 'path/to/store', - title: 'Enter message store path', - promptMessage: 'File system location for the message store'" /> - </div> - </div> - <div class="clear"> - <div class="formLabel-labelCell tableContainer-labelCell">Store overfull size:</div> - <div class="formLabel-controlCell tableContainer-valueCell"> - <input type="text" id="addVirtualHost.storeOverfullSize" - data-dojo-type="dijit/form/ValidationTextBox" - data-dojo-props=" - name: 'storeOverfullSize', - placeHolder: 'size in bytes', - required: false, - title: 'Enter ceiling (in bytes) at which store will begin to throttle sessions producing messages', - promptMessage: 'Ceiling (in bytes) at which store will begin to throttle sessions producing messages'" /> - </div> - </div> - <div class="clear"> - <div class="formLabel-labelCell tableContainer-labelCell">Store underfull size:</div> - <div class="formLabel-controlCell tableContainer-valueCell"> - <input type="text" id="addVirtualHost.storeUnderfullSize" - data-dojo-type="dijit/form/ValidationTextBox" - data-dojo-props=" - name: 'storeUnderfullSize', - placeHolder: 'size in bytes', - required: false, - title: 'Enter floor (in bytes) at which store will cease to throttle sessions producing messages', - promptMessage: 'Floor (in bytes) at which store will cease to throttle sessions producing messages'" /> - </div> - </div> - <div class="clear"></div> - <div class="infoMessage">The virtual host will have the same name as the node.</div> -</div> diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhost/sizemonitoring/edit.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhost/sizemonitoring/edit.html deleted file mode 100644 index 2486cdcf42..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhost/sizemonitoring/edit.html +++ /dev/null @@ -1,65 +0,0 @@ -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one - ~ or more contributor license agreements. See the NOTICE file - ~ distributed with this work for additional information - ~ regarding copyright ownership. The ASF licenses this file - ~ to you under the Apache License, Version 2.0 (the - ~ "License"); you may not use this file except in compliance - ~ with the License. You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, - ~ software distributed under the License is distributed on an - ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - ~ KIND, either express or implied. See the License for the - ~ specific language governing permissions and limitations - ~ under the License. - --> - -<div> - - <div class="clear"> - <div class="formLabel-labelCell tableContainer-labelCell">Message store path:</div> - <div class="formLabel-controlCell tableContainer-valueCell"> - <input type="text" id="editVirtualHost.storePath" - data-dojo-type="dijit/form/ValidationTextBox" - data-dojo-props=" - name: 'storePath', - disabled: true, - title: 'Enter message store path'" /> - </div> - </div> - - <div class="clear"> - <div class="formLabel-labelCell tableContainer-labelCell">Store overfull size (bytes):</div> - <div class="tableContainer-valueCell formLabel-controlCell"> - <input data-dojo-type="dijit/form/ValidationTextBox" - id="editVirtualHost.storeOverfullSize" - data-dojo-props=" - name: 'storeOverfullSize', - placeHolder: 'size in bytes', - required: false, - title: 'Enter ceiling (in bytes) at which store will begin to throttle sessions producing messages', - promptMessage: 'Ceiling (in bytes) at which store will begin to throttle sessions producing messages'" - /> - </div> - </div> - <div class="clear"> - <div class="formLabel-labelCell tableContainer-labelCell">Store underfull size (bytes):</div> - <div class="tableContainer-valueCell formLabel-controlCell"> - <input data-dojo-type="dijit/form/ValidationTextBox" - id="editVirtualHost.storeUnderfullSize" - data-dojo-props=" - name: 'storeUnderfullSize', - placeHolder: 'size in bytes', - required: false, - title: 'Enter floor (in bytes) at which store will cease to throttle sessions producing messages', - promptMessage: 'Floor (in bytes) at which store will cease to throttle sessions producing messages'" - /> - </div> - </div> - - <div class="clear"></div> - -</div> diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhost/sizemonitoring/show.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhost/sizemonitoring/show.html deleted file mode 100644 index 1f3c1e820c..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhost/sizemonitoring/show.html +++ /dev/null @@ -1,34 +0,0 @@ -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one - ~ or more contributor license agreements. See the NOTICE file - ~ distributed with this work for additional information - ~ regarding copyright ownership. The ASF licenses this file - ~ to you under the Apache License, Version 2.0 (the - ~ "License"); you may not use this file except in compliance - ~ with the License. You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, - ~ software distributed under the License is distributed on an - ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - ~ KIND, either express or implied. See the License for the - ~ specific language governing permissions and limitations - ~ under the License. - --> - -<div> - <div class="clear"> - <div class="formLabel-labelCell">Message store path:</div> - <div class="storePath"></div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">Store overfull size:</div> - <div><span class="storeOverfullSize"></span> bytes</div> - </div> - <div class="clear"> - <div class="formLabel-labelCell">Store underfull size:</div> - <div><span class="storeUnderfullSize"></span> bytes</div> - </div> - <div class="clear"></div> -</div> diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhostnode/filebased/edit.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhostnode/filebased/edit.html deleted file mode 100644 index 2f0d72fe9a..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhostnode/filebased/edit.html +++ /dev/null @@ -1,36 +0,0 @@ -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one - ~ or more contributor license agreements. See the NOTICE file - ~ distributed with this work for additional information - ~ regarding copyright ownership. The ASF licenses this file - ~ to you under the Apache License, Version 2.0 (the - ~ "License"); you may not use this file except in compliance - ~ with the License. You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, - ~ software distributed under the License is distributed on an - ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - ~ KIND, either express or implied. See the License for the - ~ specific language governing permissions and limitations - ~ under the License. - --> - -<div> - - <div class="clear"> - <div class="formLabel-labelCell tableContainer-labelCell">Configuration store path:</div> - <div class="formLabel-controlCell tableContainer-valueCell"> - <input type="text" id="editVirtualHostNode.storePath" - data-dojo-type="dijit/form/ValidationTextBox" - data-dojo-props=" - name: 'storePath', - placeHolder: 'path/to/store', - title: 'Enter configuration store path'" /> - </div> - </div> - - <div class="clear"></div> - -</div> diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhostnode/json/add.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhostnode/json/add.html deleted file mode 100644 index ec3ef79fa0..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhostnode/json/add.html +++ /dev/null @@ -1,34 +0,0 @@ -<!-- - - - - Licensed to the Apache Software Foundation (ASF) under one - - or more contributor license agreements. See the NOTICE file - - distributed with this work for additional information - - regarding copyright ownership. The ASF licenses this file - - to you under the Apache License, Version 2.0 (the - - "License"); you may not use this file except in compliance - - with the License. You may obtain a copy of the License at - - - - http://www.apache.org/licenses/LICENSE-2.0 - - - - Unless required by applicable law or agreed to in writing, - - software distributed under the License is distributed on an - - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - - KIND, either express or implied. See the License for the - - specific language governing permissions and limitations - - under the License. - - - --> -<div> - <div class="clear"> - <div class="formLabel-labelCell tableContainer-labelCell">Store path:</div> - <div class="formLabel-controlCell tableContainer-valueCell"> - <input type="text" id="addVirtualHostNode.jsonStorePath" - data-dojo-type="dijit/form/ValidationTextBox" - data-dojo-props=" - name: 'storePath', - placeHolder: 'path/to/store', - title: 'Enter store path'" /> - </div> - </div> - <div class="clear"></div> -</div> diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhostnode/json/show.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhostnode/json/show.html deleted file mode 100644 index 48aec9c342..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/java/resources/virtualhostnode/json/show.html +++ /dev/null @@ -1,21 +0,0 @@ -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one or more - ~ contributor license agreements. See the NOTICE file distributed with - ~ this work for additional information regarding copyright ownership. - ~ The ASF licenses this file to You under the Apache License, Version 2.0 - ~ (the "License"); you may not use this file except in compliance with - ~ the License. You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - --> - -<div class="clear"> - <div class="formLabel-labelCell">Configuration store path:</div> - <div class="storePath"></div> -</div> diff --git a/qpid/java/broker-plugins/management-http/src/main/resources-maven/dojoconfig.properties b/qpid/java/broker-plugins/management-http/src/main/resources-maven/dojoconfig.properties deleted file mode 100644 index c5c11a8486..0000000000 --- a/qpid/java/broker-plugins/management-http/src/main/resources-maven/dojoconfig.properties +++ /dev/null @@ -1,25 +0,0 @@ -# -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# -# -dojo-version=${dojo-version} -dojo-path=/dojo-${dojo-version}/dojo -dijit-path=/dojo-${dojo-version}/dijit -dojox-path=/dojo-${dojo-version}/dojox - diff --git a/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/HttpManagementTest.java b/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/HttpManagementTest.java deleted file mode 100644 index 4031f13655..0000000000 --- a/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/HttpManagementTest.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.qpid.server.management.plugin; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import java.net.InetSocketAddress; -import java.net.SocketAddress; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import org.apache.qpid.server.configuration.updater.TaskExecutor; -import org.apache.qpid.server.configuration.updater.TaskExecutorImpl; -import org.apache.qpid.server.logging.EventLogger; -import org.apache.qpid.server.model.AuthenticationProvider; -import org.apache.qpid.server.model.Broker; -import org.apache.qpid.server.model.BrokerModel; -import org.apache.qpid.server.model.ConfiguredObject; -import org.apache.qpid.server.model.ConfiguredObjectFactory; -import org.apache.qpid.server.model.ConfiguredObjectFactoryImpl; -import org.apache.qpid.server.model.State; -import org.apache.qpid.server.model.port.HttpPort; -import org.apache.qpid.test.utils.QpidTestCase; - -public class HttpManagementTest extends QpidTestCase -{ - private UUID _id; - private Broker _broker; - private HttpManagement _management; - - @Override - public void setUp() throws Exception - { - super.setUp(); - _id = UUID.randomUUID(); - _broker = mock(Broker.class); - ConfiguredObjectFactory objectFactory = new ConfiguredObjectFactoryImpl(BrokerModel.getInstance()); - - when(_broker.getObjectFactory()).thenReturn(objectFactory); - when(_broker.getModel()).thenReturn(objectFactory.getModel()); - when(_broker.getCategoryClass()).thenReturn(Broker.class); - when(_broker.getEventLogger()).thenReturn(mock(EventLogger.class)); - TaskExecutor taskExecutor = new TaskExecutorImpl(); - taskExecutor.start(); - when(_broker.getTaskExecutor()).thenReturn(taskExecutor); - when(_broker.getChildExecutor()).thenReturn(taskExecutor); - - - Map<String, Object> attributes = new HashMap<String, Object>(); - attributes.put(HttpManagement.HTTP_BASIC_AUTHENTICATION_ENABLED, false); - attributes.put(HttpManagement.HTTPS_BASIC_AUTHENTICATION_ENABLED, true); - attributes.put(HttpManagement.HTTP_SASL_AUTHENTICATION_ENABLED, false); - attributes.put(HttpManagement.HTTPS_SASL_AUTHENTICATION_ENABLED, true); - attributes.put(HttpManagement.NAME, getTestName()); - attributes.put(HttpManagement.TIME_OUT, 10000l); - attributes.put(ConfiguredObject.ID, _id); - attributes.put(HttpManagement.DESIRED_STATE, State.QUIESCED); - _management = new HttpManagement(attributes, _broker); - _management.open(); - } - - public void testGetSessionTimeout() - { - assertEquals("Unexpected session timeout", 10000l, _management.getSessionTimeout()); - } - - public void testGetName() - { - assertEquals("Unexpected name", getTestName(), _management.getName()); - } - - public void testIsHttpsSaslAuthenticationEnabled() - { - assertEquals("Unexpected value for the https sasl enabled attribute", true, - _management.isHttpsSaslAuthenticationEnabled()); - } - - public void testIsHttpSaslAuthenticationEnabled() - { - assertEquals("Unexpected value for the http sasl enabled attribute", false, _management.isHttpSaslAuthenticationEnabled()); - } - - public void testIsHttpsBasicAuthenticationEnabled() - { - assertEquals("Unexpected value for the https basic authentication enabled attribute", true, - _management.isHttpsBasicAuthenticationEnabled()); - } - - public void testIsHttpBasicAuthenticationEnabled() - { - assertEquals("Unexpected value for the http basic authentication enabled attribute", false, - _management.isHttpBasicAuthenticationEnabled()); - } - - -} diff --git a/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/log/LogFileHelperTest.java b/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/log/LogFileHelperTest.java deleted file mode 100644 index 26e6cddc82..0000000000 --- a/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/log/LogFileHelperTest.java +++ /dev/null @@ -1,339 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.qpid.server.management.plugin.log; - -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.zip.ZipEntry; -import java.util.zip.ZipInputStream; - -import org.apache.log4j.Appender; -import org.apache.log4j.DailyRollingFileAppender; -import org.apache.log4j.FileAppender; -import org.apache.log4j.QpidCompositeRollingAppender; -import org.apache.log4j.RollingFileAppender; -import org.apache.log4j.varia.ExternallyRolledFileAppender; -import org.apache.qpid.test.utils.QpidTestCase; -import org.apache.qpid.test.utils.TestFileUtils; -import org.apache.qpid.util.FileUtils; - -public class LogFileHelperTest extends QpidTestCase -{ - private Map<String, List<File>> _appendersFiles; - private File _compositeRollingAppenderBackupFolder; - private List<Appender> _appenders; - private LogFileHelper _helper; - - public void setUp() throws Exception - { - super.setUp(); - _appendersFiles = new HashMap<String, List<File>>(); - _compositeRollingAppenderBackupFolder = new File(TMP_FOLDER, "_compositeRollingAppenderBackupFolder"); - _compositeRollingAppenderBackupFolder.mkdirs(); - - _appendersFiles.put(FileAppender.class.getSimpleName(), - Collections.singletonList(TestFileUtils.createTempFile(this, ".log", "FileAppender"))); - _appendersFiles.put(DailyRollingFileAppender.class.getSimpleName(), - Collections.singletonList(TestFileUtils.createTempFile(this, ".log", "DailyRollingFileAppender"))); - _appendersFiles.put(RollingFileAppender.class.getSimpleName(), - Collections.singletonList(TestFileUtils.createTempFile(this, ".log", "RollingFileAppender"))); - _appendersFiles.put(ExternallyRolledFileAppender.class.getSimpleName(), - Collections.singletonList(TestFileUtils.createTempFile(this, ".log", "ExternallyRolledFileAppender"))); - - File file = TestFileUtils.createTempFile(this, ".log", "QpidCompositeRollingAppender"); - File backUpFile = File.createTempFile(file.getName() + ".", ".1." + LogFileHelper.GZIP_EXTENSION); - _appendersFiles.put(QpidCompositeRollingAppender.class.getSimpleName(), Arrays.asList(file, backUpFile)); - - FileAppender fileAppender = new FileAppender(); - DailyRollingFileAppender dailyRollingFileAppender = new DailyRollingFileAppender(); - RollingFileAppender rollingFileAppender = new RollingFileAppender(); - ExternallyRolledFileAppender externallyRolledFileAppender = new ExternallyRolledFileAppender(); - QpidCompositeRollingAppender qpidCompositeRollingAppender = new QpidCompositeRollingAppender(); - qpidCompositeRollingAppender.setbackupFilesToPath(_compositeRollingAppenderBackupFolder.getPath()); - - _appenders = new ArrayList<Appender>(); - _appenders.add(fileAppender); - _appenders.add(dailyRollingFileAppender); - _appenders.add(rollingFileAppender); - _appenders.add(externallyRolledFileAppender); - _appenders.add(qpidCompositeRollingAppender); - - for (Appender appender : _appenders) - { - FileAppender fa = (FileAppender) appender; - fa.setName(fa.getClass().getSimpleName()); - fa.setFile(_appendersFiles.get(fa.getClass().getSimpleName()).get(0).getPath()); - } - - _helper = new LogFileHelper(_appenders); - } - - public void tearDown() throws Exception - { - try - { - for (List<File> files : _appendersFiles.values()) - { - for (File file : files) - { - try - { - FileUtils.delete(file, false); - } - catch (Exception e) - { - // ignore - } - } - } - FileUtils.delete(_compositeRollingAppenderBackupFolder, true); - } - finally - { - super.tearDown(); - } - } - - public void testGetLogFileDetailsWithLocations() throws Exception - { - List<LogFileDetails> details = _helper.getLogFileDetails(true); - - assertLogFiles(details, true); - } - - public void testGetLogFileDetailsWithoutLocations() throws Exception - { - List<LogFileDetails> details = _helper.getLogFileDetails(false); - - assertLogFiles(details, false); - } - - public void testWriteLogFilesForAllLogs() throws Exception - { - List<LogFileDetails> details = _helper.getLogFileDetails(true); - File f = TestFileUtils.createTempFile(this, ".zip"); - - FileOutputStream os = new FileOutputStream(f); - try - { - _helper.writeLogFiles(details, os); - } - finally - { - if (os != null) - { - os.close(); - } - } - - assertWrittenFile(f, details); - } - - public void testWriteLogFile() throws Exception - { - File file = _appendersFiles.get(FileAppender.class.getSimpleName()).get(0); - - File f = TestFileUtils.createTempFile(this, ".log"); - FileOutputStream os = new FileOutputStream(f); - try - { - _helper.writeLogFile(file, os); - } - finally - { - if (os != null) - { - os.close(); - } - } - - assertEquals("Unexpected log content", FileAppender.class.getSimpleName(), FileUtils.readFileAsString(f)); - } - - public void testFindLogFileDetails() - { - String[] logFileDisplayedPaths = new String[6]; - File[] files = new File[logFileDisplayedPaths.length]; - int i = 0; - for (Map.Entry<String, List<File>> entry : _appendersFiles.entrySet()) - { - String appenderName = entry.getKey(); - List<File> appenderFiles = entry.getValue(); - for (File logFile : appenderFiles) - { - logFileDisplayedPaths[i] = appenderName + "/" + logFile.getName(); - files[i++] = logFile; - } - } - - List<LogFileDetails> logFileDetails = _helper.findLogFileDetails(logFileDisplayedPaths); - assertEquals("Unexpected details size", logFileDisplayedPaths.length, logFileDetails.size()); - - boolean gzipFileFound = false; - for (int j = 0; j < logFileDisplayedPaths.length; j++) - { - String displayedPath = logFileDisplayedPaths[j]; - String[] parts = displayedPath.split("/"); - LogFileDetails d = logFileDetails.get(j); - assertEquals("Unexpected name", parts[1], d.getName()); - assertEquals("Unexpected appender", parts[0], d.getAppenderName()); - if (files[j].getName().endsWith(LogFileHelper.GZIP_EXTENSION)) - { - assertEquals("Unexpected mime type for gz file", LogFileHelper.GZIP_MIME_TYPE, d.getMimeType()); - gzipFileFound = true; - } - else - { - assertEquals("Unexpected mime type", LogFileHelper.TEXT_MIME_TYPE, d.getMimeType()); - } - assertEquals("Unexpected file location", files[j], d.getLocation()); - assertEquals("Unexpected file size", files[j].length(), d.getSize()); - assertEquals("Unexpected file last modified date", files[j].lastModified(), d.getLastModified()); - } - assertTrue("Gzip log file is not found", gzipFileFound); - } - - public void testFindLogFileDetailsForNotExistingAppender() - { - String[] logFileDisplayedPaths = { "NotExistingAppender/qpid.log" }; - List<LogFileDetails> details = _helper.findLogFileDetails(logFileDisplayedPaths); - assertTrue("No details should be created for non-existing appender", details.isEmpty()); - } - - public void testFindLogFileDetailsForNotExistingFile() - { - String[] logFileDisplayedPaths = { "FileAppender/qpid-non-existing.log" }; - List<LogFileDetails> details = _helper.findLogFileDetails(logFileDisplayedPaths); - assertTrue("No details should be created for non-existing file", details.isEmpty()); - } - - public void testFindLogFileDetailsForIncorrectlySpecifiedLogFilePath() - { - String[] logFileDisplayedPaths = { "FileAppender\\" + _appendersFiles.get("FileAppender").get(0).getName() }; - try - { - _helper.findLogFileDetails(logFileDisplayedPaths); - fail("Exception is expected for incorrectly set path to log file"); - } - catch (IllegalArgumentException e) - { - // pass - } - } - - private void assertLogFiles(List<LogFileDetails> details, boolean includeLocation) - { - for (Map.Entry<String, List<File>> appenderData : _appendersFiles.entrySet()) - { - String appenderName = (String) appenderData.getKey(); - List<File> files = appenderData.getValue(); - - for (File logFile : files) - { - String logFileName = logFile.getName(); - LogFileDetails d = findLogFileDetails(logFileName, appenderName, details); - assertNotNull("Log file " + logFileName + " is not found for appender " + appenderName, d); - if (includeLocation) - { - assertEquals("Log file " + logFileName + " is different in appender " + appenderName, d.getLocation(), - logFile); - } - } - } - } - - private LogFileDetails findLogFileDetails(String logFileName, String appenderName, List<LogFileDetails> logFileDetails) - { - LogFileDetails d = null; - for (LogFileDetails lfd : logFileDetails) - { - if (lfd.getName().equals(logFileName) && lfd.getAppenderName().equals(appenderName)) - { - d = lfd; - break; - } - } - return d; - } - - private void assertWrittenFile(File f, List<LogFileDetails> details) throws FileNotFoundException, IOException - { - FileInputStream fis = new FileInputStream(f); - try - { - ZipInputStream zis = new ZipInputStream(fis); - ZipEntry ze = zis.getNextEntry(); - - while (ze != null) - { - String entryName = ze.getName(); - String[] parts = entryName.split("/"); - - String appenderName = parts[0]; - String logFileName = parts[1]; - - LogFileDetails d = findLogFileDetails(logFileName, appenderName, details); - - assertNotNull("Unexpected entry " + entryName, d); - details.remove(d); - - File logFile = d.getLocation(); - String logContent = FileUtils.readFileAsString(logFile); - - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - byte[] buffer = new byte[1024]; - int len; - while ((len = zis.read(buffer)) > 0) - { - baos.write(buffer, 0, len); - } - baos.close(); - - assertEquals("Unexpected log file content", logContent, baos.toString()); - - ze = zis.getNextEntry(); - } - - zis.closeEntry(); - zis.close(); - - } - finally - { - if (fis != null) - { - fis.close(); - } - } - assertEquals("Not all log files have been output", 0, details.size()); - } - -} diff --git a/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/report/ReportRunnerTest.java b/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/report/ReportRunnerTest.java deleted file mode 100644 index 38432a26f4..0000000000 --- a/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/report/ReportRunnerTest.java +++ /dev/null @@ -1,186 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.qpid.server.management.plugin.report; - -import static org.mockito.Mockito.doAnswer; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import java.io.ByteArrayOutputStream; -import java.io.ObjectOutputStream; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; - -import org.mockito.ArgumentCaptor; -import org.mockito.invocation.InvocationOnMock; -import org.mockito.stubbing.Answer; - -import org.apache.qpid.server.message.AMQMessageHeader; -import org.apache.qpid.server.message.ServerMessage; -import org.apache.qpid.server.model.Queue; -import org.apache.qpid.server.queue.AMQQueue; -import org.apache.qpid.server.queue.QueueEntry; -import org.apache.qpid.server.queue.QueueEntryVisitor; -import org.apache.qpid.test.utils.QpidTestCase; - -public class ReportRunnerTest extends QpidTestCase -{ - public void testTextReportCountsMessages() - { - ReportRunner<String> runner = (ReportRunner<String>) ReportRunner.createRunner(TestTextReport.NAME, - Collections.<String, String[]>emptyMap()); - Queue queue = createMockQueue(); - assertEquals("There are 0 messages on the queue.", runner.runReport(queue)); - - runner = (ReportRunner<String>) ReportRunner.createRunner(TestTextReport.NAME, - Collections.<String, String[]>emptyMap()); - Queue queue1 = createMockQueue(mock(ServerMessage.class)); - assertEquals("There are 1 messages on the queue.", runner.runReport(queue1)); - - runner = (ReportRunner<String>) ReportRunner.createRunner(TestTextReport.NAME, - Collections.<String, String[]>emptyMap()); - Queue queue2 = createMockQueue(mock(ServerMessage.class), mock(ServerMessage.class)); - assertEquals("There are 2 messages on the queue.", runner.runReport(queue2)); - } - - public void testTextReportSingleStringParam() - { - Queue queue2 = createMockQueue(mock(ServerMessage.class), mock(ServerMessage.class)); - - Map<String, String[]> parameterMap = new HashMap<>(); - parameterMap.put("stringParam", new String[]{"hello world"}); - ReportRunner<String> runner = - (ReportRunner<String>) ReportRunner.createRunner(TestTextReport.NAME, parameterMap); - assertEquals("There are 2 messages on the queue. stringParam = hello world.", runner.runReport(queue2)); - } - - public void testTextReportSingleStringArrayParam() - { - Queue queue = createMockQueue(); - - Map<String, String[]> parameterMap = new HashMap<>(); - parameterMap.put("stringArrayParam", new String[] { "hello world", "goodbye"}); - ReportRunner<String> runner = (ReportRunner<String>) ReportRunner.createRunner(TestTextReport.NAME, parameterMap); - assertEquals("There are 0 messages on the queue. stringArrayParam = [hello world, goodbye].", runner.runReport(queue)); - - } - - - public void testTextReportBothParams() - { - Queue queue = createMockQueue(); - - Map<String, String[]> parameterMap = new HashMap<>(); - parameterMap.put("stringParam", new String[]{"hello world"}); - parameterMap.put("stringArrayParam", new String[] { "hello world", "goodbye"}); - ReportRunner<String> runner = (ReportRunner<String>) ReportRunner.createRunner(TestTextReport.NAME, parameterMap); - assertEquals("There are 0 messages on the queue. stringParam = hello world. stringArrayParam = [hello world, goodbye].", runner.runReport(queue)); - - } - - public void testInvalidReportName() - { - try - { - ReportRunner.createRunner("unknown", Collections.<String, String[]>emptyMap()); - fail("Unknown report name should throw exception"); - } - catch(IllegalArgumentException e) - { - assertEquals("Unknown report: unknown", e.getMessage()); - } - } - - public void testBinaryReportWithLimit() throws Exception - { - Queue queue = createMockQueue(createMessageWithAppProperties(Collections.<String,Object>singletonMap("key",1)), - createMessageWithAppProperties(Collections.<String,Object>singletonMap("key",2)), - createMessageWithAppProperties(Collections.<String, Object>singletonMap("key", 3)), - createMessageWithAppProperties(Collections.<String, Object>singletonMap("key", 4))); - Map<String, String[]> parameterMap = new HashMap<>(); - parameterMap.put("propertyName", new String[]{"key"}); - parameterMap.put("limit", new String[] { "3" }); - - ReportRunner<byte[]> runner = (ReportRunner<byte[]>) ReportRunner.createRunner(TestBinaryReport.NAME, parameterMap); - - ByteArrayOutputStream bytes = new ByteArrayOutputStream(); - ObjectOutputStream objects = new ObjectOutputStream(bytes); - objects.writeObject(Integer.valueOf(1)); - objects.writeObject(Integer.valueOf(2)); - objects.writeObject(Integer.valueOf(3)); - objects.flush(); - byte[] expected = bytes.toByteArray(); - byte[] actual = runner.runReport(queue); - assertTrue("Output not as expected", Arrays.equals(expected, actual)); - } - - private ServerMessage<?> createMessageWithAppProperties(final Map<String,Object> props) - { - ServerMessage<?> message = mock(ServerMessage.class); - final AMQMessageHeader header = mock(AMQMessageHeader.class); - when(message.getMessageHeader()).thenReturn(header); - final ArgumentCaptor<String> headerNameCaptor = ArgumentCaptor.forClass(String.class); - when(header.getHeader(headerNameCaptor.capture())).thenAnswer(new Answer<Object>() - { - @Override - public Object answer(final InvocationOnMock invocation) throws Throwable - { - String header = headerNameCaptor.getValue(); - return props.get(header); - } - }); - when(header.getHeaderNames()).thenReturn(props.keySet()); - return message; - } - - private Queue createMockQueue(final ServerMessage<?>... messages) - { - final AMQQueue queue = mock(AMQQueue.class); - final ArgumentCaptor<QueueEntryVisitor> captor = ArgumentCaptor.forClass(QueueEntryVisitor.class); - doAnswer(new Answer() - { - @Override - public Object answer(final InvocationOnMock invocation) throws Throwable - { - QueueEntryVisitor visitor = captor.getValue(); - for(ServerMessage<?> message : messages) - { - if(visitor.visit(makeEntry(queue, message))) - { - break; - } - } - return null; - } - }).when(queue).visit(captor.capture()); - return queue; - } - - private QueueEntry makeEntry(final AMQQueue queue, final ServerMessage<?> message) - { - QueueEntry entry = mock(QueueEntry.class); - when(entry.getQueue()).thenReturn(queue); - when(entry.getMessage()).thenReturn(message); - return entry; - } -} diff --git a/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/report/TestBinaryReport.java b/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/report/TestBinaryReport.java deleted file mode 100644 index fc5e93631e..0000000000 --- a/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/report/TestBinaryReport.java +++ /dev/null @@ -1,114 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.qpid.server.management.plugin.report; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.ObjectOutputStream; - -public class TestBinaryReport extends QueueBinaryReport -{ - - - private int _limit; - private String _propertyName; - private int _count; - private final ByteArrayOutputStream _bytesOutputStream = new ByteArrayOutputStream(); - private final ObjectOutputStream _objectOutputStream; - public static final String NAME = "testBinary"; - - public TestBinaryReport() - { - try - { - _objectOutputStream = new ObjectOutputStream(_bytesOutputStream); - } - catch (IOException e) - { - throw new RuntimeException(e); - } - ; - } - - @Override - public String getName() - { - return NAME; - } - - @Override - public String getContentType() - { - return "application/octet-stream"; - } - - @Override - public void addMessage(final ReportableMessage reportableMessage) - { - if(_propertyName != null) - { - Object value = reportableMessage.getMessageHeader().getHeader(_propertyName); - if(value != null) - { - try - { - _objectOutputStream.writeObject(value); - } - catch (IOException e) - { - // ignore - } - } - } - _count++; - } - - @Override - public boolean isComplete() - { - return _limit != 0 && _count >= _limit; - } - - @Override - public byte[] getReport() - { - try - { - _objectOutputStream.flush(); - - return _bytesOutputStream.toByteArray(); - } - catch (IOException e) - { - throw new RuntimeException(e); - } - } - - public void setLimit(final String limit) - { - _limit = Integer.parseInt(limit); - } - - public void setPropertyName(final String propertyName) - { - this._propertyName = propertyName; - } -} diff --git a/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/report/TestTextReport.java b/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/report/TestTextReport.java deleted file mode 100644 index 7f9e1e2962..0000000000 --- a/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/report/TestTextReport.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.qpid.server.management.plugin.report; - -import java.util.Arrays; - -public class TestTextReport extends QueueTextReport -{ - public static final String NAME = "testText"; - private int _count; - private String _stringParam; - private String[] _stringArrayParam; - - @Override - public String getName() - { - return NAME; - } - - @Override - public String getContentType() - { - return "text/plain"; - } - - @Override - public void addMessage(final ReportableMessage reportableMessage) - { - _count++; - } - - @Override - public boolean isComplete() - { - return false; - } - - @Override - public String getReport() - { - StringBuilder result = new StringBuilder("There are " + _count + " messages on the queue."); - if(_stringParam != null) - { - result.append(" stringParam = " + _stringParam + "."); - } - if(_stringArrayParam != null) - { - result.append(" stringArrayParam = " + Arrays.asList(_stringArrayParam) + "."); - } - return result.toString(); - } - - @SuppressWarnings("unused") - public void setStringParam(final String value) - { - _stringParam = value; - } - - @SuppressWarnings("unused") - public void setStringArrayParam(final String[] value) - { - _stringArrayParam = value; - } - - -} diff --git a/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/servlet/rest/ConfiguredObjectToMapConverterTest.java b/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/servlet/rest/ConfiguredObjectToMapConverterTest.java deleted file mode 100644 index 5fb73c8ee4..0000000000 --- a/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/servlet/rest/ConfiguredObjectToMapConverterTest.java +++ /dev/null @@ -1,410 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.qpid.server.management.plugin.servlet.rest; - -import static org.apache.qpid.server.management.plugin.servlet.rest.ConfiguredObjectToMapConverter.STATISTICS_MAP_KEY; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyBoolean; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import junit.framework.TestCase; - -import org.apache.qpid.server.model.ConfiguredObject; -import org.apache.qpid.server.model.ConfiguredObjectAttribute; -import org.apache.qpid.server.model.ConfiguredObjectTypeRegistry; -import org.apache.qpid.server.model.Model; - -public class ConfiguredObjectToMapConverterTest extends TestCase -{ - private ConfiguredObjectToMapConverter _converter = new ConfiguredObjectToMapConverter(); - private ConfiguredObject _configuredObject = mock(ConfiguredObject.class); - - @Override - protected void setUp() throws Exception - { - super.setUp(); - } - - public void testConfiguredObjectWithSingleStatistics() throws Exception - { - final String statisticName = "statisticName"; - final int statisticValue = 10; - - when(_configuredObject.getStatistics()).thenReturn(Collections.singletonMap(statisticName, (Number) statisticValue)); - - Map<String, Object> resultMap = _converter.convertObjectToMap(_configuredObject, - ConfiguredObject.class, - 0, - false, - false, - false, - false, - 120, - false); - Map<String, Object> statsAsMap = (Map<String, Object>) resultMap.get(STATISTICS_MAP_KEY); - assertNotNull("Statistics should be part of map", statsAsMap); - assertEquals("Unexpected number of statistics", 1, statsAsMap.size()); - assertEquals("Unexpected statistic value", statisticValue, statsAsMap.get(statisticName)); - } - - public void testConfiguredObjectWithSingleNonConfiguredObjectAttribute() throws Exception - { - final String attributeName = "attribute"; - final String attributeValue = "value"; - Model model = createTestModel(); - when(_configuredObject.getModel()).thenReturn(model); - configureMockToReturnOneAttribute(_configuredObject, attributeName, attributeValue); - - Map<String, Object> resultMap = _converter.convertObjectToMap(_configuredObject, - ConfiguredObject.class, - 0, - false, - false, - false, - false, - 120, - false); - assertEquals("Unexpected number of attributes", 1, resultMap.size()); - assertEquals("Unexpected attribute value", attributeValue, resultMap.get(attributeName)); - } - - /* - * For now, it is the name of the configured object is returned as the attribute value, rather than the - * configured object itself - */ - public void testConfiguredObjectWithSingleConfiguredObjectAttribute() throws Exception - { - final String attributeName = "attribute"; - final ConfiguredObject attributeValue = mock(ConfiguredObject.class); - when(attributeValue.getName()).thenReturn("attributeConfiguredObjectName"); - - configureMockToReturnOneAttribute(_configuredObject, attributeName, attributeValue); - - Map<String, Object> resultMap = _converter.convertObjectToMap(_configuredObject, - ConfiguredObject.class, - 0, - false, - false, - false, - false, - 120, - false); - assertEquals("Unexpected number of attributes", 1, resultMap.size()); - assertEquals("Unexpected attribute value", "attributeConfiguredObjectName", resultMap.get(attributeName)); - } - - public void testConfiguredObjectWithChildAndDepth1() - { - final String childAttributeName = "childattribute"; - final String childAttributeValue = "childvalue"; - - Model model = createTestModel(); - - TestChild mockChild = mock(TestChild.class); - when(mockChild.getModel()).thenReturn(model); - when(_configuredObject.getModel()).thenReturn(model); - configureMockToReturnOneAttribute(mockChild, childAttributeName, childAttributeValue); - when(_configuredObject.getChildren(TestChild.class)).thenReturn(Arrays.asList(mockChild)); - - Map<String, Object> resultMap = _converter.convertObjectToMap(_configuredObject, - ConfiguredObject.class, - 1, - false, - false, - false, - false, - 120, - false); - assertEquals("Unexpected parent map size", 1, resultMap.size()); - - final List<Map<String, Object>> childList = (List<Map<String, Object>>) resultMap.get("testchilds"); - assertEquals("Unexpected number of children", 1, childList.size()); - final Map<String, Object> childMap = childList.get(0); - assertEquals("Unexpected child map size", 1, childMap.size()); - assertNotNull(childMap); - - assertEquals("Unexpected child attribute value", childAttributeValue, childMap.get(childAttributeName)); - } - - public void testActuals() - { - final String childAttributeName = "childattribute"; - final String childAttributeValue = "childvalue"; - final String childActualAttributeValue = "${actualvalue}"; - final Map<String,Object> actualContext = Collections.<String,Object>singletonMap("key","value"); - final Set<String> inheritedKeys = new HashSet<>(Arrays.asList("key","inheritedkey")); - - Model model = createTestModel(); - - TestChild mockChild = mock(TestChild.class); - when(mockChild.getModel()).thenReturn(model); - when(_configuredObject.getModel()).thenReturn(model); - when(_configuredObject.getAttributeNames()).thenReturn(Collections.singletonList(ConfiguredObject.CONTEXT)); - when(_configuredObject.getContextValue(eq(String.class), eq("key"))).thenReturn("value"); - when(_configuredObject.getContextValue(eq(String.class),eq("inheritedkey"))).thenReturn("foo"); - when(_configuredObject.getContextKeys(anyBoolean())).thenReturn(inheritedKeys); - when(_configuredObject.getContext()).thenReturn(actualContext); - when(_configuredObject.getActualAttributes()).thenReturn(Collections.singletonMap(ConfiguredObject.CONTEXT, actualContext)); - when(mockChild.getAttributeNames()).thenReturn(Arrays.asList(childAttributeName, ConfiguredObject.CONTEXT)); - when(mockChild.getAttribute(childAttributeName)).thenReturn(childAttributeValue); - when(mockChild.getActualAttributes()).thenReturn(Collections.singletonMap(childAttributeName, childActualAttributeValue)); - when(_configuredObject.getChildren(TestChild.class)).thenReturn(Arrays.asList(mockChild)); - - - Map<String, Object> resultMap = _converter.convertObjectToMap(_configuredObject, - ConfiguredObject.class, - 1, - true, - false, - false, - false, - 120, - false); - assertEquals("Unexpected parent map size", 2, resultMap.size()); - assertEquals("Incorrect context", resultMap.get(ConfiguredObject.CONTEXT), actualContext); - List<Map<String, Object>> childList = (List<Map<String, Object>>) resultMap.get("testchilds"); - assertEquals("Unexpected number of children", 1, childList.size()); - Map<String, Object> childMap = childList.get(0); - assertNotNull(childMap); - assertEquals("Unexpected child map size", 1, childMap.size()); - - assertEquals("Unexpected child attribute value", childActualAttributeValue, childMap.get(childAttributeName)); - - resultMap = _converter.convertObjectToMap(_configuredObject, - ConfiguredObject.class, - 1, - false, - false, - false, - false, - 120, - false); - assertEquals("Unexpected parent map size", 2, resultMap.size()); - Map<String, Object> inheritedContext = new HashMap<>(); - inheritedContext.put("key","value"); - inheritedContext.put("inheritedkey","foo"); - assertEquals("Incorrect context", inheritedContext, resultMap.get(ConfiguredObject.CONTEXT)); - childList = (List<Map<String, Object>>) resultMap.get("testchilds"); - assertEquals("Unexpected number of children", 1, childList.size()); - childMap = childList.get(0); - assertEquals("Unexpected child map size", 1, childMap.size()); - assertNotNull(childMap); - - assertEquals("Unexpected child attribute value", childAttributeValue, childMap.get(childAttributeName)); - - } - - public void testOversizedAttributes() - { - - Model model = createTestModel(); - ConfiguredObjectTypeRegistry typeRegistry = model.getTypeRegistry(); - final Map<String, ConfiguredObjectAttribute<?, ?>> attributeTypes = - typeRegistry.getAttributeTypes(TestChild.class); - final ConfiguredObjectAttribute longAttr = mock(ConfiguredObjectAttribute.class); - when(longAttr.isOversized()).thenReturn(true); - when(longAttr.getOversizedAltText()).thenReturn(""); - when(attributeTypes.get(eq("longAttr"))).thenReturn(longAttr); - - TestChild mockChild = mock(TestChild.class); - when(mockChild.getModel()).thenReturn(model); - when(_configuredObject.getModel()).thenReturn(model); - configureMockToReturnOneAttribute(mockChild, "longAttr", "this is not long"); - when(_configuredObject.getChildren(TestChild.class)).thenReturn(Arrays.asList(mockChild)); - - - Map<String, Object> resultMap = _converter.convertObjectToMap(_configuredObject, - ConfiguredObject.class, - 1, - false, - false, - false, - false, - 20, - false); - Object children = resultMap.get("testchilds"); - assertNotNull(children); - assertTrue(children instanceof Collection); - assertTrue(((Collection)children).size()==1); - Object attrs = ((Collection)children).iterator().next(); - assertTrue(attrs instanceof Map); - assertEquals("this is not long", ((Map) attrs).get("longAttr")); - - - - resultMap = _converter.convertObjectToMap(_configuredObject, - ConfiguredObject.class, - 1, - false, - false, - false, - false, - 8, - false); - - children = resultMap.get("testchilds"); - assertNotNull(children); - assertTrue(children instanceof Collection); - assertTrue(((Collection)children).size()==1); - attrs = ((Collection)children).iterator().next(); - assertTrue(attrs instanceof Map); - assertEquals("this...", ((Map) attrs).get("longAttr")); - - - - - when(longAttr.getOversizedAltText()).thenReturn("test alt text"); - - resultMap = _converter.convertObjectToMap(_configuredObject, - ConfiguredObject.class, - 1, - false, - false, - false, - false, - 8, - false); - - children = resultMap.get("testchilds"); - assertNotNull(children); - assertTrue(children instanceof Collection); - assertTrue(((Collection)children).size()==1); - attrs = ((Collection)children).iterator().next(); - assertTrue(attrs instanceof Map); - assertEquals("test alt text", ((Map) attrs).get("longAttr")); - - - } - - public void testSecureAttributes() - { - - Model model = createTestModel(); - ConfiguredObjectTypeRegistry typeRegistry = model.getTypeRegistry(); - Map<String, ConfiguredObjectAttribute<?, ?>> attributeTypes = typeRegistry.getAttributeTypes(TestChild.class); - ConfiguredObjectAttribute secureAttribute = mock(ConfiguredObjectAttribute.class); - when(secureAttribute.isSecure()).thenReturn(true); - when(secureAttribute.isSecureValue(any())).thenReturn(true); - when(attributeTypes.get(eq("secureAttribute"))).thenReturn(secureAttribute); - - TestChild mockChild = mock(TestChild.class); - when(mockChild.getModel()).thenReturn(model); - when(_configuredObject.getModel()).thenReturn(model); - - // set encoded value - configureMockToReturnOneAttribute(mockChild, "secureAttribute", "*****"); - - // set actual values - when(mockChild.getActualAttributes()).thenReturn(Collections.singletonMap("secureAttribute", "secret")); - when(_configuredObject.getChildren(TestChild.class)).thenReturn(Arrays.asList(mockChild)); - when(model.getParentTypes(TestChild.class)).thenReturn(Collections.<Class<? extends ConfiguredObject>>singleton(TestChild.class)); - when(_configuredObject.getCategoryClass()).thenReturn(TestChild.class); - when(mockChild.isDurable()).thenReturn(true); - - Map<String, Object> resultMap = _converter.convertObjectToMap(_configuredObject, - ConfiguredObject.class, - 1, - false, - false, - false, - false, - 20, - false); - Object children = resultMap.get("testchilds"); - assertNotNull(children); - assertTrue(children instanceof Collection); - assertTrue(((Collection)children).size()==1); - Object attrs = ((Collection)children).iterator().next(); - assertTrue(attrs instanceof Map); - assertEquals("*****", ((Map) attrs).get("secureAttribute")); - - resultMap = _converter.convertObjectToMap(_configuredObject, - ConfiguredObject.class, - 1, - true, - true, - false, - true, - 20, - true); - - children = resultMap.get("testchilds"); - assertNotNull(children); - assertTrue(children instanceof Collection); - assertTrue(((Collection)children).size()==1); - attrs = ((Collection)children).iterator().next(); - assertTrue(attrs instanceof Map); - assertEquals("secret", ((Map) attrs).get("secureAttribute")); - - resultMap = _converter.convertObjectToMap(_configuredObject, - ConfiguredObject.class, - 1, - true, - true, - false, - false, - 20, - true); - - children = resultMap.get("testchilds"); - assertNotNull(children); - assertTrue(children instanceof Collection); - assertTrue(((Collection)children).size()==1); - attrs = ((Collection)children).iterator().next(); - assertTrue(attrs instanceof Map); - assertEquals("*****", ((Map) attrs).get("secureAttribute")); - } - - private Model createTestModel() - { - Model model = mock(Model.class); - final List<Class<? extends ConfiguredObject>> list = new ArrayList<Class<? extends ConfiguredObject>>(); - list.add(TestChild.class); - when(model.getChildTypes(ConfiguredObject.class)).thenReturn(list); - final ConfiguredObjectTypeRegistry typeRegistry = mock(ConfiguredObjectTypeRegistry.class); - final Map<String, ConfiguredObjectAttribute<?, ?>> attrTypes = mock(Map.class); - when(attrTypes.get(any(String.class))).thenReturn(mock(ConfiguredObjectAttribute.class)); - when(typeRegistry.getAttributeTypes(any(Class.class))).thenReturn(attrTypes); - when(model.getTypeRegistry()).thenReturn(typeRegistry); - return model; - } - - private void configureMockToReturnOneAttribute(ConfiguredObject mockConfiguredObject, String attributeName, Object attributeValue) - { - when(mockConfiguredObject.getAttributeNames()).thenReturn(Arrays.asList(attributeName)); - when(mockConfiguredObject.getAttribute(attributeName)).thenReturn(attributeValue); - } - - private static interface TestChild extends ConfiguredObject - { - } -} diff --git a/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/session/LoginLogoutReporterTest.java b/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/session/LoginLogoutReporterTest.java deleted file mode 100644 index 45fa3fabd0..0000000000 --- a/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/session/LoginLogoutReporterTest.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.apache.qpid.server.management.plugin.session; - -import static org.mockito.Matchers.anyString; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Matchers.argThat; -import static org.mockito.Mockito.when; - -import javax.security.auth.Subject; - -import org.apache.qpid.server.logging.EventLogger; -import org.apache.qpid.server.logging.EventLoggerProvider; -import org.apache.qpid.server.logging.LogMessage; -import org.apache.qpid.server.logging.MessageLogger; -import org.apache.qpid.server.security.auth.AuthenticatedPrincipal; -import org.mockito.ArgumentMatcher; - -import junit.framework.TestCase; - -public class LoginLogoutReporterTest extends TestCase -{ - private LoginLogoutReporter _loginLogoutReport; - private Subject _subject = new Subject(); - private MessageLogger _logger = mock(MessageLogger.class); - - @Override - protected void setUp() throws Exception - { - super.setUp(); - - _subject.getPrincipals().add(new AuthenticatedPrincipal("mockusername")); - when(_logger.isEnabled()).thenReturn(true); - when(_logger.isMessageEnabled(anyString())).thenReturn(true); - EventLogger eventLogger = new EventLogger(_logger); - EventLoggerProvider provider = mock(EventLoggerProvider.class); - when(provider.getEventLogger()).thenReturn(eventLogger); - _loginLogoutReport = new LoginLogoutReporter(_subject, provider); - } - - public void testLoginLogged() - { - _loginLogoutReport.valueBound(null); - verify(_logger).message(isLogMessageWithMessage("MNG-1007 : Open : User mockusername")); - } - - public void testLogoutLogged() - { - _loginLogoutReport.valueUnbound(null); - verify(_logger).message(isLogMessageWithMessage("MNG-1008 : Close : User mockusername")); - } - - private LogMessage isLogMessageWithMessage(final String expectedMessage) - { - return argThat( new ArgumentMatcher<LogMessage>() - { - @Override - public boolean matches(Object argument) - { - LogMessage actual = (LogMessage) argument; - return actual.toString().equals(expectedMessage); - } - }); - } -} diff --git a/qpid/java/broker-plugins/management-http/src/test/resources/META-INF/services/org.apache.qpid.server.management.plugin.report.QueueReport b/qpid/java/broker-plugins/management-http/src/test/resources/META-INF/services/org.apache.qpid.server.management.plugin.report.QueueReport deleted file mode 100644 index 7d25ec4378..0000000000 --- a/qpid/java/broker-plugins/management-http/src/test/resources/META-INF/services/org.apache.qpid.server.management.plugin.report.QueueReport +++ /dev/null @@ -1,2 +0,0 @@ -org.apache.qpid.server.management.plugin.report.TestTextReport -org.apache.qpid.server.management.plugin.report.TestBinaryReport |
