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 2010/07/07 06:16:05 UTC
svn commit: r961189 - in /activemq/sandbox/activemq-apollo-actor:
activemq-broker/src/main/scala/org/apache/activemq/apollo/broker/
activemq-dto/src/main/java/org/apache/activemq/apollo/dto/
activemq-dto/src/main/resources/org/apache/activemq/apollo/dt...
Author: chirino
Date: Wed Jul 7 04:16:04 2010
New Revision: 961189
URL: http://svn.apache.org/viewvc?rev=961189&view=rev
Log:
- Added a main that starts broker /w jetty and web interface
- Better json property names on the dtos
- most status requests now properly being returned.
Added:
activemq/sandbox/activemq-apollo-actor/activemq-web/src/main/scala/org/apache/activemq/apollo/web/ConfigStore.scala
- copied, changed from r961188, activemq/sandbox/activemq-apollo-actor/activemq-web/src/main/scala/org/apache/activemq/apollo/ConfigStore.scala
activemq/sandbox/activemq-apollo-actor/activemq-web/src/main/scala/org/apache/activemq/apollo/web/FileConfigStoreTest.scala
- copied, changed from r961188, activemq/sandbox/activemq-apollo-actor/activemq-web/src/test/scala/org/apache/activemq/apollo/FileConfigStoreTest.scala
activemq/sandbox/activemq-apollo-actor/activemq-web/src/main/scala/org/apache/activemq/apollo/web/Main.scala
activemq/sandbox/activemq-apollo-actor/activemq-web/src/main/scala/org/apache/activemq/apollo/web/resources/RootResource.scala
- copied, changed from r961188, activemq/sandbox/activemq-apollo-actor/activemq-web/src/main/scala/org/apache/activemq/apollo/web/resources/Root.scala
activemq/sandbox/activemq-apollo-actor/activemq-web/src/main/scala/org/apache/activemq/apollo/web/resources/StatusResource.scala
- copied, changed from r961188, activemq/sandbox/activemq-apollo-actor/activemq-web/src/main/scala/org/apache/activemq/apollo/web/resources/BrokerStatus.scala
Removed:
activemq/sandbox/activemq-apollo-actor/activemq-web/src/main/scala/org/apache/activemq/apollo/BrokerRegistry.scala
activemq/sandbox/activemq-apollo-actor/activemq-web/src/main/scala/org/apache/activemq/apollo/ConfigStore.scala
activemq/sandbox/activemq-apollo-actor/activemq-web/src/main/scala/org/apache/activemq/apollo/web/resources/BrokerStatus.scala
activemq/sandbox/activemq-apollo-actor/activemq-web/src/main/scala/org/apache/activemq/apollo/web/resources/Root.scala
activemq/sandbox/activemq-apollo-actor/activemq-web/src/test/scala/org/apache/activemq/apollo/FileConfigStoreTest.scala
Modified:
activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/scala/org/apache/activemq/apollo/broker/Broker.scala
activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/BrokerDTO.java
activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/BrokerStatusDTO.java
activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/BrokerSummariesDTO.java
activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/BrokerSummaryDTO.java
activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/CassandraStoreDTO.java
activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/ConnectionStatusDTO.java
activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/ConnectorDTO.java
activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/ConnectorStatusDTO.java
activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/DestinationStatusDTO.java
activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/DestinationSummaryDTO.java
activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/EntryStatusDTO.java
activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/HawtDBStoreDTO.java
activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/IdListDTO.java
activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/LongIdDTO.java
activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/QueueStatusDTO.java
activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/ServiceDTO.java
activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/ServiceStatusDTO.java
activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/StoreDTO.java
activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/StringIdDTO.java
activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/VirtualHostDTO.java
activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/VirtualHostStatusDTO.java
activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/resources/org/apache/activemq/apollo/dto/jaxb.index
activemq/sandbox/activemq-apollo-actor/activemq-web/pom.xml
activemq/sandbox/activemq-apollo-actor/activemq-web/src/main/scala/org/apache/activemq/apollo/web/ServletContextListener.scala
Modified: activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/scala/org/apache/activemq/apollo/broker/Broker.scala
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/scala/org/apache/activemq/apollo/broker/Broker.scala?rev=961189&r1=961188&r2=961189&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/scala/org/apache/activemq/apollo/broker/Broker.scala (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-broker/src/main/scala/org/apache/activemq/apollo/broker/Broker.scala Wed Jul 7 04:16:04 2010
@@ -29,6 +29,7 @@ import JavaConversions._
import org.apache.activemq.apollo.dto.{VirtualHostStatusDTO, ConnectorStatusDTO, BrokerStatusDTO, BrokerDTO}
import java.util.concurrent.atomic.AtomicLong
import org.apache.activemq.apollo.util.LongCounter
+import java.util.concurrent.ConcurrentHashMap
/**
* <p>
@@ -87,7 +88,28 @@ object BufferConversions {
}
+/**
+ * <p>
+ * </p>
+ *
+ * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
+ */
+object BrokerRegistry {
+
+ val brokers = new ConcurrentHashMap[String, Broker]()
+ def list():Seq[String] = {
+ import JavaConversions._
+ brokers.keys.toSeq
+ }
+
+ def get(id:String) = brokers.get(id)
+
+ def add(id:String, broker:Broker) = brokers.put(id, broker)
+
+ def remove(id:String) = brokers.remove(id)
+
+}
object Broker extends Log {
@@ -95,6 +117,7 @@ object Broker extends Log {
val STICK_ON_THREAD_QUEUES = true
+
/**
* Creates a default a configuration object.
*/
Modified: activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/BrokerDTO.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/BrokerDTO.java?rev=961189&r1=961188&r2=961189&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/BrokerDTO.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/BrokerDTO.java Wed Jul 7 04:16:04 2010
@@ -16,6 +16,8 @@
*/
package org.apache.activemq.apollo.dto;
+import org.codehaus.jackson.annotate.JsonProperty;
+
import java.util.ArrayList;
import java.util.List;
@@ -35,38 +37,44 @@ public class BrokerDTO extends ServiceDT
/**
* Used to track config revisions.
*/
- @XmlAttribute(name="rev")
+ @JsonProperty
+ @XmlAttribute
public int rev;
/**
* Used to track who last modified the configuration.
*/
+ @JsonProperty("modified_by")
@XmlAttribute(name="modified-by")
public String modifiedBy;
/**
* Used to store any configuration notes.
*/
+ @JsonProperty
@XmlElement
public String notes;
/**
* A broker can service many virtual hosts.
*/
+ @JsonProperty("virtual_hosts")
@XmlElement(name="virtual-host")
public List<VirtualHostDTO> virtualHosts = new ArrayList<VirtualHostDTO>();
/**
* A broker accepts connections via it's configured connectors.
*/
- @XmlElement(name="connector")
+ @JsonProperty
+ @XmlElement
public List<ConnectorDTO> connectors = new ArrayList<ConnectorDTO>();
/**
* The base data directory of the broker. It will store
* persistent data under it.
*/
- @XmlAttribute(name="basedir")
+ @JsonProperty
+ @XmlAttribute
public String basedir;
Modified: activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/BrokerStatusDTO.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/BrokerStatusDTO.java?rev=961189&r1=961188&r2=961189&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/BrokerStatusDTO.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/BrokerStatusDTO.java Wed Jul 7 04:16:04 2010
@@ -16,6 +16,8 @@
*/
package org.apache.activemq.apollo.dto;
+import org.codehaus.jackson.annotate.JsonProperty;
+
import javax.xml.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
@@ -33,25 +35,29 @@ public class BrokerStatusDTO extends Ser
/**
* The current time on the broker machine. In milliseconds since the epoch.
*/
+ @JsonProperty("current_time")
@XmlAttribute(name="current-time")
public long currentTime;
/**
* Ids of all the virtual hosts running on the broker
*/
+ @JsonProperty("virtual_hosts")
@XmlElement(name="virtual-host")
public List<Long> virtualHosts = new ArrayList<Long>();
/**
* Ids of all the connections running on the broker
*/
- @XmlElement(name="connectors")
+ @JsonProperty("connectors")
+ @XmlElement(name="connector")
public List<Long> connectors = new ArrayList<Long>();
/**
* The current running configuration of the object
*/
- @XmlElement(name="config")
+ @JsonProperty
+ @XmlElement
public BrokerDTO config = null;
}
Modified: activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/BrokerSummariesDTO.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/BrokerSummariesDTO.java?rev=961189&r1=961188&r2=961189&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/BrokerSummariesDTO.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/BrokerSummariesDTO.java Wed Jul 7 04:16:04 2010
@@ -16,6 +16,8 @@
*/
package org.apache.activemq.apollo.dto;
+import org.codehaus.jackson.annotate.JsonProperty;
+
import javax.xml.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
@@ -30,6 +32,7 @@ public class BrokerSummariesDTO {
/**
* The list of broker summaries.
*/
+ @JsonProperty
@XmlElement
public List<BrokerSummaryDTO> brokers = new ArrayList<BrokerSummaryDTO>();
Modified: activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/BrokerSummaryDTO.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/BrokerSummaryDTO.java?rev=961189&r1=961188&r2=961189&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/BrokerSummaryDTO.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/BrokerSummaryDTO.java Wed Jul 7 04:16:04 2010
@@ -16,6 +16,8 @@
*/
package org.apache.activemq.apollo.dto;
+import org.codehaus.jackson.annotate.JsonProperty;
+
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
@@ -34,7 +36,8 @@ public class BrokerSummaryDTO extends St
/**
* The latest revision of the broker config.
*/
- @XmlAttribute(name="rev")
+ @JsonProperty
+ @XmlAttribute
public Integer rev;
Modified: activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/CassandraStoreDTO.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/CassandraStoreDTO.java?rev=961189&r1=961188&r2=961189&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/CassandraStoreDTO.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/CassandraStoreDTO.java Wed Jul 7 04:16:04 2010
@@ -16,6 +16,8 @@
*/
package org.apache.activemq.apollo.dto;
+import org.codehaus.jackson.annotate.JsonProperty;
+
import javax.xml.bind.annotation.*;
import java.util.ArrayList;
@@ -26,10 +28,12 @@ import java.util.ArrayList;
@XmlAccessorType(XmlAccessType.FIELD)
public class CassandraStoreDTO extends StoreDTO {
- @XmlAttribute(name="keyspace")
+ @JsonProperty
+ @XmlAttribute
public String keyspace="ActiveMQ";
- @XmlElement(name="host", required=true)
+ @JsonProperty
+ @XmlElement(required=true)
public ArrayList<String> hosts = new ArrayList<String>();
}
Modified: activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/ConnectionStatusDTO.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/ConnectionStatusDTO.java?rev=961189&r1=961188&r2=961189&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/ConnectionStatusDTO.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/ConnectionStatusDTO.java Wed Jul 7 04:16:04 2010
@@ -16,6 +16,8 @@
*/
package org.apache.activemq.apollo.dto;
+import org.codehaus.jackson.annotate.JsonProperty;
+
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
@@ -34,30 +36,35 @@ public class ConnectionStatusDTO extends
/**
* The number of bytes that have been read from the connection.
*/
+ @JsonProperty("read_counter")
@XmlAttribute(name="read-counter")
public Long readCounter;
/**
* The number of bytes that have been written to the connection.
*/
+ @JsonProperty("write_counter")
@XmlAttribute(name="write-counter")
public Long writeCounter;
/**
* The protocol the connection is using.
*/
- @XmlAttribute(name="protocol")
+ @JsonProperty
+ @XmlAttribute
public String protocol;
/**
* The remote address of the connection
*/
+ @JsonProperty("remote_address")
@XmlAttribute(name="remote-address")
public String remoteAddress;
/**
* The connected user
*/
- @XmlAttribute(name="user")
+ @JsonProperty
+ @XmlAttribute
public String user;
}
Modified: activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/ConnectorDTO.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/ConnectorDTO.java?rev=961189&r1=961188&r2=961189&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/ConnectorDTO.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/ConnectorDTO.java Wed Jul 7 04:16:04 2010
@@ -16,6 +16,8 @@
*/
package org.apache.activemq.apollo.dto;
+import org.codehaus.jackson.annotate.JsonProperty;
+
import javax.xml.bind.annotation.*;
/**
@@ -31,18 +33,21 @@ public class ConnectorDTO extends Servic
/**
* The transport uri which it will accept connections on.
*/
+ @JsonProperty
@XmlAttribute
public String bind;
/**
* The protocol that the transport will use.
*/
+ @JsonProperty
@XmlAttribute
public String protocol;
/**
* The uri which will be advertised for remote endpoints to connect to.
*/
+ @JsonProperty
@XmlAttribute
public String advertise;
Modified: activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/ConnectorStatusDTO.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/ConnectorStatusDTO.java?rev=961189&r1=961188&r2=961189&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/ConnectorStatusDTO.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/ConnectorStatusDTO.java Wed Jul 7 04:16:04 2010
@@ -16,6 +16,8 @@
*/
package org.apache.activemq.apollo.dto;
+import org.codehaus.jackson.annotate.JsonProperty;
+
import javax.xml.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
@@ -33,19 +35,21 @@ public class ConnectorStatusDTO extends
/**
* The number of connections that this connector has accepted.
*/
- @XmlAttribute(name="accepted")
+ @JsonProperty
+ @XmlAttribute
public Long accepted;
/**
* Ids of all open connections that the connector is managing.
*/
+ @JsonProperty("connections")
@XmlElement(name="connection")
public List<Long> connections = new ArrayList<Long>();
/**
* The current running configuration of the object
*/
- @XmlElement(name="config")
+ @XmlElement
public ConnectorDTO config = null;
}
Modified: activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/DestinationStatusDTO.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/DestinationStatusDTO.java?rev=961189&r1=961188&r2=961189&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/DestinationStatusDTO.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/DestinationStatusDTO.java Wed Jul 7 04:16:04 2010
@@ -16,6 +16,8 @@
*/
package org.apache.activemq.apollo.dto;
+import org.codehaus.jackson.annotate.JsonProperty;
+
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
@@ -36,18 +38,21 @@ public class DestinationStatusDTO extend
/**
* Ids of all connections that are producing to the destination
*/
+ @JsonProperty("producers")
@XmlElement(name="producer")
public List<Long> producers = new ArrayList<Long>();
/**
* Ids of all connections that are consuming from the destination
*/
+ @JsonProperty("consumers")
@XmlElement(name="consumer")
public List<Long> consumers = new ArrayList<Long>();
/**
* Ids of all queues that are associated with the destination
*/
+ @JsonProperty("queues")
@XmlElement(name="queue")
public List<Long> queues = new ArrayList<Long>();
}
\ No newline at end of file
Modified: activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/DestinationSummaryDTO.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/DestinationSummaryDTO.java?rev=961189&r1=961188&r2=961189&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/DestinationSummaryDTO.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/DestinationSummaryDTO.java Wed Jul 7 04:16:04 2010
@@ -16,6 +16,8 @@
*/
package org.apache.activemq.apollo.dto;
+import org.codehaus.jackson.annotate.JsonProperty;
+
import javax.xml.bind.annotation.*;
/**
@@ -31,13 +33,15 @@ public class DestinationSummaryDTO exten
/**
* The destination name
*/
- @XmlElement(name="name")
+ @JsonProperty
+ @XmlElement
public String name;
/**
* The routing domain
*/
- @XmlElement(name="domain")
+ @JsonProperty
+ @XmlElement
public String domain;
}
\ No newline at end of file
Modified: activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/EntryStatusDTO.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/EntryStatusDTO.java?rev=961189&r1=961188&r2=961189&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/EntryStatusDTO.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/EntryStatusDTO.java Wed Jul 7 04:16:04 2010
@@ -16,6 +16,8 @@
*/
package org.apache.activemq.apollo.dto;
+import org.codehaus.jackson.annotate.JsonProperty;
+
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
@@ -34,22 +36,28 @@ public class EntryStatusDTO {
/**
* A unique id of the object within it's container
*/
- @XmlAttribute(name="seq")
+ @JsonProperty
+ @XmlAttribute
public long seq;
- @XmlAttribute(name="count")
+ @JsonProperty
+ @XmlAttribute
public int count;
- @XmlAttribute(name="size")
+ @JsonProperty
+ @XmlAttribute
public int size;
- @XmlAttribute(name="state")
+ @JsonProperty
+ @XmlAttribute
public String state;
- @XmlAttribute(name="consumers")
- public int consumers;
-
- @XmlAttribute(name="prefetched")
- public int prefetched;
+ @JsonProperty("consumer_count")
+ @XmlAttribute(name = "consumer-count")
+ public int consumerCount;
+
+ @JsonProperty("prefetch_count")
+ @XmlAttribute(name = "prefetch-count")
+ public int prefetchCount;
}
\ No newline at end of file
Modified: activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/HawtDBStoreDTO.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/HawtDBStoreDTO.java?rev=961189&r1=961188&r2=961189&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/HawtDBStoreDTO.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/HawtDBStoreDTO.java Wed Jul 7 04:16:04 2010
@@ -16,6 +16,8 @@
*/
package org.apache.activemq.apollo.dto;
+import org.codehaus.jackson.annotate.JsonProperty;
+
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
@@ -29,31 +31,40 @@ import java.io.File;
@XmlAccessorType(XmlAccessType.FIELD)
public class HawtDBStoreDTO extends StoreDTO {
- @XmlAttribute(name="directory", required=false)
+ @JsonProperty
+ @XmlAttribute
public File directory;
- @XmlAttribute(name="archive-directory", required=false)
+ @JsonProperty("archive_directory")
+ @XmlAttribute(name="archive-directory")
public File archiveDirectory;
- @XmlAttribute(name="index-flush-interval", required=false)
+ @JsonProperty("index_flush_interval")
+ @XmlAttribute(name="index-flush-interval")
public long indexFlushInterval = 5 * 1000L;
- @XmlAttribute(name="cleanup-interval", required=false)
+ @JsonProperty("cleanup_interval")
+ @XmlAttribute(name="cleanup-interval")
public long cleanupInterval = 30 * 1000L;
- @XmlAttribute(name="journal-log-size", required=false)
+ @JsonProperty("journal_log_size")
+ @XmlAttribute(name="journal-log-size")
public int journalLogSize = 1024*1024*64;
- @XmlAttribute(name="journal-batch-size", required=false)
+ @JsonProperty("journal_batch_size")
+ @XmlAttribute(name="journal-batch-size")
public int journalBatchSize = 1024*256;
- @XmlAttribute(name="index-cache-size", required=false)
+ @JsonProperty("index_cache_size")
+ @XmlAttribute(name="index-cache-size")
public int indexCacheSize = 5000;
- @XmlAttribute(name="index-page-size", required=false)
+ @JsonProperty("index_page_size")
+ @XmlAttribute(name="index-page-size")
public short indexPageSize = 512;
- @XmlAttribute(name="fail-if-locked", required=false)
+ @JsonProperty("fail_if_locked")
+ @XmlAttribute(name="fail-if-locked")
public boolean failIfLocked = false;
Modified: activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/IdListDTO.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/IdListDTO.java?rev=961189&r1=961188&r2=961189&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/IdListDTO.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/IdListDTO.java Wed Jul 7 04:16:04 2010
@@ -16,6 +16,8 @@
*/
package org.apache.activemq.apollo.dto;
+import org.codehaus.jackson.annotate.JsonProperty;
+
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
@@ -33,6 +35,7 @@ public class IdListDTO {
/**
* A list of ids.
*/
+ @JsonProperty("ids")
@XmlElement
public List<String> ids = new ArrayList<String>();
Modified: activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/LongIdDTO.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/LongIdDTO.java?rev=961189&r1=961188&r2=961189&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/LongIdDTO.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/LongIdDTO.java Wed Jul 7 04:16:04 2010
@@ -16,6 +16,8 @@
*/
package org.apache.activemq.apollo.dto;
+import org.codehaus.jackson.annotate.JsonProperty;
+
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
@@ -31,7 +33,8 @@ public class LongIdDTO {
/**
* A unique id of the object within it's container
*/
- @XmlAttribute(name="id")
+ @JsonProperty
+ @XmlAttribute
public long id;
Modified: activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/QueueStatusDTO.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/QueueStatusDTO.java?rev=961189&r1=961188&r2=961189&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/QueueStatusDTO.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/QueueStatusDTO.java Wed Jul 7 04:16:04 2010
@@ -16,6 +16,8 @@
*/
package org.apache.activemq.apollo.dto;
+import org.codehaus.jackson.annotate.JsonProperty;
+
import javax.xml.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
@@ -33,40 +35,62 @@ public class QueueStatusDTO extends Long
/**
* A unique id of the object within it's container
*/
- @XmlAttribute(name="enqueue-item-counter")
+ @JsonProperty
+ @XmlAttribute
public long id;
+ @JsonProperty("enqueue_item_counter")
@XmlAttribute(name="enqueue-item-counter")
public long enqueueItemCounter;
+
+ @JsonProperty("dequeue_item_counter")
@XmlAttribute(name="dequeue-item-counter")
public long dequeueItemCounter;
+
+ @JsonProperty("enqueue_size_counter")
@XmlAttribute(name="enqueue-size-counter")
public long enqueueSizeCounter;
+
+ @JsonProperty("dequeue_size_counter")
@XmlAttribute(name="dequeue-size-counter")
public long dequeueSizeCounter;
+
+ @JsonProperty("nack_item_counter")
@XmlAttribute(name="nack-item-counter")
public long nackItemCounter;
+
+ @JsonProperty("nack_size_counter")
@XmlAttribute(name="nack-size-counter")
public long nackSizeCounter;
+ @JsonProperty("queue_size")
@XmlAttribute(name="queue-size")
public long queueSize;
+
+ @JsonProperty("queue_items")
@XmlAttribute(name="queue-items")
public long queueItems;
+ @JsonProperty("loading_size")
@XmlAttribute(name="loading-size")
public int loadingSize;
+
+ @JsonProperty("flushing_size")
@XmlAttribute(name="flushing-size")
public int flushingSize;
+
+ @JsonProperty("flushing_items")
@XmlAttribute(name="flushed-items")
public int flushedItems;
- @XmlAttribute(name="capacity")
+ @JsonProperty
+ @XmlAttribute
public int capacity;
/**
* Status of the entries in the queue
*/
+ @JsonProperty("entries")
@XmlElement(name="entry")
public List<EntryStatusDTO> entries = new ArrayList<EntryStatusDTO>();
Modified: activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/ServiceDTO.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/ServiceDTO.java?rev=961189&r1=961188&r2=961189&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/ServiceDTO.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/ServiceDTO.java Wed Jul 7 04:16:04 2010
@@ -16,6 +16,8 @@
*/
package org.apache.activemq.apollo.dto;
+import org.codehaus.jackson.annotate.JsonProperty;
+
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
@@ -31,7 +33,8 @@ public class ServiceDTO<ID> extends Stri
/**
* Should this service be running?
*/
- @XmlAttribute(name="enabled")
+ @JsonProperty
+ @XmlAttribute
public boolean enabled = true;
Modified: activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/ServiceStatusDTO.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/ServiceStatusDTO.java?rev=961189&r1=961188&r2=961189&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/ServiceStatusDTO.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/ServiceStatusDTO.java Wed Jul 7 04:16:04 2010
@@ -16,6 +16,8 @@
*/
package org.apache.activemq.apollo.dto;
+import org.codehaus.jackson.annotate.JsonProperty;
+
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
@@ -31,12 +33,14 @@ public class ServiceStatusDTO extends Lo
/**
* The state of the service.
*/
- @XmlAttribute(name="state")
+ @JsonProperty
+ @XmlAttribute
public String state;
/**
* Since when has the broker in in this state? In milliseconds since the epoch.
*/
+ @JsonProperty("state_since")
@XmlAttribute(name="state-since")
public long stateSince;
Modified: activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/StoreDTO.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/StoreDTO.java?rev=961189&r1=961188&r2=961189&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/StoreDTO.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/StoreDTO.java Wed Jul 7 04:16:04 2010
@@ -16,6 +16,7 @@
*/
package org.apache.activemq.apollo.dto;
+import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.annotate.JsonTypeInfo;
import javax.xml.bind.annotation.XmlAttribute;
@@ -37,6 +38,7 @@ public abstract class StoreDTO {
* be invalidated shortly thereafter by another unit of work which
* would negate the operation.
*/
+ @JsonProperty("flush_delay")
@XmlAttribute(name="flush-delay", required=false)
public long flushDelay = 100;
Modified: activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/StringIdDTO.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/StringIdDTO.java?rev=961189&r1=961188&r2=961189&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/StringIdDTO.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/StringIdDTO.java Wed Jul 7 04:16:04 2010
@@ -16,6 +16,8 @@
*/
package org.apache.activemq.apollo.dto;
+import org.codehaus.jackson.annotate.JsonProperty;
+
import javax.xml.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
@@ -30,7 +32,8 @@ public class StringIdDTO {
/**
* A unique id of the object within it's container
*/
- @XmlAttribute(name="id")
+ @JsonProperty
+ @XmlAttribute
public String id;
Modified: activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/VirtualHostDTO.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/VirtualHostDTO.java?rev=961189&r1=961188&r2=961189&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/VirtualHostDTO.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/VirtualHostDTO.java Wed Jul 7 04:16:04 2010
@@ -16,6 +16,8 @@
*/
package org.apache.activemq.apollo.dto;
+import org.codehaus.jackson.annotate.JsonProperty;
+
import java.util.ArrayList;
import javax.xml.bind.annotation.*;
@@ -27,22 +29,26 @@ import javax.xml.bind.annotation.*;
@XmlAccessorType(XmlAccessType.FIELD)
public class VirtualHostDTO extends ServiceDTO<String> {
+ @JsonProperty("host_names")
@XmlElement(name="host-name", required=true)
public ArrayList<String> hostNames = new ArrayList<String>();
- @XmlElementRef
+ @JsonProperty
+ @XmlElementRef
public StoreDTO store;
/**
* Should queues be auto created when they are first accessed
* by clients?
*/
+ @JsonProperty("auto_create_queues")
@XmlAttribute(name="auto-create-queues")
public boolean autoCreateQueues = true;
/**
* Should queues be purged on startup?
*/
+ @JsonProperty("purge_on_startup")
@XmlAttribute(name="purge-on-startup")
public boolean purgeOnStartup = false;
}
Modified: activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/VirtualHostStatusDTO.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/VirtualHostStatusDTO.java?rev=961189&r1=961188&r2=961189&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/VirtualHostStatusDTO.java (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/java/org/apache/activemq/apollo/dto/VirtualHostStatusDTO.java Wed Jul 7 04:16:04 2010
@@ -16,6 +16,8 @@
*/
package org.apache.activemq.apollo.dto;
+import org.codehaus.jackson.annotate.JsonProperty;
+
import javax.xml.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
@@ -33,12 +35,14 @@ public class VirtualHostStatusDTO extend
/**
* The type of store the virtual host is using.
*/
+ @JsonProperty("store_type")
@XmlAttribute(name="store-type")
public String storeType;
/**
* Ids of all the destinations running on the broker
*/
+ @JsonProperty("destinations")
@XmlElement(name="destination")
public List<DestinationSummaryDTO> destinations = new ArrayList<DestinationSummaryDTO>();
@@ -46,7 +50,8 @@ public class VirtualHostStatusDTO extend
/**
* The current running configuration of the object
*/
- @XmlElement(name="config")
+ @JsonProperty
+ @XmlElement
public VirtualHostDTO config = null;
}
Modified: activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/resources/org/apache/activemq/apollo/dto/jaxb.index
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/resources/org/apache/activemq/apollo/dto/jaxb.index?rev=961189&r1=961188&r2=961189&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/resources/org/apache/activemq/apollo/dto/jaxb.index (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-dto/src/main/resources/org/apache/activemq/apollo/dto/jaxb.index Wed Jul 7 04:16:04 2010
@@ -15,3 +15,23 @@
## limitations under the License.
## ------------------------------------------------------------------------
BrokerDTO
+BrokerStatusDTO
+BrokerSummariesDTO
+BrokerSummaryDTO
+CassandraStoreDTO
+ConnectionStatusDTO
+ConnectorDTO
+ConnectorStatusDTO
+DestinationStatusDTO
+DestinationSummaryDTO
+EntryStatusDTO
+HawtDBStoreDTO
+IdListDTO
+LongIdDTO
+QueueStatusDTO
+ServiceDTO
+ServiceStatusDTO
+StoreDTO
+StringIdDTO
+VirtualHostDTO
+VirtualHostStatusDTO
Modified: activemq/sandbox/activemq-apollo-actor/activemq-web/pom.xml
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-web/pom.xml?rev=961189&r1=961188&r2=961189&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-web/pom.xml (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-web/pom.xml Wed Jul 7 04:16:04 2010
@@ -69,6 +69,19 @@
<version>${logback-version}</version>
</dependency>
+ <dependency>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>jetty</artifactId>
+ <version>${jetty-version}</version>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>jetty-util</artifactId>
+ <version>${jetty-version}</version>
+ <optional>true</optional>
+ </dependency>
+
<!-- Scala Support -->
<dependency>
<groupId>org.scala-lang</groupId>
Copied: activemq/sandbox/activemq-apollo-actor/activemq-web/src/main/scala/org/apache/activemq/apollo/web/ConfigStore.scala (from r961188, activemq/sandbox/activemq-apollo-actor/activemq-web/src/main/scala/org/apache/activemq/apollo/ConfigStore.scala)
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-web/src/main/scala/org/apache/activemq/apollo/web/ConfigStore.scala?p2=activemq/sandbox/activemq-apollo-actor/activemq-web/src/main/scala/org/apache/activemq/apollo/web/ConfigStore.scala&p1=activemq/sandbox/activemq-apollo-actor/activemq-web/src/main/scala/org/apache/activemq/apollo/ConfigStore.scala&r1=961188&r2=961189&rev=961189&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-web/src/main/scala/org/apache/activemq/apollo/ConfigStore.scala (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-web/src/main/scala/org/apache/activemq/apollo/web/ConfigStore.scala Wed Jul 7 04:16:04 2010
@@ -14,11 +14,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.activemq.apollo
+package org.apache.activemq.apollo.web
-import broker._
-import broker.jaxb.PropertiesReader
-import dto.{XmlEncoderDecoder, ConnectorDTO, VirtualHostDTO, BrokerDTO}
+import org.apache.activemq.apollo.broker._
+import org.apache.activemq.apollo.broker.jaxb.PropertiesReader
+import org.apache.activemq.apollo.dto.{XmlEncoderDecoder, ConnectorDTO, VirtualHostDTO, BrokerDTO}
import java.util.regex.Pattern
import javax.xml.stream.{XMLOutputFactory, XMLInputFactory}
import _root_.org.fusesource.hawtdispatch.ScalaDispatch._
@@ -30,6 +30,15 @@ import javax.xml.bind.{Marshaller, JAXBC
import java.io.{OutputStreamWriter, File}
import XmlEncoderDecoder._
+object ConfigStore {
+
+ var store:ConfigStore = null
+
+ def apply() = store
+ def update(value:ConfigStore) = store=value
+
+}
+
/**
* <p>
* Defines an interface to access and update persistent broker configurations.
@@ -146,9 +155,9 @@ class FileConfigStore extends ConfigStor
} >>: dispatchQueue
- def foreachBroker(eval:Boolean)(cb: (BrokerDTO)=> Unit) = using(cb) {
- cb(unmarshall(latest.data, eval))
- }
+ def foreachBroker(eval:Boolean)(cb: (BrokerDTO)=> Unit) = reply(cb) {
+ unmarshall(latest.data, eval)
+ } >>: dispatchQueue
def getBroker(id:String, eval:Boolean)(cb: (Option[BrokerDTO]) => Unit) = reply(cb) {
Copied: activemq/sandbox/activemq-apollo-actor/activemq-web/src/main/scala/org/apache/activemq/apollo/web/FileConfigStoreTest.scala (from r961188, activemq/sandbox/activemq-apollo-actor/activemq-web/src/test/scala/org/apache/activemq/apollo/FileConfigStoreTest.scala)
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-web/src/main/scala/org/apache/activemq/apollo/web/FileConfigStoreTest.scala?p2=activemq/sandbox/activemq-apollo-actor/activemq-web/src/main/scala/org/apache/activemq/apollo/web/FileConfigStoreTest.scala&p1=activemq/sandbox/activemq-apollo-actor/activemq-web/src/test/scala/org/apache/activemq/apollo/FileConfigStoreTest.scala&r1=961188&r2=961189&rev=961189&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-web/src/test/scala/org/apache/activemq/apollo/FileConfigStoreTest.scala (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-web/src/main/scala/org/apache/activemq/apollo/web/FileConfigStoreTest.scala Wed Jul 7 04:16:04 2010
@@ -14,9 +14,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.activemq.apollo
+package org.apache.activemq.apollo.web
-import broker.LoggingTracker
+import org.apache.activemq.apollo.broker.LoggingTracker
import java.io.File
import java.util.concurrent.{TimeUnit, CountDownLatch}
import org.fusesource.hawtdispatch.Future
Added: activemq/sandbox/activemq-apollo-actor/activemq-web/src/main/scala/org/apache/activemq/apollo/web/Main.scala
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-web/src/main/scala/org/apache/activemq/apollo/web/Main.scala?rev=961189&view=auto
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-web/src/main/scala/org/apache/activemq/apollo/web/Main.scala (added)
+++ activemq/sandbox/activemq-apollo-actor/activemq-web/src/main/scala/org/apache/activemq/apollo/web/Main.scala Wed Jul 7 04:16:04 2010
@@ -0,0 +1,107 @@
+/**
+ * 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
+
+import org.mortbay.jetty.Connector
+import org.mortbay.jetty.Handler
+import org.mortbay.jetty.Server
+import org.mortbay.jetty.nio.SelectChannelConnector
+import org.mortbay.jetty.webapp.WebAppContext
+import org.apache.commons.logging.LogFactory
+
+/**
+ * <p>
+ * </p>
+ *
+ * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
+ */
+object Main {
+
+ @transient
+ private final val LOG = LogFactory.getLog(this.getClass)
+
+ var server = new Server
+ var port: Int = 8080
+ var localPort: Int = 0
+
+ var webAppDir: String = "src/main/webapp"
+ var context: String = "/"
+
+
+ def main(args:Array[String]) = run
+
+ def run = {
+ println("===========================")
+ println("Starting up ActiveMQ Apollo");
+ println("===========================")
+ println("")
+ println("Press ENTER to shutdown");
+ println("")
+
+ start
+ println("")
+ println("Web interface available at: "+url)
+ println("")
+
+ System.in.read
+
+ println("Shutting down...")
+ stop
+
+ println("=======================")
+ println("Shutdown");
+ println("=======================")
+
+ }
+
+ def start: Unit = {
+ var connector = new SelectChannelConnector
+ connector.setPort(port)
+ connector.setServer(server)
+
+ var app_context = new WebAppContext
+ app_context.setContextPath(context)
+
+ app_context.setResourceBase(webAppDir)
+ // context.setBaseResource(new ResourceCollection(Array(webAppDir, overlayWebAppDir)))
+
+ app_context.setServer(server)
+
+ server.setHandlers(Array[Handler](app_context))
+ server.setConnectors(Array[Connector](connector))
+ server.start
+
+ localPort = connector.getLocalPort
+ }
+
+
+ def stop: Unit = {
+ server.stop
+ }
+
+ def url = "http://localhost:" + localPort + context
+
+ override def toString() = {
+ "--------------------------------------\n"+
+ "Configurable Properties\n"+
+ "--------------------------------------\n"+
+ "port = "+port+"\n"+
+ "context = "+context+"\n"+
+ ""
+ }
+
+}
\ No newline at end of file
Modified: activemq/sandbox/activemq-apollo-actor/activemq-web/src/main/scala/org/apache/activemq/apollo/web/ServletContextListener.scala
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-web/src/main/scala/org/apache/activemq/apollo/web/ServletContextListener.scala?rev=961189&r1=961188&r2=961189&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-web/src/main/scala/org/apache/activemq/apollo/web/ServletContextListener.scala (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-web/src/main/scala/org/apache/activemq/apollo/web/ServletContextListener.scala Wed Jul 7 04:16:04 2010
@@ -19,12 +19,10 @@ package org.apache.activemq.apollo.web
import com.google.inject.servlet.GuiceServletContextListener
import org.fusesource.scalate.guice.ScalateModule
import javax.servlet.ServletContextEvent
-import org.apache.activemq.transport.TransportFactory
-import org.apache.activemq.apollo.broker.{LoggingTracker, Broker}
-import org.apache.activemq.apollo.{FileConfigStore, ConfigStore, BrokerRegistry}
import java.io.File
-import com.google.inject.{Inject, Provides, Guice, Singleton}
-import org.fusesource.hawtdispatch.ScalaDispatch._
+import com.google.inject.{Provides, Guice, Singleton}
+import org.apache.activemq.apollo.broker.{BrokerRegistry, LoggingTracker, Broker}
+
/**
* A servlet context listener which registers
@@ -34,13 +32,16 @@ import org.fusesource.hawtdispatch.Scala
*/
class ServletContextListener extends GuiceServletContextListener {
+ var configStore:ConfigStore = null
+
override def contextInitialized(servletContextEvent: ServletContextEvent) = {
try {
- BrokerRegistry.configStore = createConfigStore
+ configStore = createConfigStore
+ ConfigStore() = configStore
// Brokers startup async.
- BrokerRegistry.configStore.foreachBroker(true) { config=>
+ configStore.foreachBroker(true) { config=>
println("Config store contained broker: "+config.id);
@@ -50,7 +51,7 @@ class ServletContextListener extends Gui
println("starting broker: "+config.id);
val broker = new Broker()
broker.config = config
- BrokerRegistry.add(broker)
+ BrokerRegistry.add(config.id, broker)
broker.start()
}
@@ -70,22 +71,23 @@ class ServletContextListener extends Gui
super.contextDestroyed(servletContextEvent);
val tracker = new LoggingTracker("webapp shutdown")
- BrokerRegistry.configStore.foreachBroker(false) { config=>
+ configStore.foreachBroker(false) { config=>
// remove started brokers what we configured..
val broker = BrokerRegistry.remove(config.id);
if( broker!=null ) {
tracker.stop(broker)
}
}
- tracker.stop(BrokerRegistry.configStore)
+ tracker.stop(configStore)
tracker.await
+ configStore = null
}
def getInjector = Guice.createInjector(new ScalateModule() {
@Singleton
@Provides
- def provideConfigStore:ConfigStore = createConfigStore
+ def provideConfigStore:ConfigStore = configStore
// lets add any package names which contain JAXRS resources
// https://jersey.dev.java.net/issues/show_bug.cgi?id=485
@@ -95,6 +97,7 @@ class ServletContextListener extends Gui
super.resourcePackageNames
})
+
def createConfigStore():ConfigStore = {
println("created store")
val store = new FileConfigStore
Copied: activemq/sandbox/activemq-apollo-actor/activemq-web/src/main/scala/org/apache/activemq/apollo/web/resources/RootResource.scala (from r961188, activemq/sandbox/activemq-apollo-actor/activemq-web/src/main/scala/org/apache/activemq/apollo/web/resources/Root.scala)
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-web/src/main/scala/org/apache/activemq/apollo/web/resources/RootResource.scala?p2=activemq/sandbox/activemq-apollo-actor/activemq-web/src/main/scala/org/apache/activemq/apollo/web/resources/RootResource.scala&p1=activemq/sandbox/activemq-apollo-actor/activemq-web/src/main/scala/org/apache/activemq/apollo/web/resources/Root.scala&r1=961188&r2=961189&rev=961189&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-web/src/main/scala/org/apache/activemq/apollo/web/resources/Root.scala (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-web/src/main/scala/org/apache/activemq/apollo/web/resources/RootResource.scala Wed Jul 7 04:16:04 2010
@@ -23,12 +23,12 @@ import core.{Response, Context}
import org.fusesource.scalate.util.Logging
import reflect.{BeanProperty}
import com.sun.jersey.api.view.ImplicitProduces
-import org.apache.activemq.apollo.{BrokerRegistry, ConfigStore}
import org.fusesource.hawtdispatch.Future
import Response._
import Response.Status._
import org.apache.activemq.apollo.dto.{IdListDTO, BrokerSummaryDTO, BrokerDTO}
import java.util.{Arrays, Collections}
+import org.apache.activemq.apollo.web.ConfigStore
/**
* Defines the default representations to be used on resources
@@ -38,7 +38,7 @@ import java.util.{Arrays, Collections}
trait Resource extends Logging {
def result[T](value:Status, message:Any=null):T = {
- val response = status(value);
+ val response = Response.status(value)
if( message!=null ) {
response.entity(message)
}
@@ -54,7 +54,7 @@ trait Resource extends Logging {
class Root() extends Resource {
@Context
- var configStore:ConfigStore = BrokerRegistry.configStore;
+ var configStore = ConfigStore()
@GET
def get() = {
@@ -76,7 +76,7 @@ class Root() extends Resource {
case class Broker(parent:Root, @BeanProperty id: String) extends Resource {
@Context
- var configStore:ConfigStore = BrokerRegistry.configStore;
+ var configStore = ConfigStore()
@GET
def get() = {
@@ -123,6 +123,6 @@ case class Broker(parent:Root, @BeanProp
}
@Path("status")
- def status = BrokerStatus(this)
+ def status = StatusResource(this)
}
Copied: activemq/sandbox/activemq-apollo-actor/activemq-web/src/main/scala/org/apache/activemq/apollo/web/resources/StatusResource.scala (from r961188, activemq/sandbox/activemq-apollo-actor/activemq-web/src/main/scala/org/apache/activemq/apollo/web/resources/BrokerStatus.scala)
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-apollo-actor/activemq-web/src/main/scala/org/apache/activemq/apollo/web/resources/StatusResource.scala?p2=activemq/sandbox/activemq-apollo-actor/activemq-web/src/main/scala/org/apache/activemq/apollo/web/resources/StatusResource.scala&p1=activemq/sandbox/activemq-apollo-actor/activemq-web/src/main/scala/org/apache/activemq/apollo/web/resources/BrokerStatus.scala&r1=961188&r2=961189&rev=961189&view=diff
==============================================================================
--- activemq/sandbox/activemq-apollo-actor/activemq-web/src/main/scala/org/apache/activemq/apollo/web/resources/BrokerStatus.scala (original)
+++ activemq/sandbox/activemq-apollo-actor/activemq-web/src/main/scala/org/apache/activemq/apollo/web/resources/StatusResource.scala Wed Jul 7 04:16:04 2010
@@ -18,7 +18,6 @@ package org.apache.activemq.apollo.web.r
import javax.ws.rs._
import core.Response
-import org.apache.activemq.apollo.BrokerRegistry
import Response.Status._
import java.util.List
import org.apache.activemq.apollo.dto._
@@ -35,20 +34,17 @@ import org.apache.activemq.apollo.broker
*
* @author <a href="http://hiramchirino.com">Hiram Chirino</a>
*/
-case class BrokerStatus(parent:Broker) extends Resource {
+case class StatusResource(parent:Broker) extends Resource {
val broker:org.apache.activemq.apollo.broker.Broker = BrokerRegistry.get(parent.id)
if( broker == null ) {
- println("not in regisitry: "+BrokerRegistry.brokers)
result(NOT_FOUND)
}
@GET
def get() = {
- println("get hit")
Future[BrokerStatusDTO] { cb=>
broker.dispatchQueue {
- println("building result...")
val result = new BrokerStatusDTO
result.id = broker.id
@@ -72,7 +68,7 @@ case class BrokerStatus(parent:Broker) e
}
- @Path("virtual-hosts")
+ @GET @Path("virtual-hosts")
def virtualHosts :Array[jl.Long] = {
val list: List[jl.Long] = get.virtualHosts
list.toArray(new Array[jl.Long](list.size))
@@ -90,7 +86,7 @@ case class BrokerStatus(parent:Broker) e
}.getOrElse(result(NOT_FOUND))
}
- @Path("virtual-hosts/{id}")
+ @GET @Path("virtual-hosts/{id}")
def virtualHost(@PathParam("id") id : Long):VirtualHostStatusDTO = {
with_virtual_host(id) { case (virtualHost,cb) =>
val result = new VirtualHostStatusDTO
@@ -99,6 +95,7 @@ case class BrokerStatus(parent:Broker) e
result.stateSince = virtualHost.serviceState.since
result.config = virtualHost.config
+
if( virtualHost.store != null ) {
result.storeType = virtualHost.store.storeType
}
@@ -113,7 +110,7 @@ case class BrokerStatus(parent:Broker) e
}
}
- @Path("virtual-hosts/{id}/destinations/{dest}")
+ @GET @Path("virtual-hosts/{id}/destinations/{dest}")
def destination(@PathParam("id") id : Long, @PathParam("dest") dest : Long):DestinationStatusDTO = {
with_virtual_host(id) { case (virtualHost,cb) =>
cb(virtualHost.router.destinations.valuesIterator.find { _.id == dest } map { node=>
@@ -132,7 +129,7 @@ case class BrokerStatus(parent:Broker) e
}
}
- @Path("virtual-hosts/{id}/queues/{queue}")
+ @GET @Path("virtual-hosts/{id}/queues/{queue}")
def queue(@PathParam("id") id : Long, @PathParam("queue") qid : Long):QueueStatusDTO = {
with_virtual_host(id) { case (virtualHost,cb) =>
import JavaConversions._
@@ -166,8 +163,8 @@ case class BrokerStatus(parent:Broker) e
e.seq = cur.seq
e.count = cur.count
e.size = cur.size
- e.consumers = cur.parked.size
- e.prefetched = cur.prefetched
+ e.consumerCount = cur.parked.size
+ e.prefetchCount = cur.prefetched
e.state = cur.label
result.entries.add(e)
@@ -188,13 +185,13 @@ case class BrokerStatus(parent:Broker) e
}
- @Path("connectors")
+ @GET @Path("connectors")
def connectors :Array[jl.Long] = {
val list: List[jl.Long] = get.connectors
list.toArray(new Array[jl.Long](list.size))
}
- @Path("connectors/{id}")
+ @GET @Path("connectors/{id}")
def connector(@PathParam("id") id : Long):ConnectorStatusDTO = {
Future[Option[ConnectorStatusDTO]] { cb=>