You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ch...@apache.org on 2011/07/27 19:32:28 UTC

svn commit: r1151548 - in /activemq/activemq-apollo/trunk: ./ apollo-bdb/ apollo-broker/ apollo-broker/src/main/resources/OSGI-INF/blueprint/ apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/jetty/ apollo-broker/src/main/scala/org/apache/...

Author: chirino
Date: Wed Jul 27 17:32:25 2011
New Revision: 1151548

URL: http://svn.apache.org/viewvc?rev=1151548&view=rev
Log:
Use Fab metadata instead of standard OSGi metadata, makes it easier to deploy to Karaf.

Added:
    activemq/activemq-apollo/trunk/apollo-cli/src/main/resources/OSGI-INF/blueprint/broker.xml
      - copied, changed from r1150468, activemq/activemq-apollo/trunk/apollo-broker/src/main/resources/OSGI-INF/blueprint/broker.xml
    activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/osgi/
    activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/osgi/BrokerService.scala
Removed:
    activemq/activemq-apollo/trunk/apollo-broker/src/main/resources/OSGI-INF/blueprint/broker.xml
    activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/osgi/BrokerService.scala
    activemq/activemq-apollo/trunk/apollo-web/src/main/resources/META-INF/apollo-web.txt
    activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/osgi/OsgiWebServerFactory.scala
Modified:
    activemq/activemq-apollo/trunk/apollo-bdb/pom.xml
    activemq/activemq-apollo/trunk/apollo-broker/pom.xml
    activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/jetty/JettyWebServer.scala
    activemq/activemq-apollo/trunk/apollo-cassandra/pom.xml
    activemq/activemq-apollo/trunk/apollo-cli/pom.xml
    activemq/activemq-apollo/trunk/apollo-cli/src/main/resources/org/apache/activemq/apollo/cli/commands/etc/apollo-ssl.xml
    activemq/activemq-apollo/trunk/apollo-cli/src/main/resources/org/apache/activemq/apollo/cli/commands/etc/apollo.xml
    activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/Apollo.scala
    activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/commands/Create.scala
    activemq/activemq-apollo/trunk/apollo-distro/pom.xml
    activemq/activemq-apollo/trunk/apollo-dto/pom.xml
    activemq/activemq-apollo/trunk/apollo-hawtdb/pom.xml
    activemq/activemq-apollo/trunk/apollo-jdbm2/pom.xml
    activemq/activemq-apollo/trunk/apollo-selector/pom.xml
    activemq/activemq-apollo/trunk/apollo-stomp/pom.xml
    activemq/activemq-apollo/trunk/apollo-tcp/pom.xml
    activemq/activemq-apollo/trunk/apollo-transport/pom.xml
    activemq/activemq-apollo/trunk/apollo-util/pom.xml
    activemq/activemq-apollo/trunk/apollo-web/pom.xml
    activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/WEB-INF/web.xml
    activemq/activemq-apollo/trunk/pom.xml

Modified: activemq/activemq-apollo/trunk/apollo-bdb/pom.xml
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-bdb/pom.xml?rev=1151548&r1=1151547&r2=1151548&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-bdb/pom.xml (original)
+++ activemq/activemq-apollo/trunk/apollo-bdb/pom.xml Wed Jul 27 17:32:25 2011
@@ -29,12 +29,9 @@
   <groupId>org.apache.activemq</groupId>
   <artifactId>apollo-bdb</artifactId>
   <version>1.0-SNAPSHOT</version>
-  <packaging>bundle</packaging>
-
+  <!-- <packaging>bundle</packaging> -->
   <name>${project.artifactId}</name>
-
-  <properties>
-  </properties>
+  <description>BDB based message storage</description>
 
   <dependencies>
 
@@ -121,6 +118,26 @@
 
   <build>
     <plugins>
+      <!-- Generate a test jar for the test cases in this package -->
+      <plugin>
+        <groupId>org.fusesource.mvnplugins</groupId>
+        <artifactId>maven-fab-plugin</artifactId>
+        <version>1.16-SNAPSHOT</version>
+        <configuration>
+          <descriptor>
+            <Name>bdb</Name>
+            <Long-Description></Long-Description>
+            <Extends>${project.groupId}:apollo-cli:${project.version}</Extends>
+          </descriptor>
+        </configuration>
+        <executions>
+          <execution>
+            <goals>
+              <goal>generate</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
 
       <plugin>
         <groupId>org.fusesource.scalate</groupId>

Modified: activemq/activemq-apollo/trunk/apollo-broker/pom.xml
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-broker/pom.xml?rev=1151548&r1=1151547&r2=1151548&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-broker/pom.xml (original)
+++ activemq/activemq-apollo/trunk/apollo-broker/pom.xml Wed Jul 27 17:32:25 2011
@@ -29,12 +29,12 @@
   <groupId>org.apache.activemq</groupId>
   <artifactId>apollo-broker</artifactId>
   <version>1.0-SNAPSHOT</version>
-  <packaging>bundle</packaging>
+  <!-- <packaging>bundle</packaging> -->
 
   <name>${project.artifactId}</name>
-
+  <description>A reliable messaging server.</description>
+  
   <properties>
-    <osgi.fragment.host />
   </properties>
 
   <dependencies>
@@ -92,20 +92,6 @@
       <optional>true</optional>
     </dependency>
 
-    <!-- for optional osgi integration -->
-    <dependency>
-      <groupId>org.osgi</groupId>
-      <artifactId>org.osgi.core</artifactId>
-      <version>${osgi-version}</version>
-      <scope>provided</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.osgi</groupId>
-      <artifactId>org.osgi.compendium</artifactId>
-      <version>${osgi-version}</version>
-      <scope>provided</scope>
-    </dependency>
-
     <!-- Scala Support -->
     <dependency>
       <groupId>org.scala-lang</groupId>
@@ -178,8 +164,8 @@
     
     <plugins>
 
-      <!-- Generate a test jar for the test cases in this package -->
       <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-jar-plugin</artifactId>
         <executions>
           <execution>

Modified: activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/jetty/JettyWebServer.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/jetty/JettyWebServer.scala?rev=1151548&r1=1151547&r2=1151548&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/jetty/JettyWebServer.scala (original)
+++ activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/jetty/JettyWebServer.scala Wed Jul 27 17:32:25 2011
@@ -22,16 +22,17 @@ import org.eclipse.jetty.webapp.WebAppCo
 import org.eclipse.jetty.server.nio.SelectChannelConnector
 import org.apache.activemq.apollo.util._
 import org.fusesource.hawtdispatch._
-import java.io.File
-import java.lang.String
 import org.apache.activemq.apollo.broker.web.{WebServer, WebServerFactory}
-import java.net.URI
 import org.eclipse.jetty.server.handler.HandlerList
 import collection.mutable.HashMap
 import org.eclipse.jetty.server.ssl.SslSelectChannelConnector
 import javax.net.ssl.SSLContext
 import org.eclipse.jetty.util.thread.ExecutorThreadPool
 import org.apache.activemq.apollo.dto.WebAdminDTO
