activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r1073252 - in /activemq/activemq-apollo/trunk: apollo-broker/pom.xml apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/osgi/OsgiWebServerFactory.scala pom.xml
Date Tue, 22 Feb 2011 08:38:43 GMT
Author: chirino
Date: Tue Feb 22 08:38:42 2011
New Revision: 1073252

URL: http://svn.apache.org/viewvc?rev=1073252&view=rev
Log:
Merged in osgi web server impl.

Added:
    activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/osgi/OsgiWebServerFactory.scala
Modified:
    activemq/activemq-apollo/trunk/apollo-broker/pom.xml
    activemq/activemq-apollo/trunk/pom.xml

Modified: activemq/activemq-apollo/trunk/apollo-broker/pom.xml
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-broker/pom.xml?rev=1073252&r1=1073251&r2=1073252&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-broker/pom.xml (original)
+++ activemq/activemq-apollo/trunk/apollo-broker/pom.xml Tue Feb 22 08:38:42 2011
@@ -107,6 +107,13 @@
       <scope>provided</scope>
     </dependency>
 
+    <dependency>
+      <groupId>org.ops4j.pax.web</groupId>
+      <artifactId>pax-web-spi</artifactId>
+      <version>${pax-web-version}</version>
+      <optional>true</optional>
+    </dependency>
+
     <!-- Scala Support -->
     <dependency>
       <groupId>org.scala-lang</groupId>

Added: activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/osgi/OsgiWebServerFactory.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/osgi/OsgiWebServerFactory.scala?rev=1073252&view=auto
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/osgi/OsgiWebServerFactory.scala
(added)
+++ activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/osgi/OsgiWebServerFactory.scala
Tue Feb 22 08:38:42 2011
@@ -0,0 +1,69 @@
+package org.apache.activemq.apollo.broker.osgi
+
+import org.apache.activemq.apollo.broker.web.{WebServerFactory, WebServer}
+import org.apache.activemq.apollo.util.{Reporter, ReporterLevel}
+import org.apache.activemq.apollo.broker.Broker
+import org.fusesource.hawtdispatch._
+import org.apache.activemq.apollo.dto.WebAdminDTO
+
+import BrokerService._
+import org.osgi.framework.{ServiceReference, BundleContext}
+import org.osgi.util.tracker.{ServiceTrackerCustomizer, ServiceTracker}
+import org.ops4j.pax.web.service.spi.WarManager
+
+object OsgiWebServerFactory extends WebServerFactory.Provider with WebServer {
+
+  var war_manager:WarManager = _
+  var started_config:WebAdminDTO = null
+
+  val war_manager_tracker = new ServiceTracker(context, classOf[WarManager].getName, new
ServiceTrackerCustomizer {
+
+    def addingService(reference: ServiceReference): AnyRef = OsgiWebServerFactory.synchronized
{
+      war_manager = context.getService(reference).asInstanceOf[WarManager]
+      if( started_config!=null ) {
+        war_manager.start(context.getBundle.getBundleId, started_config.prefix )
+      }
+      war_manager
+    }
+
+    def removedService(reference: ServiceReference, service: AnyRef): Unit = OsgiWebServerFactory.synchronized
{
+      context.ungetService(reference)
+      war_manager = null
+    }
+
+    def modifiedService(reference: ServiceReference, service: AnyRef): Unit = {
+    }
+  })
+  war_manager_tracker.open();
+
+  def create(broker:Broker): WebServer = this
+
+  def validate(config: WebAdminDTO, reporter: Reporter): ReporterLevel.ReporterLevel = OsgiWebServerFactory.synchronized
{
+    import ReporterLevel._
+    return INFO
+  }
+
+  def start: Unit = start(NOOP)
+  def stop: Unit = stop(NOOP)
+
+  def start(onComplete: Runnable): Unit = Broker.BLOCKABLE_THREAD_POOL {
+    OsgiWebServerFactory.synchronized {
+      started_config = broker.config.web_admin
+      if( war_manager!=null ) {
+        war_manager.start(context.getBundle.getBundleId, started_config.prefix )
+      }
+    }
+    onComplete.run
+  }
+  def stop(onComplete: Runnable): Unit = Broker.BLOCKABLE_THREAD_POOL {
+    OsgiWebServerFactory.synchronized {
+      if( war_manager!=null ) {
+        war_manager.stop(context.getBundle.getBundleId)
+      }
+      started_config = null
+    }
+    onComplete.run
+  }
+
+}
+

Modified: activemq/activemq-apollo/trunk/pom.xml
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/pom.xml?rev=1073252&r1=1073251&r2=1073252&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/pom.xml (original)
+++ activemq/activemq-apollo/trunk/pom.xml Tue Feb 22 08:38:42 2011
@@ -126,6 +126,8 @@
     <!-- osgi stuff -->
     <osgi-version>4.2.0</osgi-version>
     <karaf-version>2.99.99-SNAPSHOT</karaf-version>
+    <karaf-version>2.1.2</karaf-version>
+    <pax-web-version>1.1.0-SNAPSHOT</pax-web-version>
     <features-maven-plugin-version>2.1.0</features-maven-plugin-version>
     
     <osgi.fragment.host>${project.groupId}.apollo-broker</osgi.fragment.host>
@@ -717,6 +719,14 @@
           <url>http://download.oracle.com/maven</url>
           <layout>default</layout>
         </repository>
+        
+        <repository>
+          <id>ops4j.sonatype.snapshots.deploy</id>
+          <name>OPS4J snapshot repository</name>
+          <url>https://oss.sonatype.org/content/repositories/ops4j-snapshots/</url>
+          <snapshots><enabled>true</enabled></snapshots>
+          <releases><enabled>false</enabled></releases>
+        </repository>
     
       </repositories>
 



Mime
View raw message