Author: jstrachan
Date: Thu May 24 07:14:49 2007
New Revision: 541306

URL: http://svn.apache.org/viewvc?view=rev&rev=541306
Log:
applied patch for AMQ-1241 to allow the web console to be run against an 
embedded, invm, properties or remote broker. Many thanks to Mario Siegenthaler 
for the patch!

Added:
    
activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/RemoteJMXBrokerFacade.java
   (with props)
    
activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/WebConsoleStarter.java
   (with props)
    
activemq/trunk/activemq-web-console/src/main/webapp/WEB-INF/webconsole-embedded.xml
   (contents, props changed)
      - copied, changed from r540136, 
activemq/trunk/activemq-web-console/src/main/webapp/WEB-INF/applicationContext.xml
    
activemq/trunk/activemq-web-console/src/main/webapp/WEB-INF/webconsole-invm.xml 
  (with props)
    
activemq/trunk/activemq-web-console/src/main/webapp/WEB-INF/webconsole-jndi.xml 
  (with props)
    
activemq/trunk/activemq-web-console/src/main/webapp/WEB-INF/webconsole-properties.xml
   (with props)
    
activemq/trunk/assembly/src/release/webapps/admin/WEB-INF/webconsole-embedded.xml
   (contents, props changed)
      - copied, changed from r541274, 
activemq/trunk/assembly/src/release/webapps/admin/WEB-INF/applicationContext.xml
Removed:
    
activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/JMXBrokerFacade.java
    
activemq/trunk/activemq-web-console/src/main/webapp/WEB-INF/applicationContext.xml
    
activemq/trunk/assembly/src/release/webapps/admin/WEB-INF/applicationContext.xml
Modified:
    activemq/trunk/activemq-web-console/pom.xml
    
activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/SessionPool.java
    
activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/controller/SendMessage.java
    activemq/trunk/activemq-web-console/src/main/webapp/WEB-INF/web.xml
    
activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/QueueBrowseServlet.java
    
activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/WebClient.java
    activemq/trunk/assembly/pom.xml
    activemq/trunk/assembly/src/main/descriptors/unix-bin.xml
    activemq/trunk/assembly/src/main/descriptors/windows-bin.xml
    activemq/trunk/pom.xml

Modified: activemq/trunk/activemq-web-console/pom.xml
URL: 
http://svn.apache.org/viewvc/activemq/trunk/activemq-web-console/pom.xml?view=diff&rev=541306&r1=541305&r2=541306
==============================================================================
--- activemq/trunk/activemq-web-console/pom.xml (original)
+++ activemq/trunk/activemq-web-console/pom.xml Thu May 24 07:14:49 2007
@@ -52,6 +52,20 @@
               <name>com.sun.management.jmxremote</name>
               <value></value>
             </systemProperty>
+<!--
+            <systemProperty>
+              <name>webconsole.type</name>
+              <value>properties</value>
+            </systemProperty>
+            <systemProperty>
+              <name>webconsole.jms.url</name>
+              <value>tcp://localhost:61616</value>
+            </systemProperty>
+            <systemProperty>
+              <name>webconsole.jmx.url</name>
+              
<value>service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi</value>
+            </systemProperty>
+-->
           </systemProperties>
           <scanIntervalSeconds>10</scanIntervalSeconds>
         </configuration>

Added: 
activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/RemoteJMXBrokerFacade.java
URL: 
http://svn.apache.org/viewvc/activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/RemoteJMXBrokerFacade.java?view=auto&rev=541306
==============================================================================
--- 
activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/RemoteJMXBrokerFacade.java
 (added)
+++ 
activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/RemoteJMXBrokerFacade.java
 Thu May 24 07:14:49 2007