+import java.net.{URL, URI}
+import java.io.{FileOutputStream, File}
+import java.util.jar.JarInputStream
+import java.lang.String
 
 /**
  * <p>
@@ -43,7 +44,7 @@ object JettyWebServerFactory extends Web
 
   // Enabled this factory if we can load the jetty classes.
   val enabled = try {
-    getClass.getClassLoader.loadClass(classOf[WebAppContext].getName)
+    this.getClass.getClassLoader.loadClass(classOf[WebAppContext].getName)
     true
   } catch {
     case _ =>
@@ -54,10 +55,6 @@ object JettyWebServerFactory extends Web
     if( !enabled ) {
       return null
     }
-    if( JettyWebServer.webapp==null ) {
-      JettyWebServer.warn("The apollo.home or apollo.webapp system property must be set so that the webconsole can be started.")
-      return null
-    }
     new JettyWebServer(broker)
   }
 
@@ -72,46 +69,47 @@ object JettyWebServerFactory extends Web
 object JettyWebServer extends Log {
 
 
-  val webapp = {
+  def webapp(tmp:File) = {
     import FileSupport._
 
     var rc:File = null
+    val loader = JettyWebServer.getClass.getClassLoader
 
-    Option(System.getProperty("apollo.webapp")).foreach{ x=>
-      rc = new File(x)
-    }
-
-    if( rc==null ) {
-      Option(System.getProperty("apollo.home")).foreach { home=>
-        val lib = new File(home) / "lib"
-        rc = lib.list.find( _.matches("""apollo-web-.+-slim.war""")).map(lib / _).getOrElse(null)
+    // Unpack all the webapp resources found on the classpath.
+    val resources = loader.getResources("META-INF/services/org.apache.activemq.apollo/webapp-resources.jar")
+    while( resources.hasMoreElements ) {
+      val url = resources.nextElement();
+      import FileSupport._
+      rc = tmp / "webapp-resources"
+      rc.mkdirs()
+      using(new JarInputStream(url.openStream()) ) { is =>
+        var entry = is.getNextJarEntry
+        while( entry!=null ) {
+          if( entry.isDirectory ) {
+            (rc / entry.getName).mkdirs()
+          } else {
+            using(new FileOutputStream( rc / entry.getName )) { os =>
+              copy(is, os)
+            }
+          }
+          is.closeEntry()
+          entry = is.getNextJarEntry
+        }
       }
     }
 
     // the war might be on the classpath..
     if( rc==null ) {
-      var url = JettyWebServer.getClass.getClassLoader.getResource("META-INF/apollo-web.txt")
-
+      val bootClazz: String = "org/apache/activemq/apollo/web/Boot.class"
+      var url = loader.getResource(bootClazz)
       rc = if(url==null) {
         null
       } else {
-        if( url.getProtocol == "jar") {
-
-          // we are probably being run from a maven build..
-          url = new java.net.URL( url.getFile.stripSuffix("!/META-INF/apollo-web.txt") )
-          val jar = new File( url.getFile )
-          if( jar.isFile ) {
-            jar.getParentFile / (jar.getName.stripSuffix(".jar")+".war")
-          } else {
-            null
-          }
-
-        } else if( url.getProtocol == "file") {
-
+        if( url.getProtocol == "file") {
           // we are probably being run from an IDE...
-          val rc = new File( url.getFile.stripSuffix("/META-INF/apollo-web.txt") )
-          if( rc.isDirectory ) {
-            rc/".."/".."/"src"/"main"/"webapp"
+          val classes_dir = new File( url.getFile.stripSuffix("/"+bootClazz) )
+          if( classes_dir.isDirectory ) {
+            classes_dir/".."/".."/"src"/"main"/"webapp"
           } else {
             null
           }
@@ -144,107 +142,116 @@ class JettyWebServer(val broker:Broker) 
 
       val config = broker.config
 
-      // Start up the admin interface...
-      debug("Starting administration interface");
-
-      if( broker.tmp !=null ) {
-        System.setProperty("scalate.workdir", (broker.tmp / "scalate").getCanonicalPath )
-      }
-
-      val contexts = HashMap[String, Handler]()
-      val connectors = HashMap[String, Connector]()
-
-      web_admins = config.web_admins.toList
-      web_admins.foreach { web_admin =>
+      val webapp_path = webapp(broker.tmp)
+      if(webapp_path==null ) {
+        warn("Administration interface cannot be started: webapp resources not found");
+      } else {
+        // Start up the admin interface...
+        debug("Starting administration interface");
 
-        val bind = web_admin.bind.getOrElse("http://127.0.0.1:61680")
-        val bind_uri = new URI(bind)
-        val prefix = "/"+bind_uri.getPath.stripPrefix("/")
-
-        val scheme = bind_uri.getScheme
-        val host = bind_uri.getHost
-        var port = bind_uri.getPort
-
-        scheme match {
-          case "http" =>
-            if (port == -1) {
-              port = 80
-            }
-          case "https" =>
-            if (port == -1) {
-              port = 443
-            }
-          case _ => throw new Exception("Invalid 'web_admin' bind setting.  The protocol scheme must be http or https.")
+        if( broker.tmp !=null ) {
+          System.setProperty("scalate.workdir", (broker.tmp / "scalate").getCanonicalPath )
         }
 
-        // Only add the connector if not yet added..
-        val connector_id = scheme+"://"+host+":"+port
-        if ( !connectors.containsKey(connector_id) ) {
+        val contexts = HashMap[String, Handler]()
+        val connectors = HashMap[String, Connector]()
+
+        web_admins = config.web_admins.toList
+        web_admins.foreach { web_admin =>
 
-          val connector = scheme match {
-            case "http" => new SelectChannelConnector
+          val bind = web_admin.bind.getOrElse("http://127.0.0.1:61680")
+          val bind_uri = new URI(bind)
+          val prefix = "/"+bind_uri.getPath.stripPrefix("/")
+
+          val scheme = bind_uri.getScheme
+          val host = bind_uri.getHost
+          var port = bind_uri.getPort
+
+          scheme match {
+            case "http" =>
+              if (port == -1) {
+                port = 80
+              }
             case "https" =>
-              val sslContext = if( broker.key_storage!=null ) {
-                val protocol = "TLS"
-                val sslContext = SSLContext.getInstance (protocol)
-                sslContext.init(broker.key_storage.create_key_managers, broker.key_storage.create_trust_managers, null)
-                sslContext
-              } else {
-                SSLContext.getDefault
+              if (port == -1) {
+                port = 443
               }
-
-              val connector = new SslSelectChannelConnector
-              connector.setSslContext(sslContext)
-              connector.setWantClientAuth(true)
-              connector
+            case _ => throw new Exception("Invalid 'web_admin' bind setting.  The protocol scheme must be http or https.")
           }
 
-          connector.setHost(host)
-          connector.setPort(port)
-          connectors.put(connector_id, connector)
-        }
+          // Only add the connector if not yet added..
+          val connector_id = scheme+"://"+host+":"+port
+          if ( !connectors.containsKey(connector_id) ) {
+
+            val connector = scheme match {
+              case "http" => new SelectChannelConnector
+              case "https" =>
+                val sslContext = if( broker.key_storage!=null ) {
+                  val protocol = "TLS"
+                  val sslContext = SSLContext.getInstance (protocol)
+                  sslContext.init(broker.key_storage.create_key_managers, broker.key_storage.create_trust_managers, null)
+                  sslContext
+                } else {
+                  SSLContext.getDefault
+                }
+
+                val connector = new SslSelectChannelConnector
+                connector.setSslContext(sslContext)
+                connector.setWantClientAuth(true)
+                connector
+            }
 
-        // Only add the app context if not yet added..
-        if ( !contexts.containsKey(prefix) ) {
-          var context = new WebAppContext
-          context.setContextPath(prefix)
-          context.setWar(webapp.getCanonicalPath)
-          context.setClassLoader(Broker.class_loader)
-          if( broker.tmp !=null ) {
-            context.setTempDirectory(broker.tmp)
+            connector.setHost(host)
+            connector.setPort(port)
+            connectors.put(connector_id, connector)
+          }
+
+          // Only add the app context if not yet added..
+          if ( !contexts.containsKey(prefix) ) {
+            var context = new WebAppContext
+            context.setContextPath(prefix)
+            context.setWar(webapp_path.getCanonicalPath)
+            context.setClassLoader(Broker.class_loader)
+            if( broker.tmp !=null ) {
+              context.setTempDirectory(broker.tmp)
+            }
+            contexts.put(prefix, context)
           }
-          contexts.put(prefix, context)
         }
-      }
 
 
-      val context_list = new HandlerList
-      contexts.values.foreach(context_list.addHandler(_))
+        val context_list = new HandlerList
+        contexts.values.foreach(context_list.addHandler(_))
 
-      server = new Server
-      server.setHandler(context_list)
-      server.setConnectors(connectors.values.toArray)
-      server.setThreadPool(new ExecutorThreadPool(Broker.BLOCKABLE_THREAD_POOL))
-      server.start
-
-      for( connector <- connectors.values ; prefix <- contexts.keys ) {
-        val localPort = connector.getLocalPort
-        val scheme = connector match {
-          case x:SslSelectChannelConnector => "https"
-          case _ => "http"
+        server = new Server
+        server.setHandler(context_list)
+        server.setConnectors(connectors.values.toArray)
+        server.setThreadPool(new ExecutorThreadPool(Broker.BLOCKABLE_THREAD_POOL))
+        server.start
+
+        for( connector <- connectors.values ; prefix <- contexts.keys ) {
+          val localPort = connector.getLocalPort
+          val scheme = connector match {
+            case x:SslSelectChannelConnector => "https"
+            case _ => "http"
+          }
+
+          def url = new URI(scheme, null, connector.getHost, localPort, prefix, null, null).toString
+          broker.console_log.info("Administration interface available at: "+url)
         }
 
-        def url = new URI(scheme, null, connector.getHost, localPort, prefix, null, null).toString
-        broker.console_log.info("Administration interface available at: "+url)
       }
       on_completed.run
+
     }
   }
 
   protected def _stop(on_completed: Runnable) = Broker.BLOCKABLE_THREAD_POOL {
     this.synchronized {
-      server.stop
-      server = null
+      if( server!=null ) {
+        server.stop
+        server = null
+      }
       on_completed.run
     }
   }

Modified: activemq/activemq-apollo/trunk/apollo-cassandra/pom.xml
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-cassandra/pom.xml?rev=1151548&r1=1151547&r2=1151548&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-cassandra/pom.xml (original)
+++ activemq/activemq-apollo/trunk/apollo-cassandra/pom.xml Wed Jul 27 17:32:25 2011
@@ -30,7 +30,7 @@
   <groupId>org.apache.activemq</groupId>
   <artifactId>apollo-cassandra</artifactId>
   <version>1.0-SNAPSHOT</version>
-  <packaging>bundle</packaging>
+  <!-- <packaging>bundle</packaging> -->
 
   <name>${project.artifactId}</name>
 

Modified: activemq/activemq-apollo/trunk/apollo-cli/pom.xml
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-cli/pom.xml?rev=1151548&r1=1151547&r2=1151548&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-cli/pom.xml (original)
+++ activemq/activemq-apollo/trunk/apollo-cli/pom.xml Wed Jul 27 17:32:25 2011
@@ -30,6 +30,7 @@
   <packaging>jar</packaging>
 
   <name>${project.artifactId}</name>
+  <description>A reliable messaging server.</description>
 
   <properties>
   </properties>
@@ -78,6 +79,20 @@
       <version>${jasypt-version}</version>
     </dependency>
 
+    <!-- for optional osgi integration -->
+    <dependency>
+      <groupId>org.osgi</groupId>
+      <artifactId>org.osgi.core</artifactId>
+      <version>${osgi-version}</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.osgi</groupId>
+      <artifactId>org.osgi.compendium</artifactId>
+      <version>${osgi-version}</version>
+      <scope>provided</scope>
+    </dependency>
+
     <dependency>
       <groupId>com.sun.winsw</groupId>
       <artifactId>winsw</artifactId>
@@ -91,6 +106,7 @@
       <groupId>log4j</groupId>
       <artifactId>log4j</artifactId>
       <version>1.2.16</version>
+      <optional>true</optional>
     </dependency>
 
     <!-- Testing Dependencies -->
@@ -169,6 +185,61 @@
 
     <plugins>
       
+      <!-- Generate a test jar for the test cases in this package -->
+      <plugin>
+        <groupId>org.fusesource.mvnplugins</groupId>
+        <artifactId>maven-fab-plugin</artifactId>
+        <version>1.16-SNAPSHOT</version>
+        <configuration>
+          <descriptor>
+            <Name>apollo</Name>
+            <Long-Description>
+              ActiveMQ Apollo is a faster, more reliable, easier to maintain messaging 
+              broker built from the foundations of the original ActiveMQ. It accomplishes 
+              this using a radically different threading and message dispatching architecture.
+      
+              In it’s current incarnation, Apollo only supports the STOMP protocol but just 
+              like the original ActiveMQ, it’s been designed to be a multi protocol broker.
+               In future versions it should get OpenWire support so it can be compatible 
+               with ActiveMQ 5.x JMS clients.
+            </Long-Description>
+            <Endorsed-Extensions>
+              ${project.groupId}:apollo-jdbm2:${project.version}
+              ${project.groupId}:apollo-bdb:${project.version}
+              ${project.groupId}:apollo-stomp:${project.version}
+              ${project.groupId}:apollo-web:${project.version}
+            </Endorsed-Extensions>
+            <Default-Extensions>bdb stomp web</Default-Extensions>
+          </descriptor>
+        </configuration>
+        <executions>
+          <execution>
+            <goals>
+              <goal>generate</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+      
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-jar-plugin</artifactId>
+        <configuration>
+          <archive>
+            <manifestEntries>
+              <Fabric-Provided-Dependency>
+                org.slf4j:slf4j-api
+                org.apache.karaf.shell:org.apache.karaf.shell.console
+              </Fabric-Provided-Dependency>
+              <Fabric-Exclude-Dependency>
+                org.fusesource.jansi:jansi
+                org.sonatype.jline:jline
+              </Fabric-Exclude-Dependency>
+            </manifestEntries>
+          </archive>
+        </configuration>
+      </plugin>
+
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-dependency-plugin</artifactId>

Copied: activemq/activemq-apollo/trunk/apollo-cli/src/main/resources/OSGI-INF/blueprint/broker.xml (from r1150468, activemq/activemq-apollo/trunk/apollo-broker/src/main/resources/OSGI-INF/blueprint/broker.xml)
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-cli/src/main/resources/OSGI-INF/blueprint/broker.xml?p2=activemq/activemq-apollo/trunk/apollo-cli/src/main/resources/OSGI-INF/blueprint/broker.xml&p1=activemq/activemq-apollo/trunk/apollo-broker/src/main/resources/OSGI-INF/blueprint/broker.xml&r1=1150468&r2=1151548&rev=1151548&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-broker/src/main/resources/OSGI-INF/blueprint/broker.xml (original)
+++ activemq/activemq-apollo/trunk/apollo-cli/src/main/resources/OSGI-INF/blueprint/broker.xml Wed Jul 27 17:32:25 2011
@@ -22,20 +22,24 @@
   xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"
   xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0">
 
-  <cm:property-placeholder persistent-id="org.apache.activemq.apollo">
-  <!-- <cm:property-placeholder persistent-id="org.apache.activemq.apollo" update-strategy="reload"> -->
-    <cm:default-properties>
-      <cm:property name="apollo.base" value="."/>
-    </cm:default-properties>
-  </cm:property-placeholder>
-
   <reference id="configAdmin" interface="org.osgi.service.cm.ConfigurationAdmin"/>
 
-  <bean id="broker" class="org.apache.activemq.apollo.broker.osgi.BrokerService"
+  <bean id="broker" class="org.apache.activemq.apollo.cli.osgi.BrokerService"
         init-method="start" destroy-method="stop">
     <property name="context" ref="blueprintBundleContext"/>
-    <property name="basedir" value="${apollo.base}"/>
     <property name="configAdmin" ref="configAdmin"/>
   </bean>
 
+  <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.0.0">
+    <command name="apollo/encrypt">
+        <action class="org.apache.activemq.apollo.cli.commands.Encrypt"/>
+    </command>
+    <command name="apollo/decrypt">
+        <action class="org.apache.activemq.apollo.cli.commands.Decrypt"/>
+    </command>
+    <command name="apollo/version">
+        <action class="org.apache.activemq.apollo.cli.commands.Version"/>
+    </command>
+  </command-bundle>
+
 </blueprint>
\ No newline at end of file

Modified: activemq/activemq-apollo/trunk/apollo-cli/src/main/resources/org/apache/activemq/apollo/cli/commands/etc/apollo-ssl.xml
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-cli/src/main/resources/org/apache/activemq/apollo/cli/commands/etc/apollo-ssl.xml?rev=1151548&r1=1151547&r2=1151548&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-cli/src/main/resources/org/apache/activemq/apollo/cli/commands/etc/apollo-ssl.xml (original)
+++ activemq/activemq-apollo/trunk/apollo-cli/src/main/resources/org/apache/activemq/apollo/cli/commands/etc/apollo-ssl.xml Wed Jul 27 17:32:25 2011
@@ -28,12 +28,7 @@
 
   <log_category console="console" security="security" connection="connection" audit="audit"/>
 
-  <!-- used to secure the web admin interface -->
-  <authentication domain="apollo"/>
-  <acl>
-    <admin allow="admins"/>
-    <config allow="admins"/>
-  </acl>
+  ${broker_security_config}
 
   <virtual_host id="${host}">
     <!--
@@ -47,13 +42,9 @@
     <!-- Uncomment to disable security for the virtual host -->
     <!-- <authentication enabled="false"/> -->
 
-    <acl>
-      <admin allow="admins"/>
-      <connect allow="admins"/>
-    </acl>
+    ${host_security_config}
 
-    <!-- You can delete this element if you want to disable persistence for this virtual host -->
-    <jdbm2_store directory="${apollo.base}/data"/>
+    ${store_config}
 
   </virtual_host>
 

Modified: activemq/activemq-apollo/trunk/apollo-cli/src/main/resources/org/apache/activemq/apollo/cli/commands/etc/apollo.xml
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-cli/src/main/resources/org/apache/activemq/apollo/cli/commands/etc/apollo.xml?rev=1151548&r1=1151547&r2=1151548&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-cli/src/main/resources/org/apache/activemq/apollo/cli/commands/etc/apollo.xml (original)
+++ activemq/activemq-apollo/trunk/apollo-cli/src/main/resources/org/apache/activemq/apollo/cli/commands/etc/apollo.xml Wed Jul 27 17:32:25 2011
@@ -28,12 +28,7 @@
 
   <log_category console="console" security="security" connection="connection" audit="audit"/>
 
-  <!-- used to secure the web admin interface -->
-  <authentication domain="apollo"/>
-  <acl>
-    <admin allow="admins"/>
-    <config allow="admins"/>
-  </acl>
+  ${broker_security_config}
 
   <virtual_host id="${host}">
     <!--
@@ -44,16 +39,9 @@
     <host_name>localhost</host_name>
     <host_name>127.0.0.1</host_name>
 
-    <!-- Uncomment to disable security for the virtual host -->
-    <!-- <authentication enabled="false"/> -->
+    ${host_security_config}
 
-    <acl>
-      <admin allow="admins"/>
-      <connect allow="admins"/>
-    </acl>
-
-    <!-- You can delete this element if you want to disable persistence for this virtual host -->
-    <jdbm2_store directory="${apollo.base}/data"/>
+    ${store_config}
 
   </virtual_host>
 

Modified: activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/Apollo.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/Apollo.scala?rev=1151548&r1=1151547&r2=1151548&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/Apollo.scala (original)
+++ activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/Apollo.scala Wed Jul 27 17:32:25 2011
@@ -109,7 +109,6 @@ class Apollo extends Main with Action {
       } else {
         BOLD+"apollo> "+RESET
       }
-      protected override def isPrintStackTraces = debug
       protected override def welcome = {
         print_banner(session.getConsole)
         print_tips(session.getConsole)

Modified: activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/commands/Create.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/commands/Create.scala?rev=1151548&r1=1151547&r2=1151548&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/commands/Create.scala (original)
+++ activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/commands/Create.scala Wed Jul 27 17:32:25 2011
@@ -47,11 +47,33 @@ class Create extends Action {
   @option(name = "--force", description = "Overwrite configuration at destination directory")
   var force = false
 
-  var version:String = "${version}"
+  @option(name = "--home", description = "Directory where apollo is installed")
+  val home: String = System.getProperty("apollo.home")
+
+  var broker_security_config =
+  """<!-- used to secure the web admin interface -->
+  <authentication domain="apollo"/>
+  <acl>
+    <admin allow="admins"/>
+    <config allow="admins"/>
+  </acl>
+  """
+  var host_security_config =
+    """<!-- Uncomment to disable security for the virtual host -->
+    <!-- <authentication enabled="false"/> -->
+    <acl>
+      <admin allow="admins"/>
+      <connect allow="admins"/>
+    </acl>
+    """
+
+  var create_login_config = true
+  var create_log_config = true
 
   def execute(session: CommandSession) = {
 
     def println(value:Any) = session.getConsole.println(value)
+
     try {
       println("Creating apollo instance at: %s".format(directory))
 
@@ -59,26 +81,19 @@ class Create extends Action {
         host = directory.getName
       }
 
-      val bin = directory / "bin"
-      bin.mkdirs
-
       val etc = directory / "etc"
       etc.mkdirs
 
-      var target = etc / "log4j.properties"
-      write("etc/log4j.properties", target)
-
-      target = etc / "users.properties"
-      write("etc/users.properties", target)
-
-      target = etc / "groups.properties"
-      write("etc/groups.properties", target)
-
-      target = etc / "login.config"
-      write("etc/login.config", target)
+      if (create_log_config) {
+        write("etc/log4j.properties", etc/"log4j.properties")
+      }
 
-      target = etc / "black-list.txt"
-      write("etc/black-list.txt", target)
+      if ( create_login_config ) {
+        write("etc/users.properties", etc/"users.properties")
+        write("etc/groups.properties", etc/"groups.properties")
+        write("etc/login.config", etc/"login.config")
+        write("etc/black-list.txt", etc/"black-list.txt")
+      }
 
       // Generate a keystore with a new key
       println("Generating ssl keystore...")
@@ -94,81 +109,76 @@ class Create extends Action {
         "-dname", "cn=%s".format(host),
         "-validity", "3650"))==0
 
-      target = etc / "apollo.xml"
       if( ssl ) {
-        write("etc/apollo-ssl.xml", target, true)
+        write("etc/apollo-ssl.xml", etc/"apollo.xml", true)
       } else {
         println("WARNNIG: Could not generate the keystore, make sure the keytool command is in your PATH")
-        write("etc/apollo.xml", target, true)
+        write("etc/apollo.xml", etc/"apollo.xml", true)
       }
 
+      val data = directory / "data"
+      data.mkdirs
 
-      if( IS_WINDOWS ) {
-        target = bin / "apollo-broker.cmd"
-        write("bin/apollo-broker.cmd", target, true)
+      val tmp = directory / "tmp"
+      tmp.mkdirs
 
-        target = bin / "apollo-broker-service.exe"
-        write("bin/apollo-broker-service.exe", target)
+      // home is set to null if executing within an OSGi env,
+      // it's a hint to not generate startup scripts.
+      if ( home!=null ) {
+        val log = directory / "log"
+        log.mkdirs
+
+        val bin = directory / "bin"
+        bin.mkdirs
+
+        if( IS_WINDOWS ) {
+          write("bin/apollo-broker.cmd", bin/"apollo-broker.cmd", true)
+          write("bin/apollo-broker-service.exe", bin/"apollo-broker-service.exe")
+          write("bin/apollo-broker-service.xml", bin/"apollo-broker-service.xml", true)
+        } else {
+          write("bin/apollo-broker", bin/"apollo-broker", true)
+          setExecutable(bin/"apollo-broker")
 
-        target = bin / "apollo-broker-service.xml"
-        write("bin/apollo-broker-service.xml", target, true)
+          write("bin/apollo-broker-service", bin/"apollo-broker-service", true)
+          setExecutable(bin/"apollo-broker-service")
+        }
 
-      } else {
-        target = bin / "apollo-broker"
-        write("bin/apollo-broker", target, true)
-        setExecutable(target)
-
-        target = bin / "apollo-broker-service"
-        write("bin/apollo-broker-service", target, true)
-        setExecutable(target)
-      }
+        println("")
+        println("You can now start the broker by executing:  ")
+        println("")
+        println("   \"%s\" run".format((bin/"apollo-broker").getCanonicalPath))
 
-      val data = directory / "data"
-      data.mkdirs
-      
-      val log = directory / "log"
-      log.mkdirs
+        val service = bin / "apollo-broker-service"
+        println("")
 
-      val tmp = directory / "tmp"
-      log.mkdirs
+        if( !IS_WINDOWS ) {
 
-      val home = new File(System.getProperty("apollo.home"))
+          // Does it look like we are on a System V init system?
+          if( new File("/etc/init.d/").isDirectory ) {
 
-      println("")
-      println("You can now start the broker by executing:  ")
-      println("")
-      println("   \"%s\" run".format((bin/"apollo-broker").getCanonicalPath))
-
-      val service = bin / "apollo-broker-service"
-      println("")
-      
-      if( !IS_WINDOWS ) {
+            println("Or you can setup the broker as system service and run it in the background:")
+            println("")
+            println("   sudo ln -s \"%s\" /etc/init.d/".format(service.getCanonicalPath))
+            println("   /etc/init.d/apollo-broker-service start")
 
-        // Does it look like we are on a System V init system?
-        if( new File("/etc/init.d/").isDirectory ) {
+          } else {
 
-          println("Or you can setup the broker as system service and run it in the background:")
-          println("")
-          println("   sudo ln -s \"%s\" /etc/init.d/".format(service.getCanonicalPath))
-          println("   /etc/init.d/apollo-broker-service start")
+            println("Or you can run the broker in the background using:")
+            println("")
+            println("   \"%s\" start".format(service.getCanonicalPath))
+
+          }
 
         } else {
 
-          println("Or you can run the broker in the background using:")
+          println("Or you can setup the broker as system service and run it in the background:")
           println("")
+          println("   \"%s\" install".format(service.getCanonicalPath))
           println("   \"%s\" start".format(service.getCanonicalPath))
 
         }
-
-      } else {
-      
-        println("Or you can setup the broker as system service and run it in the background:")
         println("")
-        println("   \"%s\" install".format(service.getCanonicalPath))
-        println("   \"%s\" start".format(service.getCanonicalPath))
-
       }
-      println("")
 
 
     } catch {
@@ -176,7 +186,6 @@ class Create extends Action {
         println(ansi.a(INTENSITY_BOLD).fg(RED).a("ERROR: ").reset.a(x.getMessage))
     }
 
-
     null
   }
 
@@ -209,11 +218,16 @@ class Create extends Action {
         replace("${user}", System.getProperty("user.name",""))
         replace("${host}", host)
         replace("${version}", Broker.version)
-        replace("${home}", cp(System.getProperty("apollo.home")))
+        if( home !=null ) {
+          replace("${home}", cp(home))
+        }
         replace("${base}", directory.getCanonicalPath)
         replace("${java.home}", cp(System.getProperty("java.home")))
-      }
+        replace("${store_config}", store_config)
 
+        replace("${broker_security_config}", broker_security_config)
+        replace("${host_security_config}", host_security_config)
+      }
       // and then writing out in the new target encoding.
       val in = new ByteArrayInputStream(content.getBytes(encoding))
 
@@ -230,7 +244,30 @@ class Create extends Action {
     }
   }
 
+  def can_load(name:String) = {
+    try {
+      getClass.getClassLoader.loadClass(name)
+      true
+    } catch {
+      case _ => false
+    }
+  }
 
+  def store_config = {
+    if( can_load("com.sleepycat.je.Environment") ) {
+      """<!-- You can delete this element if you want to disable persistence for this virtual host -->
+      <bdb_store directory="${apollo.base}/data"/>
+      """
+    } else if( can_load("jdbm.RecordManagerFactory") ) {
+      """<!-- You can delete this element if you want to disable persistence for this virtual host -->
+      <jdbm2_store directory="${apollo.base}/data"/>
+      """
+    } else {
+      """<!-- Perisistence disabled because no store implementations were found on the classpath -->
+      <!-- <bdb_store directory="${apollo.base}/data"/> -->
+      """
+    }
+  }
   def setExecutable(path:File) = if( !IS_WINDOWS ) {
     try {
         system(path.getParentFile(), Array("chmod", "a+x", path.getName))

Added: activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/osgi/BrokerService.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/osgi/BrokerService.scala?rev=1151548&view=auto
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/osgi/BrokerService.scala (added)
+++ activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/osgi/BrokerService.scala Wed Jul 27 17:32:25 2011
@@ -0,0 +1,178 @@
+/**
+ * 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.apollo.cli.osgi
+
+import org.apache.activemq.apollo.broker.Broker
+import org.fusesource.hawtdispatch._
+import org.apache.activemq.apollo.dto.{XmlCodec, BrokerDTO}
+import org.osgi.framework._
+import collection.JavaConversions._
+import org.apache.activemq.apollo.util._
+import FileSupport._
+import java.util.{Hashtable, Dictionary, Properties}
+import org.osgi.service.cm.{Configuration, ConfigurationAdmin}
+import org.apache.activemq.apollo.cli.commands.Create
+import org.apache.felix.service.command.CommandSession
+import java.io._
+import java.lang.{UnsupportedOperationException, String}
+import tools.nsc.io.NullPrintStream
+
+/**
+ * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
+ */
+object BrokerService extends Log {
+
+  var context: BundleContext = _
+  var config:BrokerDTO = _
+  var configAdmin:ConfigurationAdmin = _
+  var broker:Broker = _
+
+  def start(): Unit = this.synchronized {
+    try {
+      if(broker!=null) {
+        error("Apollo has allready been started.")
+        return
+      }
+      info("Starting Apollo.")
+
+      val configuration: Configuration = configAdmin.getConfiguration("org.apache.activemq.apollo")
+      var cmProps = configuration.getProperties
+
+      val karaf_data: File = new File(System.getProperty("karaf.data", "."))
+      var basedir: File = new File(karaf_data, "apollo")
+
+      if( cmProps!=null ) {
+        basedir = Option(cmProps.get("apollo.base").asInstanceOf[String])
+                  .map(new File(_)).getOrElse(basedir)
+      }
+
+      if( !basedir.exists() ) {
+        info("Initializing apollo instance directory: "+basedir)
+
+        // Lets create a broker instance since it does not exist.
+        val create = new Create()
+        create.directory = basedir
+
+        // Lets just reuse Karaf's Logging and Authentication configurations
+        create.create_log_config = false
+        create.create_login_config = false
+        create.broker_security_config =
+  """<!-- used to secure the web admin interface -->
+  <authentication domain="karaf">
+    <user_principal_kind>org.apache.karaf.jaas.modules.UserPrincipal</user_principal_kind>
+    <acl_principal_kind>org.apache.karaf.jaas.modules.RolePrincipal</acl_principal_kind>
+  </authentication>
+
+  <acl>
+    <admin allow="admin"/>
+    <config allow="admin"/>
+  </acl>
+  """
+        create.host_security_config =
+    """<!-- Uncomment to disable security for the virtual host -->
+    <!-- <authentication enabled="false"/> -->
+    <acl>
+      <admin allow="admin"/>
+      <config allow="admin"/>
+    </acl>
+    """
+        create.execute(new CommandSession(){
+          def put(name: String, value: AnyRef) = throw new UnsupportedOperationException()
+          def getKeyboard: InputStream = throw new UnsupportedOperationException()
+          def get(name: String): AnyRef = throw new UnsupportedOperationException()
+          def format(target: AnyRef, level: Int): CharSequence = throw new UnsupportedOperationException()
+          def execute(commandline: CharSequence): AnyRef = throw new UnsupportedOperationException()
+          def convert(`type` : Class[_], instance: AnyRef): AnyRef = throw new UnsupportedOperationException()
+          def getConsole: PrintStream = new PrintStream(new ByteArrayOutputStream())
+          def close() {}
+        })
+      }
+
+      // in case the config gets injected.
+      val dto = if( config != null ) {
+        config
+      } else {
+
+        // val base = system_dir("apollo.base")
+        val apollo_xml = basedir / "etc" / "apollo.xml"
+
+        if (!apollo_xml.exists) {
+          error("Apollo configuration file'%s' does not exist.".format(apollo_xml))
+          return
+        }
+
+        // Load the configs and start the brokers up.
+        info("Loading configuration file '%s'.", apollo_xml)
+
+        val props = new Properties()
+        props.putAll(System.getProperties)
+        if( cmProps!=null ) {
+          cmProps.keySet.foreach { key =>
+            props.put(key.asInstanceOf[String], cmProps.get(key).asInstanceOf[String])
+          }
+        }
+        props.put("apollo.base", basedir.getCanonicalPath)
+        XmlCodec.decode(classOf[BrokerDTO], new FileInputStream(apollo_xml), props)
+      }
+
+      debug("Starting broker")
+      broker = new Broker()
+      broker.update(dto, NOOP)
+      broker.tmp = basedir / "tmp"
+      broker.tmp.mkdirs
+      broker.start(^{
+        info("Apollo started")
+      })
+
+    } catch {
+      case e: Throwable =>
+        println()
+        e.printStackTrace
+        stop
+        error(e)
+    }
+  }
+
+  def stop(): Unit = this.synchronized {
+    info("Stopping Apollo")
+    if( broker!=null ) {
+      ServiceControl.stop(broker, "Apollo shutdown")
+      info("Apollo stopped")
+      broker = null
+    }
+  }
+
+}
+
+import BrokerService._
+
+/**
+ * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
+ */
+class BrokerService {
+
+  //
+  // Setters to allow blueprint injection.
+  //
+  def setContext(value:BundleContext):Unit = context = value
+  def setConfig(value:BrokerDTO):Unit = config = value
+  def setConfigAdmin(value:ConfigurationAdmin):Unit = configAdmin = value
+
+  def start() = BrokerService.start
+  def stop() = BrokerService.stop
+}
+

