[activemq] Make this thing actually work

Sam Kottler skottler at fedoraproject.org
Thu Oct 10 21:29:25 UTC 2013


commit b4d21cb57c93d690e4cc01ead0a92ac5babebc49
Author: Sam Kottler <shk at redhat.com>
Date:   Thu Oct 10 17:29:01 2013 -0400

    Make this thing actually work

 .gitignore             |    3 +
 activemq.spec          |  326 ++++++++++++++++++++----------------------------
 activemq.xml           |  169 +++++++++++++++++++++++++
 jetty-realm.properties |   20 +++
 jetty.xml              |  117 +++++++++++++++++
 5 files changed, 444 insertions(+), 191 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 9f46977..7ab3ca4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,4 @@
 /activemq-5.6.0.tar.xz
+/apache-activemq-5.5.0-bin.tar.gz
+/wlcg-patch.tgz
+/apache-activemq-5.6.0-bin.tar.gz
diff --git a/activemq.spec b/activemq.spec
index 846d39e..f992512 100644
--- a/activemq.spec
+++ b/activemq.spec
@@ -1,210 +1,154 @@
-Name:          activemq
-Version:       5.6.0
-Release:       6%{?dist}
-Summary:       Open source messaging and Integration Patterns server
-Group:         Development/Libraries
-License:       ASL 2.0
-URL:           http://activemq.apache.org
-# git clone -b activemq-5.6.0 https://github.com/apache/activemq.git activemq-core-5.6.0
-# rm -rf activemq-core-5.6.0/.git
-# tar cJf activemq-core-5.6.0.tar.xz activemq-core-5.6.0
-Source0:       activemq-5.6.0.tar.xz
-
-BuildRequires: activeio
-BuildRequires: activemq-protobuf
-BuildRequires: derby
-BuildRequires: geronimo-jta
-BuildRequires: jasypt
-BuildRequires: javacc-maven-plugin
-BuildRequires: java-devel
-BuildRequires: jettison
-BuildRequires: jpackage-utils
-BuildRequires: maven-clean-plugin
-BuildRequires: maven-compiler-plugin
-BuildRequires: maven-enforcer-plugin
-BuildRequires: maven-gpg-plugin
-BuildRequires: maven-idea-plugin
-BuildRequires: maven-javadoc-plugin
-BuildRequires: maven-plugin-cobertura
-BuildRequires: maven-pmd-plugin
-BuildRequires: maven-release-plugin
-BuildRequires: maven-source-plugin
-BuildRequires: maven-surefire-plugin
-BuildRequires: maven-surefire-provider-junit4
-BuildRequires: maven-xbean-plugin
-BuildRequires: springframework-jms
-
-# Required for /usr/share/java/activemq directory
-Requires: activemq-protobuf
-
-Requires: java
-Requires: jpackage-utils
-
+Summary: Apache ActiveMQ
+Name: activemq
+Version: 5.6.0
+Release: 6%{?dist}
+License: Apache
+Group: Network/Daemons
+Source0: http://mirrors.sonic.net/apache/activemq/apache-activemq/%{version}/apache-activemq-%{version}-bin.tar.gz
+Source1: wlcg-patch.tgz
+Source2: activemq.xml
+Source3: jetty-realm.properties
+Source4: jetty.xml
+BuildRoot: %{_tmppath}/%{name}-%{version}-root
 BuildArch: noarch
+Requires: tanukiwrapper >= 3.2.0
 
+#%define buildver 5.1.0
 
