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/02/04 19:02:21 UTC
svn commit: r1067244 - in /activemq/activemq-apollo/trunk: ./
apollo-bdb/src/main/resources/META-INF/services/org.apache.activemq.apollo/
apollo-bdb/src/main/resources/OSGI-INF/blueprint/
apollo-bdb/src/main/scala/org/apache/activemq/apollo/broker/stor...
Author: chirino
Date: Fri Feb 4 18:02:19 2011
New Revision: 1067244
URL: http://svn.apache.org/viewvc?rev=1067244&view=rev
Log:
Simplified OSGi integration by just using bundle fragments.
Added:
activemq/activemq-apollo/trunk/apollo-bdb/src/main/resources/META-INF/services/org.apache.activemq.apollo/modules.index
- copied, changed from r1066696, activemq/activemq-apollo/trunk/apollo-bdb/src/main/resources/META-INF/services/org.apache.activemq.apollo/xml-packages.index
activemq/activemq-apollo/trunk/apollo-bdb/src/main/scala/org/apache/activemq/apollo/broker/store/bdb/ExtensionModule.scala
- copied, changed from r1066696, activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/Boot.scala
activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/jetty/
activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/jetty/JettyWebServer.scala
- copied, changed from r1066696, activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/web/WebServer.scala
activemq/activemq-apollo/trunk/apollo-cassandra/src/main/resources/META-INF/services/org.apache.activemq.apollo/modules.index
- copied, changed from r1066696, activemq/activemq-apollo/trunk/apollo-dto/src/main/resources/META-INF/services/org.apache.activemq.apollo/xml-packages.index
activemq/activemq-apollo/trunk/apollo-cassandra/src/main/scala/org/apache/activemq/apollo/broker/store/cassandra/ExtensionModule.scala
- copied, changed from r1066696, activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/Boot.scala
activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/ExtensionModule.java
- copied, changed from r1066696, activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/Boot.scala
activemq/activemq-apollo/trunk/apollo-dto/src/main/resources/META-INF/services/org.apache.activemq.apollo/modules.index
- copied, changed from r1066696, activemq/activemq-apollo/trunk/apollo-dto/src/main/resources/META-INF/services/org.apache.activemq.apollo/xml-packages.index
activemq/activemq-apollo/trunk/apollo-hawtdb/src/main/resources/META-INF/services/org.apache.activemq.apollo/modules.index
- copied, changed from r1066696, activemq/activemq-apollo/trunk/apollo-cassandra/src/main/resources/META-INF/services/org.apache.activemq.apollo/xml-packages.index
activemq/activemq-apollo/trunk/apollo-hawtdb/src/main/scala/org/apache/activemq/apollo/broker/store/hawtdb/ExtensionModule.scala
- copied, changed from r1066696, activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/Boot.scala
activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/resources/META-INF/services/org.apache.activemq.apollo/modules.index
- copied, changed from r1066696, activemq/activemq-apollo/trunk/apollo-cassandra/src/main/resources/META-INF/services/org.apache.activemq.apollo/xml-packages.index
activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/scala/org/apache/activemq/apollo/broker/store/jdbm2/ExtensionModule.scala
- copied, changed from r1066696, activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/Boot.scala
activemq/activemq-apollo/trunk/apollo-selector/src/main/java/org/apache/activemq/apollo/filter/ExtensionModule.java
- copied, changed from r1066696, activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/Boot.scala
activemq/activemq-apollo/trunk/apollo-selector/src/main/resources/
activemq/activemq-apollo/trunk/apollo-selector/src/main/resources/META-INF/
activemq/activemq-apollo/trunk/apollo-selector/src/main/resources/META-INF/services/
activemq/activemq-apollo/trunk/apollo-selector/src/main/resources/META-INF/services/org.apache.activemq.apollo/
activemq/activemq-apollo/trunk/apollo-selector/src/main/resources/META-INF/services/org.apache.activemq.apollo/modules.index
- copied, changed from r1066696, activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/resources/META-INF/services/org.apache.activemq.apollo/xml-packages.index
activemq/activemq-apollo/trunk/apollo-tcp/src/main/java/org/apache/activemq/apollo/transport/tcp/ExtensionModule.java
- copied, changed from r1066696, activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/Boot.scala
activemq/activemq-apollo/trunk/apollo-tcp/src/main/resources/META-INF/services/org.apache.activemq.apollo/modules.index
- copied, changed from r1066696, activemq/activemq-apollo/trunk/apollo-cassandra/src/main/resources/META-INF/services/org.apache.activemq.apollo/xml-packages.index
activemq/activemq-apollo/trunk/apollo-transport/src/main/java/org/apache/activemq/apollo/transport/ExtensionModule.java
- copied, changed from r1066696, activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/Boot.scala
activemq/activemq-apollo/trunk/apollo-transport/src/main/resources/META-INF/services/org.apache.activemq.apollo/modules.index
- copied, changed from r1066696, activemq/activemq-apollo/trunk/apollo-hawtdb/src/main/resources/META-INF/services/org.apache.activemq.apollo/xml-packages.index
activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/Module.scala
activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/JerseyServletContainer.scala
- copied, changed from r1066696, activemq/activemq-apollo/trunk/apollo-web/src/test/scala/org/apache/activemq/apollo/web/ResourcesTest.scala
activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/osgi/
activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/osgi/OsgiWebServerFactory.scala
activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/META-INF/
activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/META-INF/services/
activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/META-INF/services/org.apache.activemq.apollo/
activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/META-INF/services/org.apache.activemq.apollo/modules.index
- copied, changed from r1066696, activemq/activemq-apollo/trunk/apollo-bdb/src/main/resources/META-INF/services/org.apache.activemq.apollo/xml-packages.index
activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/META-INF/services/org.apache.activemq.apollo/web-server-factory.index
- copied, changed from r1066696, activemq/activemq-apollo/trunk/apollo-broker/src/main/resources/META-INF/services/org.apache.activemq.apollo/web-server-factory.index
activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/test.jade
Removed:
activemq/activemq-apollo/trunk/apollo-bdb/src/main/resources/META-INF/services/org.apache.activemq.apollo/xml-packages.index
activemq/activemq-apollo/trunk/apollo-bdb/src/main/resources/OSGI-INF/blueprint/apollo-services.xml
activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/web/WebServer.scala
activemq/activemq-apollo/trunk/apollo-cassandra/src/main/resources/META-INF/services/org.apache.activemq.apollo/xml-packages.index
activemq/activemq-apollo/trunk/apollo-cassandra/src/main/resources/OSGI-INF/blueprint/apollo-services.xml
activemq/activemq-apollo/trunk/apollo-cli/src/main/resources/OSGI-INF/blueprint/apollo-services.xml
activemq/activemq-apollo/trunk/apollo-dto/src/main/resources/META-INF/services/org.apache.activemq.apollo/xml-packages.index
activemq/activemq-apollo/trunk/apollo-hawtdb/src/main/resources/META-INF/services/org.apache.activemq.apollo/xml-packages.index
activemq/activemq-apollo/trunk/apollo-hawtdb/src/main/resources/OSGI-INF/blueprint/apollo-services.xml
activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/resources/META-INF/services/org.apache.activemq.apollo/xml-packages.index
activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/resources/OSGI-INF/blueprint/apollo-services.xml
activemq/activemq-apollo/trunk/apollo-stomp/src/main/resources/OSGI-INF/blueprint/apollo-services.xml
activemq/activemq-apollo/trunk/apollo-tcp/src/main/resources/OSGI-INF/blueprint/apollo-services.xml
activemq/activemq-apollo/trunk/apollo-transport/src/main/resources/OSGI-INF/blueprint/apollo-services.xml
activemq/activemq-apollo/trunk/apollo-util/src/main/resources/OSGI-INF/blueprint/utils.xml
activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/osgi/ClassFinderLoader.scala
activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/osgi/ClassFinderServiceExporter.scala
activemq/activemq-apollo/trunk/apollo-web/src/main/resources/logback.xml
Modified:
activemq/activemq-apollo/trunk/apollo-broker/pom.xml
activemq/activemq-apollo/trunk/apollo-broker/src/main/resources/META-INF/services/org.apache.activemq.apollo/web-server-factory.index
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/Broker.scala
activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/osgi/BrokerService.scala
activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/web/WebServerFactory.scala
activemq/activemq-apollo/trunk/apollo-dto/pom.xml
activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/XmlCodec.java
activemq/activemq-apollo/trunk/apollo-util/pom.xml
activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/ClassFinder.scala
activemq/activemq-apollo/trunk/apollo-web/pom.xml
activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/Boot.scala
activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/ScalatePackage.scala
activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/WEB-INF/web.xml
activemq/activemq-apollo/trunk/apollo-web/src/test/scala/org/apache/activemq/apollo/web/ResourcesTest.scala
activemq/activemq-apollo/trunk/pom.xml
Copied: activemq/activemq-apollo/trunk/apollo-bdb/src/main/resources/META-INF/services/org.apache.activemq.apollo/modules.index (from r1066696, activemq/activemq-apollo/trunk/apollo-bdb/src/main/resources/META-INF/services/org.apache.activemq.apollo/xml-packages.index)
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-bdb/src/main/resources/META-INF/services/org.apache.activemq.apollo/modules.index?p2=activemq/activemq-apollo/trunk/apollo-bdb/src/main/resources/META-INF/services/org.apache.activemq.apollo/modules.index&p1=activemq/activemq-apollo/trunk/apollo-bdb/src/main/resources/META-INF/services/org.apache.activemq.apollo/xml-packages.index&r1=1066696&r2=1067244&rev=1067244&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-bdb/src/main/resources/META-INF/services/org.apache.activemq.apollo/xml-packages.index (original)
+++ activemq/activemq-apollo/trunk/apollo-bdb/src/main/resources/META-INF/services/org.apache.activemq.apollo/modules.index Fri Feb 4 18:02:19 2011
@@ -14,4 +14,4 @@
## See the License for the specific language governing permissions and
## limitations under the License.
## ---------------------------------------------------------------------------
-org.apache.activemq.apollo.broker.store.bdb.dto
+org.apache.activemq.apollo.broker.store.bdb.ExtensionModule
\ No newline at end of file
Copied: activemq/activemq-apollo/trunk/apollo-bdb/src/main/scala/org/apache/activemq/apollo/broker/store/bdb/ExtensionModule.scala (from r1066696, activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/Boot.scala)
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-bdb/src/main/scala/org/apache/activemq/apollo/broker/store/bdb/ExtensionModule.scala?p2=activemq/activemq-apollo/trunk/apollo-bdb/src/main/scala/org/apache/activemq/apollo/broker/store/bdb/ExtensionModule.scala&p1=activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/Boot.scala&r1=1066696&r2=1067244&rev=1067244&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/Boot.scala (original)
+++ activemq/activemq-apollo/trunk/apollo-bdb/src/main/scala/org/apache/activemq/apollo/broker/store/bdb/ExtensionModule.scala Fri Feb 4 18:02:19 2011
@@ -1,3 +1,5 @@
+package org.apache.activemq.apollo.broker.store.bdb
+
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -14,19 +16,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.activemq.apollo.web
-
-import org.fusesource.scalate.TemplateEngine
+import org.apache.activemq.apollo.util.Module
-class Boot(engine: TemplateEngine) {
-
- // Put some references to the jersey classes in our code so that the osgi
- // metadata creates the proper imports.
- val we_are_using = Array(
- classOf[com.sun.jersey.spi.container.servlet.ServletContainer]
- )
-
- def run: Unit = {
- engine.packagePrefix = "org.apache.activemq.apollo.web.templates"
- }
+/**
+ * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
+ */
+class ExtensionModule extends Module {
+ override def xml_packages = Array("org.apache.activemq.apollo.broker.store.bdb.dto")
}
\ No newline at end of file
Modified: activemq/activemq-apollo/trunk/apollo-broker/pom.xml
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-broker/pom.xml?rev=1067244&r1=1067243&r2=1067244&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-broker/pom.xml (original)
+++ activemq/activemq-apollo/trunk/apollo-broker/pom.xml Fri Feb 4 18:02:19 2011
@@ -35,6 +35,7 @@
<name>${project.artifactId}</name>
<properties>
+ <osgi.fragment.host></osgi.fragment.host>
</properties>
<dependencies>
@@ -105,6 +106,12 @@
<version>${osgi-version}</version>
<scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>org.ops4j.pax.web</groupId>
+ <artifactId>pax-web-extender-war</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <optional>true</optional>
+ </dependency>
<!-- Scala Support -->
<dependency>
Modified: activemq/activemq-apollo/trunk/apollo-broker/src/main/resources/META-INF/services/org.apache.activemq.apollo/web-server-factory.index
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-broker/src/main/resources/META-INF/services/org.apache.activemq.apollo/web-server-factory.index?rev=1067244&r1=1067243&r2=1067244&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-broker/src/main/resources/META-INF/services/org.apache.activemq.apollo/web-server-factory.index (original)
+++ activemq/activemq-apollo/trunk/apollo-broker/src/main/resources/META-INF/services/org.apache.activemq.apollo/web-server-factory.index Fri Feb 4 18:02:19 2011
@@ -14,4 +14,4 @@
## See the License for the specific language governing permissions and
## limitations under the License.
## ---------------------------------------------------------------------------
-org.apache.activemq.apollo.broker.web.JettyWebServerFactory
+org.apache.activemq.apollo.broker.jetty.JettyWebServerFactory
Modified: 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-broker/src/main/resources/OSGI-INF/blueprint/broker.xml?rev=1067244&r1=1067243&r2=1067244&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-broker/src/main/resources/OSGI-INF/blueprint/broker.xml (original)
+++ activemq/activemq-apollo/trunk/apollo-broker/src/main/resources/OSGI-INF/blueprint/broker.xml Fri Feb 4 18:02:19 2011
@@ -38,9 +38,4 @@
<property name="configAdmin" ref="configAdmin"/>
</bean>
- <bean id="exporter" class="org.apache.activemq.apollo.util.osgi.ClassFinderServiceExporter"
- init-method="start" destroy-method="stop">
- <property name="context" ref="blueprintBundleContext"/>
- </bean>
-
</blueprint>
\ No newline at end of file
Modified: activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Broker.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Broker.scala?rev=1067244&r1=1067243&r2=1067244&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Broker.scala (original)
+++ activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Broker.scala Fri Feb 4 18:02:19 2011
@@ -145,6 +145,7 @@ object Broker extends Log {
val STICK_ON_THREAD_QUEUES = true
+ def class_loader:ClassLoader = ClassFinder.class_loader
/**
* Creates a default a configuration object.
@@ -283,8 +284,13 @@ class Broker() extends BaseService {
val second_tracker = new LoggingTracker("broker startup", dispatch_queue)
Option(config.web_admin).foreach{ web_admin=>
- web_server = WebServerFactory.create(this)
- second_tracker.start(web_server)
+ WebServerFactory.create(this) match {
+ case null =>
+ warn("Could not start admistration interface.")
+ case x =>
+ web_server = x
+ second_tracker.start(web_server)
+ }
}
virtual_hosts.valuesIterator.foreach( x=>
@@ -316,9 +322,7 @@ class Broker() extends BaseService {
tracker.stop(x)
)
- if( web_server!=null ) {
- tracker.stop(web_server)
- }
+ Option(web_server).foreach(tracker.stop(_))
BrokerRegistry.remove(this)
tracker.callback(on_completed)
Copied: activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/jetty/JettyWebServer.scala (from r1066696, activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/web/WebServer.scala)
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/jetty/JettyWebServer.scala?p2=activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/jetty/JettyWebServer.scala&p1=activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/web/WebServer.scala&r1=1066696&r2=1067244&rev=1067244&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/web/WebServer.scala (original)
+++ activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/jetty/JettyWebServer.scala Fri Feb 4 18:02:19 2011
@@ -14,9 +14,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.activemq.apollo.broker.web
+package org.apache.activemq.apollo.broker.jetty
-import org.apache.activemq.apollo.dto.WebAdminDTO
import org.eclipse.jetty.server.{Connector, Handler, Server}
import org.eclipse.jetty.security._
import org.apache.activemq.apollo.dto.{WebAdminDTO, PrincipalDTO}
@@ -29,6 +28,7 @@ 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}
/**
* <p>
@@ -36,16 +36,28 @@ import java.lang.String
*
* @author <a href="http://hiramchirino.com">Hiram Chirino</a>
*/
-trait WebServer extends Service
-
object JettyWebServerFactory extends WebServerFactory.Provider {
- // So that the factory class does not load, if we can not load jetty.
- private val LOAD_JETTY = classOf[LoginService]
+ // Enabled this factory if we can load the jetty classes.
+ val enabled = try {
+ getClass.getClassLoader.loadClass(classOf[WebAppContext].getName)
+ true
+ } catch {
+ case _ =>
+ false
+ }
- def create(broker:Broker): WebServer = new JettyWebServer(broker)
+ def create(broker:Broker): WebServer = {
+ if( !enabled ) {
+ return null
+ }
+ new JettyWebServer(broker)
+ }
def validate(config: WebAdminDTO, reporter: Reporter): ReporterLevel.ReporterLevel = {
+ if( !enabled ) {
+ return null
+ }
import ReporterLevel._
if( JettyWebServer.webapp==null ) {
reporter.report(ERROR, "The apollo.home or apollo.webapp system property must be set so that the webconsole can be started.")
@@ -55,6 +67,12 @@ object JettyWebServerFactory extends Web
}
}
+/**
+ * <p>
+ * </p>
+ *
+ * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
+ */
object JettyWebServer extends Log {
@@ -82,7 +100,7 @@ object JettyWebServer extends Log {
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 )
@@ -91,9 +109,9 @@ object JettyWebServer extends Log {
} else {
null
}
-
+
} else 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 ) {
@@ -104,7 +122,7 @@ object JettyWebServer extends Log {
} else {
null
}
-
+
}
}
rc
Modified: activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/osgi/BrokerService.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/osgi/BrokerService.scala?rev=1067244&r1=1067243&r2=1067244&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/osgi/BrokerService.scala (original)
+++ activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/osgi/BrokerService.scala Fri Feb 4 18:02:19 2011
@@ -16,13 +16,10 @@
*/
package org.apache.activemq.apollo.broker.osgi
-import java.net.URL
import org.apache.activemq.apollo.broker.Broker
import org.fusesource.hawtdispatch._
-import java.lang.Class
import org.apache.activemq.apollo.dto.{XmlCodec, BrokerDTO}
import org.osgi.service.cm.ConfigurationAdmin
-import java.util.Enumeration
import org.osgi.framework._
import java.lang.String
import collection.JavaConversions._
@@ -30,7 +27,6 @@ import java.util.Properties
import org.apache.activemq.apollo.util._
import FileSupport._
import java.io.{FileInputStream, File}
-
/**
* @author <a href="http://hiramchirino.com">Hiram Chirino</a>
*/
@@ -49,9 +45,6 @@ object BrokerService extends Log {
return;
}
- // this makes jaxb happy
- Thread.currentThread().setContextClassLoader(JaxbClassLoader(context))
-
// in case the config gets injected.
val dto = if( config != null ) {
config
@@ -90,6 +83,7 @@ object BrokerService extends Log {
} catch {
case e: Throwable =>
+ e.printStackTrace
stop
error(e)
}
@@ -124,73 +118,3 @@ class BrokerService {
def stop() = BrokerService.stop
}
-/**
- * We need to setup a context class loader because apollo allows
- * optional/plugin modules to dynamically add to the JAXB context.
- *
- * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
- */
-case class JaxbClassLoader(context: BundleContext) extends ClassLoader(classOf[JaxbClassLoader].getClassLoader) {
-
- def wait_for_start(bundle:Bundle):Option[Bundle] = {
- var i=0
- while(true) {
- i+=1
- bundle.getState match {
- case Bundle.UNINSTALLED=> return None
- case Bundle.RESOLVED=> return Some(bundle)
- case Bundle.ACTIVE=> return Some(bundle)
- case _ =>
- Thread.sleep(100)
- if( (i%50)==0 ) {
- println("Waiting on bundle: "+bundle.getSymbolicName);
- }
- }
- }
- None
- }
-
- val bundles = context.getBundles.flatMap { bundle =>
- if (bundle.getEntry("META-INF/services/org.apache.activemq.apollo/xml-packages.index")!=null ) {
- wait_for_start(bundle)
- } else {
- None
- }
- }
-
- override def findClass(name: String): Class[_] = {
- // try to find the class in one of the bundles.
- bundles.foreach{ bundle:Bundle =>
- try {
- return bundle.loadClass(name)
- } catch {
- case e:ClassNotFoundException => // ignore.
- }
- }
- super.findClass(name)
- }
-
- override def findResource(name: String): URL = {
- bundles.foreach{ bundle =>
- val rc = bundle.getResource(name)
- if( rc!=null ) {
- return rc
- }
- }
- null
- }
-
- override def findResources(name: String): Enumeration[URL] = {
- val list = new java.util.Vector[URL]
- bundles.foreach{ bundle =>
- val rc = bundle.getResources(name)
- if( rc!=null ) {
- rc.foreach{ x=>
- list.add( x.asInstanceOf[URL] )
- }
- }
- }
- list.elements
- }
-}
-
Modified: activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/web/WebServerFactory.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/web/WebServerFactory.scala?rev=1067244&r1=1067243&r2=1067244&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/web/WebServerFactory.scala (original)
+++ activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/web/WebServerFactory.scala Fri Feb 4 18:02:19 2011
@@ -18,8 +18,7 @@ package org.apache.activemq.apollo.broke
import org.apache.activemq.apollo.util._
import ReporterLevel._
-import org.apache.activemq.apollo.broker.store.Store
-import org.apache.activemq.apollo.dto.{WebAdminDTO, StoreDTO}
+import org.apache.activemq.apollo.dto.WebAdminDTO
import org.apache.activemq.apollo.broker.Broker
/**
@@ -28,6 +27,14 @@ import org.apache.activemq.apollo.broker
*
* @author <a href="http://hiramchirino.com">Hiram Chirino</a>
*/
+trait WebServer extends Service
+
+/**
+ * <p>
+ * </p>
+ *
+ * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
+ */
object WebServerFactory {
trait Provider {
@@ -47,7 +54,7 @@ object WebServerFactory {
return rc
}
}
- throw new IllegalArgumentException("Could not find a web server implementation to use.")
+ null
}
Copied: activemq/activemq-apollo/trunk/apollo-cassandra/src/main/resources/META-INF/services/org.apache.activemq.apollo/modules.index (from r1066696, activemq/activemq-apollo/trunk/apollo-dto/src/main/resources/META-INF/services/org.apache.activemq.apollo/xml-packages.index)
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-cassandra/src/main/resources/META-INF/services/org.apache.activemq.apollo/modules.index?p2=activemq/activemq-apollo/trunk/apollo-cassandra/src/main/resources/META-INF/services/org.apache.activemq.apollo/modules.index&p1=activemq/activemq-apollo/trunk/apollo-dto/src/main/resources/META-INF/services/org.apache.activemq.apollo/xml-packages.index&r1=1066696&r2=1067244&rev=1067244&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-dto/src/main/resources/META-INF/services/org.apache.activemq.apollo/xml-packages.index (original)
+++ activemq/activemq-apollo/trunk/apollo-cassandra/src/main/resources/META-INF/services/org.apache.activemq.apollo/modules.index Fri Feb 4 18:02:19 2011
@@ -14,4 +14,4 @@
## See the License for the specific language governing permissions and
## limitations under the License.
## ---------------------------------------------------------------------------
-org.apache.activemq.apollo.dto
\ No newline at end of file
+org.apache.activemq.apollo.broker.store.cassandra.ExtensionModule
\ No newline at end of file
Copied: activemq/activemq-apollo/trunk/apollo-cassandra/src/main/scala/org/apache/activemq/apollo/broker/store/cassandra/ExtensionModule.scala (from r1066696, activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/Boot.scala)
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-cassandra/src/main/scala/org/apache/activemq/apollo/broker/store/cassandra/ExtensionModule.scala?p2=activemq/activemq-apollo/trunk/apollo-cassandra/src/main/scala/org/apache/activemq/apollo/broker/store/cassandra/ExtensionModule.scala&p1=activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/Boot.scala&r1=1066696&r2=1067244&rev=1067244&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/Boot.scala (original)
+++ activemq/activemq-apollo/trunk/apollo-cassandra/src/main/scala/org/apache/activemq/apollo/broker/store/cassandra/ExtensionModule.scala Fri Feb 4 18:02:19 2011
@@ -1,3 +1,5 @@
+package org.apache.activemq.apollo.broker.store.cassandra
+
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -14,19 +16,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.activemq.apollo.web
-
-import org.fusesource.scalate.TemplateEngine
+import org.apache.activemq.apollo.util.Module
-class Boot(engine: TemplateEngine) {
-
- // Put some references to the jersey classes in our code so that the osgi
- // metadata creates the proper imports.
- val we_are_using = Array(
- classOf[com.sun.jersey.spi.container.servlet.ServletContainer]
- )
-
- def run: Unit = {
- engine.packagePrefix = "org.apache.activemq.apollo.web.templates"
- }
+/**
+ * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
+ */
+class ExtensionModule extends Module {
+ override def xml_packages = Array("org.apache.activemq.apollo.broker.store.cassandra.dto")
}
\ No newline at end of file
Modified: activemq/activemq-apollo/trunk/apollo-dto/pom.xml
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-dto/pom.xml?rev=1067244&r1=1067243&r2=1067244&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-dto/pom.xml (original)
+++ activemq/activemq-apollo/trunk/apollo-dto/pom.xml Fri Feb 4 18:02:19 2011
@@ -55,6 +55,11 @@
<version>${hawtbuf-version}</version>
<optional>true</optional>
</dependency>
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>apollo-util</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </dependency>
<!-- Testing Dependencies -->
<dependency>
Copied: activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/ExtensionModule.java (from r1066696, activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/Boot.scala)
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/ExtensionModule.java?p2=activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/ExtensionModule.java&p1=activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/Boot.scala&r1=1066696&r2=1067244&rev=1067244&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/Boot.scala (original)
+++ activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/ExtensionModule.java Fri Feb 4 18:02:19 2011
@@ -14,19 +14,22 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.activemq.apollo.web
+package org.apache.activemq.apollo.dto;
-import org.fusesource.scalate.TemplateEngine
+import org.apache.activemq.apollo.util.Module;
-class Boot(engine: TemplateEngine) {
-
- // Put some references to the jersey classes in our code so that the osgi
- // metadata creates the proper imports.
- val we_are_using = Array(
- classOf[com.sun.jersey.spi.container.servlet.ServletContainer]
- )
-
- def run: Unit = {
- engine.packagePrefix = "org.apache.activemq.apollo.web.templates"
- }
-}
\ No newline at end of file
+/**
+ * <p>
+ * </p>
+ *
+ * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
+ */
+public class ExtensionModule extends Module {
+
+ public String name() {
+ return "apollo-dto";
+ }
+ public String[] xml_packages() {
+ return new String[]{"org.apache.activemq.apollo.dto"};
+ }
+}
Modified: activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/XmlCodec.java
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/XmlCodec.java?rev=1067244&r1=1067243&r2=1067244&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/XmlCodec.java (original)
+++ activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/XmlCodec.java Fri Feb 4 18:02:19 2011
@@ -16,6 +16,10 @@
*/
package org.apache.activemq.apollo.dto;
+import org.apache.activemq.apollo.util.ClassFinder;
+import org.apache.activemq.apollo.util.Module;
+import org.apache.activemq.apollo.util.ModuleRegistry;
+
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
@@ -26,7 +30,6 @@ import javax.xml.stream.XMLStreamReader;
import javax.xml.stream.util.StreamReaderDelegate;
import java.io.*;
import java.net.URL;
-import java.util.Enumeration;
import java.util.HashSet;
import java.util.Properties;
import java.util.regex.Matcher;
@@ -75,64 +78,34 @@ public class XmlCodec {
}
private static final XMLInputFactory factory = XMLInputFactory.newInstance();
- private static final JAXBContext context;
-
- public static ClassLoader loader = Thread.currentThread().getContextClassLoader();
-
- static {
- try {
- String path = "META-INF/services/org.apache.activemq.apollo/xml-packages.index";
-
- HashSet<String> names = new HashSet<String>();
- try {
- Enumeration<URL> resources = loader.getResources(path);
-
- while (resources.hasMoreElements()) {
- URL url = resources.nextElement();
- Properties p = loadProperties(url.openStream());
- Enumeration<Object> keys = p.keys();
- while (keys.hasMoreElements()) {
- names.add((String) keys.nextElement());
- }
- }
-
- } catch (IOException e) {
- e.printStackTrace();
- }
-
- String packages = "";
- for ( String p : names) {
- if( packages.length() !=0 ) {
- packages += ":";
- }
- packages += p;
- }
- context = JAXBContext.newInstance(packages);
+ volatile public static JAXBContext _context;
- } catch (JAXBException e) {
- throw new RuntimeException(e);
+ private static JAXBContext context() throws JAXBException {
+ JAXBContext rc = _context;
+ if( rc==null ) {
+ rc = _context = createContext();
}
+ return rc;
}
- static private Properties loadProperties(InputStream is) {
- if (is == null) {
- return null;
+ private static JAXBContext createContext() throws JAXBException {
+ HashSet<String> names = new HashSet<String>();
+ for( Module m: ModuleRegistry.jsingletons()) {
+ for( String p:m.xml_packages() ) {
+ names.add(p);
+ }
}
- try {
- Properties p = new Properties();
- p.load(is);
- return p;
- } catch (Exception e) {
- return null;
- } finally {
- try {
- is.close();
- } catch (Throwable e) {
+
+ String packages = "";
+ for ( String p : names) {
+ if( packages.length() !=0 ) {
+ packages += ":";
}
+ packages += p;
}
+ return JAXBContext.newInstance(packages);
}
-
static public BrokerDTO unmarshalBrokerDTO(URL url) throws IOException, XMLStreamException, JAXBException {
return unmarshalBrokerDTO(url, null);
}
@@ -148,7 +121,7 @@ public class XmlCodec {
static public BrokerDTO unmarshalBrokerDTO(InputStream is, Properties props) throws IOException, XMLStreamException, JAXBException {
ClassLoader original = Thread.currentThread().getContextClassLoader();
try {
- Thread.currentThread().setContextClassLoader(loader);
+ Thread.currentThread().setContextClassLoader(ClassFinder.class_loader());
if (is == null) {
throw new IllegalArgumentException("input stream was null");
}
@@ -157,7 +130,7 @@ public class XmlCodec {
if (props != null) {
reader = new PropertiesFilter(reader, props);
}
- Unmarshaller unmarshaller = context.createUnmarshaller();
+ Unmarshaller unmarshaller = context().createUnmarshaller();
return (BrokerDTO) unmarshaller.unmarshal(reader);
} finally {
is.close();
@@ -169,11 +142,17 @@ public class XmlCodec {
}
static public void marshalBrokerDTO(BrokerDTO in, OutputStream os, boolean format) throws JAXBException {
- Marshaller marshaller = context.createMarshaller();
- if( format ) {
- marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, java.lang.Boolean.TRUE);
+ ClassLoader original = Thread.currentThread().getContextClassLoader();
+ try {
+ Thread.currentThread().setContextClassLoader(ClassFinder.class_loader());
+ Marshaller marshaller = context().createMarshaller();
+ if( format ) {
+ marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, java.lang.Boolean.TRUE);
+ }
+ marshaller.marshal(in, new OutputStreamWriter(os));
+ } finally {
+ Thread.currentThread().setContextClassLoader(original);
}
- marshaller.marshal(in, new OutputStreamWriter(os));
}
Copied: activemq/activemq-apollo/trunk/apollo-dto/src/main/resources/META-INF/services/org.apache.activemq.apollo/modules.index (from r1066696, activemq/activemq-apollo/trunk/apollo-dto/src/main/resources/META-INF/services/org.apache.activemq.apollo/xml-packages.index)
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-dto/src/main/resources/META-INF/services/org.apache.activemq.apollo/modules.index?p2=activemq/activemq-apollo/trunk/apollo-dto/src/main/resources/META-INF/services/org.apache.activemq.apollo/modules.index&p1=activemq/activemq-apollo/trunk/apollo-dto/src/main/resources/META-INF/services/org.apache.activemq.apollo/xml-packages.index&r1=1066696&r2=1067244&rev=1067244&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-dto/src/main/resources/META-INF/services/org.apache.activemq.apollo/xml-packages.index (original)
+++ activemq/activemq-apollo/trunk/apollo-dto/src/main/resources/META-INF/services/org.apache.activemq.apollo/modules.index Fri Feb 4 18:02:19 2011
@@ -14,4 +14,4 @@
## See the License for the specific language governing permissions and
## limitations under the License.
## ---------------------------------------------------------------------------
-org.apache.activemq.apollo.dto
\ No newline at end of file
+org.apache.activemq.apollo.dto.ExtensionModule
\ No newline at end of file
Copied: activemq/activemq-apollo/trunk/apollo-hawtdb/src/main/resources/META-INF/services/org.apache.activemq.apollo/modules.index (from r1066696, activemq/activemq-apollo/trunk/apollo-cassandra/src/main/resources/META-INF/services/org.apache.activemq.apollo/xml-packages.index)
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-hawtdb/src/main/resources/META-INF/services/org.apache.activemq.apollo/modules.index?p2=activemq/activemq-apollo/trunk/apollo-hawtdb/src/main/resources/META-INF/services/org.apache.activemq.apollo/modules.index&p1=activemq/activemq-apollo/trunk/apollo-cassandra/src/main/resources/META-INF/services/org.apache.activemq.apollo/xml-packages.index&r1=1066696&r2=1067244&rev=1067244&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-cassandra/src/main/resources/META-INF/services/org.apache.activemq.apollo/xml-packages.index (original)
+++ activemq/activemq-apollo/trunk/apollo-hawtdb/src/main/resources/META-INF/services/org.apache.activemq.apollo/modules.index Fri Feb 4 18:02:19 2011
@@ -14,4 +14,4 @@
## See the License for the specific language governing permissions and
## limitations under the License.
## ---------------------------------------------------------------------------
-org.apache.activemq.apollo.broker.store.cassandra.dto
+org.apache.activemq.apollo.broker.store.hawtdb.ExtensionModule
\ No newline at end of file
Copied: activemq/activemq-apollo/trunk/apollo-hawtdb/src/main/scala/org/apache/activemq/apollo/broker/store/hawtdb/ExtensionModule.scala (from r1066696, activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/Boot.scala)
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-hawtdb/src/main/scala/org/apache/activemq/apollo/broker/store/hawtdb/ExtensionModule.scala?p2=activemq/activemq-apollo/trunk/apollo-hawtdb/src/main/scala/org/apache/activemq/apollo/broker/store/hawtdb/ExtensionModule.scala&p1=activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/Boot.scala&r1=1066696&r2=1067244&rev=1067244&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/Boot.scala (original)
+++ activemq/activemq-apollo/trunk/apollo-hawtdb/src/main/scala/org/apache/activemq/apollo/broker/store/hawtdb/ExtensionModule.scala Fri Feb 4 18:02:19 2011
@@ -1,3 +1,5 @@
+package org.apache.activemq.apollo.broker.store.hawtdb
+
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -14,19 +16,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.activemq.apollo.web
-
-import org.fusesource.scalate.TemplateEngine
+import org.apache.activemq.apollo.util.Module
-class Boot(engine: TemplateEngine) {
-
- // Put some references to the jersey classes in our code so that the osgi
- // metadata creates the proper imports.
- val we_are_using = Array(
- classOf[com.sun.jersey.spi.container.servlet.ServletContainer]
- )
-
- def run: Unit = {
- engine.packagePrefix = "org.apache.activemq.apollo.web.templates"
- }
+/**
+ * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
+ */
+class ExtensionModule extends Module {
+ override def xml_packages = Array("org.apache.activemq.apollo.broker.store.hawtdb.dto")
}
\ No newline at end of file
Copied: activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/resources/META-INF/services/org.apache.activemq.apollo/modules.index (from r1066696, activemq/activemq-apollo/trunk/apollo-cassandra/src/main/resources/META-INF/services/org.apache.activemq.apollo/xml-packages.index)
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/resources/META-INF/services/org.apache.activemq.apollo/modules.index?p2=activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/resources/META-INF/services/org.apache.activemq.apollo/modules.index&p1=activemq/activemq-apollo/trunk/apollo-cassandra/src/main/resources/META-INF/services/org.apache.activemq.apollo/xml-packages.index&r1=1066696&r2=1067244&rev=1067244&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-cassandra/src/main/resources/META-INF/services/org.apache.activemq.apollo/xml-packages.index (original)
+++ activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/resources/META-INF/services/org.apache.activemq.apollo/modules.index Fri Feb 4 18:02:19 2011
@@ -14,4 +14,4 @@
## See the License for the specific language governing permissions and
## limitations under the License.
## ---------------------------------------------------------------------------
-org.apache.activemq.apollo.broker.store.cassandra.dto
+org.apache.activemq.apollo.broker.store.jdbm2.ExtensionModule
\ No newline at end of file
Copied: activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/scala/org/apache/activemq/apollo/broker/store/jdbm2/ExtensionModule.scala (from r1066696, activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/Boot.scala)
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/scala/org/apache/activemq/apollo/broker/store/jdbm2/ExtensionModule.scala?p2=activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/scala/org/apache/activemq/apollo/broker/store/jdbm2/ExtensionModule.scala&p1=activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/Boot.scala&r1=1066696&r2=1067244&rev=1067244&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/Boot.scala (original)
+++ activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/scala/org/apache/activemq/apollo/broker/store/jdbm2/ExtensionModule.scala Fri Feb 4 18:02:19 2011
@@ -1,3 +1,5 @@
+package org.apache.activemq.apollo.broker.store.jdbm2
+
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -14,19 +16,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.activemq.apollo.web
-
-import org.fusesource.scalate.TemplateEngine
+import org.apache.activemq.apollo.util.Module
-class Boot(engine: TemplateEngine) {
-
- // Put some references to the jersey classes in our code so that the osgi
- // metadata creates the proper imports.
- val we_are_using = Array(
- classOf[com.sun.jersey.spi.container.servlet.ServletContainer]
- )
-
- def run: Unit = {
- engine.packagePrefix = "org.apache.activemq.apollo.web.templates"
- }
+/**
+ * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
+ */
+class ExtensionModule extends Module {
+ override def xml_packages = Array("org.apache.activemq.apollo.broker.store.jdbm2.dto")
}
\ No newline at end of file
Copied: activemq/activemq-apollo/trunk/apollo-selector/src/main/java/org/apache/activemq/apollo/filter/ExtensionModule.java (from r1066696, activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/Boot.scala)
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-selector/src/main/java/org/apache/activemq/apollo/filter/ExtensionModule.java?p2=activemq/activemq-apollo/trunk/apollo-selector/src/main/java/org/apache/activemq/apollo/filter/ExtensionModule.java&p1=activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/Boot.scala&r1=1066696&r2=1067244&rev=1067244&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/Boot.scala (original)
+++ activemq/activemq-apollo/trunk/apollo-selector/src/main/java/org/apache/activemq/apollo/filter/ExtensionModule.java Fri Feb 4 18:02:19 2011
@@ -14,19 +14,20 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.activemq.apollo.web
+package org.apache.activemq.apollo.filter;
-import org.fusesource.scalate.TemplateEngine
+import org.apache.activemq.apollo.util.Module;
-class Boot(engine: TemplateEngine) {
-
- // Put some references to the jersey classes in our code so that the osgi
- // metadata creates the proper imports.
- val we_are_using = Array(
- classOf[com.sun.jersey.spi.container.servlet.ServletContainer]
- )
-
- def run: Unit = {
- engine.packagePrefix = "org.apache.activemq.apollo.web.templates"
- }
-}
\ No newline at end of file
+/**
+ * <p>
+ * </p>
+ *
+ * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
+ */
+public class ExtensionModule extends Module {
+
+ public String name() {
+ return "apollo-selector";
+ }
+
+}
Copied: activemq/activemq-apollo/trunk/apollo-selector/src/main/resources/META-INF/services/org.apache.activemq.apollo/modules.index (from r1066696, activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/resources/META-INF/services/org.apache.activemq.apollo/xml-packages.index)
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-selector/src/main/resources/META-INF/services/org.apache.activemq.apollo/modules.index?p2=activemq/activemq-apollo/trunk/apollo-selector/src/main/resources/META-INF/services/org.apache.activemq.apollo/modules.index&p1=activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/resources/META-INF/services/org.apache.activemq.apollo/xml-packages.index&r1=1066696&r2=1067244&rev=1067244&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-jdbm2/src/main/resources/META-INF/services/org.apache.activemq.apollo/xml-packages.index (original)
+++ activemq/activemq-apollo/trunk/apollo-selector/src/main/resources/META-INF/services/org.apache.activemq.apollo/modules.index Fri Feb 4 18:02:19 2011
@@ -14,4 +14,4 @@
## See the License for the specific language governing permissions and
## limitations under the License.
## ---------------------------------------------------------------------------
-org.apache.activemq.apollo.broker.store.jdbm2.dto
+org.apache.activemq.apollo.filter.ExtensionModule
\ No newline at end of file
Copied: activemq/activemq-apollo/trunk/apollo-tcp/src/main/java/org/apache/activemq/apollo/transport/tcp/ExtensionModule.java (from r1066696, activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/Boot.scala)
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-tcp/src/main/java/org/apache/activemq/apollo/transport/tcp/ExtensionModule.java?p2=activemq/activemq-apollo/trunk/apollo-tcp/src/main/java/org/apache/activemq/apollo/transport/tcp/ExtensionModule.java&p1=activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/Boot.scala&r1=1066696&r2=1067244&rev=1067244&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/Boot.scala (original)
+++ activemq/activemq-apollo/trunk/apollo-tcp/src/main/java/org/apache/activemq/apollo/transport/tcp/ExtensionModule.java Fri Feb 4 18:02:19 2011
@@ -14,19 +14,18 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.activemq.apollo.web
+package org.apache.activemq.apollo.transport.tcp;
-import org.fusesource.scalate.TemplateEngine
+import org.apache.activemq.apollo.util.Module;
-class Boot(engine: TemplateEngine) {
-
- // Put some references to the jersey classes in our code so that the osgi
- // metadata creates the proper imports.
- val we_are_using = Array(
- classOf[com.sun.jersey.spi.container.servlet.ServletContainer]
- )
-
- def run: Unit = {
- engine.packagePrefix = "org.apache.activemq.apollo.web.templates"
- }
-}
\ No newline at end of file
+/**
+ * <p>
+ * </p>
+ *
+ * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
+ */
+public class ExtensionModule extends Module {
+ public String name() {
+ return "apollo-tcp";
+ }
+}
Copied: activemq/activemq-apollo/trunk/apollo-tcp/src/main/resources/META-INF/services/org.apache.activemq.apollo/modules.index (from r1066696, activemq/activemq-apollo/trunk/apollo-cassandra/src/main/resources/META-INF/services/org.apache.activemq.apollo/xml-packages.index)
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-tcp/src/main/resources/META-INF/services/org.apache.activemq.apollo/modules.index?p2=activemq/activemq-apollo/trunk/apollo-tcp/src/main/resources/META-INF/services/org.apache.activemq.apollo/modules.index&p1=activemq/activemq-apollo/trunk/apollo-cassandra/src/main/resources/META-INF/services/org.apache.activemq.apollo/xml-packages.index&r1=1066696&r2=1067244&rev=1067244&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-cassandra/src/main/resources/META-INF/services/org.apache.activemq.apollo/xml-packages.index (original)
+++ activemq/activemq-apollo/trunk/apollo-tcp/src/main/resources/META-INF/services/org.apache.activemq.apollo/modules.index Fri Feb 4 18:02:19 2011
@@ -14,4 +14,4 @@
## See the License for the specific language governing permissions and
## limitations under the License.
## ---------------------------------------------------------------------------
-org.apache.activemq.apollo.broker.store.cassandra.dto
+org.apache.activemq.apollo.transport.tcp.ExtensionModule
\ No newline at end of file
Copied: activemq/activemq-apollo/trunk/apollo-transport/src/main/java/org/apache/activemq/apollo/transport/ExtensionModule.java (from r1066696, activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/Boot.scala)
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-transport/src/main/java/org/apache/activemq/apollo/transport/ExtensionModule.java?p2=activemq/activemq-apollo/trunk/apollo-transport/src/main/java/org/apache/activemq/apollo/transport/ExtensionModule.java&p1=activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/Boot.scala&r1=1066696&r2=1067244&rev=1067244&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/Boot.scala (original)
+++ activemq/activemq-apollo/trunk/apollo-transport/src/main/java/org/apache/activemq/apollo/transport/ExtensionModule.java Fri Feb 4 18:02:19 2011
@@ -14,19 +14,20 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.activemq.apollo.web
+package org.apache.activemq.apollo.transport;
-import org.fusesource.scalate.TemplateEngine
+import org.apache.activemq.apollo.util.Module;
-class Boot(engine: TemplateEngine) {
-
- // Put some references to the jersey classes in our code so that the osgi
- // metadata creates the proper imports.
- val we_are_using = Array(
- classOf[com.sun.jersey.spi.container.servlet.ServletContainer]
- )
-
- def run: Unit = {
- engine.packagePrefix = "org.apache.activemq.apollo.web.templates"
- }
-}
\ No newline at end of file
+/**
+ * <p>
+ * </p>
+ *
+ * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
+ */
+public class ExtensionModule extends Module {
+
+ public String name() {
+ return "apollo-transport";
+ }
+
+}
Copied: activemq/activemq-apollo/trunk/apollo-transport/src/main/resources/META-INF/services/org.apache.activemq.apollo/modules.index (from r1066696, activemq/activemq-apollo/trunk/apollo-hawtdb/src/main/resources/META-INF/services/org.apache.activemq.apollo/xml-packages.index)
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-transport/src/main/resources/META-INF/services/org.apache.activemq.apollo/modules.index?p2=activemq/activemq-apollo/trunk/apollo-transport/src/main/resources/META-INF/services/org.apache.activemq.apollo/modules.index&p1=activemq/activemq-apollo/trunk/apollo-hawtdb/src/main/resources/META-INF/services/org.apache.activemq.apollo/xml-packages.index&r1=1066696&r2=1067244&rev=1067244&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-hawtdb/src/main/resources/META-INF/services/org.apache.activemq.apollo/xml-packages.index (original)
+++ activemq/activemq-apollo/trunk/apollo-transport/src/main/resources/META-INF/services/org.apache.activemq.apollo/modules.index Fri Feb 4 18:02:19 2011
@@ -14,4 +14,4 @@
## See the License for the specific language governing permissions and
## limitations under the License.
## ---------------------------------------------------------------------------
-org.apache.activemq.apollo.broker.store.hawtdb.dto
+org.apache.activemq.apollo.transport.ExtensionModule
\ No newline at end of file
Modified: activemq/activemq-apollo/trunk/apollo-util/pom.xml
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-util/pom.xml?rev=1067244&r1=1067243&r2=1067244&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-util/pom.xml (original)
+++ activemq/activemq-apollo/trunk/apollo-util/pom.xml Fri Feb 4 18:02:19 2011
@@ -34,9 +34,6 @@
<name>${project.artifactId}</name>
- <properties>
- </properties>
-
<repositories>
<!-- For the JNA dependency -->
<repository>
@@ -170,8 +167,21 @@
</execution>
</executions>
</plugin>
-
- </plugins>
+
+ <!-- <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <version>${bundle-plugin-version}</version>
+ <extensions>true</extensions>
+ <inherited>true</inherited>
+ <configuration>
+ <instructions>
+ <Webapp-Context>apollo</Webapp-Context>
+ </instructions>
+ </configuration>
+ </plugin>
+ -->
+ </plugins>
</build>
</project>
Modified: activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/ClassFinder.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/ClassFinder.scala?rev=1067244&r1=1067243&r2=1067244&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/ClassFinder.scala (original)
+++ activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/ClassFinder.scala Fri Feb 4 18:02:19 2011
@@ -24,6 +24,8 @@ import collection.JavaConversions._
object ClassFinder extends Log {
+ var class_loader:ClassLoader = Option(ClassFinder.getClass.getClassLoader).getOrElse(ClassLoader.getSystemClassLoader)
+
trait Loader {
def discover[T](path:String, clazz: Class[T])( callback: List[T]=>Unit )
}
@@ -45,7 +47,7 @@ object ClassFinder extends Log {
classes += loader.loadClass(name)
} catch {
case e:Throwable =>
- debug(e, "Could not load class %s", name)
+ debug("Could not load class %s using class loader: %s", name, loader)
}
}
}
@@ -65,17 +67,13 @@ object ClassFinder extends Log {
Some(moduleField.get(null).asInstanceOf[T])
} catch {
case e2: Throwable =>
- debug(e, "Could create an instance of the class")
+ debug("Could not create an instance of '%s' using classloader %s", clazz.getName, clazz.getClassLoader)
None
}
}
}
- def standalone_loader() = {
- ClassLoaderLoader(Array(Thread.currentThread.getContextClassLoader))
- }
-
- var default_loader:Loader = standalone_loader
+ var default_loader:Loader = ClassLoaderLoader(Array(class_loader))
def loadProperties(is:InputStream):Properties = {
if( is==null ) {
Added: activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/Module.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/Module.scala?rev=1067244&view=auto
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/Module.scala (added)
+++ activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/Module.scala Fri Feb 4 18:02:19 2011
@@ -0,0 +1,55 @@
+/**
+ * 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.util
+
+import java.lang.String
+import scala.collection.mutable.ListBuffer
+
+object Module {
+ val MODULE_INDEX_RESOURCE: String = "META-INF/services/org.apache.activemq.apollo/modules.index"
+}
+import Module._
+
+/**
+ * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
+ */
+abstract class Module {
+ def xml_packages:Array[String] = Array()
+}
+
+/**
+ * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
+ */
+object ModuleRegistry {
+
+ val finder = new ClassFinder[Module](MODULE_INDEX_RESOURCE,classOf[Module])
+
+ def singletons = finder.singletons
+ def jsingletons = finder.jsingletons
+
+ private val listeners = ListBuffer[Runnable]()
+
+ finder.on_change = ()=> {
+ val copy = this.synchronized {
+ listeners.toArray
+ }
+ copy.foreach { listener=>
+ listener.run
+ }
+ }
+}
+
Modified: activemq/activemq-apollo/trunk/apollo-web/pom.xml
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-web/pom.xml?rev=1067244&r1=1067243&r2=1067244&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-web/pom.xml (original)
+++ activemq/activemq-apollo/trunk/apollo-web/pom.xml Fri Feb 4 18:02:19 2011
@@ -83,6 +83,14 @@
<optional>true</optional>
</dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <version>${osgi-version}</version>
+ <scope>provided</scope>
+ <optional>true</optional>
+ </dependency>
+
<!-- Scala Support -->
<dependency>
<groupId>org.scala-lang</groupId>
@@ -223,10 +231,8 @@
<supportedProjectType>war</supportedProjectType>
</supportedProjectTypes>
<instructions>
- <!-- <Export-Package>!*</Export-Package> -->
- <!-- <Import-Package>javax.servlet,javax.servlet.http,org.osgi.framework,org.osgi.service.packageadmin</Import-Package> -->
- <!-- <Bundle-ClassPath>WEB-INF/classes</Bundle-ClassPath> -->
<Webapp-Context>apollo</Webapp-Context>
+ <Webapp-Deploy>false</Webapp-Deploy>
</instructions>
</configuration>
</execution>
Modified: activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/Boot.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/Boot.scala?rev=1067244&r1=1067243&r2=1067244&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/Boot.scala (original)
+++ activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/Boot.scala Fri Feb 4 18:02:19 2011
@@ -17,7 +17,12 @@
package org.apache.activemq.apollo.web
import org.fusesource.scalate.TemplateEngine
+import org.apache.activemq.apollo.broker.Broker
+/**
+ * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
+ *
+ */
class Boot(engine: TemplateEngine) {
// Put some references to the jersey classes in our code so that the osgi
@@ -27,6 +32,8 @@ class Boot(engine: TemplateEngine) {
)
def run: Unit = {
+ println("scalate boot: "+Thread.currentThread.getContextClassLoader)
+ engine.classLoader = Thread.currentThread.getContextClassLoader
engine.packagePrefix = "org.apache.activemq.apollo.web.templates"
}
}
\ No newline at end of file
Copied: activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/JerseyServletContainer.scala (from r1066696, activemq/activemq-apollo/trunk/apollo-web/src/test/scala/org/apache/activemq/apollo/web/ResourcesTest.scala)
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/JerseyServletContainer.scala?p2=activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/JerseyServletContainer.scala&p1=activemq/activemq-apollo/trunk/apollo-web/src/test/scala/org/apache/activemq/apollo/web/ResourcesTest.scala&r1=1066696&r2=1067244&rev=1067244&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-web/src/test/scala/org/apache/activemq/apollo/web/ResourcesTest.scala (original)
+++ activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/JerseyServletContainer.scala Fri Feb 4 18:02:19 2011
@@ -16,23 +16,24 @@
*/
package org.apache.activemq.apollo.web
-import org.junit.runner.RunWith
-import org.scalatest.junit.JUnitRunner
-import org.scalatest.{FunSuite}
-
-import org.fusesource.scalate.test._
+import com.sun.jersey.spi.container.servlet.ServletContainer
+import javax.servlet._
+import org.apache.activemq.apollo.broker.Broker
/**
+ * Sets the broker's extension class loader as the context class loader
+ * and then delegates to the jersey filter.
+ *
+ * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
*/
-@RunWith(classOf[JUnitRunner])
-class ResourcesTest extends FunSuite with WebServerMixin with WebDriverMixin {
-
- test("home page") {
- webDriver.get(rootUrl)
-// pageContains("Bookstore")
+class JerseyServletContainer extends ServletContainer {
+ override def init(filterConfig: FilterConfig): Unit = {
+ println("jersey init: "+Thread.currentThread.getContextClassLoader)
+/* Thread.currentThread.setContextClassLoader(getClass.getClassLoader)*/
+ super.init(filterConfig)
}
-// testPageContains("id/item1", "Title1", "Author1", "item1")
-// testPageContains("id/item2", "Title2", "Author2", "item2")
-
+ override def doFilter(request: ServletRequest, response: ServletResponse, chain: FilterChain): Unit = {
+ super.doFilter(request, response, chain)
+ }
}
\ No newline at end of file
Modified: activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/ScalatePackage.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/ScalatePackage.scala?rev=1067244&r1=1067243&r2=1067244&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/ScalatePackage.scala (original)
+++ activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/ScalatePackage.scala Fri Feb 4 18:02:19 2011
@@ -22,6 +22,9 @@ import org.fusesource.scalate.{Binding,
/**
* Defines the template package of reusable imports, attributes and methods across templates
+ *
+ *
+ * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
*/
class ScalatePackage extends DefaultTemplatePackage {
override def header(source: TemplateSource, bindings: List[Binding]) = super.header(source,bindings)+"""
Added: activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/osgi/OsgiWebServerFactory.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/osgi/OsgiWebServerFactory.scala?rev=1067244&view=auto
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/osgi/OsgiWebServerFactory.scala (added)
+++ activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/osgi/OsgiWebServerFactory.scala Fri Feb 4 18:02:19 2011
@@ -0,0 +1,63 @@
+/**
+ * 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.web.osgi
+
+import org.apache.activemq.apollo.broker.web.{WebServerFactory, WebServer}
+import org.apache.activemq.apollo.util.{Reporter, ReporterLevel}
+import org.apache.activemq.apollo.dto.WebAdminDTO
+import org.apache.activemq.apollo.broker.Broker
+import org.apache.activemq.apollo.broker.osgi.BrokerService
+
+/**
+ * <p>
+ * </p>
+ *
+ * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
+ */
+class OsgiWebServerFactory extends WebServerFactory.Provider {
+
+ // So that the factory class does not load, if we cannot load OSGi
+ private val broker_service = BrokerService
+
+ def create(broker:Broker): WebServer = new WebServer {
+
+ def start: Unit = {
+ // TODO: see if we can poke around and get the endpoint address
+ // of our deployment to pax web
+ }
+
+ def stop: Unit = {
+ }
+
+ def start(onComplete: Runnable): Unit = {
+ start
+ onComplete.run
+ }
+ def stop(onComplete: Runnable): Unit = {
+ stop
+ onComplete.run
+ }
+
+ }
+
+ def validate(config: WebAdminDTO, reporter: Reporter): ReporterLevel.ReporterLevel = {
+ if( broker_service.context == null ) {
+ return null
+ }
+ return ReporterLevel.INFO
+ }
+}
\ No newline at end of file
Copied: activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/META-INF/services/org.apache.activemq.apollo/modules.index (from r1066696, activemq/activemq-apollo/trunk/apollo-bdb/src/main/resources/META-INF/services/org.apache.activemq.apollo/xml-packages.index)
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/META-INF/services/org.apache.activemq.apollo/modules.index?p2=activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/META-INF/services/org.apache.activemq.apollo/modules.index&p1=activemq/activemq-apollo/trunk/apollo-bdb/src/main/resources/META-INF/services/org.apache.activemq.apollo/xml-packages.index&r1=1066696&r2=1067244&rev=1067244&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-bdb/src/main/resources/META-INF/services/org.apache.activemq.apollo/xml-packages.index (original)
+++ activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/META-INF/services/org.apache.activemq.apollo/modules.index Fri Feb 4 18:02:19 2011
@@ -14,4 +14,4 @@
## See the License for the specific language governing permissions and
## limitations under the License.
## ---------------------------------------------------------------------------
-org.apache.activemq.apollo.broker.store.bdb.dto
+org.apache.activemq.apollo.web.ExtensionModule
\ No newline at end of file
Copied: activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/META-INF/services/org.apache.activemq.apollo/web-server-factory.index (from r1066696, activemq/activemq-apollo/trunk/apollo-broker/src/main/resources/META-INF/services/org.apache.activemq.apollo/web-server-factory.index)
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/META-INF/services/org.apache.activemq.apollo/web-server-factory.index?p2=activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/META-INF/services/org.apache.activemq.apollo/web-server-factory.index&p1=activemq/activemq-apollo/trunk/apollo-broker/src/main/resources/META-INF/services/org.apache.activemq.apollo/web-server-factory.index&r1=1066696&r2=1067244&rev=1067244&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-broker/src/main/resources/META-INF/services/org.apache.activemq.apollo/web-server-factory.index (original)
+++ activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/META-INF/services/org.apache.activemq.apollo/web-server-factory.index Fri Feb 4 18:02:19 2011
@@ -14,4 +14,4 @@
## See the License for the specific language governing permissions and
## limitations under the License.
## ---------------------------------------------------------------------------
-org.apache.activemq.apollo.broker.web.JettyWebServerFactory
+org.apache.activemq.apollo.web.osgi.OsgiWebServerFactory
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=1067244&r1=1067243&r2=1067244&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 Fri Feb 4 18:02:19 2011
@@ -31,7 +31,7 @@
<filter>
<filter-name>Jersey Filter</filter-name>
- <filter-class>com.sun.jersey.spi.container.servlet.ServletContainer</filter-class>
+ <filter-class>org.apache.activemq.apollo.web.JerseyServletContainer</filter-class>
<init-param>
<param-name>com.sun.jersey.config.feature.Trace</param-name>
<param-value>false</param-value>
Added: activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/test.jade
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/test.jade?rev=1067244&view=auto
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/test.jade (added)
+++ activemq/activemq-apollo/trunk/apollo-web/src/main/webapp/test.jade Fri Feb 4 18:02:19 2011
@@ -0,0 +1,4 @@
+
+h1 Hello
+
+p test
\ No newline at end of file
Modified: activemq/activemq-apollo/trunk/apollo-web/src/test/scala/org/apache/activemq/apollo/web/ResourcesTest.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-web/src/test/scala/org/apache/activemq/apollo/web/ResourcesTest.scala?rev=1067244&r1=1067243&r2=1067244&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-web/src/test/scala/org/apache/activemq/apollo/web/ResourcesTest.scala (original)
+++ activemq/activemq-apollo/trunk/apollo-web/src/test/scala/org/apache/activemq/apollo/web/ResourcesTest.scala Fri Feb 4 18:02:19 2011
@@ -23,6 +23,7 @@ import org.scalatest.{FunSuite}
import org.fusesource.scalate.test._
/**
+ * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
*/
@RunWith(classOf[JUnitRunner])
class ResourcesTest extends FunSuite with WebServerMixin with WebDriverMixin {
Modified: activemq/activemq-apollo/trunk/pom.xml
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/pom.xml?rev=1067244&r1=1067243&r2=1067244&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/pom.xml (original)
+++ activemq/activemq-apollo/trunk/pom.xml Fri Feb 4 18:02:19 2011
@@ -81,7 +81,7 @@
<regexp-version>1.3</regexp-version>
<rome-version>0.8</rome-version>
- <slf4j-version>1.5.11</slf4j-version>
+ <slf4j-version>1.6.1</slf4j-version>
<jaxb-api-version>2.1</jaxb-api-version>
<jaxb-version>2.1.6</jaxb-version>
@@ -128,6 +128,8 @@
<karaf-version>2.1.2</karaf-version>
<features-maven-plugin-version>2.1.0</features-maven-plugin-version>
<bundle-plugin-version>2.3.5-SNAPSHOT</bundle-plugin-version>
+
+ <osgi.fragment.host>${project.groupId}.apollo-broker</osgi.fragment.host>
</properties>
<prerequisites>
@@ -386,6 +388,7 @@
<inherited>true</inherited>
<configuration>
<instructions>
+ <Fragment-Host>${osgi.fragment.host}</Fragment-Host>
<Implementation-Title>${project.artifactId}</Implementation-Title>
<Implementation-Version>${project.version}</Implementation-Version>
<Bundle-Name>${project.artifactId}</Bundle-Name>