Modified: activemq/activemq-apollo/trunk/apollo-distro/pom.xml
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-distro/pom.xml?rev=1151548&r1=1151547&r2=1151548&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-distro/pom.xml (original)
+++ activemq/activemq-apollo/trunk/apollo-distro/pom.xml Wed Jul 27 17:32:25 2011
@@ -64,15 +64,7 @@
       <groupId>org.apache.activemq</groupId>
       <artifactId>apollo-web</artifactId>
       <version>1.0-SNAPSHOT</version>
-      <type>war</type>
-      <classifier>slim</classifier>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.activemq</groupId>
-      <artifactId>apollo-web</artifactId>
-      <version>1.0-SNAPSHOT</version>
       <type>jar</type>
-      <classifier>slim</classifier>
     </dependency>
     
     <dependency>

Modified: activemq/activemq-apollo/trunk/apollo-dto/pom.xml
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-dto/pom.xml?rev=1151548&r1=1151547&r2=1151548&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-dto/pom.xml (original)
+++ activemq/activemq-apollo/trunk/apollo-dto/pom.xml Wed Jul 27 17:32:25 2011
@@ -28,7 +28,7 @@
   <groupId>org.apache.activemq</groupId>
   <artifactId>apollo-dto</artifactId>
   <version>1.0-SNAPSHOT</version>