-%description
-The most popular and powerful open source messaging and Integration Patterns
-server.
-
-%package javadoc
-Group: Documentation
-Summary: Javadoc for %{name}
-Requires: jpackage-utils
-
-%description javadoc
-This package contains javadoc for %{name}
-
-%package core
-Group: Development/Libraries
-Summary: ActiveMQ Core
-Requires: %{name}        = %{version}-%{release}
-Requires: %{name}-jaas   = %{version}-%{release}
-Requires: %{name}-kahadb = %{version}-%{release}
-Requires: jpackage-utils
-Requires: java
-Requires: activemq-protobuf
-Requires: activeio
-Requires: jettison
-Requires: springframework-jms
-Requires: geronimo-jta
-Requires: derby
-Requires: jasypt
-
-%description core
-ActiveMQ Core Library
-
-%package jaas
-Group: Development/Libraries
-Summary: ActiveMQ Jaas
-Requires: %{name} = %{version}-%{release}
-Requires: jpackage-utils
-Requires: java
-
-%description jaas
-ActiveMQ Jaas Library
-
-%package kahadb
-Group: Development/Libraries
-Summary: ActiveMQ KahaDB
-Requires: %{name} = %{version}-%{release}
-Requires: jpackage-utils
-Requires: java
-Requires: activemq-protobuf
-Requires: activeio
-
-%description kahadb
-A file based persistence database that is local to the message broker that
-is using it. It has been optimized for fast persistence and is the the default
-storage mechanism from ActiveMQ 5.4 onwards. KahaDB uses less file descriptors
-and provides faster recovery than its predecessor, the AMQ Message Store.
-
-%prep
-
-%setup -q -n %{name}-%{version}
-
-# Disable modules
-for m in all camel console fileserver blueprint karaf \
-    openwire-generator optional pool ra rar run spring \
-    tooling web web-demo web-console xmpp jmdns_1.0
-do
-    %pom_disable_module %{name}-${m}
-done
-
-%pom_disable_module assembly
-
-# Remove missing plugin for activemq-core
-%pom_remove_dep xsddoc:maven-xsddoc-plugin %{name}-core/pom.xml
-
-# Remove missing plugin
-%pom_remove_plugin org.codehaus.mojo:ianal-maven-plugin
+%define homedir /usr/share/%{name}
+%define libdir /var/lib/%{name}
+%define libexecdir /usr/libexec/%{name}
+%define cachedir /var/cache/%{name}
+%define docsdir /usr/share/doc/%{name}-%{version}
 
-# Remove missing test dependencies
-%pom_remove_dep org.springframework:spring-test
-
-# Remove missing optional dependencies
-%pom_remove_dep org.apache.geronimo.specs:geronimo-j2ee-management_1.1_spec
-
-# Remove xstream support (fedora version is out of date)
-rm -rf %{name}-core/src/main/java/org/apache/activemq/transport/stomp
-rm -rf %{name}-core/src/main/java/org/apache/activemq/util/XStreamFactoryBean.java
-%pom_remove_dep com.thoughtworks.xstream:xstream %{name}-core/pom.xml
-
-# Remove jmdns support
-rm -rf %{name}-core/src/main/java/org/apache/activemq/transport/discovery/zeroconf
-%pom_remove_dep org.apache.activemq:activemq-jmdns_1.0 %{name}-core/pom.xml
-
-# Remove leveldb support
-rm -rf %{name}-core/src/main/java/org/apache/activemq/store/leveldb
-%pom_remove_dep org.fusesource.fuse-extra:fusemq-leveldb %{name}-core/pom.xml
-
-# Remove mqtt support
-rm -rf %{name}-core/src/main/java/org/apache/activemq/transport/mqtt
-%pom_remove_dep org.fusesource.mqtt-client:mqtt-client %{name}-core/pom.xml
+%description
+ApacheMQ is a JMS Compliant Messaging System
 
-# Remove other optional dependencies
-%pom_remove_dep org.apache.activemq:activemq-openwire-generator %{name}-core/pom.xml
-%pom_remove_dep org.apache.geronimo.specs:geronimo-j2ee-management_1.1_spec %{name}-core/pom.xml
-%pom_remove_dep org.apache.geronimo.specs:geronimo-jta_1.0.1B_spec %{name}-core/pom.xml
-%pom_remove_dep org.apache.geronimo.specs:geronimo-jacc_1.1_spec %{name}-core/pom.xml
-%pom_remove_dep org.apache.geronimo.specs:geronimo-annotation_1.0_spec %{name}-core/pom.xml
+%package info-provider
+Summary: An LDAP information provider for activemq
+Group:grid/lcg
+%description info-provider
+An LDAP infomation provider for activemq
 
-chmod 644 LICENSE README.txt
+%package meta
+Summary: A metapackage
+Group:grid/lcg
+Requires: activemq = %{version}-%{release}, activemq-info-provider = %{version}-%{release}
+%description meta
+A metapackage
 
-# Fix license file encoding
-mv LICENSE LICENSE.orig
-iconv -f iso-8859-1 -t utf-8 LICENSE.orig > LICENSE
+%prep
+%setup -q -a1 -n apache-activemq-%{version}
 
 %build
-mvn-rpmbuild -Dmaven.test.skip=true \
-    -Dproject.build.sourceEncoding=UTF-8 \
-    install javadoc:aggregate
+install --directory ${RPM_BUILD_ROOT}
 
 %install
