Author: chirino
Date: Thu Dec 9 02:54:03 2010
New Revision: 1043825
URL: http://svn.apache.org/viewvc?rev=1043825&view=rev
Log:
Simplifying DTOs for json by using a custom jackson jaxrs provider config.
Added:
activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/JacksonJsonProvider.java
- copied, changed from r1043689,
activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/DestinationDTO.java
Modified:
activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Queue.scala
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/test/scala/org/apache/activemq/apollo/cli/ApolloIDERunner.scala
activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/BrokerDTO.java
activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/DestinationDTO.java
activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/DestinationStatusDTO.java
activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/QueueDTO.java
activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/QueueStatusDTO.java
activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/VirtualHostDTO.java
activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/RuntimeResource.scala
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-broker/src/main/scala/org/apache/activemq/apollo/broker/Queue.scala
URL:
http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Queue.scala?rev=1043825&r1=1043824&r2=1043825&view=diff
==============================================================================
---
activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Queue.scala
(original)
+++
activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Queue.scala
Thu Dec 9 02:54:03 2010
@@ -106,7 +106,7 @@ class Queue(val host: VirtualHost, var i
* Should messages be flushed or swapped out of memory if
* no consumers need the message?
*/
- var tune_flush_to_store = true
+ var tune_swap = true
/**
* The number max number of flushed queue entries to load
@@ -124,7 +124,7 @@ class Queue(val host: VirtualHost, var i
def configure(c:QueueDTO) = {
config = c
tune_persistent = host.store !=null && config.persistent.getOrElse(true)
- tune_flush_to_store = tune_persistent &&
config.flush_to_store.getOrElse(true)
+ tune_swap = tune_persistent && config.swap.getOrElse(true)
tune_flush_range_size = config.flush_range_size.getOrElse(10000)
tune_consumer_buffer = config.consumer_buffer.getOrElse(32*1024)
}
@@ -321,7 +321,7 @@ class Queue(val host: VirtualHost, var i
}
def trigger_swap = {
- if( tune_flush_to_store ) {
+ if( tune_swap ) {
swap_source.merge(1)
}
}
@@ -891,7 +891,7 @@ class QueueEntry(val queue:Queue, val se
}
override def flush(asap:Boolean) = {
- if( queue.tune_flush_to_store ) {
+ if( queue.tune_swap ) {
if( stored ) {
flushing=true
queue.flushing_size+=size
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=1043825&r1=1043824&r2=1043825&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
Thu Dec 9 02:54:03 2010
@@ -19,8 +19,36 @@
</notes>
<virtual-host id="default" auto-create-queues="true" >
+ <!--
+ You should add all the host names that this virtual host is known as
+ to properly support the STOMP 1.1 virtual host feature.
+ -->
<host-name>localhost</host-name>
+
+ <!--
+ Examples of how to configure destinations and queues. Note
+ they you can use wildcard patterns when specifying destinations,
+ only the first element that matches will be used to configure the
+ destination or queue.
+ -->
+
+ <!-- Use this if you expect to have slow consumers on a topic
+ allows slow consumers to swap messages to a disk queue -->
+ <destination path="slow.**" slow_consumer_policy="queue"/>
+
+ <!-- Use this if you want the queue and topic with of the same name
+ to be the same logical entity -->
+ <destination path="unified.**" unified="true"/>
+
+ <!-- disable message swapping for some queues -->
+ <queue destination="noswap.**" kind="ptp" swap="false"/>
+
+ <!-- disable message swapping for durable subscriptions -->
+ <queue destination="noswap.**" kind="ds" swap="false"/>
+
+ <!-- You can delete this element if you want to disable persistent for
this virtual host -->
<hawtdb-store directory="${apollo.base}/data"/>
+
</virtual-host>
<key-storage file="${apollo.base}/etc/keystore" password="password"
key-password="password"/>
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=1043825&r1=1043824&r2=1043825&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
Thu Dec 9 02:54:03 2010
@@ -19,8 +19,36 @@
</notes>
<virtual-host id="default" auto-create-queues="true" >
+
+ <!--
+ You should add all the host names that this virtual host is known as
+ to properly support the STOMP 1.1 virtual host feature.
+ -->
<host-name>localhost</host-name>
+
+ <!--
+ Examples of how to configure destinations and queues. Note
+ they you can use wildcard patterns when specifying destinations,
+ only the first element that matches will be used to configure the
+ destination or queue.
+ -->
+
+ <!-- Use this if you expect to have slow consumers on a topic -->
+ <destination path="slow.**" slow_consumer_policy="queue"/>
+
+ <!-- Use this if you want the queue and topic with of the same name
+ to be the same logical entity -->
+ <destination path="unified.**" unified="true"/>
+
+ <!-- disable message swapping for some queues -->
+ <queue destination="noswap.**" kind="ptp" swap="false"/>
+
+ <!-- disable message swapping for durable subscriptions -->
+ <queue destination="noswap.**" kind="ds" swap="false"/>
+
+ <!-- You can delete this element if you want to disable persistent for
this virtual host -->
<hawtdb-store directory="${apollo.base}/data"/>
+
</virtual-host>
<connector id="tcp" bind="tcp://0.0.0.0:61613" connection-limit="2000"
protocol="multi"/>
Modified:
activemq/activemq-apollo/trunk/apollo-cli/src/test/scala/org/apache/activemq/apollo/cli/ApolloIDERunner.scala
URL:
http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-cli/src/test/scala/org/apache/activemq/apollo/cli/ApolloIDERunner.scala?rev=1043825&r1=1043824&r2=1043825&view=diff
==============================================================================
---
activemq/activemq-apollo/trunk/apollo-cli/src/test/scala/org/apache/activemq/apollo/cli/ApolloIDERunner.scala
(original)
+++
activemq/activemq-apollo/trunk/apollo-cli/src/test/scala/org/apache/activemq/apollo/cli/ApolloIDERunner.scala
Thu Dec 9 02:54:03 2010
@@ -63,6 +63,9 @@ class ApolloIDERunner {
System.setProperty("apollo.webapp", apollo_webapp.getCanonicalPath)
}
+ System.setProperty("scalate.mode", "development")
+
+
// Configure jul logging..
val apollo_base = new File(System.getProperty("apollo.base"))
val jul_properties = apollo_base / "etc" / "jul.properties"
Modified:
activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/BrokerDTO.java
URL:
http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/BrokerDTO.java?rev=1043825&r1=1043824&r2=1043825&view=diff
==============================================================================
---
activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/BrokerDTO.java
(original)
+++
activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/BrokerDTO.java
Thu Dec 9 02:54:03 2010
@@ -53,14 +53,12 @@ public class BrokerDTO extends ServiceDT
/**
* A broker can service many virtual hosts.
*/
- @JsonProperty("virtual_hosts")
@XmlElement(name="virtual-host")
public List<VirtualHostDTO> virtual_hosts = new
ArrayList<VirtualHostDTO>();
/**
* A broker accepts connections via it's configured connectors.
*/
- @JsonProperty("connectors")
@XmlElement(name="connector")
public List<ConnectorDTO> connectors = new ArrayList<ConnectorDTO>();
Modified:
activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/DestinationDTO.java
URL:
http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/DestinationDTO.java?rev=1043825&r1=1043824&r2=1043825&view=diff
==============================================================================
---
activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/DestinationDTO.java
(original)
+++
activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/DestinationDTO.java
Thu Dec 9 02:54:03 2010
@@ -43,6 +43,7 @@ public class DestinationDTO extends Stri
@XmlAttribute
public Boolean unified;
+ @XmlElement(name="slow-consumer-policy")
public String slow_consumer_policy;
}
Modified:
activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/DestinationStatusDTO.java
URL:
http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/DestinationStatusDTO.java?rev=1043825&r1=1043824&r2=1043825&view=diff
==============================================================================
---
activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/DestinationStatusDTO.java
(original)
+++
activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/DestinationStatusDTO.java
Thu Dec 9 02:54:03 2010
@@ -38,6 +38,9 @@ public class DestinationStatusDTO extend
@XmlAttribute
public String name;
+ @XmlElement
+ public DestinationDTO config;
+
/**
* Ids of all connections that are producing to the destination
*/
Modified:
activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/QueueDTO.java
URL:
http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/QueueDTO.java?rev=1043825&r1=1043824&r2=1043825&view=diff
==============================================================================
---
activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/QueueDTO.java
(original)
+++
activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/QueueDTO.java
Thu Dec 9 02:54:03 2010
@@ -60,37 +60,32 @@ public class QueueDTO {
* The amount of memory buffer space for receiving messages.
*/
@XmlAttribute(name="producer-buffer")
- @JsonProperty("producer_buffer")
public Integer producer_buffer;
/**
* The amount of memory buffer space for the queue..
*/
@XmlAttribute(name="queue-buffer")
- @JsonProperty("queue_buffer")
public Integer queue_buffer;
/**
* The amount of memory buffer space to use per subscription.
*/
@XmlAttribute(name="consumer-buffer")
- @JsonProperty("consumer_buffer")
public Integer consumer_buffer;
/**
* Should this queue persistently store it's entries?
*/
@XmlAttribute(name="persistent")
- @JsonProperty("persistent")
public Boolean persistent;
/**
- * Should messages be flushed or swapped out of memory if
+ * Should messages be swapped out of memory if
* no consumers need the message?
*/
- @XmlAttribute(name="flush-to-store")
- @JsonProperty("flush_to_store")
- public Boolean flush_to_store;
+ @XmlAttribute(name="swap")
+ public Boolean swap;
/**
* The number max number of flushed queue entries to load
@@ -99,15 +94,6 @@ public class QueueDTO {
* the batch is referenced as sequence range to conserve memory.
*/
@XmlAttribute(name="flush-range-size")
- @JsonProperty("flush_range_size")
public Integer flush_range_size;
- /**
- * The number of intervals that a consumer must not meeting the
subscription rate before it is
- * flagged as a slow consumer.
- */
- @XmlAttribute(name="max-slow-intervals")
- @JsonProperty("max_slow_intervals")
- public Integer max_slow_intervals;
-
}
Modified:
activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/QueueStatusDTO.java
URL:
http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/QueueStatusDTO.java?rev=1043825&r1=1043824&r2=1043825&view=diff
==============================================================================
---
activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/QueueStatusDTO.java
(original)
+++
activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/QueueStatusDTO.java
Thu Dec 9 02:54:03 2010
@@ -33,6 +33,9 @@ import java.util.List;
public class QueueStatusDTO extends LongIdDTO {
@XmlElement
+ public QueueDTO config;
+
+ @XmlElement
public BindingDTO binding;
@XmlAttribute(name="enqueue-item-counter")
Modified:
activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/VirtualHostDTO.java
URL:
http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/VirtualHostDTO.java?rev=1043825&r1=1043824&r2=1043825&view=diff
==============================================================================
---
activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/VirtualHostDTO.java
(original)
+++
activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/VirtualHostDTO.java
Thu Dec 9 02:54:03 2010
@@ -39,7 +39,6 @@ public class VirtualHostDTO extends Serv
* Should queues be auto created when they are first accessed
* by clients?
*/
- @JsonProperty("auto_create_queues")
@XmlAttribute(name="auto-create-queues")
public Boolean auto_create_queues;
@@ -53,14 +52,12 @@ public class VirtualHostDTO extends Serv
* Holds the configuration for the destinations.
*/
@XmlElement(name="destination")
- @JsonProperty("destinations")
public ArrayList<DestinationDTO> destinations = new
ArrayList<DestinationDTO>();
/**
* Holds the configuration for the queues.
*/
@XmlElement(name="queue")
- @JsonProperty("queues")
public ArrayList<QueueDTO> queues = new ArrayList<QueueDTO>();
/**
Copied:
activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/JacksonJsonProvider.java
(from r1043689,
activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/DestinationDTO.java)
URL:
http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/JacksonJsonProvider.java?p2=activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/JacksonJsonProvider.java&p1=activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/DestinationDTO.java&r1=1043689&r2=1043825&rev=1043825&view=diff
==============================================================================
---
activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/DestinationDTO.java
(original)
+++
activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/JacksonJsonProvider.java
Thu Dec 9 02:54:03 2010
@@ -14,35 +14,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.activemq.apollo.dto;
-
-import org.codehaus.jackson.annotate.JsonProperty;
-
-import javax.xml.bind.annotation.*;
-import java.util.ArrayList;
+package org.apache.activemq.apollo.web.resources;
/**
+ * <p>
+ * </p>
+ *
* @author <a href="http://hiramchirino.com">Hiram Chirino</a>
*/
-...@xmlrootelement(name = "destination")
-...@xmlaccessortype(XmlAccessType.FIELD)
-public class DestinationDTO extends StringIdDTO {
-
- /**
- * The path to the destination. You can use wild cards.
- */
- @XmlAttribute
- public String path;
-
- /**
- * If set to true, then routing then there is no difference between
- * sending to a queue or topic of the same name. The first time
- * a queue subscriptions is created, it will act like if a durable
- * subscription was created on the topic.
- */
- @XmlAttribute
- public Boolean unified;
-
- public String slow_consumer_policy;
[email protected]
[email protected]({"application/json", "text/json"})
[email protected]({"application/json", "text/json"})
+public class JacksonJsonProvider extends
org.codehaus.jackson.jaxrs.JacksonJsonProvider {
}
Modified:
activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/RuntimeResource.scala
URL:
http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/RuntimeResource.scala?rev=1043825&r1=1043824&r2=1043825&view=diff
==============================================================================
---
activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/RuntimeResource.scala
(original)
+++
activemq/activemq-apollo/trunk/apollo-web/src/main/scala/org/apache/activemq/apollo/web/resources/RuntimeResource.scala
Thu Dec 9 02:54:03 2010
@@ -160,6 +160,7 @@ case class RuntimeResource(parent:Broker
val result = new DestinationStatusDTO
result.id = node.id
result.name = node.name.toString
+ result.config = node.config
node.queues.foreach { q=>
result.queues.add(new LongIdLabeledDTO(q.id, q.binding.label))
}
@@ -211,6 +212,7 @@ case class RuntimeResource(parent:Broker
rc.binding = q.binding.binding_dto
rc.capacity_used = q.capacity_used
rc.capacity = q.capacity
+ rc.config = q.config
rc.enqueue_item_counter = q.enqueue_item_counter
rc.dequeue_item_counter = q.dequeue_item_counter
@@ -246,6 +248,8 @@ case class RuntimeResource(parent:Broker
cur.nextOrTail
}
}
+ } else {
+// rc.entries = null
}
q.inbound_sessions.flatMap( _.producer.connection ).foreach {
connection=>
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=1043825&r1=1043824&r2=1043825&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
Thu Dec 9 02:54:03 2010
@@ -51,7 +51,6 @@
<init-param>
<param-name>com.sun.jersey.config.property.packages</param-name>
<param-value>
- org.codehaus.jackson.jaxrs;
org.fusesource.scalate.console;
org.apache.activemq.apollo.web.resources
</param-value>
Modified: activemq/activemq-apollo/trunk/pom.xml
URL:
http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/pom.xml?rev=1043825&r1=1043824&r2=1043825&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/pom.xml (original)
+++ activemq/activemq-apollo/trunk/pom.xml Thu Dec 9 02:54:03 2010
@@ -108,7 +108,7 @@
<scalamd-version>1.2</scalamd-version>
<servlet-api-version>2.5</servlet-api-version>
- <jackson-version>1.5.2</jackson-version>
+ <jackson-version>1.6.1</jackson-version>
<logback-version>0.9.24</logback-version>
<jersey-version>1.5-ea03</jersey-version>