You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by de...@apache.org on 2013/03/29 14:34:34 UTC

svn commit: r1462479 - in /activemq/trunk: ./ activemq-osgi/ activemq-web-demo/ activemq-web-demo/src/main/webapp/ activemq-web-demo/src/main/webapp/WEB-INF/ activemq-web-demo/src/main/webapp/sandbox/ activemq-web-demo/src/main/webapp/websocket/ active...

Author: dejanb
Date: Fri Mar 29 13:34:34 2013
New Revision: 1462479

URL: http://svn.apache.org/r1462479
Log:
https://issues.apache.org/jira/browse/AMQ-4418 - refactor web demo to be war that can be ran in karaf

Removed:
    activemq/trunk/activemq-web-demo/src/main/webapp/sandbox/index.html
    activemq/trunk/activemq-web-demo/src/main/webapp/sandbox/portfolio.html
    activemq/trunk/activemq-web-demo/src/main/webapp/sandbox/portfolio.js
    activemq/trunk/activemq-web-demo/src/main/webapp/sandbox/util.js
    activemq/trunk/activemq-web-demo/src/main/webapp/sandbox/webmq.js
Modified:
    activemq/trunk/activemq-osgi/pom.xml
    activemq/trunk/activemq-web-demo/pom.xml
    activemq/trunk/activemq-web-demo/src/main/webapp/WEB-INF/web.xml
    activemq/trunk/activemq-web-demo/src/main/webapp/chat.html
    activemq/trunk/activemq-web-demo/src/main/webapp/index.html
    activemq/trunk/activemq-web-demo/src/main/webapp/websocket/index.html
    activemq/trunk/activemq-web/src/main/java/org/apache/activemq/web/WebClient.java
    activemq/trunk/assembly/src/main/descriptors/common-bin.xml
    activemq/trunk/pom.xml

Modified: activemq/trunk/activemq-osgi/pom.xml
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-osgi/pom.xml?rev=1462479&r1=1462478&r2=1462479&view=diff
==============================================================================
--- activemq/trunk/activemq-osgi/pom.xml (original)
+++ activemq/trunk/activemq-osgi/pom.xml Fri Mar 29 13:34:34 2013
@@ -65,10 +65,12 @@
       javax.transaction*,
       org.apache.commons.pool*;resolution:=optional,
       org.apache.commons.net*;resolution:=optional,
-	  *
+      com.sun.syndication*;resolution:=optional,
+	    *
     </activemq.osgi.import.pkg>
     <activemq.osgi.export>
       org.apache.activemq*;version=${project.version};-noimport:=true;-split-package:=merge-first,
+      org.apache.activemq.web*;version=${project.version};-noimport:=true;-split-package:=merge-first,
     </activemq.osgi.export>
 	<activemq.osgi.private.pkg>
    	  org.fusesource*,
@@ -150,6 +152,11 @@
 
     <dependency>
       <groupId>${project.groupId}</groupId>
+      <artifactId>activemq-web</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>${project.groupId}</groupId>
       <artifactId>activemq-spring</artifactId>
     </dependency>
 

Modified: activemq/trunk/activemq-web-demo/pom.xml
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-web-demo/pom.xml?rev=1462479&r1=1462478&r2=1462479&view=diff
==============================================================================
--- activemq/trunk/activemq-web-demo/pom.xml (original)
+++ activemq/trunk/activemq-web-demo/pom.xml Fri Mar 29 13:34:34 2013
@@ -46,6 +46,96 @@
           <scanIntervalSeconds>10</scanIntervalSeconds>
         </configuration>
       </plugin>