-  <packaging>bundle</packaging>
+  <!-- <packaging>bundle</packaging> -->
 
   <name>${project.artifactId}</name>
 

Modified: activemq/activemq-apollo/trunk/apollo-hawtdb/pom.xml
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-hawtdb/pom.xml?rev=1151548&r1=1151547&r2=1151548&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-hawtdb/pom.xml (original)
+++ activemq/activemq-apollo/trunk/apollo-hawtdb/pom.xml Wed Jul 27 17:32:25 2011
@@ -30,7 +30,7 @@
   <groupId>org.apache.activemq</groupId>
   <artifactId>apollo-hawtdb</artifactId>
   <version>1.0-SNAPSHOT</version>
-  <packaging>bundle</packaging>
+  <!-- <packaging>bundle</packaging> -->
 
   <name>${project.artifactId}</name>
 

Modified: activemq/activemq-apollo/trunk/apollo-jdbm2/pom.xml
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-jdbm2/pom.xml?rev=1151548&r1=1151547&r2=1151548&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-jdbm2/pom.xml (original)
+++ activemq/activemq-apollo/trunk/apollo-jdbm2/pom.xml Wed Jul 27 17:32:25 2011
@@ -29,9 +29,11 @@
   <groupId>org.apache.activemq</groupId>
   <artifactId>apollo-jdbm2</artifactId>
   <version>1.0-SNAPSHOT</version>