@@ -0,0 +1,222 @@
+/**
+ *
+ * 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.activemq.web;
+
+import org.apache.activemq.broker.jmx.BrokerViewMBean;
+import org.apache.activemq.broker.jmx.ManagementContext;
+import org.apache.activemq.broker.jmx.QueueViewMBean;
+import org.apache.activemq.command.ActiveMQDestination;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.management.MBeanServerConnection;
+import javax.management.MBeanServerInvocationHandler;
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+import javax.management.remote.JMXConnector;
+import javax.management.remote.JMXConnectorFactory;
+import javax.management.remote.JMXServiceURL;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * A [EMAIL PROTECTED] BrokerFacade} which uses a JMX-Connection to 
communicate with a
+ * broker
+ *
+ * @version $Revision: 1.1 $
+ */
+public class RemoteJMXBrokerFacade extends BrokerFacadeSupport {
+    private static final transient Log log = 
LogFactory.getLog(RemoteJMXBrokerFacade.class);
+    private String jmxUrl;
+    private String brokerName;
+    private JMXConnector connector;
+
+    public void setBrokerName(String brokerName) {
+        this.brokerName = brokerName;
+    }
+
+    public void setJmxUrl(String url) {
+        this.jmxUrl = url;
+    }
+
+    /**
+     * Shutdown this facade aka close any open connection.
+     */
+    public void shutdown() {
+        closeConnection();
+    }
+
+    public BrokerViewMBean getBrokerAdmin() throws Exception {
+        MBeanServerConnection connection = getConnection();
+
+        Set brokers = findBrokers(connection);
+        if (brokers.size() == 0) {
+            throw new IOException("No broker could be found in the JMX.");
+        }
+        ObjectName name = (ObjectName) brokers.iterator().next();
+        BrokerViewMBean mbean = (BrokerViewMBean) MBeanServerInvocationHandler
+                .newProxyInstance(connection, name, BrokerViewMBean.class, 
true);
+        return mbean;
+    }
+
+    protected MBeanServerConnection getConnection() throws IOException {
+        JMXConnector connector = this.connector;
+        if (isConnectionActive(connector)) {
+            return connector.getMBeanServerConnection();
+        }
+
+        synchronized (this) {
+            closeConnection();
+
+            log.debug("Creating a new JMX-Connection to the broker");
+            this.connector = createConnection();
+            return this.connector.getMBeanServerConnection();
+        }
+    }
+
+    protected boolean isConnectionActive(JMXConnector connector) {
+        if (connector == null) {
+            return false;
+        }
+
+        try {
+            MBeanServerConnection connection = connector
+                    .getMBeanServerConnection();
+            int brokerCount = findBrokers(connection).size();
+            return brokerCount > 0;
+        }
+        catch (Exception e) {
+            return false;
+        }
+    }
+
+    protected JMXConnector createConnection() {
+        String[] urls = this.jmxUrl.split(",");
+        if (urls == null || urls.length == 0) {
+            urls = new String[]{this.jmxUrl};
+        }
+
+        Exception exception = null;
+        for (int i = 0; i < urls.length; i++) {
+            try {
+                JMXConnector connector = JMXConnectorFactory
+                        .connect(new JMXServiceURL(urls[i]));
+                connector.connect();
+                MBeanServerConnection connection = connector
+                        .getMBeanServerConnection();
+
+                Set brokers = findBrokers(connection);
+                if (brokers.size() > 0) {
+                    log
+                            .info("Connected via JMX to the broker at "
+                                    + urls[i]);
+                    return connector;
+                }
+            }
+            catch (Exception e) {
+                // Keep the exception for later
+                exception = e;
+            }
+        }
+        if (exception != null) {
+            if (exception instanceof RuntimeException) {
+                throw (RuntimeException) exception;
+            }
+            else {
+                throw new RuntimeException(exception);
+            }
+        }
+        throw new IllegalStateException(
+                "No broker is found at any of the urls " + this.jmxUrl);
+    }
+
+    protected synchronized void closeConnection() {
+        if (connector != null) {
+            try {
+                log.debug("Closing a connection to a broker ("
+                        + connector.getConnectionId() + ")");
+
+                connector.close();
+            }
+            catch (IOException e) {
+                // Ignore the exception, since it most likly won't matter
+                // anymore
+            }
+        }
+    }
+
+    /**
+     * Finds all ActiveMQ-Brokers registered on a certain JMX-Server or, if a
+     * JMX-BrokerName has been set, the broker with that name.
+     *
+     * @param connection not <code>null</code>
+     * @return Set with ObjectName-elements
+     * @throws IOException
+     * @throws MalformedObjectNameException
+     */
+    protected Set findBrokers(MBeanServerConnection connection)
+            throws IOException, MalformedObjectNameException {
+        ObjectName name;
+        if (this.brokerName == null) {
+            name = new ObjectName("org.apache.activemq:Type=Broker,*");
+        }
+        else {
+            name = new ObjectName("org.apache.activemq:BrokerName="
+                    + this.brokerName + ",Type=Broker");
+        }
+
+        Set brokers = connection.queryNames(name, null);
+        return brokers;
+    }
+
+    public void purgeQueue(ActiveMQDestination destination) throws Exception {
+        QueueViewMBean queue = getQueue(destination.getPhysicalName());
+        queue.purge();
+    }
+
+    public ManagementContext getManagementContext() {
+        throw new IllegalStateException("not supported");
+    }
+
+    protected Collection getManagedObjects(ObjectName[] names, Class type) {
+        MBeanServerConnection connection;
+        try {
+            connection = getConnection();
+        }
+        catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+
+        List answer = new ArrayList();
+        if (connection != null) {
+            for (int i = 0; i < names.length; i++) {
+                ObjectName name = names[i];
+                Object value = MBeanServerInvocationHandler.newProxyInstance(
+                        connection, name, type, true);
+                if (value != null) {
+                    answer.add(value);
+                }
+            }
+        }
+               return answer;
+       }
+
+}

Propchange: 
activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/RemoteJMXBrokerFacade.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: 
activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/SessionPool.java
URL: 
http://svn.apache.org/viewvc/activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/SessionPool.java?view=diff&rev=541306&r1=541305&r2=541306
==============================================================================
--- 
activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/SessionPool.java
 (original)
+++ 
activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/SessionPool.java
 Thu May 24 07:14:49 2007
@@ -16,13 +16,12 @@
  */
 package org.apache.activemq.web;
 
-import org.apache.activemq.ActiveMQConnectionFactory;
+import java.util.LinkedList;
 
 import javax.jms.Connection;
 import javax.jms.ConnectionFactory;
 import javax.jms.JMSException;
 import javax.jms.Session;