+
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-war-plugin</artifactId>
+        <configuration>
+          <outputFileNameMapping>@{artifactId}@-@{baseVersion}@@{dashClassifier?}@.@{extension}@</outputFileNameMapping>
+          <packagingExcludes>
+            WEB-INF/lib/jetty*.jar,
+            WEB-INF/lib/servlet*.jar,
+            WEB-INF/lib/activemq*.jar
+          </packagingExcludes>
+          <webResources>
+            <resource>
+              <directory>${basedir}/../activemq-web-console/src/main/webapp/styles/</directory>
+              <targetPath>styles</targetPath>
+            </resource>
+            <resource>
+              <directory>${basedir}/../activemq-web-console/src/main/webapp/images/</directory>
+              <targetPath>images</targetPath>
+            </resource>
+            <resource>
+              <directory>${basedir}/../activemq-web-console/src/main/webapp/js/</directory>
+              <targetPath>js</targetPath>
+            </resource>
+          </webResources>
+          <archive>
+            <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
+          </archive>
+        </configuration>
+      </plugin>
+
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>bundle-manifest</id>
+            <phase>process-classes</phase>
+            <goals>
+              <goal>manifest</goal>
+            </goals>
+          </execution>
+        </executions>
+        <configuration>
+          <supportedProjectTypes>
+            <supportedProjectType>jar</supportedProjectType>
+            <supportedProjectType>bundle</supportedProjectType>
+            <supportedProjectType>war</supportedProjectType>
+          </supportedProjectTypes>
+          <instructions>
+            <Webapp-Context>activemqdemo</Webapp-Context>
+            <Web-ContextPath>activemqdemo</Web-ContextPath>
+            <Bundle-ClassPath>.,WEB-INF/classes</Bundle-ClassPath>
+            <Embed-Directory>WEB-INF/lib</Embed-Directory>
+            <Embed-Dependency>*;scope=compile|runtime</Embed-Dependency>
+            <Embed-Transitive>true</Embed-Transitive>
+            <Import-Package>
+              org.apache.activemq,
+              org.apache.activemq.web,
+              org.xml.sax,
+              org.xml.sax.helpers,
+              javax.xml.parsers,
+              javax.xml.transform,
+              javax.management.remote,
+              javax.naming,
+              org.w3c.dom,
+              javax.servlet,
+              javax.servlet.http,
+              javax.servlet.resources,
+              javax.servlet.jsp,
+              javax.servlet.jsp.tagext,
+              javax.servlet.jsp.el,
+              javax.management,
+              javax.management.openmbean,
+              javax.net,
+              org.osgi.framework,
+              org.osgi.service.cm,
+              org.apache.commons.logging;version="[1.1,2)";resolution:=optional,
+              org.slf4j;version="[1.6,2)";resolution:=optional,
+              org.slf4j.spi;version="[1.6,2)";resolution:=optional,
+              org.apache.log4j;version="[1.2.14,2)";resolution:=optional,
+              org.apache.log4j.spi;version="[1.2.14,2)";resolution:=optional
+            </Import-Package>
+            <Export-Package>
+              !*
+            </Export-Package>
+          </instructions>
+        </configuration>
+      </plugin>
+
     </plugins>
   </build>
 

Modified: activemq/trunk/activemq-web-demo/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-web-demo/src/main/webapp/WEB-INF/web.xml?rev=1462479&r1=1462478&r2=1462479&view=diff
==============================================================================
--- activemq/trunk/activemq-web-demo/src/main/webapp/WEB-INF/web.xml (original)
+++ activemq/trunk/activemq-web-demo/src/main/webapp/WEB-INF/web.xml Fri Mar 29 13:34:34 2013
@@ -25,11 +25,6 @@
 
     <!-- context config -->
     <context-param>
-        <param-name>org.apache.activemq.brokerURL</param-name>
-        <param-value>vm://amq-broker</param-value>
-        <description>The URL of the Message Broker to connect to</description>
-    </context-param>
-    <context-param>
         <param-name>org.apache.activemq.embeddedBroker</param-name>
         <param-value>true</param-value>
         <description>Whether we should include an embedded broker or not</description>
@@ -106,4 +101,9 @@
         <url-pattern>/portfolioPublish</url-pattern>
     </servlet-mapping>
 