-  <packaging>bundle</packaging>
+  <!-- <packaging>bundle</packaging> -->
 
   <name>${project.artifactId}</name>
+  <description>JDBM2 based message storage</description>
+  
   <properties>
   </properties>
 
@@ -121,6 +123,26 @@
 
   <build>
     <plugins>
+      <plugin>
+        <groupId>org.fusesource.mvnplugins</groupId>
+        <artifactId>maven-fab-plugin</artifactId>
+        <version>1.16-SNAPSHOT</version>
+        <configuration>
+          <descriptor>
+            <Name>jdbm2</Name>
+            <Long-Description></Long-Description>
+            <Extends>${project.groupId}:apollo-cli:${project.version}</Extends>
+          </descriptor>
+        </configuration>
+        <executions>
+          <execution>
+            <goals>
+              <goal>generate</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+
 
       <plugin>
         <groupId>org.fusesource.scalate</groupId>

Modified: activemq/activemq-apollo/trunk/apollo-selector/pom.xml
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-selector/pom.xml?rev=1151548&r1=1151547&r2=1151548&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-selector/pom.xml (original)
+++ activemq/activemq-apollo/trunk/apollo-selector/pom.xml Wed Jul 27 17:32:25 2011
@@ -28,7 +28,7 @@
   <groupId>org.apache.activemq</groupId>
   <artifactId>apollo-selector</artifactId>
   <version>1.0-SNAPSHOT</version>