-import java.util.LinkedList;
 
 /**
  * A simple pool of JMS Session objects intended for use by Queue browsers.
@@ -31,58 +30,71 @@
  */
 public class SessionPool {
 
-    private ConnectionFactory connectionFactory;
-    private Connection connection;
-    private LinkedList sessions = new LinkedList();
-
-    public Connection getConnection() throws JMSException {
-        if (connection == null) {
-            connection = getConnectionFactory().createConnection();
-            connection.start();
-        }
-        return connection;
-    }
-
-    public void setConnection(Connection connection) {
-        this.connection = connection;
-    }
-
-    public ConnectionFactory getConnectionFactory() {
-        if (connectionFactory == null) {
-            // TODO support remote brokers too
-            connectionFactory = new 
ActiveMQConnectionFactory("vm://localhost");
-        }
-        return connectionFactory;
-    }
-
-    public void setConnectionFactory(ConnectionFactory connectionFactory) {
-        this.connectionFactory = connectionFactory;
-    }
-
-
-    public Session borrowSession() throws JMSException {
-        Session answer = null;
-        synchronized (sessions) {
-            if (sessions.isEmpty()) {
-                answer = createSession();
-            }
-            else {
-                answer = (Session) sessions.removeLast();
-            }
-        }
-        return answer;
-    }
-
-    protected void returnSession(Session session) {
-        if (session != null) {
-            synchronized (sessions) {
-                sessions.add(session);
-            }
-        }
-    }
-
-    protected Session createSession() throws JMSException {
-        return getConnection().createSession(false, Session.AUTO_ACKNOWLEDGE);
-    }
+       private ConnectionFactory connectionFactory;
+       private Connection connection;
+       private LinkedList sessions = new LinkedList();
+
+       public Connection getConnection() throws JMSException {
+               if (checkConnection())
+                       return connection;
+
+               synchronized (this) {
+                       connection = getConnectionFactory().createConnection();
+                       connection.start();
+                       return connection;
+               }
+       }
+
+       private boolean checkConnection() {
+               if (connection == null)
+                       return false;
+
+               try {
+                       connection.getMetaData();
+                       return true;
+               } catch (JMSException e) {
+                       return false;
+               }
+       }
+
+       public void setConnection(Connection connection) {
+               this.connection = connection;
+       }
+
+       public ConnectionFactory getConnectionFactory() {
+               if (connectionFactory == null) {
+                       throw new IllegalStateException(
+                                       "No ConnectionFactory has been set for 
the session pool");
+               }
+               return connectionFactory;
+       }
+
+       public void setConnectionFactory(ConnectionFactory connectionFactory) {
+               this.connectionFactory = connectionFactory;
+       }
+
+       public Session borrowSession() throws JMSException {
+               Session answer = null;
+               synchronized (sessions) {
+                       if (sessions.isEmpty()) {
+                               answer = createSession();
+                       } else {
+                               answer = (Session) sessions.removeLast();
+                       }
+               }
+               return answer;
+       }
+
+       public void returnSession(Session session) {
+               if (session != null) {
+                       synchronized (sessions) {
+                               sessions.add(session);
+                       }
+               }
+       }
+
+       protected Session createSession() throws JMSException {
+               return getConnection().createSession(false, 
Session.AUTO_ACKNOWLEDGE);
+       }
 
 }

Added: 
activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/WebConsoleStarter.java
URL: 
http://svn.apache.org/viewvc/activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/WebConsoleStarter.java?view=auto&rev=541306
==============================================================================
--- 
activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/WebConsoleStarter.java
 (added)
+++ 
activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/WebConsoleStarter.java
 Thu May 24 07:14:49 2007
@@ -0,0 +1,83 @@
+/**
+ *
+ * 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.activemq.web;
+
+import javax.jms.ConnectionFactory;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
+
+import org.springframework.web.context.WebApplicationContext;
+import org.springframework.web.context.support.WebApplicationContextUtils;
+import org.springframework.web.context.support.XmlWebApplicationContext;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * Starts the WebConsole.
+ * 
+ * @version $Revision: 1.1 $
+ */
+public class WebConsoleStarter implements ServletContextListener {
+    private static final transient Log log = 
LogFactory.getLog(WebConsoleStarter.class);
+
+    public void contextInitialized(ServletContextEvent event) {
+               log.debug("Initializing ActiveMQ WebConsole...");
+               
+               ServletContext servletContext = event.getServletContext();
+               WebApplicationContext context = 
createWebapplicationContext(servletContext);
+               
+               initializeWebClient(servletContext, context);
+               
+               log.info("ActiveMQ WebConsole initialized.");
+       }
+
+       private WebApplicationContext 
createWebapplicationContext(ServletContext servletContext) {
+               String webconsoleType = System.getProperty("webconsole.type", 
"embedded");
+               String configuration = "/WEB-INF/webconsole-" + webconsoleType 
+ ".xml";
+               
+               XmlWebApplicationContext context = new 
XmlWebApplicationContext();
+               context.setServletContext(servletContext);
+               context.setConfigLocations(new String[] { configuration });
+               context.refresh();
+               context.start();
+               
+               
servletContext.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE,
 context);
+
+               return context;
+       }
+
+       private void initializeWebClient(ServletContext servletContext, 
WebApplicationContext context) {
+               ConnectionFactory connectionFactory = (ConnectionFactory) 
context
+                               .getBean("connectionFactory");
+               
servletContext.setAttribute(WebClient.connectionFactoryAttribute,
+                               connectionFactory);
+       }
+       
+       public void contextDestroyed(ServletContextEvent event) {
+               XmlWebApplicationContext context = (XmlWebApplicationContext) 
WebApplicationContextUtils
+                               
.getWebApplicationContext(event.getServletContext());
+               if (context != null)
+               {
+                       context.stop();
+                       context.destroy();
+               }
+               // do nothing, since the context is destoyed anyway
+       }
+
+}

Propchange: 
activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/WebConsoleStarter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: 
activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/controller/SendMessage.java
URL: 
http://svn.apache.org/viewvc/activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/controller/SendMessage.java?view=diff&rev=541306&r1=541305&r2=541306
==============================================================================
--- 
activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/controller/SendMessage.java
 (original)
+++ 
activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/controller/SendMessage.java
 Thu May 24 07:14:49 2007
@@ -78,8 +78,6 @@
             }
 
             client.send(dest, message, JMSPersistent, JMSPriority, 
JMSTimeToLive);
-
-            System.out.println("Sent message: " + message);
         }
     }
 

Modified: activemq/trunk/activemq-web-console/src/main/webapp/WEB-INF/web.xml
URL: 
http://svn.apache.org/viewvc/activemq/trunk/activemq-web-console/src/main/webapp/WEB-INF/web.xml?view=diff&rev=541306&r1=541305&r2=541306
==============================================================================
--- activemq/trunk/activemq-web-console/src/main/webapp/WEB-INF/web.xml 
(original)
+++ activemq/trunk/activemq-web-console/src/main/webapp/WEB-INF/web.xml Thu May 
24 07:14:49 2007
@@ -22,117 +22,141 @@
          http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd";
          version="2.4">
 
-    <description>
-      Apache ActiveMQ Web Console
-    </description>
-    <display-name>ActiveMQ Console</display-name>
-
-    <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
-->
-    <!--              Configuration of the SiteMesh Filter.                    
                                             -->