+    <welcome-file-list>
+      <welcome-file>index.html</welcome-file>
+      <welcome-file>index.jsp</welcome-file>
+    </welcome-file-list>
+
 </web-app>

Modified: activemq/trunk/activemq-web-demo/src/main/webapp/chat.html
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-web-demo/src/main/webapp/chat.html?rev=1462479&r1=1462478&r2=1462479&view=diff
==============================================================================
--- activemq/trunk/activemq-web-demo/src/main/webapp/chat.html (original)
+++ activemq/trunk/activemq-web-demo/src/main/webapp/chat.html Fri Mar 29 13:34:34 2013
@@ -22,10 +22,10 @@
     <title>Chat Example - ActiveMQ Web Demos</title>
     <link rel="stylesheet" href="chat.css" type="text/css">
     <style type="text/css" media="screen">
-        @import url(/admin/styles/sorttable.css);
-        @import url(/admin/styles/type-settings.css);
-        @import url(/admin/styles/site.css);
-        @import url(/admin/styles/prettify.css);
+        @import url(styles/sorttable.css);
+        @import url(styles/type-settings.css);
+        @import url(styles/site.css);
+        @import url(styles/prettify.css);
     </style>
 
     <!--<script type="text/javascript" src="js/prototype.js"></script>-->

Modified: activemq/trunk/activemq-web-demo/src/main/webapp/index.html
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-web-demo/src/main/webapp/index.html?rev=1462479&r1=1462478&r2=1462479&view=diff
==============================================================================
--- activemq/trunk/activemq-web-demo/src/main/webapp/index.html (original)
+++ activemq/trunk/activemq-web-demo/src/main/webapp/index.html Fri Mar 29 13:34:34 2013
@@ -21,16 +21,16 @@
     <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
     <title>ActiveMQ Web Demos</title>
     <style type="text/css" media="screen">
-        @import url(/admin/styles/sorttable.css);
-        @import url(/admin/styles/type-settings.css);
-        @import url(/admin/styles/site.css);
-        @import url(/admin/styles/prettify.css);
+        @import url(styles/sorttable.css);
+        @import url(styles/type-settings.css);
+        @import url(styles/site.css);
+        @import url(styles/prettify.css);
     </style>
 
-        <script type='text/javascript' src='/js/common.js'></script>
-        <script type='text/javascript' src='/js/css.js'></script>
-        <script type='text/javascript' src='/js/standardista-table-sorting.js'></script>
-        <script type='text/javascript' src='/js/prettify.js'></script>
+        <script type='text/javascript' src='js/common.js'></script>
+        <script type='text/javascript' src='js/css.js'></script>
+        <script type='text/javascript' src='js/standardista-table-sorting.js'></script>
+        <script type='text/javascript' src='js/prettify.js'></script>
         <script>addEvent(window, 'load', prettyPrint)</script>
 
 

Modified: activemq/trunk/activemq-web-demo/src/main/webapp/websocket/index.html
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-web-demo/src/main/webapp/websocket/index.html?rev=1462479&r1=1462478&r2=1462479&view=diff
==============================================================================
--- activemq/trunk/activemq-web-demo/src/main/webapp/websocket/index.html (original)
+++ activemq/trunk/activemq-web-demo/src/main/webapp/websocket/index.html Fri Mar 29 13:34:34 2013
@@ -21,10 +21,10 @@
     <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
     <link rel="stylesheet" href="chat.css" type="text/css">
     <style type="text/css" media="screen">
-        @import url(/admin/styles/sorttable.css);
-        @import url(/admin/styles/type-settings.css);
-        @import url(/admin/styles/site.css);
-        @import url(/admin/styles/prettify.css);
+        @import url(../styles/sorttable.css);
+        @import url(../styles/type-settings.css);
+        @import url(../styles/site.css);
+        @import url(../styles/prettify.css);
     </style>
     <title>Chat Example Using Stomp Over WebSocket</title>
     <link rel="stylesheet" type="text/css" href="chat.css"></link>

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?rev=1462479&r1=1462478&r2=1462479&view=diff
==============================================================================
--- 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 Fri Mar 29 13:34:34 2013
@@ -47,6 +47,8 @@ import javax.servlet.http.HttpSessionEve
 
 import org.apache.activemq.ActiveMQConnectionFactory;
 import org.apache.activemq.MessageAvailableConsumer;