-  <packaging>bundle</packaging>
+  <!-- <packaging>bundle</packaging> -->
 
   <name>${project.artifactId}</name>
 

Modified: activemq/activemq-apollo/trunk/apollo-stomp/pom.xml
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-stomp/pom.xml?rev=1151548&r1=1151547&r2=1151548&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-stomp/pom.xml (original)
+++ activemq/activemq-apollo/trunk/apollo-stomp/pom.xml Wed Jul 27 17:32:25 2011
@@ -29,9 +29,11 @@
   <groupId>org.apache.activemq</groupId>
   <artifactId>apollo-stomp</artifactId>
   <version>1.0-SNAPSHOT</version>
-  <packaging>bundle</packaging>
+  <!-- <packaging>bundle</packaging> -->
 
   <name>${project.artifactId}</name>
+  <description>STOMP messaging protocol</description>
+  
   <properties>
   </properties>
 
@@ -132,6 +134,27 @@
 
   <build>
     <plugins>
+
+      <plugin>
+        <groupId>org.fusesource.mvnplugins</groupId>
+        <artifactId>maven-fab-plugin</artifactId>
+        <version>1.16-SNAPSHOT</version>
+        <configuration>
+          <descriptor>
+            <Name>stomp</Name>
+            <Long-Description></Long-Description>
+            <Extends>${project.groupId}:apollo-cli:${project.version}</Extends>
+          </descriptor>
+        </configuration>
+        <executions>
+          <execution>
+            <goals>
+              <goal>generate</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+
       <!-- Generate a test jar for the test cases in this package -->
       <plugin>
         <artifactId>maven-jar-plugin</artifactId>