-    <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
-->
-    <filter>
-        <filter-name>sitemesh</filter-name>
-        
<filter-class>com.opensymphony.module.sitemesh.filter.PageFilter</filter-class>
-    </filter>
-
-    <filter-mapping>
-        <filter-name>sitemesh</filter-name>
-        <url-pattern>/*</url-pattern>
-    </filter-mapping>
-    
-    <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
-->
-    <!--              Expose Spring POJOs to JSP                   .           
                                                  -->
-    <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
-->
-    <filter>
-        <filter-name>spring</filter-name>
-        
<filter-class>org.apache.activemq.web.filter.ApplicationContextFilter</filter-class>
-    </filter>
-
-    <filter-mapping>
-        <filter-name>spring</filter-name>
-        <url-pattern>/*</url-pattern>
-    </filter-mapping>
-
-    <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
-->
-    <!--              ActiveMQ servlets                                        
                                                        -->
-    <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
-->
-        
-    <!-- the subscription REST servlet -->
-    <servlet>
-        <servlet-name>AjaxServlet</servlet-name>
-        <servlet-class>org.apache.activemq.web.AjaxServlet</servlet-class>
-        <load-on-startup>1</load-on-startup>
-    </servlet>
-    <servlet-mapping>
-        <servlet-name>AjaxServlet</servlet-name>
-        <url-pattern>/ajax/*</url-pattern>
-    </servlet-mapping>
-
-    <servlet>
-        <servlet-name>SendServlet</servlet-name>
-        <servlet-class>org.apache.activemq.web.MessageServlet</servlet-class>
-        <load-on-startup>1</load-on-startup>
-    </servlet>
-    <servlet-mapping>
-        <servlet-name>SendServlet</servlet-name>
-        <url-pattern>/send/*</url-pattern>
-    </servlet-mapping>
-
-    <!-- the queue browse servlet -->
-    <servlet>
-        <servlet-name>QueueBrowseServlet</servlet-name>
-        
<servlet-class>org.apache.activemq.web.QueueBrowseServlet</servlet-class>
-    </servlet>
-    <servlet-mapping>
-        <servlet-name>QueueBrowseServlet</servlet-name>
-        <url-pattern>/queueBrowse/*</url-pattern>
-    </servlet-mapping>
-
-    <!-- track the session usage for web JMS clients -->
-    <filter>
-      <filter-name>session</filter-name>
-      <filter-class>org.apache.activemq.web.SessionFilter</filter-class>
-    </filter>
-    
-    <filter-mapping>
-      <filter-name>session</filter-name>
-      <url-pattern>/*</url-pattern>
-    </filter-mapping>
-
-    
-    <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
-->
-    <!--              Spring listener.                   -->
-    <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
-->
-               <listener>
-                 
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
-               </listener>
-
-    <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
-->
-    <!--         Configuration of the Spring MVC dispatcher              -->
-    <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
-->
-               <servlet>
-                       <servlet-name>dispatcher</servlet-name>
-                       
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
-                       <load-on-startup>2</load-on-startup>
-               </servlet>
-
-    <servlet-mapping>
-        <servlet-name>dispatcher</servlet-name>
-        <url-pattern>*.action</url-pattern>
-    </servlet-mapping>
-
-         <welcome-file-list>
-                       <welcome-file>index.html</welcome-file>
-                       <welcome-file>index.jsp</welcome-file>
-               </welcome-file-list>
-
-    <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
-->
-    <!--         Factor out common headers in JSP pages            -->
-    <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
-->
-         <jsp-config>
-           <jsp-property-group>
-              <url-pattern>*.jsp</url-pattern>
-              <include-prelude>/WEB-INF/jspf/headertags.jspf</include-prelude>
-            </jsp-property-group>
-   </jsp-config>
+  <description>
+    Apache ActiveMQ Web Console
+  </description>
+  <display-name>ActiveMQ Console</display-name>
+
+  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+  <!--              Configuration of the SiteMesh Filter.                      
                                           -->
+  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+  <filter>
+    <filter-name>sitemesh</filter-name>
+    
<filter-class>com.opensymphony.module.sitemesh.filter.PageFilter</filter-class>
+  </filter>
+
+  <filter-mapping>
+    <filter-name>sitemesh</filter-name>
+    <url-pattern>/*</url-pattern>
+  </filter-mapping>
+
+  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+  <!--              Expose Spring POJOs to JSP                   .             
                                                -->
+  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+  <filter>
+    <filter-name>spring</filter-name>
+    
<filter-class>org.apache.activemq.web.filter.ApplicationContextFilter</filter-class>
+  </filter>
+
+  <filter-mapping>
+    <filter-name>spring</filter-name>
+    <url-pattern>/*</url-pattern>
+  </filter-mapping>
+
+  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+  <!--              ActiveMQ servlets                                          
                                                      -->
+  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+
+  <!-- the subscription REST servlet -->
+  <servlet>
+    <servlet-name>AjaxServlet</servlet-name>
+    <servlet-class>org.apache.activemq.web.AjaxServlet</servlet-class>
+    <load-on-startup>1</load-on-startup>
+  </servlet>
+  <servlet-mapping>
+    <servlet-name>AjaxServlet</servlet-name>
+    <url-pattern>/ajax/*</url-pattern>
+  </servlet-mapping>
+
+  <servlet>
+    <servlet-name>SendServlet</servlet-name>
+    <servlet-class>org.apache.activemq.web.MessageServlet</servlet-class>
+    <load-on-startup>1</load-on-startup>
+  </servlet>
+  <servlet-mapping>
+    <servlet-name>SendServlet</servlet-name>
+    <url-pattern>/send/*</url-pattern>
+  </servlet-mapping>
+
+  <!-- the queue browse servlet -->
+  <servlet>
+    <servlet-name>QueueBrowseServlet</servlet-name>
+    <servlet-class>org.apache.activemq.web.QueueBrowseServlet</servlet-class>
+  </servlet>
+  <servlet-mapping>
+    <servlet-name>QueueBrowseServlet</servlet-name>
+    <url-pattern>/queueBrowse/*</url-pattern>
+  </servlet-mapping>
+
+  <!-- track the session usage for web JMS clients -->
+  <filter>
+    <filter-name>session</filter-name>
+    <filter-class>org.apache.activemq.web.SessionFilter</filter-class>
+  </filter>
+
+  <filter>
+    <filter-name>spring-rq</filter-name>
+    
<filter-class>org.springframework.web.filter.RequestContextFilter</filter-class>
+  </filter>
+
+  <filter-mapping>
+    <filter-name>session</filter-name>
+    <url-pattern>/*</url-pattern>
+  </filter-mapping>
+  <filter-mapping>
+    <filter-name>spring-rq</filter-name>
+    <url-pattern>/*</url-pattern>
+  </filter-mapping>
+
+
+  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+  <!--              Spring listener.                                           
                 -->
+  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+  <listener>
+    <listener-class>org.apache.activemq.web.WebConsoleStarter</listener-class>
+  </listener>
+
+
+  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+  <!--         Configuration of the Spring MVC dispatcher                      
 -->
+  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+  <servlet>
+    <servlet-name>dispatcher</servlet-name>
+    
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
+    <load-on-startup>2</load-on-startup>
+  </servlet>
+
+  <servlet-mapping>
+    <servlet-name>dispatcher</servlet-name>
+    <url-pattern>*.action</url-pattern>
+  </servlet-mapping>
+
+  <welcome-file-list>
+    <welcome-file>index.html</welcome-file>
+    <welcome-file>index.jsp</welcome-file>
+  </welcome-file-list>
+
+
+  <!-- JNDI Stuff
+<resource-ref>
+ <res-ref-name>jms/connectionFactory</res-ref-name>
+ <res-type>javax.jms.ConnectionFactory</res-type>
+ <res-auth>Container</res-auth>
+ </resource-ref>
+ <resource-ref>
+   <res-ref-name>jmx/url</res-ref-name>
+   <res-type>java.lang.String</res-type>
+ </resource-ref>
+  -->
+
+
+  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+  <!--         Factor out common headers in JSP pages            -->
+  <!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+  <jsp-config>
+    <jsp-property-group>
+      <url-pattern>*.jsp</url-pattern>
+      <include-prelude>/WEB-INF/jspf/headertags.jspf</include-prelude>
+    </jsp-property-group>
+  </jsp-config>
 </web-app>

Copied: 
activemq/trunk/activemq-web-console/src/main/webapp/WEB-INF/webconsole-embedded.xml
 (from r540136, 
activemq/trunk/activemq-web-console/src/main/webapp/WEB-INF/applicationContext.xml)
URL: 
http://svn.apache.org/viewvc/activemq/trunk/activemq-web-console/src/main/webapp/WEB-INF/webconsole-embedded.xml?view=diff&rev=541306&p1=activemq/trunk/activemq-web-console/src/main/webapp/WEB-INF/applicationContext.xml&r1=540136&p2=activemq/trunk/activemq-web-console/src/main/webapp/WEB-INF/webconsole-embedded.xml&r2=541306
==============================================================================
--- 
activemq/trunk/activemq-web-console/src/main/webapp/WEB-INF/applicationContext.xml
 (original)
+++ 
activemq/trunk/activemq-web-console/src/main/webapp/WEB-INF/webconsole-embedded.xml
 Thu May 24 07:14:49 2007
@@ -20,20 +20,23 @@
 
   <bean id="placeholderConfig" 
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" 
/>
   
-  
-  <bean id="sessionPool" class="org.apache.activemq.web.SessionPool"/>
-  
   <!-- use the following bean for a local in-JVM broker -->
-
   <bean id="brokerQuery" class="org.apache.activemq.web.LocalBrokerFacade" 
autowire='constructor' singleton="false"/>
 
+  <!-- use the following for a remote JMX based broker -->
+  <!--<bean id="brokerQuery" class="org.apache.activemq.web.JMXBrokerFacade" 
autowire='constructor' singleton="false"/>-->
+
   <bean id="brokerService" class="org.apache.activemq.xbean.BrokerFactoryBean">
     <property name="config" value="/WEB-INF/activemq.xml"/>
   </bean>
 
-  <!-- use the following for a remote JMX based broker -->
-  <!--<bean id="brokerQuery" class="org.apache.activemq.web.JMXBrokerFacade" 
autowire='constructor' singleton="false"/>-->
+  <bean id="sessionPool" class="org.apache.activemq.web.SessionPool">
+       <property name="connectionFactory" ref="connectionFactory"/>
+  </bean>
 
+  <bean id="connectionFactory" 
class="org.apache.activemq.ActiveMQConnectionFactory" 
depends-on="brokerService">
+    <property name="brokerURL" value="vm://localhost"/>
+  </bean>
 
   <bean id="queueBrowser" class="org.apache.activemq.web.QueueBrowseQuery" 
autowire='constructor' singleton="false"/>
   <bean id="messageQuery" class="org.apache.activemq.web.MessageQuery" 
autowire='constructor' singleton="false"/>

Propchange: 
activemq/trunk/activemq-web-console/src/main/webapp/WEB-INF/webconsole-embedded.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
activemq/trunk/activemq-web-console/src/main/webapp/WEB-INF/webconsole-embedded.xml
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Propchange: 
activemq/trunk/activemq-web-console/src/main/webapp/WEB-INF/webconsole-embedded.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: 
activemq/trunk/activemq-web-console/src/main/webapp/WEB-INF/webconsole-invm.xml
URL: 
http://svn.apache.org/viewvc/activemq/trunk/activemq-web-console/src/main/webapp/WEB-INF/webconsole-invm.xml?view=auto&rev=541306
==============================================================================
--- 
activemq/trunk/activemq-web-console/src/main/webapp/WEB-INF/webconsole-invm.xml 
(added)
+++ 
activemq/trunk/activemq-web-console/src/main/webapp/WEB-INF/webconsole-invm.xml 
Thu May 24 07:14:49 2007
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+    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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+       xmlns:aop="http://www.springframework.org/schema/aop";
+       xsi:schemaLocation="http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+                           http://www.springframework.org/schema/aop 
http://www.springframework.org/schema/aop/spring-aop-2.0.xsd";>
+
+  <bean id="placeholderConfig" 
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" 
/>
+  
+  
+  <bean id="sessionPool" class="org.apache.activemq.web.SessionPool">
+       <property name="connectionFactory" ref="connectionFactory"/>
+  </bean>
+
+  <bean id="brokerRegistry" class="org.apache.activemq.broker.BrokerRegistry" 
factory-method="getInstance"/>
+  <bean id="brokerService" factory-bean="brokerRegistry" 
factory-method="findFirst"/>
+  <bean id="brokerURL" factory-bean="brokerService" 
factory-method="getVmConnectorURI"/>
+
+  <bean id="connectionFactory" 
class="org.apache.activemq.ActiveMQConnectionFactory">
+    <constructor-arg ref="brokerURL"/>
+  </bean>
+
+  <bean id="brokerQuery" class="org.apache.activemq.web.LocalBrokerFacade" 
autowire="constructor" scope="prototype"/>
+
+  <bean id="queueBrowser" class="org.apache.activemq.web.QueueBrowseQuery" 
autowire="constructor" destroy-method="destroy" scope="request"/>
+  <bean id="messageQuery" class="org.apache.activemq.web.MessageQuery" 
autowire="constructor" destroy-method="destroy" scope="request"/>
+
+</beans>

Propchange: 
activemq/trunk/activemq-web-console/src/main/webapp/WEB-INF/webconsole-invm.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
activemq/trunk/activemq-web-console/src/main/webapp/WEB-INF/webconsole-jndi.xml
URL: 
http://svn.apache.org/viewvc/activemq/trunk/activemq-web-console/src/main/webapp/WEB-INF/webconsole-jndi.xml?view=auto&rev=541306
==============================================================================
--- 
activemq/trunk/activemq-web-console/src/main/webapp/WEB-INF/webconsole-jndi.xml 
(added)
+++ 
activemq/trunk/activemq-web-console/src/main/webapp/WEB-INF/webconsole-jndi.xml 
Thu May 24 07:14:49 2007
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+    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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+       xmlns:aop="http://www.springframework.org/schema/aop";
+       xsi:schemaLocation="http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+                           http://www.springframework.org/schema/aop 
http://www.springframework.org/schema/aop/spring-aop-2.0.xsd";>
+
+  <bean id="placeholderConfig" 
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" 
/>
+  
+  
+  <bean id="sessionPool" class="org.apache.activemq.web.SessionPool">
+       <property name="connectionFactory" ref="connectionFactory"/>
+  </bean>
+
+  <bean id="brokerQuery" class="org.apache.activemq.web.RemoteJMXBrokerFacade" 
autowire="constructor" destroy-method="shutdown">
+       <property name="jmxUrl" ref="jmxUrl"/>
+       <property name="brokerName"><null/></property>
+  </bean>
+  
+  <bean id="jmxUrl" class="org.springframework.jndi.JndiObjectFactoryBean">
+    <property name="jndiName" value="java:comp/env/jmx/url" />
+  </bean>
+  <bean id="connectionFactory" 
class="org.springframework.jndi.JndiObjectFactoryBean">
+    <property name="jndiName" value="java:comp/env/jms/connectionFactory" />
+  </bean>
+  
+
+  <bean id="queueBrowser" class="org.apache.activemq.web.QueueBrowseQuery" 
autowire="constructor" destroy-method="destroy" scope="request"/>
+  <bean id="messageQuery" class="org.apache.activemq.web.MessageQuery" 
autowire="constructor" destroy-method="destroy" scope="request"/>
+
+</beans>

Propchange: 
activemq/trunk/activemq-web-console/src/main/webapp/WEB-INF/webconsole-jndi.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 
activemq/trunk/activemq-web-console/src/main/webapp/WEB-INF/webconsole-properties.xml
URL: 
http://svn.apache.org/viewvc/activemq/trunk/activemq-web-console/src/main/webapp/WEB-INF/webconsole-properties.xml?view=auto&rev=541306
==============================================================================
--- 
activemq/trunk/activemq-web-console/src/main/webapp/WEB-INF/webconsole-properties.xml
 (added)
+++ 
activemq/trunk/activemq-web-console/src/main/webapp/WEB-INF/webconsole-properties.xml
 Thu May 24 07:14:49 2007
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+    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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+       xmlns:aop="http://www.springframework.org/schema/aop";
+       xsi:schemaLocation="http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+                           http://www.springframework.org/schema/aop 
http://www.springframework.org/schema/aop/spring-aop-2.0.xsd";>
+
+  <bean id="placeholderConfig" 
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" 
/>
+  
+  
+  <bean id="sessionPool" class="org.apache.activemq.web.SessionPool">
+       <property name="connectionFactory" ref="connectionFactory"/>
+  </bean>
+
+  <bean id="brokerQuery" class="org.apache.activemq.web.RemoteJMXBrokerFacade" 
autowire="constructor" destroy-method="shutdown">
+       <property name="jmxUrl" value="${webconsole.jmx.url}"/>
+       <property name="brokerName"><null/></property>
+  </bean>
+  
+  <bean id="connectionFactory" 
class="org.apache.activemq.ActiveMQConnectionFactory">
+    <property name="brokerURL" value="${webconsole.jms.url}"/>
+  </bean>  
+  
+
+  <bean id="queueBrowser" class="org.apache.activemq.web.QueueBrowseQuery" 
autowire="constructor" destroy-method="destroy" scope="request"/>
+  <bean id="messageQuery" class="org.apache.activemq.web.MessageQuery" 
autowire="constructor" destroy-method="destroy" scope="request"/>
+
+</beans>

Propchange: 
activemq/trunk/activemq-web-console/src/main/webapp/WEB-INF/webconsole-properties.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: 
activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/QueueBrowseServlet.java
URL: 
http://svn.apache.org/viewvc/activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/QueueBrowseServlet.java?view=diff&rev=541306&r1=541305&r2=541306
==============================================================================
--- 
activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/QueueBrowseServlet.java
 (original)
+++ 
activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/QueueBrowseServlet.java
 Thu May 24 07:14:49 2007
@@ -16,10 +16,11 @@
  */
 package org.apache.activemq.web;
 