+rm -rf $RPM_BUILD_ROOT
+install --directory ${RPM_BUILD_ROOT}%{homedir}
+install --directory ${RPM_BUILD_ROOT}%{homedir}/bin
+install --directory ${RPM_BUILD_ROOT}%{docsdir}
+install --directory ${RPM_BUILD_ROOT}%{libdir}/lib
+install --directory ${RPM_BUILD_ROOT}%{libexecdir}
+install --directory ${RPM_BUILD_ROOT}%{libdir}/webapps
+install --directory ${RPM_BUILD_ROOT}%{cachedir}
+install --directory ${RPM_BUILD_ROOT}%{cachedir}/data
+install --directory ${RPM_BUILD_ROOT}/var/log/%{name}
+install --directory ${RPM_BUILD_ROOT}/var/run/%{name}
+install --directory ${RPM_BUILD_ROOT}/etc/%{name}
+install --directory ${RPM_BUILD_ROOT}/etc/init.d
+install --directory ${RPM_BUILD_ROOT}/etc/httpd/conf.d
+
+# Config files
+install %{SOURCE2} ${RPM_BUILD_ROOT}/etc/%{name}
+install conf/credentials.properties ${RPM_BUILD_ROOT}/etc/%{name}
+install conf/jetty.xml  ${RPM_BUILD_ROOT}/etc/%{name}
+install %{SOURCE3} ${RPM_BUILD_ROOT}/etc/%{name}
+install %{SOURCE4} ${RPM_BUILD_ROOT}/etc/%{name}
+install conf/log4j.properties ${RPM_BUILD_ROOT}/etc/%{name}
+install conf/activemq-wrapper.conf ${RPM_BUILD_ROOT}/etc/%{name}
+install conf/activemq-httpd.conf ${RPM_BUILD_ROOT}/etc/httpd/conf.d
+
+# startup script
+install bin/activemq ${RPM_BUILD_ROOT}/etc/init.d
+
+# Bin and doc dirs
+install *.txt *.html ${RPM_BUILD_ROOT}%{docsdir}
+cp -r docs ${RPM_BUILD_ROOT}%{docsdir}
+
+install bin/run.jar bin/activemq-admin ${RPM_BUILD_ROOT}%{homedir}/bin
+install --directory ${RPM_BUILD_ROOT}/usr/bin
+%{__ln_s} -f %{homedir}/bin/activemq-admin ${RPM_BUILD_ROOT}/usr/bin
+
+# Runtime directory
+cp -r lib ${RPM_BUILD_ROOT}%{libdir}
+cp -r webapps/admin ${RPM_BUILD_ROOT}%{libdir}/webapps
+
+# Info provider
+install info-provider-activemq ${RPM_BUILD_ROOT}/%{libexecdir}
+
+pushd ${RPM_BUILD_ROOT}%{homedir}
+    [ -d conf ] || %{__ln_s} -f /etc/%{name} conf
+    [ -d data ] || %{__ln_s} -f %{cachedir}/data data
+    [ -d docs ] || %{__ln_s} -f %{docsdir} docs
+    [ -d lib ] || %{__ln_s} -f %{libdir}/lib lib
+    [ -d lib ] || %{__ln_s} -f %{libdir}/libexec libexec
+    [ -d log ] || %{__ln_s} -f /var/log/%{name} log 
+    [ -d webapps ] || %{__ln_s} -f %{libdir}/webapps webapps
+popd
+
+#pushd $RPM_BUILD_ROOT/%{_sysconfdir}/%{name}
+#  for file in $(ls -1)
+#  do
+#    sed -i 's,${activemq.base},/usr/share/activemq/,g' $file
+#  done
+#popd
+
+
+%pre
+# Add the "activemq" user and group
+# we need a shell to be able to use su - later
+/usr/sbin/groupadd -g 92 -r activemq 2> /dev/null || :
+/usr/sbin/useradd -c "Apache Activemq" -u 92 -g activemq \
+    -s /bin/bash -r -d /usr/share/activemq activemq 2> /dev/null || :
+
+%post
+# install activemq (but don't activate)
+/sbin/chkconfig --add activemq
+
+%preun
+if [ $1 = 0 ]; then
+    [ -f /var/lock/subsys/activemq ] && /etc/init.d/activemq stop
+    [ -f /etc/init.d/activemq ] && /sbin/chkconfig --del activemq
+fi
+
+%postun
+
+%clean
+rm -rf $RPM_BUILD_ROOT
 