+import org.apache.activemq.broker.BrokerRegistry;
+import org.apache.activemq.broker.BrokerService;
 import org.apache.activemq.camel.component.ActiveMQComponent;
 import org.apache.activemq.camel.component.ActiveMQConfiguration;
 import org.apache.activemq.pool.PooledConnectionFactory;
@@ -280,12 +282,19 @@ public class WebClient implements HttpSe
         if (factory == null) {
             String brokerURL = servletContext.getInitParameter(BROKER_URL_INIT_PARAM);
 
-            LOG.debug("Value of: " + BROKER_URL_INIT_PARAM + " is: " + brokerURL);
 
             if (brokerURL == null) {
-                throw new IllegalStateException("missing brokerURL (specified via " + BROKER_URL_INIT_PARAM + " init-Param");
+                LOG.debug("Couldn't find " + BROKER_URL_INIT_PARAM + " param, trying to find a broker embedded in a local VM");
+                BrokerService broker = BrokerRegistry.getInstance().findFirst();
+                if (broker == null) {
+                    throw new IllegalStateException("missing brokerURL (specified via " + BROKER_URL_INIT_PARAM + " init-Param) or embedded broker");
+                } else {
+                    brokerURL = "vm://" + broker.getBrokerName();
+                }
             }
 
+            LOG.debug("Using broker URL: " + brokerURL);
+
             ActiveMQConnectionFactory amqfactory = new ActiveMQConnectionFactory(brokerURL);
 
             // Set prefetch policy for factory

Modified: activemq/trunk/assembly/src/main/descriptors/common-bin.xml
URL: http://svn.apache.org/viewvc/activemq/trunk/assembly/src/main/descriptors/common-bin.xml?rev=1462479&r1=1462478&r2=1462479&view=diff
==============================================================================
--- activemq/trunk/assembly/src/main/descriptors/common-bin.xml (original)
+++ activemq/trunk/assembly/src/main/descriptors/common-bin.xml Fri Mar 29 13:34:34 2013
@@ -67,6 +67,18 @@
         <exclude>**/webconsole-embedded.xml</exclude>
       </excludes>
     </fileSet>
+    <fileSet>
+      <directory>../activemq-web-console/src/main/webapp/styles/</directory>
+      <outputDirectory>/webapps-demo/demo/styles/</outputDirectory>
+    </fileSet>
+    <fileSet>
+      <directory>../activemq-web-console/src/main/webapp/images/</directory>
+      <outputDirectory>/webapps-demo/demo/images/</outputDirectory>
+    </fileSet>
+    <fileSet>
+      <directory>../activemq-web-console/src/main/webapp/js/</directory>
+      <outputDirectory>/webapps-demo/demo/js/</outputDirectory>
+    </fileSet>
 
     <!-- the file server -->
     <fileSet>

Modified: activemq/trunk/pom.xml
URL: http://svn.apache.org/viewvc/activemq/trunk/pom.xml?rev=1462479&r1=1462478&r2=1462479&view=diff
==============================================================================
--- activemq/trunk/pom.xml (original)
+++ activemq/trunk/pom.xml Fri Mar 29 13:34:34 2013
@@ -234,10 +234,10 @@
     <module>activemq-rar</module>
     <module>activemq-run</module>
     <module>activemq-spring</module>
-    <module>activemq-osgi</module>
-    <module>activemq-blueprint</module>
     <module>activemq-tooling</module>
     <module>activemq-web</module>
+    <module>activemq-osgi</module>
+    <module>activemq-blueprint</module>
     <module>activemq-web-demo</module>
     <module>activemq-web-console</module>
     <module>activemq-karaf-itest</module>