-import org.apache.activemq.ActiveMQConnectionFactory;
-import org.apache.activemq.util.FactoryFinder;
-import org.apache.activemq.util.IntrospectionSupport;
-import org.apache.activemq.web.view.MessageRenderer;
+import java.io.IOException;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.Map;
 
 import javax.jms.Connection;
 import javax.jms.ConnectionFactory;
@@ -32,11 +33,9 @@
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
-import java.io.IOException;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.Map;
+import org.apache.activemq.util.FactoryFinder;
+import org.apache.activemq.util.IntrospectionSupport;
+import org.apache.activemq.web.view.MessageRenderer;
 
 /**
  * Renders the contents of a queue using some kind of view. The URI is assumed
@@ -49,6 +48,8 @@
  * 
  * @version $Revision: $
  */
+//TODO Why do we implement our own session pool?
+//TODO This doesn't work, since nobody will be setting the connection factory 
(because nobody is able to). Just use the WebClient?
 public class QueueBrowseServlet extends HttpServlet {
 
     private static FactoryFinder factoryFinder = new 
FactoryFinder("META-INF/services/org/apache/activemq/web/view/");
@@ -71,8 +72,7 @@
 
     public ConnectionFactory getConnectionFactory() {
         if (connectionFactory == null) {
-            // TODO support remote brokers too
-            connectionFactory = new 
ActiveMQConnectionFactory("vm://localhost");
+               throw new IllegalStateException("missing ConnectionFactory in 
QueueBrowserServlet");
         }
         return connectionFactory;
     }

Modified: 
activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/WebClient.java
URL: 
http://svn.apache.org/viewvc/activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/WebClient.java?view=diff&rev=541306&r1=541305&r2=541306
==============================================================================
--- 
activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/WebClient.java
 (original)
+++ 
activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/WebClient.java
 Thu May 24 07:14:49 2007
@@ -28,6 +28,7 @@
 import java.util.List;
 import java.util.Map;
 
+import javax.jms.Connection;
 import javax.jms.ConnectionFactory;
 import javax.jms.DeliveryMode;
 import javax.jms.Destination;
@@ -44,9 +45,7 @@
 import javax.servlet.http.HttpSessionBindingListener;
 import javax.servlet.http.HttpSessionEvent;
 
-import org.apache.activemq.ActiveMQConnection;
 import org.apache.activemq.ActiveMQConnectionFactory;
-import org.apache.activemq.ActiveMQSession;
 import org.apache.activemq.MessageAvailableConsumer;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -75,8 +74,8 @@
     private static transient ConnectionFactory factory;
 
     private transient Map consumers = new HashMap();
-    private transient ActiveMQConnection connection;
-    private transient ActiveMQSession session;
+    private transient Connection connection;
+    private transient Session session;
     private transient MessageProducer producer;
     private int deliveryMode = DeliveryMode.NON_PERSISTENT;
 
@@ -221,15 +220,15 @@
         return session;
     }
 
-    public ActiveMQConnection getConnection() throws JMSException {
+    public Connection getConnection() throws JMSException {
         if (connection == null) {
-            connection = (ActiveMQConnection) factory.createConnection();
+            connection = factory.createConnection();
             connection.start();
         }
         return connection;
     }
 
-    public static synchronized void initConnectionFactory(ServletContext 
servletContext) {
+    protected static synchronized void initConnectionFactory(ServletContext 
servletContext) {
         if (factory == null)
             factory = (ConnectionFactory) 
servletContext.getAttribute(connectionFactoryAttribute);
         if (factory == null) {
@@ -239,7 +238,7 @@
             log.debug("Value of: " + brokerUrlInitParam + " is: " + brokerURL);
 
             if (brokerURL == null) {
-                brokerURL = "vm://localhost";
+               throw new IllegalStateException("missing brokerURL (specified 
via "+brokerUrlInitParam+" init-Param");
             }
 
             ActiveMQConnectionFactory amqfactory = new 
ActiveMQConnectionFactory(brokerURL);
@@ -302,8 +301,8 @@
         return new ArrayList(consumers.values());
     }
 
-    protected ActiveMQSession createSession() throws JMSException {
-        return (ActiveMQSession) getConnection().createSession(false, 
Session.AUTO_ACKNOWLEDGE);
+    protected Session createSession() throws JMSException {
+        return getConnection().createSession(false, Session.AUTO_ACKNOWLEDGE);
     }
 
     public Semaphore getSemaphore() {

Modified: activemq/trunk/assembly/pom.xml
URL: 
http://svn.apache.org/viewvc/activemq/trunk/assembly/pom.xml?view=diff&rev=541306&r1=541305&r2=541306
==============================================================================
--- activemq/trunk/assembly/pom.xml (original)
+++ activemq/trunk/assembly/pom.xml Thu May 24 07:14:49 2007
@@ -210,6 +210,10 @@
     <!-- enable commons-logging when inside jetty6:run -->
     <dependency>
       <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
       <artifactId>slf4j-jcl</artifactId>
     </dependency>
     <dependency>

Modified: activemq/trunk/assembly/src/main/descriptors/unix-bin.xml
URL: 
http://svn.apache.org/viewvc/activemq/trunk/assembly/src/main/descriptors/unix-bin.xml?view=diff&rev=541306&r1=541305&r2=541306
==============================================================================
--- activemq/trunk/assembly/src/main/descriptors/unix-bin.xml (original)
+++ activemq/trunk/assembly/src/main/descriptors/unix-bin.xml Thu May 24 
07:14:49 2007
@@ -105,7 +105,7 @@
       <outputDirectory>/webapps/admin</outputDirectory>
       <excludes>
         <exclude>**/activemq.xml</exclude>
-        <exclude>**/applicationContext.xml</exclude>
+        <exclude>**/webconsole-embedded.xml</exclude>
       </excludes>
     </fileSet>
     <fileSet>
@@ -122,7 +122,7 @@
       <outputDirectory>/webapps/demo</outputDirectory>
       <excludes>
         <exclude>**/activemq.xml</exclude>
-        <exclude>**/applicationContext.xml</exclude>
+        <exclude>**/webconsole-embedded.xml</exclude>
       </excludes>
     </fileSet>
 
@@ -188,6 +188,7 @@
         <include>org.mortbay.jetty:jetty-util</include>
         <include>org.mortbay.jetty:jetty-xbean</include>
         <include>org.mortbay.jetty:servlet-api-2.5</include>
+        <include>org.slf4j:slf4j-api</include>
         <include>org.slf4j:slf4j-jcl</include>
 
         <!-- JSP support -->

Modified: activemq/trunk/assembly/src/main/descriptors/windows-bin.xml
URL: 
http://svn.apache.org/viewvc/activemq/trunk/assembly/src/main/descriptors/windows-bin.xml?view=diff&rev=541306&r1=541305&r2=541306
==============================================================================
--- activemq/trunk/assembly/src/main/descriptors/windows-bin.xml (original)
+++ activemq/trunk/assembly/src/main/descriptors/windows-bin.xml Thu May 24 
07:14:49 2007
@@ -109,7 +109,7 @@
       <outputDirectory>/webapps/admin</outputDirectory>
       <excludes>
         <exclude>**/activemq.xml</exclude>
-        <exclude>**/applicationContext.xml</exclude>
+        <exclude>**/webconsole-embedded.xml</exclude>
       </excludes>
     </fileSet>
     <fileSet>
@@ -127,7 +127,7 @@
       <outputDirectory>/webapps/demo</outputDirectory>
       <excludes>
         <exclude>**/activemq.xml</exclude>
-        <exclude>**/applicationContext.xml</exclude>
+        <exclude>**/webconsole-embedded.xml</exclude>
       </excludes>
     </fileSet>
 
@@ -196,6 +196,7 @@
         <include>org.mortbay.jetty:jetty-util</include>
         <include>org.mortbay.jetty:jetty-xbean</include>
         <include>org.mortbay.jetty:servlet-api-2.5</include>
+        <include>org.slf4j:slf4j-api</include>
         <include>org.slf4j:slf4j-jcl</include>
 
         <!-- JSP support -->

Copied: 
activemq/trunk/assembly/src/release/webapps/admin/WEB-INF/webconsole-embedded.xml
 (from r541274, 
activemq/trunk/assembly/src/release/webapps/admin/WEB-INF/applicationContext.xml)
URL: 
http://svn.apache.org/viewvc/activemq/trunk/assembly/src/release/webapps/admin/WEB-INF/webconsole-embedded.xml?view=diff&rev=541306&p1=activemq/trunk/assembly/src/release/webapps/admin/WEB-INF/applicationContext.xml&r1=541274&p2=activemq/trunk/assembly/src/release/webapps/admin/WEB-INF/webconsole-embedded.xml&r2=541306
==============================================================================
--- 
activemq/trunk/assembly/src/release/webapps/admin/WEB-INF/applicationContext.xml
 (original)
+++ 
activemq/trunk/assembly/src/release/webapps/admin/WEB-INF/webconsole-embedded.xml
 Thu May 24 07:14:49 2007
@@ -20,11 +20,17 @@
 
   <bean id="placeholderConfig" 
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" 
/>
   
-  
-  <bean id="sessionPool" class="org.apache.activemq.web.SessionPool"/>
-  
   <!-- use the following bean for a local in-JVM broker -->
   <bean id="brokerQuery" class="org.apache.activemq.web.SingletonBrokerFacade" 
autowire='constructor' singleton="false"/>
+
+
+  <bean id="sessionPool" class="org.apache.activemq.web.SessionPool">
+       <property name="connectionFactory" ref="connectionFactory"/>
+  </bean>
+
+  <bean id="connectionFactory" 
class="org.apache.activemq.ActiveMQConnectionFactory">
+    <property name="brokerURL" value="vm://localhost"/>
+  </bean>
 
   <bean id="queueBrowser" class="org.apache.activemq.web.QueueBrowseQuery" 
autowire='constructor' singleton="false"/>
   <bean id="messageQuery" class="org.apache.activemq.web.MessageQuery" 
autowire='constructor' singleton="false"/>

Propchange: 
activemq/trunk/assembly/src/release/webapps/admin/WEB-INF/webconsole-embedded.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
activemq/trunk/assembly/src/release/webapps/admin/WEB-INF/webconsole-embedded.xml
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: 
activemq/trunk/assembly/src/release/webapps/admin/WEB-INF/webconsole-embedded.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: activemq/trunk/pom.xml
URL: 
http://svn.apache.org/viewvc/activemq/trunk/pom.xml?view=diff&rev=541306&r1=541305&r2=541306
==============================================================================
--- activemq/trunk/pom.xml (original)
+++ activemq/trunk/pom.xml Thu May 24 07:14:49 2007
@@ -64,6 +64,8 @@
     <p2psockets-version>1.1.2</p2psockets-version>
     <regexp-version>1.3</regexp-version>
     <rome-version>0.8</rome-version>
+    <slf4j-version>1.4.0</slf4j-version>
+    <!--<slf4j-version>1.0-rc5</slf4j-version>-->
     <stax-version>1.1.1-dev</stax-version>
     <xalan-version>2.6.0</xalan-version>
     <xmlbeans-version>2.0.0-beta1</xmlbeans-version>
@@ -796,8 +798,13 @@
 
       <dependency>
         <groupId>org.slf4j</groupId>
+        <artifactId>slf4j-api</artifactId>
+        <version>${slf4j-version}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.slf4j</groupId>
         <artifactId>slf4j-jcl</artifactId>
-        <version>1.0-rc5</version>
+        <version>${slf4j-version}</version>
       </dependency>
       <dependency>
         <groupId>opensymphony</groupId>


Reply via email to