Modified: activemq/activemq-apollo/trunk/apollo-tcp/pom.xml
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-tcp/pom.xml?rev=1151548&r1=1151547&r2=1151548&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-tcp/pom.xml (original)
+++ activemq/activemq-apollo/trunk/apollo-tcp/pom.xml Wed Jul 27 17:32:25 2011
@@ -28,7 +28,7 @@
   <groupId>org.apache.activemq</groupId>
   <artifactId>apollo-tcp</artifactId>
   <version>1.0-SNAPSHOT</version>
-  <packaging>bundle</packaging>
+  <!-- <packaging>bundle</packaging> -->
 
   <name>${project.artifactId}</name>
   <properties>

Modified: activemq/activemq-apollo/trunk/apollo-transport/pom.xml
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-transport/pom.xml?rev=1151548&r1=1151547&r2=1151548&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-transport/pom.xml (original)
+++ activemq/activemq-apollo/trunk/apollo-transport/pom.xml Wed Jul 27 17:32:25 2011
@@ -28,7 +28,7 @@
   <groupId>org.apache.activemq</groupId>
   <artifactId>apollo-transport</artifactId>
   <version>1.0-SNAPSHOT</version>
-  <packaging>bundle</packaging>
+  <!-- <packaging>bundle</packaging> -->
 
   <name>${project.artifactId}</name>
 

Modified: activemq/activemq-apollo/trunk/apollo-util/pom.xml
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-util/pom.xml?rev=1151548&r1=1151547&r2=1151548&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-util/pom.xml (original)
+++ activemq/activemq-apollo/trunk/apollo-util/pom.xml Wed Jul 27 17:32:25 2011
@@ -29,7 +29,7 @@
   <groupId>org.apache.activemq</groupId>
   <artifactId>apollo-util</artifactId>
   <version>1.0-SNAPSHOT</version>
-  <packaging>bundle</packaging>
+  <!-- <packaging>bundle</packaging> -->
 
   <name>${project.artifactId}</name>
 

Modified: activemq/activemq-apollo/trunk/apollo-web/pom.xml
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-web/pom.xml?rev=1151548&r1=1151547&r2=1151548&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-web/pom.xml (original)
+++ activemq/activemq-apollo/trunk/apollo-web/pom.xml Wed Jul 27 17:32:25 2011
@@ -27,15 +27,14 @@
 
   <groupId>org.apache.activemq</groupId>
   <artifactId>apollo-web</artifactId>
-  <packaging>war</packaging>
+  <packaging>jar</packaging>
   <version>1.0-SNAPSHOT</version>
 
   <name>${project.artifactId}</name>
+  <description>Adds web administration support.</description>
 
   <properties>
     <jetty-port>8080</jetty-port>
-    <scalate.editor>${env.SCALATE_EDITOR}</scalate.editor>
-    <scalate.workdir>${basedir}/target/_scalate</scalate.workdir>
     <netbeans.hint.deploy.server>Tomcat60</netbeans.hint.deploy.server>
   </properties>
 
@@ -84,14 +83,6 @@
     </dependency>
 
     <dependency>
-      <groupId>org.osgi</groupId>
-      <artifactId>org.osgi.core</artifactId>
-      <version>${osgi-version}</version>
-      <scope>provided</scope>
-      <optional>true</optional>
-    </dependency>
-
-    <dependency>
       <groupId>net.sf.josql</groupId>
       <artifactId>josql</artifactId>
       <version>${josql-version}</version>
@@ -165,6 +156,26 @@
     <plugins>
 
       <plugin>
+        <groupId>org.fusesource.mvnplugins</groupId>
+        <artifactId>maven-fab-plugin</artifactId>
+        <version>1.16-SNAPSHOT</version>
+        <configuration>
+          <descriptor>
+            <Name>web</Name>
+            <Long-Description></Long-Description>
+            <Extends>${project.groupId}:apollo-cli:${project.version}</Extends>
+          </descriptor>
+        </configuration>
+        <executions>
+          <execution>
+            <goals>
+              <goal>generate</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+
+      <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-surefire-plugin</artifactId>
         <version>${maven-surefire-plugin-version}</version>
@@ -194,11 +205,11 @@
           <systemProperties>
             <systemProperty>
               <name>scalate.editor</name>
-              <value>${scalate.editor}</value>
+              <value>${env.SCALATE_EDITOR}</value>
             </systemProperty>
             <systemProperty>
               <name>scalate.workdir</name>