-install -d -m 755 %{buildroot}%{_javadir}/%{name}
-install -d -m 755 %{buildroot}%{_mavenpomdir}
-
-for m in %{name}-core %{name}-jaas kahadb; do
-    install -pm 644 ${m}/target/${m}-%{version}.jar %{buildroot}%{_javadir}/%{name}/${m}.jar
-    install -pm 644 ${m}/pom.xml %{buildroot}%{_mavenpomdir}/JPP.%{name}-${m}.pom
-    %add_maven_depmap JPP.%{name}-${m}.pom %{name}/${m}.jar
-done
-
-# Parent POM
-install -pm 644 pom.xml %{buildroot}%{_mavenpomdir}/JPP-%{name}.pom
-%add_maven_depmap JPP-%{name}.pom
-mkdir -p %{buildroot}%{_javadocdir}/%{name}
-cp -rp target/site/apidocs/* %{buildroot}%{_javadocdir}/%{name}
 
 %files
-%doc LICENSE NOTICE README.txt
-# Not owning /usr/share/java/activemq since it is owned by activemq-protobuf
-%{_mavenpomdir}/JPP-%{name}.pom
-%{_mavendepmapfragdir}/%{name}
-
-%files javadoc
-%doc LICENSE NOTICE
-%{_javadocdir}/%{name}
-
-%files core
-%doc LICENSE NOTICE
-%{_javadir}/%{name}/%{name}-core.jar
-%{_mavenpomdir}/JPP.%{name}-%{name}-core.pom
-
-%files jaas
-%doc LICENSE NOTICE
-%{_javadir}/%{name}/%{name}-jaas.jar
-%{_mavenpomdir}/JPP.%{name}-%{name}-jaas.pom
-
-%files kahadb
-%doc LICENSE NOTICE
-%{_javadir}/%{name}/kahadb.jar
-%{_mavenpomdir}/JPP.%{name}-kahadb.pom
+%defattr(-,root,root)
+%attr(755,root,root) /usr/bin/activemq-admin
+%{homedir}
+%docdir %{docsdir}
+%{docsdir}
+%{libdir}
+%attr(775,activemq,activemq) %dir /var/log/%{name}
+%attr(775,activemq,activemq) %dir /var/run/%{name}
+%attr(775,root,activemq) %dir %{cachedir}/data
+%attr(755,root,root) /etc/init.d/activemq
+%config(noreplace) /etc/httpd/conf.d/activemq-httpd.conf
+%config(noreplace) /etc/%{name}/*
+
+%files info-provider
+%defattr(-,root,root)
+%attr(755,root,root) %{libexecdir}/info-provider-activemq
 
 %changelog
-* Sat Aug 03 2013 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 5.6.0-6
-- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
+* Thu Oct 10 2013 Sam Kottler <skottler at fedoraproject.org> - 5.6.0-6
+- Fix the spec so that the service works
 
 * Sun Mar 03 2013 Matt Spaulding <mspaulding06 at gmail.com> - 5.6.0-5
 - Removed optional geronimo-annotation dependency from activemq-core
diff --git a/activemq.xml b/activemq.xml
new file mode 100644
index 0000000..39562ae
--- /dev/null
+++ b/activemq.xml
@@ -0,0 +1,169 @@
+<!--
+    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:amq="http://activemq.apache.org/schema/core"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+    http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd 
+    http://activemq.apache.org/camel/schema/spring http://activemq.apache.org/camel/schema/spring/camel-spring.xsd">
+
+    <!-- Allows us to use system properties as variables in this configuration file -->
+    <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
+        <property name="locations">
+            <value>file:${activemq.base}/conf/credentials.properties</value>
+        </property>      
+    </bean>
+
+    <!-- 
+        The <broker> element is used to configure the ActiveMQ broker. 
+    -->
+    <broker xmlns="http://activemq.apache.org/schema/core" brokerName="localhost" dataDirectory="${activemq.base}/data" destroyApplicationContextOnStop="true">
+ 
+        <!--
+          For better performances use VM cursor and small memory limit.
+          For more information, see:
+            
+          http://activemq.apache.org/message-cursors.html
+            
+          Also, if your producer is "hanging", it's probably due to producer 
+          flow control.
+
+          For more information, see:
+          http://activemq.apache.org/producer-flow-control.html
+        -->
+              
+        <destinationPolicy>
+            <policyMap>
+              <policyEntries>
+                <policyEntry topic=">" producerFlowControl="true" memoryLimit="1mb">
+                  <pendingSubscriberPolicy>
+                    <vmCursor />
+                  </pendingSubscriberPolicy>
+                </policyEntry>
+                <policyEntry queue=">" producerFlowControl="true" memoryLimit="1mb">
+                  <!-- 
+                    Use VM cursor for better latency
+                    For more information, see:
+                       
+                    http://activemq.apache.org/message-cursors.html
+                       
+                  <pendingQueuePolicy>
+                    <vmQueueCursor/>
+                  </pendingQueuePolicy>
+                  -->
+                </policyEntry>
+              </policyEntries>
+            </policyMap>
+        </destinationPolicy> 
+
+        <!-- 
+          The managementContext is used to configure how ActiveMQ is exposed in 
+          JMX. By default, ActiveMQ uses the MBean server that is started by 
+          the JVM. For more information, see: 
+            
+          http://activemq.apache.org/jmx.html 
+        -->
+        <managementContext>
+            <managementContext createConnector="false"/>
+        </managementContext>
+
+        <!-- 
+          Configure message persistence for the broker. The default persistence
+          mechanism is the KahaDB store (identified by the kahaDB tag). 
+          For more information, see: 
+            
+          http://activemq.apache.org/persistence.html 
+        -->
+        <persistenceAdapter>
+            <kahaDB directory="${activemq.base}/data/kahadb"/>
+        </persistenceAdapter>
+        
+        <plugins>
+          <!--
+            Enable the statisticsBrokerPlugin to allow ActiveMQ to collect
+            statistics.
+          -->
+          <statisticsBrokerPlugin/>
+
+          <!--
+            Here we define a default set of users
+          -->
+          <simpleAuthenticationPlugin>
+            <users>
+              <authenticationUser username="${activemq.username}" password="${activemq.password}" groups="admins,everyone"/>
+              <authenticationUser username="mcollective" password="secret" groups="mcollective,admins,everyone"/>
+            </users>
+          </simpleAuthenticationPlugin>
+          <authorizationPlugin>
+            <map>
+              <authorizationMap>
+                <authorizationEntries>
+                  <authorizationEntry queue=">" write="admins" read="admins" admin="admins" />
+                  <authorizationEntry topic=">" write="admins" read="admins" admin="admins" />
+                  <authorizationEntry topic="mcollective.>" write="mcollective" read="mcollective" admin="mcollective" />
+                  <authorizationEntry topic="mcollective.>" write="mcollective" read="mcollective" admin="mcollective" />
+                  <authorizationEntry topic="ActiveMQ.Advisory.>" read="everyone" write="everyone" admin="everyone"/>
+                </authorizationEntries>
+              </authorizationMap>
+            </map>
+          </authorizationPlugin>
+        </plugins>
+
+        
+        <!--
+          The systemUsage controls the maximum amount of space the broker will 
+          use before slowing down producers. For more information, see:
+          
+          http://activemq.apache.org/producer-flow-control.html
+        -->
+        <systemUsage>
+            <systemUsage>
+                <memoryUsage>
+                    <memoryUsage limit="20 mb"/>
+                </memoryUsage>
+                <storeUsage>
+                    <storeUsage limit="1 gb"/>
+                </storeUsage>
+                <tempUsage>
+                    <tempUsage limit="100 mb"/>
+                </tempUsage>
+            </systemUsage>
+        </systemUsage>
+		  
+        <!-- 
+          The transport connectors expose ActiveMQ over a given protocol to
+          clients and other brokers. For more information, see: 
+            
+          http://activemq.apache.org/configuring-transports.html 
+        -->
+        <transportConnectors>
+            <transportConnector name="openwire" uri="tcp://0.0.0.0:61616"/>
+            <transportConnector name="stomp+nio" uri="stomp+nio://0.0.0.0:61613"/>
+        </transportConnectors>
+
+    </broker>
+
+    <!-- 
+      Enable web consoles, REST and Ajax APIs and demos
+      It also includes Camel (with its web console), see ${ACTIVEMQ_HOME}/conf/camel.xml for more info
+        
+      Take a look at ${ACTIVEMQ_HOME}/conf/jetty.xml for more details 
+    -->
+    <import resource="jetty.xml"/>
+    
+</beans>
diff --git a/jetty-realm.properties b/jetty-realm.properties
new file mode 100644
index 0000000..2cef758
--- /dev/null
+++ b/jetty-realm.properties
@@ -0,0 +1,20 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+
+# Defines users that can access the web (console, demo, etc.)
+# username: password [,rolename ...]
+admin: admin, admin
diff --git a/jetty.xml b/jetty.xml
new file mode 100644
index 0000000..752dcbd
--- /dev/null
+++ b/jetty.xml
@@ -0,0 +1,117 @@
+
+    <!--
+        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.
+    -->
+    <!--
+        An embedded servlet engine for serving up the Admin consoles, REST and Ajax APIs and
+        some demos Include this file in your configuration to enable ActiveMQ web components
+        e.g. <import resource="jetty.xml"/>
+    -->
+<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
+
+    <bean id="securityLoginService" class="org.eclipse.jetty.security.HashLoginService">
+        <property name="name" value="ActiveMQRealm" />
+        <property name="config" value="${activemq.base}/conf/jetty-realm.properties" />
+    </bean>
+
+    <bean id="securityConstraint" class="org.eclipse.jetty.http.security.Constraint">
+        <property name="name" value="BASIC" />
+        <property name="roles" value="admin" />
+        <property name="authenticate" value="false" />
+    </bean>
+    <bean id="securityConstraintMapping" class="org.eclipse.jetty.security.ConstraintMapping">
+        <property name="constraint" ref="securityConstraint" />
+        <property name="pathSpec" value="/*" />
+    </bean>
+    <bean id="securityHandler" class="org.eclipse.jetty.security.ConstraintSecurityHandler">
+        <property name="loginService" ref="securityLoginService" />
+        <property name="authenticator">
+            <bean class="org.eclipse.jetty.security.authentication.BasicAuthenticator" />
+        </property>
+        <property name="constraintMappings">
+            <list>
+                <ref bean="securityConstraintMapping" />
+            </list>
+        </property>
+        <property name="handler">
+            <bean id="sec" class="org.eclipse.jetty.server.handler.HandlerCollection">
+                <property name="handlers">
+                    <list>
+                        <bean class="org.eclipse.jetty.webapp.WebAppContext">
+                            <property name="contextPath" value="/admin" />
+                            <property name="resourceBase" value="${activemq.home}/webapps/admin" />
+                            <property name="logUrlOnStart" value="true" />
+                        </bean>
+                        <bean class="org.eclipse.jetty.webapp.WebAppContext">
+                            <property name="contextPath" value="/camel" />
+                            <property name="resourceBase" value="${activemq.home}/webapps/camel" />
+                            <property name="logUrlOnStart" value="true" />
+                        </bean>
+                        <bean class="org.eclipse.jetty.webapp.WebAppContext">
+                            <property name="contextPath" value="/demo" />
+                            <property name="resourceBase" value="${activemq.home}/webapps/demo" />
+                            <property name="logUrlOnStart" value="true" />
+                        </bean>
+                        <bean class="org.eclipse.jetty.webapp.WebAppContext">
+                            <property name="contextPath" value="/fileserver" />
+                            <property name="resourceBase" value="${activemq.home}/webapps/fileserver" />
+                            <property name="logUrlOnStart" value="true" />
+                            <property name="parentLoaderPriority" value="true" />
+                        </bean>
+                        <bean class="org.eclipse.jetty.server.handler.ResourceHandler">
+                            <property name="directoriesListed" value="false" />
+                            <property name="welcomeFiles">
+                                <list>
+                                    <value>index.html</value>
+                                </list>
+                            </property>
+                            <property name="resourceBase" value="${activemq.home}/webapps/" />
+                        </bean>
+                        <bean id="defaultHandler" class="org.eclipse.jetty.server.handler.DefaultHandler">
+                            <property name="serveIcon" value="false" />
+                        </bean>
+                    </list>
+                </property>
+            </bean>
+        </property>
+    </bean>
+
+    <bean id="contexts" class="org.eclipse.jetty.server.handler.ContextHandlerCollection">
+    </bean>
+
+    <bean id="Server" class="org.eclipse.jetty.server.Server" init-method="start"
+        destroy-method="stop">
+
+        <property name="connectors">
+            <list>
+                <bean id="Connector" class="org.eclipse.jetty.server.nio.SelectChannelConnector">
+                    <property name="port" value="8161" />
+                </bean>
+            </list>
+        </property>
+
+        <property name="handler">
+            <bean id="handlers" class="org.eclipse.jetty.server.handler.HandlerCollection">
+                <property name="handlers">
+                    <list>
+                        <ref bean="contexts" />
+                        <ref bean="securityHandler" />
+                    </list>
+                </property>
+            </bean>
+        </property>
+
+    </bean>
+
+</beans>


More information about the scm-commits mailing list