-              <value>${scalate.workdir}</value>
+              <value>${basedir}/target/_scalate</value>
             </systemProperty>
           </systemProperties>
           <scanIntervalSeconds>0</scanIntervalSeconds>
@@ -216,7 +227,6 @@
             </goals>
             <configuration>
               <templates>
-                <!-- pre compile some templates that are in the classpath -->
                 <template>/WEB-INF/scalate/errors/500.scaml</template>
               </templates>
               <bootClassName>org.apache.activemq.apollo.web.Boot</bootClassName>
@@ -224,156 +234,47 @@
           </execution>
         </executions>
       </plugin>
-      
-      <plugin>
-        <groupId>org.apache.felix</groupId>
-        <artifactId>maven-bundle-plugin</artifactId>
-        <extensions>true</extensions>
-        <inherited>true</inherited>
-        <executions>
-          <execution>
-            <id>bundle-manifest</id>
-            <phase>prepare-package</phase>
-            <goals>
-              <goal>manifest</goal>
-            </goals>
-            <configuration>
-              <supportedProjectTypes>
-                <supportedProjectType>war</supportedProjectType>
-              </supportedProjectTypes>
-              <instructions>
-                <Webapp-Context>apollo</Webapp-Context>
-                <Webapp-Deploy>false</Webapp-Deploy>
-              </instructions>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
 
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-jar-plugin</artifactId>
         <version>2.3.1</version>
         <executions>
+          <!-- embed the wabapp resources in jar as resource -->
           <execution>
+            <id>webapp.war</id>
+            <phase>process-resources</phase>
             <goals>
               <goal>jar</goal>
             </goals>
+            <configuration>
+              <outputDirectory>${basedir}/target/classes/META-INF/services/org.apache.activemq.apollo</outputDirectory>
+              <finalName>webapp-resources</finalName>
+              <classesDirectory>${basedir}/src/main/webapp</classesDirectory>
+              <excludes>
+                <exclude>META-INF/**</exclude>
+                <exclude>**/*.scaml</exclude>
+                <exclude>**/*.jade</exclude>
+                <exclude>**/*.ssp</exclude>
+              </excludes>
+            </configuration>
           </execution>
         </executions>
         <configuration>
-          <classifier>slim</classifier>
           <archive>
-            <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
+            <manifestEntries>
+              <Fabric-Include-Optional-Dependency>
+                org.eclipse.jetty.aggregate:jetty-all-server
+              </Fabric-Include-Optional-Dependency>
+            </manifestEntries>
           </archive>
         </configuration>
       </plugin>
       
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-war-plugin</artifactId>
-        <version>2.1</version>
-        <configuration>
-          <archive>
-            <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
-          </archive>
-        </configuration>
-      </plugin>
-            
-      <plugin>
-        <groupId>org.fusesource.mvnplugins</groupId>
-        <artifactId>maven-uberize-plugin</artifactId>
-        <version>${mvnplugins-version}</version>
-        <executions>
-          <execution>
-            <id>slim</id>
-            <phase>package</phase>
-            <goals><goal>uberize</goal></goals>
-            <configuration>
-              <uberArtifactAttached>true</uberArtifactAttached>
-              <uberClassifierName>slim</uberClassifierName>
-              <artifactSet>
-                <includes>
-                  <include>org.apache.activemq:apollo-web</include>
-                </includes>
-              </artifactSet>            
-              <filters>
-                <filter>
-                  <artifact>org.apache.activemq:apollo-web</artifact>
-                  <excludes>
-                    <exclude>WEB-INF/classes/**</exclude>
-                    <exclude>WEB-INF/lib/**</exclude>
-                    <exclude>**/*.scaml</exclude>
-                    <exclude>**/*.jade</exclude>
-                    <exclude>**/*.ssp</exclude>
-                  </excludes>
-                </filter>
-              </filters>            
-            </configuration>
-          </execution>
-          <execution>
-            <id>osgi</id>
-            <phase>package</phase>
-            <goals><goal>uberize</goal></goals>
-            <configuration>
-              <uberArtifactAttached>true</uberArtifactAttached>
-              <uberClassifierName>osgi</uberClassifierName>
-              <artifactSet>
-                <includes>
-                  <include>org.apache.activemq:apollo-web</include>
-                </includes>
-              </artifactSet>            
-              <filters>
-                <filter>
-                  <artifact>org.apache.activemq:apollo-web</artifact>
-                  <excludes>
-                    <exclude>WEB-INF/lib/**</exclude>
-                    <!-- <exclude>**/*.scaml</exclude>
-                    <exclude>**/*.jade</exclude>
-                    <exclude>**/*.ssp</exclude> -->
-                  </excludes>
-                </filter>
-              </filters>
-              <transformers>
-                <transformer implementation="org.fusesource.mvnplugins.uberize.transformer.ManifestEditor">
-                  <manifestEntries>
-                    <Bundle-ClassPath>WEB-INF/classes</Bundle-ClassPath>
-                  </manifestEntries>
-                </transformer>
-              </transformers>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-      
     </plugins>
   </build>
   
   <profiles>
-
-    <profile>
-      <id>dev</id>
-      <!--<activation>-->
-        <!--<activeByDefault>true</activeByDefault>-->
-      <!--</activation>-->
-      <dependencies>
-        <!-- include the scalate overlay during development =-->
-        <dependency>
-          <groupId>org.fusesource.scalate</groupId>
-          <artifactId>scalate-war</artifactId>
-          <version>${scalate-version}</version>
-          <type>war</type>
-        </dependency>
-      </dependencies>
-    </profile>
-
-    <profile>
-      <id>release</id>
-      <build>
-        <plugins>
-        </plugins>
-      </build>
-    </profile>
   </profiles> 
    
 </project>

Modified: activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/WEB-INF/web.xml?rev=1151548&r1=1151547&r2=1151548&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/WEB-INF/web.xml (original)
+++ activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/WEB-INF/web.xml Wed Jul 27 17:32:25 2011
@@ -53,6 +53,8 @@
       <param-value>
         org.apache.activemq.apollo.web.resources.RootResource,
         org.apache.activemq.apollo.web.resources.JacksonJsonProvider
+        org.fusesource.scalate.jersey.ScalateTemplateProvider
+        org.fusesource.scalate.jersey.ScalateTemplateProcessor
       </param-value>
     </init-param>
     <init-param>

Modified: activemq/activemq-apollo/trunk/pom.xml
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/pom.xml?rev=1151548&r1=1151547&r2=1151548&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/pom.xml (original)
+++ activemq/activemq-apollo/trunk/pom.xml Wed Jul 27 17:32:25 2011
@@ -126,7 +126,7 @@
     
     <!-- osgi stuff -->
     <osgi-version>4.2.0</osgi-version>
-    <karaf-version>2.2.0</karaf-version>
+    <karaf-version>2.2.2</karaf-version>
     <features-maven-plugin-version>2.1.0</features-maven-plugin-version>
     
     <osgi.fragment.host>${project.groupId}.apollo-broker</osgi.fragment.host>
@@ -393,7 +393,7 @@
         </executions>
       </plugin>
       
-      <plugin>
+      <!-- <plugin>
         <groupId>org.apache.felix</groupId>
         <artifactId>maven-bundle-plugin</artifactId>
         <version>2.3.4</version>
@@ -415,7 +415,7 @@
             <_failok>false</_failok>
           </instructions>
         </configuration>
-      </plugin>
+      </plugin> -->
       
     </plugins>
   </build>