[maven-release-plugin] copy for tag apollo-project-1.0
git-svn-id: https://svn.apache.org/repos/asf/activemq/activemq-apollo/tags/apollo-project-1.0@1237646 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/apollo-bdb/src/main/resources/META-INF/services/org.apache.activemq.apollo/dto-module.index b/apollo-bdb/src/main/resources/META-INF/services/org.apache.activemq.apollo/dto-module.index
new file mode 100644
index 0000000..00a0ea7
--- /dev/null
+++ b/apollo-bdb/src/main/resources/META-INF/services/org.apache.activemq.apollo/dto-module.index
@@ -0,0 +1,17 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+org.apache.activemq.apollo.broker.store.bdb.dto.Module
\ No newline at end of file
diff --git a/apollo-bdb/src/main/resources/META-INF/services/org.apache.activemq.apollo/jaxb-module.index b/apollo-bdb/src/main/resources/META-INF/services/org.apache.activemq.apollo/jaxb-module.index
deleted file mode 100644
index 5e6fa57..0000000
--- a/apollo-bdb/src/main/resources/META-INF/services/org.apache.activemq.apollo/jaxb-module.index
+++ /dev/null
@@ -1,17 +0,0 @@
-## ---------------------------------------------------------------------------
-## 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.
-## ---------------------------------------------------------------------------
-org.apache.activemq.apollo.broker.store.bdb.ExtensionJaxbModule
\ No newline at end of file
diff --git a/apollo-bdb/src/main/scala/org/apache/activemq/apollo/broker/store/bdb/BDBClient.scala b/apollo-bdb/src/main/scala/org/apache/activemq/apollo/broker/store/bdb/BDBClient.scala
index 689daf7..71d9d7a 100644
--- a/apollo-bdb/src/main/scala/org/apache/activemq/apollo/broker/store/bdb/BDBClient.scala
+++ b/apollo-bdb/src/main/scala/org/apache/activemq/apollo/broker/store/bdb/BDBClient.scala
@@ -30,7 +30,7 @@
object BDBClient extends Log {
final val STORE_SCHEMA_PREFIX = "bdb_store:"
- final val STORE_SCHEMA_VERSION = 1
+ final val STORE_SCHEMA_VERSION = 2
}
/**
*
diff --git a/apollo-bdb/src/main/scala/org/apache/activemq/apollo/broker/store/bdb/ExtensionJaxbModule.scala b/apollo-bdb/src/main/scala/org/apache/activemq/apollo/broker/store/bdb/ExtensionJaxbModule.scala
deleted file mode 100644
index 9f8baf2..0000000
--- a/apollo-bdb/src/main/scala/org/apache/activemq/apollo/broker/store/bdb/ExtensionJaxbModule.scala
+++ /dev/null
@@ -1,26 +0,0 @@
-/**
- * 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.broker.store.bdb
-
-import org.apache.activemq.apollo.util.JaxbModule
-
-/**
- * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
- */
-class ExtensionJaxbModule extends JaxbModule {
- def xml_package = "org.apache.activemq.apollo.broker.store.bdb.dto"
-}
\ No newline at end of file
diff --git a/apollo-bdb/src/main/scala/org/apache/activemq/apollo/broker/store/bdb/dto/Module.scala b/apollo-bdb/src/main/scala/org/apache/activemq/apollo/broker/store/bdb/dto/Module.scala
new file mode 100644
index 0000000..eb8d24f
--- /dev/null
+++ b/apollo-bdb/src/main/scala/org/apache/activemq/apollo/broker/store/bdb/dto/Module.scala
@@ -0,0 +1,26 @@
+/**
+ * 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.broker.store.bdb.dto
+import org.apache.activemq.apollo.util.DtoModule
+
+/**
+ * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
+ */
+class Module extends DtoModule {
+ def dto_package = "org.apache.activemq.apollo.broker.store.bdb.dto"
+ def extension_classes = Array(classOf[BDBStoreDTO], classOf[BDBStoreStatusDTO])
+}
\ No newline at end of file
diff --git a/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Broker.scala b/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Broker.scala
index 0cb873f..8325ade 100644
--- a/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Broker.scala
+++ b/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Broker.scala
@@ -348,12 +348,12 @@
def schedule_virtualhost_maintenance:Unit = dispatch_queue.after(1, TimeUnit.SECONDS) {
if( service_state.is_started ) {
- val active_connections = connections.keySet
+ val active_sessions = connections.values.flatMap(_.session_id).toSet
virtual_hosts.values.foreach { host=>
host.dispatch_queue {
if(host.service_state.is_started) {
- host.router.remove_temp_destinations(active_connections)
+ host.router.remove_temp_destinations(active_sessions)
}
}
}
diff --git a/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Connection.scala b/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Connection.scala
index 88884ae..b7944f7 100644
--- a/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Connection.scala
+++ b/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Connection.scala
@@ -96,6 +96,8 @@
var protocol_handler: ProtocolHandler = null;
+ def session_id = Option(protocol_handler).flatMap(_.session_id)
+
override def toString = "id: "+id.toString
protected override def _start(on_completed:Runnable) = {
@@ -140,9 +142,10 @@
result.state = service_state.toString
result.state_since = service_state.since
result.protocol = protocol_handler.protocol
- result.transport = transport.getTypeId
+ result.connector = connector.id
result.remote_address = transport.getRemoteAddress.toString
result.local_address = transport.getLocalAddress.toString
+ result.protocol_session_id = protocol_handler.session_id.getOrElse(null)
val wf = transport.getProtocolCodec
if( wf!=null ) {
result.write_counter = wf.getWriteCounter
diff --git a/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/DestinationParser.scala b/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/DestinationParser.scala
index 5a208bb..ef837ce 100644
--- a/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/DestinationParser.scala
+++ b/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/DestinationParser.scala
@@ -35,6 +35,7 @@
var temp_queue_prefix = "temp-queue:"
var temp_topic_prefix = "temp-topic:"
var destination_separator = ","
+ var sanitize_destinations = false
def copy(other:DestinationParser) = {
super.copy(other)
@@ -59,20 +60,32 @@
}
dest match {
case d:QueueDestinationDTO =>
- if( queue_prefix!=null ) {
- rc.append(queue_prefix)
+ if ( d.temp() ) {
+ if( temp_queue_prefix!=null ) {
+ rc.append(temp_queue_prefix)
+ }
+ } else {
+ if( queue_prefix!=null ) {
+ rc.append(queue_prefix)
+ }
}
- rc.append(encode_path(dest.path.toIterable))
+ rc.append(encode_path_iter(dest.path.toIterable, sanitize_destinations))
case d:DurableSubscriptionDestinationDTO =>
if( dsub_prefix!=null ) {
rc.append(dsub_prefix)
}
- rc.append(d.subscription_id)
+ rc.append(unsanitize_destination_part(d.subscription_id))
case d:TopicDestinationDTO =>
- if( topic_prefix!=null ) {
- rc.append(topic_prefix)
+ if ( d.temp() ) {
+ if( temp_topic_prefix!=null ) {
+ rc.append(temp_topic_prefix)
+ }
+ } else {
+ if( topic_prefix!=null ) {
+ rc.append(topic_prefix)
+ }
}
- rc.append(encode_path(dest.path.toIterable))
+ rc.append(encode_path_iter(dest.path.toIterable, sanitize_destinations))
case _ =>
throw new Exception("Uknown destination type: "+dest.getClass);
}
@@ -125,19 +138,19 @@
def decode_single_destination(value: String, unqualified: (String) => DestinationDTO): DestinationDTO = {
if (queue_prefix != null && value.startsWith(queue_prefix)) {
var name = value.substring(queue_prefix.length)
- return new QueueDestinationDTO(parts(name))
+ return new QueueDestinationDTO(parts(name, sanitize_destinations))
} else if (topic_prefix != null && value.startsWith(topic_prefix)) {
var name = value.substring(topic_prefix.length)
- return new TopicDestinationDTO(parts(name))
+ return new TopicDestinationDTO(parts(name, sanitize_destinations))
} else if (dsub_prefix != null && value.startsWith(dsub_prefix)) {
- var name = value.substring(dsub_prefix.length)
+ var name = sanitize_destination_part(value.substring(dsub_prefix.length))
return new DurableSubscriptionDestinationDTO(name).direct();
} else if (temp_topic_prefix != null && value.startsWith(temp_topic_prefix)) {
var name = value.substring(temp_topic_prefix.length)
- return new TopicDestinationDTO(parts(name)).temp(true)
+ return new TopicDestinationDTO(parts(name, sanitize_destinations)).temp(true)
} else if (temp_queue_prefix != null && value.startsWith(temp_queue_prefix)) {
var name = value.substring(temp_queue_prefix.length)
- return new QueueDestinationDTO(parts(name)).temp(true)
+ return new QueueDestinationDTO(parts(name, sanitize_destinations)).temp(true)
} else if (unqualified != null) {
return unqualified(value)
} else {
diff --git a/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/LocalRouter.scala b/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/LocalRouter.scala
index d00a7e7..88f02f9 100644
--- a/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/LocalRouter.scala
+++ b/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/LocalRouter.scala
@@ -213,7 +213,7 @@
None
} else {
try {
- Some((destination.path.get(1), destination.path.get(2).toLong))
+ Some((destination.path.get(1), destination.path.get(2)))
} catch {
case _ => None
}
@@ -287,7 +287,7 @@
for(dest <- get_destination_matches(path)) {
if( is_temp(destination) ) {
val owner = temp_owner(destination).get
- for( connection <- security.connection_id) {
+ for( connection <- security.session_id) {
if( (virtual_host.broker.id, connection) != owner ) {
return Some("Not authorized to destroy the temp %s '%s'. Principals=%s".format(dest.resource_kind.id, dest.id, security.principal_dump))
}
@@ -313,7 +313,7 @@
if( is_temp(destination) ) {
temp_owner(destination) match {
case Some(owner) =>
- for( connection <- security.connection_id) {
+ for( connection <- security.session_id) {
if( (virtual_host.broker.id, connection) != owner ) {
return Some("Not authorized to receive from the temporary destination. Principals=%s".format(security.principal_dump))
}
@@ -911,7 +911,7 @@
}
- def remove_temp_destinations(active_connections:scala.collection.Set[Long]) = {
+ def remove_temp_destinations(active_connections:scala.collection.Set[String]) = {
virtual_host.dispatch_queue.assertExecuting()
val min_create_time = virtual_host.broker.now - 1000;
diff --git a/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Router.scala b/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Router.scala
index ba54b04..3a0297f 100644
--- a/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Router.scala
+++ b/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Router.scala
@@ -48,7 +48,7 @@
def apply_update(on_completed:Runnable):Unit
- def remove_temp_destinations(active_connections:scala.collection.Set[Long]):Unit
+ def remove_temp_destinations(active_connections:scala.collection.Set[String]):Unit
}
/**
diff --git a/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/protocol/AnyProtocol.scala b/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/protocol/AnyProtocol.scala
index 11da1ee..2da18de 100644
--- a/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/protocol/AnyProtocol.scala
+++ b/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/protocol/AnyProtocol.scala
@@ -154,6 +154,8 @@
var discriminated = false
+ def session_id = None
+
override def on_transport_command(command: AnyRef) = {
if (!command.isInstanceOf[ProtocolDetected]) {
diff --git a/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/protocol/ProtocolFactory.scala b/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/protocol/ProtocolFactory.scala
index 62c401f..25c62cf 100644
--- a/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/protocol/ProtocolFactory.scala
+++ b/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/protocol/ProtocolFactory.scala
@@ -67,6 +67,8 @@
def protocol:String
+ def session_id:Option[String]
+
var connection:BrokerConnection = null;
def set_connection(brokerConnection:BrokerConnection) = {
diff --git a/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/security/SecurityContext.scala b/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/security/SecurityContext.scala
index 001cefb..9c6e0e1 100644
--- a/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/security/SecurityContext.scala
+++ b/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/security/SecurityContext.scala
@@ -39,7 +39,7 @@
var local_address:SocketAddress = _
var remote_address:SocketAddress = _
var login_context:LoginContext = _
- var connection_id:Option[Long] = None
+ var session_id:Option[String] = None
def credential_dump = {
var rc = List[String]()
diff --git a/apollo-cli/pom.xml b/apollo-cli/pom.xml
index 047f3ca..d32928d 100644
--- a/apollo-cli/pom.xml
+++ b/apollo-cli/pom.xml
@@ -135,6 +135,12 @@
<version>1.0</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>apollo-openwire</artifactId>
+ <version>1.0</version>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
diff --git a/apollo-cli/src/main/filtered-resources/org/apache/activemq/apollo/cli/banner.txt b/apollo-cli/src/main/filtered-resources/org/apache/activemq/apollo/cli/banner.txt
index b1e9e2e..601791f 100644
--- a/apollo-cli/src/main/filtered-resources/org/apache/activemq/apollo/cli/banner.txt
+++ b/apollo-cli/src/main/filtered-resources/org/apache/activemq/apollo/cli/banner.txt
@@ -1,9 +1,9 @@
-
-[4C[0;1m_____[16C.__ .__
+[0;40;37m
+ [1m_____ .__ .__
/ [32m_ \ [37m______ ____ | [32m| [37m| [32m| [37m____
/ [32m/[37m_\ [32m\[37m\[32m____ \ [37m/ [32m_ \[37m| [32m| [37m| [32m| [37m/ [32m_ \
[37m/ | [32m\ |[37m_> [32m> <[37m_> [32m) |[37m_| [32m|[37m_( [32m<[37m_> [32m)
\____[37m|[32m__ / __/ \____/[37m|[32m____/____/[37m\[32m____/
-[9C\/[37m|[32m__| [37mApache Apollo[0m (${project.version})
-
+[9C\/[37m|[32m__| [37mApache Apollo[2m (${project.version})
+[0m
diff --git a/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/Apollo.scala b/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/Apollo.scala
index f61b840..d68ee7b 100644
--- a/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/Apollo.scala
+++ b/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/Apollo.scala
@@ -133,7 +133,7 @@
var log_level:String = "NONE"
@argument(name = "args", description = "apollo sub command arguments", multiValued=true)
- var args:Array[String] = _
+ var args:Array[String] = Array()
def execute(session: CommandSession): AnyRef = {
diff --git a/apollo-distro/pom.xml b/apollo-distro/pom.xml
index 2355f18..dc522ef 100644
--- a/apollo-distro/pom.xml
+++ b/apollo-distro/pom.xml
@@ -70,6 +70,12 @@
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
+ <artifactId>apollo-openwire</artifactId>
+ <version>1.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
<artifactId>apollo-web</artifactId>
<version>1.0</version>
<type>jar</type>
@@ -126,19 +132,12 @@
</dependencies>
<profiles>
-
<!-- to include the unstable modules -->
<profile>
<id>unstable</id>
<dependencies>
- <dependency>
- <groupId>org.apache.activemq</groupId>
- <artifactId>apollo-openwire</artifactId>
- <version>${project.version}</version>
- </dependency>
</dependencies>
</profile>
-
</profiles>
<build>
diff --git a/apollo-distro/src/main/release/examples/java/readme.md b/apollo-distro/src/main/release/examples/java/readme.md
index 6e724b2..d1fe75b 100644
--- a/apollo-distro/src/main/release/examples/java/readme.md
+++ b/apollo-distro/src/main/release/examples/java/readme.md
@@ -17,11 +17,11 @@
In one terminal window run:
- java -cp target/example-1.0-SNAPSHOT.jar example.Listener
+ java -cp target/example-0.1-SNAPSHOT.jar example.Listener
In another terminal window run:
- java -cp target/example-1.0-SNAPSHOT.jar example.Publisher
+ java -cp target/example-0.1-SNAPSHOT.jar example.Publisher
You can control to which stomp server the examples try to connect to by
setting the following environment variables:
diff --git a/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/AcceptingConnectorDTO.java b/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/AcceptingConnectorDTO.java
index 1800e45..97d4445 100644
--- a/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/AcceptingConnectorDTO.java
+++ b/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/AcceptingConnectorDTO.java
@@ -21,6 +21,10 @@
import java.util.List;
/**
+ * <p>
+ * A broker connector is used to accept new connections to the broker.
+ * </p>
+ *
* @author <a href="http://hiramchirino.com">Hiram Chirino</a>
*/
@XmlRootElement(name = "connector")
@@ -28,13 +32,14 @@
public class AcceptingConnectorDTO extends ConnectorTypeDTO {
/**
- * The transport uri which it will accept connections on.
+ * The transport that the connector will listen on, it includes the ip address and port that it will bind to.
+ * Transports are specified using a URI syntax.
*/
@XmlAttribute
public String bind;
/**
- * The protocol that the transport will use.
+ * Defaults to 'any' which means that any of the broker's supported protocols can connect via this transport.
*/
@XmlAttribute
public String protocol;
diff --git a/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/AccessRuleDTO.java b/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/AccessRuleDTO.java
index 892774f..f67284d 100644
--- a/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/AccessRuleDTO.java
+++ b/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/AccessRuleDTO.java
@@ -23,6 +23,8 @@
/**
* <p>
+ * User authorization to broker resources is accomplished by configuring access control rules. The rules define
+ * which principals are allowed or denied access to perform actions against server resources.
* </p>
*
* @author <a href="http://hiramchirino.com">Hiram Chirino</a>
@@ -32,16 +34,16 @@
public class AccessRuleDTO {
/**
- * The class name of the JAAS principle that this rule will mach against. If not set
- * the this defaults to the default principal kinds configured on the broker or virtual host.
- * If set to "*" then it matches all principal classes.
+ * A space separated list of class names of which will be matched against the principle type. If set to *
+ * then it matches all principal classes. Defaults to the default principal kinds configured on the broker
+ * or virtual host.
*/
@XmlAttribute(name = "principal_kind")
public String principal_kind;
/**
* The principal which are allowed access to the action. If set to "+" then it matches all principals
- * but requires at at least one. If set to "*" the it matches all principals and even matches
+ * but requires at at least one. If set to "*" then it matches all principals and even matches
* the case where there are no principals associated with the subject.
*/
@XmlAttribute
@@ -49,7 +51,7 @@
/**
* The principal which are denied access to the action If set to "+" then it matches all principals
- * but requires at at least one. If set to "*" the it matches all principals and even matches
+ * but requires at at least one. If set to "*" then it matches all principals and even matches
* the case where there are no principals associated with the subject.
*/
@XmlAttribute
@@ -70,15 +72,16 @@
public String action;
/**
- * The kind of broker resource which matches this rule. You can use "*" to match all types. If not set
- * it defaults to "*"
+ * A space separated list of broker resource types that will match this rule. You can use * to match all key.
+ * Example values 'broker queue'. Defaults to *.
*/
@XmlAttribute
public String kind;
/**
- * The identifier of the resource which matches this rule. You can use "*" to match all resources. If not set
- * it defaults to "*"
+ * The identifier of the resource that will match this rule. You can use * to match all resources. If the
+ * kind is set to queue or topic the your can use a destination wild card to match against the destination
+ * id. Defaults to *.
*/
@XmlAttribute
public String id;
diff --git a/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/AddUserHeaderDTO.java b/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/AddUserHeaderDTO.java
index 0680589..535b6a6 100644
--- a/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/AddUserHeaderDTO.java
+++ b/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/AddUserHeaderDTO.java
@@ -23,6 +23,7 @@
/**
* <p>
+ * This class is used to more finely control how user headers are added to received STOMP messages.
* </p>
*
* @author <a href="http://hiramchirino.com">Hiram Chirino</a>
@@ -49,7 +50,7 @@
/**
* The user sending the message may have many principals,
* setting the kind will only select those principals who's
- * class name matches the kind.
+ * class name matches the kind. Defaults to *.
*/
@XmlAttribute(name="kind")
public String kind;
diff --git a/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/AggregateConnectionMetricsDTO.java b/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/AggregateConnectionMetricsDTO.java
index 0c824ad..e868f91 100644
--- a/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/AggregateConnectionMetricsDTO.java
+++ b/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/AggregateConnectionMetricsDTO.java
@@ -25,6 +25,7 @@
/**
* <p>
+ * Collects aggregated metrics on all connections.
* </p>
*
* @author <a href="http://hiramchirino.com">Hiram Chirino</a>
diff --git a/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/AggregateDestMetricsDTO.java b/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/AggregateDestMetricsDTO.java
index 1c14a44..9206512 100644
--- a/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/AggregateDestMetricsDTO.java
+++ b/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/AggregateDestMetricsDTO.java
@@ -20,6 +20,7 @@
/**
* <p>
+ * Collects aggregated metrics on all destinations
* </p>
*
* @author <a href="http://hiramchirino.com">Hiram Chirino</a>
diff --git a/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/ApolloTypeIdResolver.java b/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/ApolloTypeIdResolver.java
new file mode 100644
index 0000000..ebfd6bb
--- /dev/null
+++ b/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/ApolloTypeIdResolver.java
@@ -0,0 +1,79 @@
+/**
+ * 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.dto;
+
+import org.apache.activemq.apollo.util.DtoModule$;
+import org.codehaus.jackson.annotate.JsonTypeInfo;
+import org.codehaus.jackson.annotate.JsonTypeName;
+import org.codehaus.jackson.map.jsontype.TypeIdResolver;
+import org.codehaus.jackson.map.type.TypeFactory;
+import org.codehaus.jackson.type.JavaType;
+
+import javax.xml.bind.annotation.XmlRootElement;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+
+/**
+ */
+public class ApolloTypeIdResolver implements TypeIdResolver {
+
+ protected final HashMap<Class<?>, String> typeToId = new HashMap<Class<?>, String>();
+ protected final HashMap<String, JavaType> idToType = new HashMap<String, JavaType>();
+
+ private JavaType baseType;
+ public void init(JavaType baseType) {
+ this.baseType = baseType;
+ ArrayList<Class<?>> classes = new ArrayList<Class<?>>();
+ classes.add(baseType.getRawClass());
+ classes.addAll(Arrays.asList(DtoModule$.MODULE$.extension_classes()));
+ for ( Class<?> c : classes) {
+ if( baseType.getRawClass().isAssignableFrom(c) ) {
+ JsonTypeName jsonAnnoation = c.getAnnotation(JsonTypeName.class);
+ if(jsonAnnoation!=null && jsonAnnoation.value()!=null) {
+ typeToId.put(c, jsonAnnoation.value());
+ idToType.put(jsonAnnoation.value(), TypeFactory.specialize(baseType, c));
+ } else {
+ XmlRootElement xmlAnnoation = c.getAnnotation(XmlRootElement.class);
+ if(xmlAnnoation!=null && xmlAnnoation.name()!=null) {
+ typeToId.put(c, xmlAnnoation.name());
+ idToType.put(xmlAnnoation.name(), TypeFactory.specialize(baseType, c));
+ }
+ }
+ }
+ }
+ }
+
+ public JsonTypeInfo.Id getMechanism() {
+ return JsonTypeInfo.Id.CUSTOM;
+ }
+
+ public String idFromValue(Object value) {
+ String rc = typeToId.get(value.getClass());
+ if(rc==null)
+ throw new IllegalArgumentException("Invalid sub type: "+value.getClass()+", of base type: "+baseType.getRawClass());
+ return rc;
+ }
+
+ public JavaType typeFromId(String id) {
+ JavaType rc = idToType.get(id);
+ if(rc==null)
+ throw new IllegalArgumentException("Invalid type id '"+id);
+ return rc;
+ }
+}
diff --git a/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/AuthenticationDTO.java b/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/AuthenticationDTO.java
index b1268fb..f09f760 100644
--- a/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/AuthenticationDTO.java
+++ b/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/AuthenticationDTO.java
@@ -25,6 +25,7 @@
/**
* <p>
+ * Sets the JAAS authentication used to access the broker.
* </p>
*
* @author <a href="http://hiramchirino.com">Hiram Chirino</a>
@@ -32,9 +33,15 @@
@XmlAccessorType(XmlAccessType.FIELD)
public class AuthenticationDTO {
+ /**
+ * Used to enable/disable authentication in a virtual host.
+ */
@XmlAttribute
public Boolean enabled;
+ /**
+ * Specifies the name of the JAAS domain.
+ */
@XmlAttribute
public String domain;
diff --git a/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/BrokerDTO.java b/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/BrokerDTO.java
index b3c857f..dfd72ef 100644
--- a/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/BrokerDTO.java
+++ b/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/BrokerDTO.java
@@ -48,28 +48,41 @@
public List<ConnectorTypeDTO> connectors = new ArrayList<ConnectorTypeDTO>();
/**
- * The clients should use to connect to this
+ * The address clients should use to connect to this
* broker.
*/
@XmlElement(name="client_address")
public String client_address;
/**
- * The base data directory of the broker. It will store
- * persistent data under it.
+ * Specifies the key store data object
*/
@XmlElementRef
public KeyStorageDTO key_storage;
+ /**
+ * List of AccessRulesDTO objects which contain information about
+ * user authorization to broker resources
+ */
@XmlElement(name="access_rule")
public List<AccessRuleDTO> access_rules = new ArrayList<AccessRuleDTO>();
+ /**
+ * List of WebAdminDTO objects which contain address and port information
+ * to bind to the web interface
+ */
@XmlElement(name="web_admin")
public List<WebAdminDTO> web_admins = new ArrayList<WebAdminDTO>();
+ /**
+ * List of AuthenticationDTO objects which contain JAAS authentication information
+ */
@XmlElement(name="authentication")
public AuthenticationDTO authentication;
+ /**
+ * List of LogCategoryDTO objects which configure logging
+ */
@XmlElement(name="log_category")
public LogCategoryDTO log_category;
@@ -81,8 +94,10 @@
public List<CustomServiceDTO> services = new ArrayList<CustomServiceDTO>();
/**
- * If set to strict, then the broker will not start up if there
- * are any validation errors in the configuration file.
+ * When a broker is first started up, it will validate the configuration file against
+ * the the XSD Schema and report any errors/warnings it finds but it will continue to
+ * start the broker even it finds problems. If set to strict, then the broker will not
+ * start up if there are any validation errors in the configuration file.
*/
@XmlAttribute(name="validation")
public String validation;
diff --git a/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/ConnectionStatusDTO.java b/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/ConnectionStatusDTO.java
index 00adc23..d4b6962 100644
--- a/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/ConnectionStatusDTO.java
+++ b/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/ConnectionStatusDTO.java
@@ -18,10 +18,10 @@
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlRootElement;
+import org.codehaus.jackson.annotate.JsonTypeInfo;
+import org.codehaus.jackson.map.annotate.JsonTypeIdResolver;
+
+import javax.xml.bind.annotation.*;
/**
* <p>
@@ -31,6 +31,9 @@
*/
@XmlRootElement(name="connection_status")
@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "connection_status_type")
+@JsonTypeInfo(use=JsonTypeInfo.Id.CUSTOM, include=JsonTypeInfo.As.PROPERTY, property="@class")
+@JsonTypeIdResolver(ApolloTypeIdResolver.class)
public class ConnectionStatusDTO extends ServiceStatusDTO {
/**
@@ -58,10 +61,10 @@
public long write_counter;
/**
- * The transport the connection is using.
+ * The connector that created the connection.
*/
@XmlAttribute
- public String transport;
+ public String connector;
/**
* The protocol the connection is using.
@@ -72,7 +75,7 @@
/**
* The version of the protocol being used.
*/
- @XmlAttribute
+ @XmlAttribute(name="protocol_version")
public String protocol_version;
/**
@@ -88,6 +91,12 @@
public String local_address;
/**
+ * The session id of the protocol.
+ */
+ @XmlAttribute(name="protocol_session_id")
+ public String protocol_session_id;
+
+ /**
* The connected user
*/
@XmlAttribute
diff --git a/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/ConnectorTypeDTO.java b/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/ConnectorTypeDTO.java
index d988250..cf22a8b 100644
--- a/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/ConnectorTypeDTO.java
+++ b/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/ConnectorTypeDTO.java
@@ -17,6 +17,7 @@
package org.apache.activemq.apollo.dto;
import org.codehaus.jackson.annotate.JsonTypeInfo;
+import org.codehaus.jackson.map.annotate.JsonTypeIdResolver;
import javax.xml.bind.annotation.*;
import java.util.ArrayList;
@@ -27,9 +28,14 @@
*/
@XmlType(name = "connector_type")
@XmlAccessorType(XmlAccessType.FIELD)
-@JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, include = JsonTypeInfo.As.PROPERTY, property = "@class")
+@JsonTypeInfo(use = JsonTypeInfo.Id.CUSTOM, include = JsonTypeInfo.As.PROPERTY, property = "@class")
+@JsonTypeIdResolver(ApolloTypeIdResolver.class)
abstract public class ConnectorTypeDTO extends ServiceDTO {
+ /**
+ * The maximum number of concurrently open connections this connector will accept before it stops accepting
+ * additional connections. If not set, then there is no limit.
+ */
@XmlAttribute(name = "connection_limit")
public Integer connection_limit;
diff --git a/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/DestMetricsDTO.java b/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/DestMetricsDTO.java
index 0933e73..ffbafa4 100644
--- a/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/DestMetricsDTO.java
+++ b/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/DestMetricsDTO.java
@@ -24,13 +24,13 @@
/**
* <p>
- * Collects metrics about the status of a queue since the
- * time a broker gets started.
+ * Collects metrics about the status of a destination since the
+ * time the broker was started.
* </p>
*
* <p>
- * Note that you may need to do a little math to compute how much
- * the number of message swapped on disk:
+ * Note: To compute the total size in bytes of messages that are in persistent
+ * storage use the following algorithm:
*
* swapped_out_size = queue_size - swapped_in_size
*
@@ -80,7 +80,7 @@
public long dequeue_size_counter;
/**
- * The time stamp of when the last dequeue to a consumers occurred.
+ * The time stamp of when the last dequeue to consumers occurred.
*/
@XmlAttribute(name="dequeue_ts")
public long dequeue_ts;
@@ -108,7 +108,7 @@
public long producer_count;
/**
- * The current number of producers consuming from the destination.
+ * The current number of consumers consuming from the destination.
*/
@XmlAttribute(name="consumer_count")
public long consumer_count;
@@ -188,7 +188,7 @@
/**
* The total size in bytes of messages that are being
- * loaded from persistent storage into RAM
+ * loaded from persistent storage into RAM.
*/
@XmlAttribute(name="swapping_in_size")
public long swapping_in_size;
diff --git a/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/DestinationDTO.java b/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/DestinationDTO.java
index 325a397..c13e9df 100644
--- a/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/DestinationDTO.java
+++ b/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/DestinationDTO.java
@@ -17,6 +17,7 @@
package org.apache.activemq.apollo.dto;
import org.codehaus.jackson.annotate.JsonTypeInfo;
+import org.codehaus.jackson.map.annotate.JsonTypeIdResolver;
import javax.xml.bind.annotation.*;
import java.util.ArrayList;
@@ -31,7 +32,8 @@
*/
@XmlType(name = "destination")
@XmlSeeAlso({QueueDestinationDTO.class, DurableSubscriptionDestinationDTO.class})
-@JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, include = JsonTypeInfo.As.PROPERTY, property = "@class")
+@JsonTypeInfo(use = JsonTypeInfo.Id.CUSTOM, include = JsonTypeInfo.As.PROPERTY, property = "@class")
+@JsonTypeIdResolver(ApolloTypeIdResolver.class)
@XmlAccessorType(XmlAccessType.FIELD)
abstract public class DestinationDTO {
diff --git a/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/KeyStorageDTO.java b/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/KeyStorageDTO.java
index d419ed2..934fa6c 100644
--- a/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/KeyStorageDTO.java
+++ b/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/KeyStorageDTO.java
@@ -23,7 +23,7 @@
import java.io.File;
/**
- *
+ * Used to specify the location of key store and key store access
*
* @author <a href="http://hiramchirino.com">Hiram Chirino</a>
*/
@@ -38,7 +38,7 @@
public File file;
/**
- * The key store password
+ * The key store password.
*/
@XmlAttribute
public String password;
@@ -50,19 +50,19 @@
public String key_password;
/**
- * The type of key store. If not set, defaults to JKS
+ * The type of key store. If not set, defaults to JKS.
*/
@XmlAttribute(name="store_type")
public String store_type;
/**
- * The trust management algorithm. If not set, defaults to SunX509
+ * The trust management algorithm. If not set, defaults to SunX509.
*/
@XmlAttribute(name="trust_algorithm")
public String trust_algorithm;
/**
- * The key management algorithm. If not set, defaults to SunX509
+ * The key management algorithm. If not set, defaults to SunX509.
*/
@XmlAttribute(name="key_algorithm")
public String key_algorithm;
diff --git a/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/Module.java b/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/Module.java
new file mode 100644
index 0000000..2d9e023
--- /dev/null
+++ b/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/Module.java
@@ -0,0 +1,41 @@
+/**
+ * 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.dto;
+
+import org.apache.activemq.apollo.util.DtoModule;
+
+/**
+ * <p>
+ * </p>
+ *
+ * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
+ */
+public class Module implements DtoModule {
+ public String dto_package() {
+ return "org.apache.activemq.apollo.dto";
+ }
+ public Class<?>[] extension_classes() {
+ return new Class<?>[]{
+ AcceptingConnectorDTO.class,
+ TopicDestinationDTO.class,
+ DurableSubscriptionDestinationDTO.class,
+ QueueDestinationDTO.class,
+ NullStoreDTO.class,
+ SimpleStoreStatusDTO.class
+ };
+ }
+}
diff --git a/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/PrimaryJaxbModule.java b/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/PrimaryJaxbModule.java
deleted file mode 100644
index 6b4c7f2..0000000
--- a/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/PrimaryJaxbModule.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
- * 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.dto;
-
-import org.apache.activemq.apollo.util.JaxbModule;
-
-/**
- * <p>
- * </p>
- *
- * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
- */
-public class PrimaryJaxbModule implements JaxbModule {
- public String xml_package() {
- return "org.apache.activemq.apollo.dto";
- }
-}
diff --git a/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/ProtocolDTO.java b/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/ProtocolDTO.java
index fc5ff84..5884e9a 100644
--- a/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/ProtocolDTO.java
+++ b/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/ProtocolDTO.java
@@ -17,6 +17,7 @@
package org.apache.activemq.apollo.dto;
import org.codehaus.jackson.annotate.JsonTypeInfo;
+import org.codehaus.jackson.map.annotate.JsonTypeIdResolver;
import javax.xml.bind.annotation.*;
import java.util.ArrayList;
@@ -25,8 +26,9 @@
/**
* @author <a href="http://hiramchirino.com">Hiram Chirino</a>
*/
+@JsonTypeInfo(use=JsonTypeInfo.Id.CUSTOM, include=JsonTypeInfo.As.PROPERTY, property="@class")
+@JsonTypeIdResolver(ApolloTypeIdResolver.class)
@XmlType (name = "protocol_type")
-@JsonTypeInfo(use=JsonTypeInfo.Id.CLASS, include=JsonTypeInfo.As.PROPERTY, property="@class")
@XmlRootElement(name="protocol")
@XmlAccessorType(XmlAccessType.FIELD)
public class ProtocolDTO {
diff --git a/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/ServiceDTO.java b/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/ServiceDTO.java
index 8ad312d..923dc44 100644
--- a/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/ServiceDTO.java
+++ b/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/ServiceDTO.java
@@ -30,7 +30,8 @@
abstract public class ServiceDTO extends StringIdDTO {
/**
- * Should this service be running?
+ * If set to true, then the connector host will be enabled.
+ * If set to false, then the connector host will be disabled.
*/
@XmlAttribute
public Boolean enabled;
diff --git a/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/StoreDTO.java b/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/StoreDTO.java
index f6f3f8e..4e5beae 100644
--- a/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/StoreDTO.java
+++ b/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/StoreDTO.java
@@ -17,6 +17,7 @@
package org.apache.activemq.apollo.dto;
import org.codehaus.jackson.annotate.JsonTypeInfo;
+import org.codehaus.jackson.map.annotate.JsonTypeIdResolver;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlSeeAlso;
@@ -26,7 +27,8 @@
* @author <a href="http://hiramchirino.com">Hiram Chirino</a>
*/
@XmlType (name = "store_type")
-@JsonTypeInfo(use=JsonTypeInfo.Id.CLASS, include=JsonTypeInfo.As.PROPERTY, property="@class")
+@JsonTypeIdResolver(ApolloTypeIdResolver.class)
+@JsonTypeInfo(use=JsonTypeInfo.Id.CUSTOM, include=JsonTypeInfo.As.PROPERTY, property="@class")
public abstract class StoreDTO {
/**
diff --git a/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/StoreStatusDTO.java b/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/StoreStatusDTO.java
index db72ef1..e331a90 100644
--- a/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/StoreStatusDTO.java
+++ b/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/StoreStatusDTO.java
@@ -17,6 +17,7 @@
package org.apache.activemq.apollo.dto;
import org.codehaus.jackson.annotate.JsonTypeInfo;
+import org.codehaus.jackson.map.annotate.JsonTypeIdResolver;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
@@ -27,7 +28,8 @@
* @author <a href="http://hiramchirino.com">Hiram Chirino</a>
*/
@XmlType(name = "store_status_type")
-@JsonTypeInfo(use=JsonTypeInfo.Id.CLASS, include=JsonTypeInfo.As.PROPERTY, property="@class")
+@JsonTypeInfo(use=JsonTypeInfo.Id.CUSTOM, include=JsonTypeInfo.As.PROPERTY, property="@class")
+@JsonTypeIdResolver(ApolloTypeIdResolver.class)
public abstract class StoreStatusDTO extends StringIdDTO {
/**
diff --git a/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/VirtualHostDTO.java b/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/VirtualHostDTO.java
index 0a7f5c2..3db1e7e 100644
--- a/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/VirtualHostDTO.java
+++ b/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/VirtualHostDTO.java
@@ -17,6 +17,8 @@
package org.apache.activemq.apollo.dto;
import org.codehaus.jackson.annotate.JsonTypeInfo;
+import org.codehaus.jackson.annotate.JsonTypeName;
+import org.codehaus.jackson.map.annotate.JsonTypeIdResolver;
import java.util.ArrayList;
import java.util.List;
@@ -26,9 +28,10 @@
/**
* @author <a href="http://hiramchirino.com">Hiram Chirino</a>
*/
+@JsonTypeInfo(use=JsonTypeInfo.Id.CUSTOM, include=JsonTypeInfo.As.PROPERTY, property="@class")
+@JsonTypeIdResolver(ApolloTypeIdResolver.class)
@XmlRootElement(name = "virtual_host")
@XmlAccessorType(XmlAccessType.FIELD)
-@JsonTypeInfo(use=JsonTypeInfo.Id.CLASS, include=JsonTypeInfo.As.PROPERTY, property="@class")
public class VirtualHostDTO extends ServiceDTO {
@XmlElement(name="host_name", required=true)
diff --git a/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/WebAdminDTO.java b/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/WebAdminDTO.java
index 576815f..c5e0de8 100644
--- a/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/WebAdminDTO.java
+++ b/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/WebAdminDTO.java
@@ -25,6 +25,7 @@
/**
* <p>
+ * Holds the address and port to bind the web interface
* </p>
*
* @author <a href="http://hiramchirino.com">Hiram Chirino</a>
@@ -32,6 +33,9 @@
@XmlAccessorType(XmlAccessType.FIELD)
public class WebAdminDTO {
+ /**
+ * The address and port to bind the web interface on in URL syntax.
+ */
@XmlAttribute
public String bind;
diff --git a/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/XmlCodec.java b/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/XmlCodec.java
index 11d3c8a..0366902 100644
--- a/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/XmlCodec.java
+++ b/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/XmlCodec.java
@@ -17,7 +17,7 @@
package org.apache.activemq.apollo.dto;
import org.apache.activemq.apollo.util.ClassFinder;
-import org.apache.activemq.apollo.util.JaxbModule$;
+import org.apache.activemq.apollo.util.DtoModule$;
import org.xml.sax.SAXException;
import javax.xml.XMLConstants;
@@ -90,7 +90,7 @@
private static JAXBContext createContext() throws JAXBException {
String packages = "";
- for ( String p : JaxbModule$.MODULE$.packages()) {
+ for ( String p : DtoModule$.MODULE$.packages()) {
if( packages.length() !=0 ) {
packages += ":";
}
diff --git a/apollo-dto/src/main/resources/META-INF/services/org.apache.activemq.apollo/dto-module.index b/apollo-dto/src/main/resources/META-INF/services/org.apache.activemq.apollo/dto-module.index
new file mode 100644
index 0000000..4c79653
--- /dev/null
+++ b/apollo-dto/src/main/resources/META-INF/services/org.apache.activemq.apollo/dto-module.index
@@ -0,0 +1,17 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+org.apache.activemq.apollo.dto.Module
\ No newline at end of file
diff --git a/apollo-dto/src/main/resources/META-INF/services/org.apache.activemq.apollo/jaxb-module.index b/apollo-dto/src/main/resources/META-INF/services/org.apache.activemq.apollo/jaxb-module.index
deleted file mode 100644
index c030a1a..0000000
--- a/apollo-dto/src/main/resources/META-INF/services/org.apache.activemq.apollo/jaxb-module.index
+++ /dev/null
@@ -1,17 +0,0 @@
-## ---------------------------------------------------------------------------
-## 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.
-## ---------------------------------------------------------------------------
-org.apache.activemq.apollo.dto.PrimaryJaxbModule
\ No newline at end of file
diff --git a/apollo-itests/pom.xml b/apollo-itests/pom.xml
index 312548d..059958a 100644
--- a/apollo-itests/pom.xml
+++ b/apollo-itests/pom.xml
@@ -21,106 +21,101 @@
<parent>
<groupId>org.apache.activemq</groupId>
- <artifactId>apollo-scala</artifactId>
- <version>1.0-SNAPSHOT</version>
- <relativePath>../apollo-scala</relativePath>
+ <artifactId>apollo-project</artifactId>
+ <version>1.0</version>
</parent>
<groupId>org.apache.activemq</groupId>
<artifactId>apollo-itests</artifactId>
- <version>1.0-SNAPSHOT</version>
+ <version>1.0</version>
<name>${project.artifactId}</name>
<description>General Apollo Integration/System Tests</description>
<properties>
<maven-compiler-plugin-version>2.3.2</maven-compiler-plugin-version>
- <stompjms-client-version>1.5-SNAPSHOT</stompjms-client-version>
</properties>
<dependencies>
- <!-- Scala Support -->
- <dependency>
- <groupId>org.scala-lang</groupId>
- <artifactId>scala-library</artifactId>
- <scope>compile</scope>
- <version>${scala-version}</version>
- </dependency>
-
-
+ <!-- The JMS Client Jars -->
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jms_1.1_spec</artifactId>
<version>1.1.1</version>
</dependency>
-
<dependency>
<groupId>org.fusesource.stompjms</groupId>
<artifactId>stompjms-client</artifactId>
- <version>${stompjms-client-version}</version>
+ <version>${stompjms-version}</version>
<scope>test</scope>
</dependency>
-
- <!-- Testing Dependencies -->
<dependency>
<groupId>org.apache.activemq</groupId>
- <artifactId>apollo-broker</artifactId>
- <version>1.0-SNAPSHOT</version>
- <type>test-jar</type>
+ <artifactId>activemq-core</artifactId>
+ <version>5.5.1</version>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>org.apache.activemq</groupId>
- <artifactId>apollo-util</artifactId>
- <version>1.0-SNAPSHOT</version>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
-
+ <!-- So we can boot up a broker -->
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>apollo-stomp</artifactId>
- <version>1.0-SNAPSHOT</version>
+ <version>1.0</version>
<scope>test</scope>
</dependency>
-
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>apollo-openwire</artifactId>
+ <version>1.0</version>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>apollo-bdb</artifactId>
- <version>1.0-SNAPSHOT</version>
+ <version>1.0</version>
<scope>test</scope>
</dependency>
-
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>apollo-leveldb</artifactId>
+ <version>1.0</version>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>org.eclipse.jetty.aggregate</groupId>
<artifactId>jetty-all-server</artifactId>
<version>${jetty-version}</version>
<scope>test</scope>
</dependency>
-
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>apollo-web</artifactId>
- <version>1.0-SNAPSHOT</version>
+ <version>1.0</version>
<scope>test</scope>
</dependency>
+ <!-- Test framework support files -->
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>apollo-broker</artifactId>
+ <version>1.0</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>apollo-util</artifactId>
+ <version>1.0</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
<version>${junit-version}</version>
</dependency>
-
- <dependency>
- <groupId>org.scalatest</groupId>
- <artifactId>scalatest_2.9.1</artifactId>
- <version>${scalatest-version}</version>
- <scope>test</scope>
- </dependency>
-
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
@@ -136,18 +131,6 @@
<id>unstable</id>
<dependencies>
- <dependency>
- <groupId>org.apache.activemq</groupId>
- <artifactId>activemq-core</artifactId>
- <version>5.5.1</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.activemq</groupId>
- <artifactId>apollo-openwire</artifactId>
- <version>1.0-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
</dependencies>
</profile>
@@ -155,98 +138,8 @@
</profiles>
<build>
-
- <pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.scala-tools</groupId>
- <artifactId>maven-scala-plugin</artifactId>
- <version>${maven-scala-plugin-version}</version>
- </plugin>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>${maven-compiler-plugin-version}</version>
- </plugin>
- </plugins>
- </pluginManagement>
-
<plugins>
<plugin>
- <groupId>org.scala-tools</groupId>
- <artifactId>maven-scala-plugin</artifactId>
- <version>${maven-scala-plugin-version}</version>
- <executions>
- <execution>
- <id>scala-compile-first</id>
- <phase>process-resources</phase>
- <goals>
- <goal>add-source</goal>
- <goal>compile</goal>
- </goals>
- </execution>
- <execution>
- <id>scala-test-compile</id>
- <phase>process-test-resources</phase>
- <goals>
- <goal>testCompile</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <testSourceDir>src/test/scala</testSourceDir>
- <args>
- <arg>-deprecation</arg>
- <arg>-P:continuations:enable</arg>
- </args>
- <compilerPlugins>
- <compilerPlugin>
- <groupId>org.scala-lang.plugins</groupId>
- <artifactId>continuations</artifactId>
- <version>${scala-version}</version>
- </compilerPlugin>
- <compilerPlugin>
- <groupId>org.fusesource.jvmassert</groupId>
- <artifactId>jvmassert</artifactId>
- <version>1.2</version>
- </compilerPlugin>
- </compilerPlugins>
- <jvmArgs>
- <jvmArg>-Xmx1024m</jvmArg>
- <jvmArg>-Xss8m</jvmArg>
- </jvmArgs>
- <scalaVersion>${scala-version}</scalaVersion>
- </configuration>
- </plugin>
-
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>${maven-compiler-plugin-version}</version>
- <executions>
- <execution>
- <phase>compile</phase>
- <goals>
- <goal>compile</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
-
- <!-- Generate a test jar for the test cases in this package -->
- <plugin>
- <artifactId>maven-jar-plugin</artifactId>
- <executions>
- <execution>
- <goals>
- <goal>test-jar</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
-
- <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin-version}</version>
@@ -255,21 +148,20 @@
<!-- we must turn off the use of system class loader so our tests can find stuff - otherwise ScalaSupport compiler can't find stuff -->
<useSystemClassLoader>false</useSystemClassLoader>
<!--forkMode>pertest</forkMode-->
- <childDelegation>false</childDelegation>
- <useFile>true</useFile>
- <redirectTestOutputToFile>true</redirectTestOutputToFile>
- <failIfNoTests>false</failIfNoTests>
+ <childDelegation>false</childDelegation>
+ <useFile>true</useFile>
+ <redirectTestOutputToFile>true</redirectTestOutputToFile>
+ <failIfNoTests>false</failIfNoTests>
- <excludes>
- <!-- hangs -->
- <!--
- <exclude>**/JmsTopicTransactionTest.*</exclude>
- -->
- </excludes>
- </configuration>
- </plugin>
+ <excludes>
+ <!--
+ <exclude>**/JmsTopicTransactionTest.*</exclude>
+ -->
+ </excludes>
+ </configuration>
+ </plugin>
- </plugins>
-</build>
+ </plugins>
+ </build>
</project>
diff --git a/apollo-itests/src/test/scala/org/apache/activemq/apollo/AutoFailTestSupport.java b/apollo-itests/src/test/java/org/apache/activemq/apollo/AutoFailTestSupport.java
similarity index 100%
rename from apollo-itests/src/test/scala/org/apache/activemq/apollo/AutoFailTestSupport.java
rename to apollo-itests/src/test/java/org/apache/activemq/apollo/AutoFailTestSupport.java
diff --git a/apollo-itests/src/test/java/org/apache/activemq/apollo/BrokerProtocol.java b/apollo-itests/src/test/java/org/apache/activemq/apollo/BrokerProtocol.java
new file mode 100644
index 0000000..28237e0
--- /dev/null
+++ b/apollo-itests/src/test/java/org/apache/activemq/apollo/BrokerProtocol.java
@@ -0,0 +1,56 @@
+/**
+ * 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;
+
+import org.apache.activemq.apollo.broker.Broker;
+import org.apache.activemq.apollo.broker.BrokerFactory;
+import org.apache.activemq.apollo.util.ServiceControl;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.jms.ConnectionFactory;
+import java.net.InetSocketAddress;
+
+/**
+ * <p>
+ * </p>
+ *
+ * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
+ */
+abstract public class BrokerProtocol {
+ protected static final Logger LOG = LoggerFactory.getLogger(BrokerProtocol.class);
+
+ public Object create(String config) {
+ LOG.info("Loading broker configuration from the classpath with URI: " + config);
+ return BrokerFactory.createBroker(config);
+ }
+ public void start(Object broker) {
+ ServiceControl.start((Broker)broker, "Starting "+broker);
+ }
+ public void stop(Object broker) {
+ ServiceControl.stop((Broker)broker, "Stopping "+broker);
+ }
+
+ public int port(Object broker) {
+ Broker b = (Broker) broker;
+ InetSocketAddress address = (InetSocketAddress) b.get_socket_address();
+ return address.getPort();
+ }
+
+ abstract ConnectionFactory getConnectionFactory(Object broker);
+
+}
diff --git a/apollo-itests/src/test/scala/org/apache/activemq/apollo/CombinationTestSupport.java b/apollo-itests/src/test/java/org/apache/activemq/apollo/CombinationTestSupport.java
similarity index 100%
rename from apollo-itests/src/test/scala/org/apache/activemq/apollo/CombinationTestSupport.java
rename to apollo-itests/src/test/java/org/apache/activemq/apollo/CombinationTestSupport.java
diff --git a/apollo-itests/src/test/java/org/apache/activemq/apollo/JMSMessageTest.java b/apollo-itests/src/test/java/org/apache/activemq/apollo/JMSMessageTest.java
new file mode 100644
index 0000000..03955c5
--- /dev/null
+++ b/apollo-itests/src/test/java/org/apache/activemq/apollo/JMSMessageTest.java
@@ -0,0 +1,487 @@
+/**
+ * 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;
+
+import junit.framework.Test;
+import org.fusesource.stomp.jms.StompJmsSession;
+
+import javax.jms.*;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Vector;
+
+/**
+ * Test cases used to test the JMS message consumer.
+ *
+ *
+ */
+public class JMSMessageTest extends JmsTestBase {
+
+ public Destination destination;
+ public int deliveryMode = DeliveryMode.NON_PERSISTENT;
+ public int prefetch;
+ public int ackMode;
+ public DestinationType destinationType = DestinationType.QUEUE_TYPE;
+ public boolean durableConsumer;
+
+ /**
+ * Run all these tests in both marshaling and non-marshaling mode.
+ */
+ public void initCombos() {
+ super.initCombos();
+ addCombinationValues("deliveryMode", new Object[]{Integer.valueOf(DeliveryMode.NON_PERSISTENT),
+ Integer.valueOf(DeliveryMode.PERSISTENT)});
+ addCombinationValues("destinationType", new Object[] {DestinationType.QUEUE_TYPE});
+ }
+
+ public void testTextMessage() throws Exception {
+
+ // Receive a message with the JMS API
+ connection.start();
+ Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ destination = createDestination(session, destinationType);
+ MessageConsumer consumer = session.createConsumer(destination);
+ MessageProducer producer = session.createProducer(destination);
+
+ // Send the message.
+ {
+ TextMessage message = session.createTextMessage();
+ message.setText("Hi");
+ producer.send(message);
+ }
+
+ // Check the Message
+ {
+ TextMessage message = (TextMessage)consumer.receive(1000);
+ assertNotNull(message);
+ assertEquals("Hi", message.getText());
+ }
+
+ assertNull(consumer.receiveNoWait());
+ }
+
+ public static Test suite() {
+ return suite(JMSMessageTest.class);
+ }
+
+ public static void main(String[] args) {
+ junit.textui.TestRunner.run(suite());
+ }
+
+ public void testBytesMessageLength() throws Exception {
+
+ // Receive a message with the JMS API
+ connection.start();
+ Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ destination = createDestination(session, destinationType);
+ MessageConsumer consumer = session.createConsumer(destination);
+ MessageProducer producer = session.createProducer(destination);
+
+ // Send the message
+ {
+ BytesMessage message = session.createBytesMessage();
+ message.writeInt(1);
+ message.writeInt(2);
+ message.writeInt(3);
+ message.writeInt(4);
+ producer.send(message);
+ }
+
+ // Check the message.
+ {
+ BytesMessage message = (BytesMessage)consumer.receive(1000);
+ assertNotNull(message);
+ assertEquals(16, message.getBodyLength());
+ }
+
+ assertNull(consumer.receiveNoWait());
+ }
+
+ public void testObjectMessage() throws Exception {
+
+ // Receive a message with the JMS API
+ connection.start();
+ Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ destination = createDestination(session, destinationType);
+ MessageConsumer consumer = session.createConsumer(destination);
+ MessageProducer producer = session.createProducer(destination);
+
+ // send the message.
+ {
+ ObjectMessage message = session.createObjectMessage();
+ message.setObject("Hi");
+ producer.send(message);
+ }
+
+ // Check the message
+ {
+ ObjectMessage message = (ObjectMessage)consumer.receive(1000);
+ assertNotNull(message);
+ assertEquals("Hi", message.getObject());
+ }
+ assertNull(consumer.receiveNoWait());
+ }
+
+ public void testBytesMessage() throws Exception {
+
+ // Receive a message with the JMS API
+ connection.start();
+ Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ destination = createDestination(session, destinationType);
+ MessageConsumer consumer = session.createConsumer(destination);
+ MessageProducer producer = session.createProducer(destination);
+
+ // Send the message
+ {
+ BytesMessage message = session.createBytesMessage();
+ message.writeBoolean(true);
+ producer.send(message);
+ }
+
+ // Check the message
+ {
+ BytesMessage message = (BytesMessage)consumer.receive(1000);
+ assertNotNull(message);
+ assertTrue(message.readBoolean());
+
+ // TODO - stompjms appears to reset the stream so this check fails
+ if (!(session instanceof StompJmsSession)) {
+ try {
+ message.readByte();
+ fail("Expected exception not thrown.");
+ } catch (MessageEOFException e) {
+ }
+ }
+
+ }
+ assertNull(consumer.receiveNoWait());
+ }
+
+ public void testStreamMessage() throws Exception {
+
+ // Receive a message with the JMS API
+ connection.start();
+ Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ destination = createDestination(session, destinationType);
+ MessageConsumer consumer = session.createConsumer(destination);
+ MessageProducer producer = session.createProducer(destination);
+
+ // Send the message.
+ {
+ StreamMessage message = session.createStreamMessage();
+ message.writeString("This is a test to see how it works.");
+ producer.send(message);
+ }
+
+ // Check the message.
+ {
+ StreamMessage message = (StreamMessage)consumer.receive(1000);
+ assertNotNull(message);
+
+ // Invalid conversion should throw exception and not move the stream
+ // position.
+ if (!(session instanceof StompJmsSession)) {
+ // TODO - stompjms appears to a problem here that doesn't result in the right exception being thrown
+ try {
+ message.readByte();
+ fail("Should have received NumberFormatException");
+ } catch (NumberFormatException e) {
+ }
+ }
+
+ assertEquals("This is a test to see how it works.", message.readString());
+
+ // Invalid conversion should throw exception and not move the stream
+ // position.
+ try {
+ message.readByte();
+ fail("Should have received MessageEOFException");
+ } catch (MessageEOFException e) {
+ }
+ }
+ assertNull(consumer.receiveNoWait());
+ }
+
+ public void testMapMessage() throws Exception {
+
+ // Receive a message with the JMS API
+ connection.start();
+ Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ destination = createDestination(session, destinationType);
+ MessageConsumer consumer = session.createConsumer(destination);
+ MessageProducer producer = session.createProducer(destination);
+
+ // send the message.
+ {
+ MapMessage message = session.createMapMessage();
+ message.setBoolean("boolKey", true);
+ producer.send(message);
+ }
+
+ // get the message.
+ {
+ MapMessage message = (MapMessage)consumer.receive(1000);
+ assertNotNull(message);
+ assertTrue(message.getBoolean("boolKey"));
+ }
+ assertNull(consumer.receiveNoWait());
+ }
+
+ static class ForeignMessage implements TextMessage {
+
+ public int deliveryMode;
+
+ private String messageId;
+ private long timestamp;
+ private String correlationId;
+ private Destination replyTo;
+ private Destination destination;
+ private boolean redelivered;
+ private String type;
+ private long expiration;
+ private int priority;
+ private String text;
+ private HashMap<String, Object> props = new HashMap<String, Object>();
+
+ public String getJMSMessageID() throws JMSException {
+ return messageId;
+ }
+
+ public void setJMSMessageID(String arg0) throws JMSException {
+ messageId = arg0;
+ }
+
+ public long getJMSTimestamp() throws JMSException {
+ return timestamp;
+ }
+
+ public void setJMSTimestamp(long arg0) throws JMSException {
+ timestamp = arg0;
+ }
+
+ public byte[] getJMSCorrelationIDAsBytes() throws JMSException {
+ return null;
+ }
+
+ public void setJMSCorrelationIDAsBytes(byte[] arg0) throws JMSException {
+ }
+
+ public void setJMSCorrelationID(String arg0) throws JMSException {
+ correlationId = arg0;
+ }
+
+ public String getJMSCorrelationID() throws JMSException {
+ return correlationId;
+ }
+
+ public Destination getJMSReplyTo() throws JMSException {
+ return replyTo;
+ }
+
+ public void setJMSReplyTo(Destination arg0) throws JMSException {
+ replyTo = arg0;
+ }
+
+ public Destination getJMSDestination() throws JMSException {
+ return destination;
+ }
+
+ public void setJMSDestination(Destination arg0) throws JMSException {
+ destination = arg0;
+ }
+
+ public int getJMSDeliveryMode() throws JMSException {
+ return deliveryMode;
+ }
+
+ public void setJMSDeliveryMode(int arg0) throws JMSException {
+ deliveryMode = arg0;
+ }
+
+ public boolean getJMSRedelivered() throws JMSException {
+ return redelivered;
+ }
+
+ public void setJMSRedelivered(boolean arg0) throws JMSException {
+ redelivered = arg0;
+ }
+
+ public String getJMSType() throws JMSException {
+ return type;
+ }
+
+ public void setJMSType(String arg0) throws JMSException {
+ type = arg0;
+ }
+
+ public long getJMSExpiration() throws JMSException {
+ return expiration;
+ }
+
+ public void setJMSExpiration(long arg0) throws JMSException {
+ expiration = arg0;
+ }
+
+ public int getJMSPriority() throws JMSException {
+ return priority;
+ }
+
+ public void setJMSPriority(int arg0) throws JMSException {
+ priority = arg0;
+ }
+
+ public void clearProperties() throws JMSException {
+ }
+
+ public boolean propertyExists(String arg0) throws JMSException {
+ return false;
+ }
+
+ public boolean getBooleanProperty(String arg0) throws JMSException {
+ return false;
+ }
+
+ public byte getByteProperty(String arg0) throws JMSException {
+ return 0;
+ }
+
+ public short getShortProperty(String arg0) throws JMSException {
+ return 0;
+ }
+
+ public int getIntProperty(String arg0) throws JMSException {
+ return 0;
+ }
+
+ public long getLongProperty(String arg0) throws JMSException {
+ return 0;
+ }
+
+ public float getFloatProperty(String arg0) throws JMSException {
+ return 0;
+ }
+
+ public double getDoubleProperty(String arg0) throws JMSException {
+ return 0;
+ }
+
+ public String getStringProperty(String arg0) throws JMSException {
+ return (String)props.get(arg0);
+ }
+
+ public Object getObjectProperty(String arg0) throws JMSException {
+ return props.get(arg0);
+ }
+
+ public Enumeration getPropertyNames() throws JMSException {
+ return new Vector<String>(props.keySet()).elements();
+ }
+
+ public void setBooleanProperty(String arg0, boolean arg1) throws JMSException {
+ }
+
+ public void setByteProperty(String arg0, byte arg1) throws JMSException {
+ }
+
+ public void setShortProperty(String arg0, short arg1) throws JMSException {
+ }
+
+ public void setIntProperty(String arg0, int arg1) throws JMSException {
+ }
+
+ public void setLongProperty(String arg0, long arg1) throws JMSException {
+ }
+
+ public void setFloatProperty(String arg0, float arg1) throws JMSException {
+ }
+
+ public void setDoubleProperty(String arg0, double arg1) throws JMSException {
+ }
+
+ public void setStringProperty(String arg0, String arg1) throws JMSException {
+ props.put(arg0, arg1);
+ }
+
+ public void setObjectProperty(String arg0, Object arg1) throws JMSException {
+ props.put(arg0, arg1);
+ }
+
+ public void acknowledge() throws JMSException {
+ }
+
+ public void clearBody() throws JMSException {
+ }
+
+ public void setText(String arg0) throws JMSException {
+ text = arg0;
+ }
+
+ public String getText() throws JMSException {
+ return text;
+ }
+ }
+
+ public void testForeignMessage() throws Exception {
+
+ // Receive a message with the JMS API
+ connection.start();
+ Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ destination = createDestination(session, destinationType);
+ MessageConsumer consumer = session.createConsumer(destination);
+ MessageProducer producer = session.createProducer(destination);
+
+ // Send the message.
+ {
+ ForeignMessage message = new ForeignMessage();
+ message.text = "Hello";
+ message.setStringProperty("test", "value");
+ long timeToLive = 10000L;
+ long start = System.currentTimeMillis();
+ producer.send(message, Session.AUTO_ACKNOWLEDGE, 7, timeToLive);
+ long end = System.currentTimeMillis();
+
+
+ //validate jms spec 1.1 section 3.4.11 table 3.1
+ // JMSDestination, JMSDeliveryMode, JMSExpiration, JMSPriority, JMSMessageID, and JMSTimestamp
+ //must be set by sending a message.
+
+ // exception for jms destination as the format is provider defined so it is only set on the copy
+ if (!(session instanceof StompJmsSession)) {
+ // TODO - stompjms doesn't appear to set some/all of these, needs to be sorted
+ assertNull(message.getJMSDestination());
+ assertEquals(Session.AUTO_ACKNOWLEDGE, message.getJMSDeliveryMode());
+ assertTrue(start + timeToLive <= message.getJMSExpiration());
+ assertTrue(end + timeToLive >= message.getJMSExpiration());
+ assertEquals(7, message.getJMSPriority());
+ assertNotNull(message.getJMSMessageID());
+ assertTrue(start <= message.getJMSTimestamp());
+ assertTrue(end >= message.getJMSTimestamp());
+ }
+ }
+
+ // Validate message is OK.
+ {
+ TextMessage message = (TextMessage)consumer.receive(1000);
+ assertNotNull(message);
+ assertEquals("Hello", message.getText());
+ assertEquals("value", message.getStringProperty("test"));
+ }
+
+ assertNull(consumer.receiveNoWait());
+ }
+
+}
diff --git a/apollo-itests/src/test/java/org/apache/activemq/apollo/JmsQueueTransactionTest.java b/apollo-itests/src/test/java/org/apache/activemq/apollo/JmsQueueTransactionTest.java
new file mode 100755
index 0000000..6c8e883
--- /dev/null
+++ b/apollo-itests/src/test/java/org/apache/activemq/apollo/JmsQueueTransactionTest.java
@@ -0,0 +1,230 @@
+/**
+ * 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;
+
+import junit.framework.Test;
+import org.apache.activemq.apollo.test.JmsResourceProvider;
+import org.fusesource.stomp.jms.StompJmsSession;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.jms.*;
+import java.util.ArrayList;
+import java.util.Enumeration;
+
+/**
+ *
+ */
+public class JmsQueueTransactionTest extends JmsTransactionTestSupport {
+ private static final Logger LOG = LoggerFactory.getLogger(JmsQueueTransactionTest.class);
+
+ public static Test suite() {
+ return suite(JmsQueueTransactionTest.class);
+ }
+
+ public void testChangeMutableObjectInObjectMessageThenRollback() throws Exception {
+ // Disabled.. currently failing.
+ // super.testChangeMutableObjectInObjectMessageThenRollback();
+ }
+
+ @Override
+ public void testMessageListener() throws Exception {
+ // Disabled.. currently failing.
+ // super.testMessageListener();
+ }
+
+ @Override
+ public void testReceiveTwoThenRollbackManyTimes() throws Exception {
+ // Disabled.. currently failing.
+ // super.testReceiveTwoThenRollbackManyTimes(); //To change body of overridden methods use File | Settings | File Templates.
+ }
+
+ /**
+ * @see org.apache.activemq.apollo.JmsTransactionTestSupport#getJmsResourceProvider()
+ */
+ protected JmsResourceProvider getJmsResourceProvider() {
+ JmsResourceProvider p = new JmsResourceProvider(this);
+ p.setTopic(false);
+ return p;
+ }
+
+ /**
+ * Tests if the the connection gets reset, the messages will still be
+ * received.
+ *
+ * @throws Exception
+ */
+ public void testReceiveTwoThenCloseConnection() throws Exception {
+ Message[] outbound = new Message[] {session.createTextMessage("First Message"), session.createTextMessage("Second Message")};
+
+ // lets consume any outstanding messages from previous test runs
+ beginTx();
+ while (consumer.receive(1000) != null) {
+ }
+ commitTx();
+
+ beginTx();
+ producer.send(outbound[0]);
+ producer.send(outbound[1]);
+ commitTx();
+
+ LOG.info("Sent 0: " + outbound[0]);
+ LOG.info("Sent 1: " + outbound[1]);
+
+ ArrayList<Message> messages = new ArrayList<Message>();
+ beginTx();
+ Message message = consumer.receive(2000);
+ ((TextMessage)message).getText();
+ assertEquals(outbound[0], message);
+
+ message = consumer.receive(2000);
+ ((TextMessage)message).getText();
+ assertNotNull(message);
+ assertEquals(outbound[1], message);
+
+ // Close and reopen connection.
+ reconnect();
+
+ // Consume again.. the previous message should
+ // get redelivered.
+ beginTx();
+ message = consumer.receive(2000);
+ assertNotNull("Should have re-received the first message again!", message);
+ messages.add(message);
+ assertEquals(outbound[0], message);
+
+ message = consumer.receive(5000);
+ assertNotNull("Should have re-received the second message again!", message);
+ messages.add(message);
+ assertEquals(outbound[1], message);
+ commitTx();
+
+ Message inbound[] = new Message[messages.size()];
+ messages.toArray(inbound);
+
+ assertTextMessagesEqual("Rollback did not work", outbound, inbound);
+ }
+
+ /**
+ * Tests sending and receiving messages with two sessions(one for producing
+ * and another for consuming).
+ *
+ * @throws Exception
+ */
+ public void testSendReceiveInSeperateSessionTest() throws Exception {
+ session.close();
+ int batchCount = 10;
+
+ for (int i = 0; i < batchCount; i++) {
+ String messageText = String.format("Test message %s of %s", i, batchCount);
+ // Session that sends messages
+ {
+ Session session = resourceProvider.createSession(connection);
+ this.session = session;
+ MessageProducer producer = resourceProvider.createProducer(session, destination);
+ // consumer = resourceProvider.createConsumer(session,
+ // destination);
+ beginTx();
+ LOG.debug("Sending message : " + messageText);
+ producer.send(session.createTextMessage(messageText));
+ commitTx();
+ session.close();
+ }
+
+ // Session that consumes messages
+ {
+ Session session = resourceProvider.createSession(connection);
+ this.session = session;
+ MessageConsumer consumer = resourceProvider.createConsumer(session, destination);
+
+ beginTx();
+ TextMessage message = (TextMessage)consumer.receive(1000 * 5);
+ assertNotNull("Received only " + i + " messages in batch ", message);
+ LOG.debug("Received message : " + message.getText());
+ assertEquals(messageText, message.getText());
+
+ commitTx();
+ session.close();
+ }
+ }
+ }
+
+ /**
+ * Tests the queue browser. Browses the messages then the consumer tries to
+ * receive them. The messages should still be in the queue even when it was
+ * browsed.
+ *
+ * @throws Exception
+ */
+ public void testReceiveBrowseReceive() throws Exception {
+ if (session instanceof StompJmsSession) {
+ // browsing not supported by stomp
+ return;
+ }
+ Message[] outbound = new Message[] {session.createTextMessage("First Message"), session.createTextMessage("Second Message"), session.createTextMessage("Third Message")};
+
+ // lets consume any outstanding messages from previous test runs
+ beginTx();
+ while (consumer.receive(1000) != null) {
+ }
+ commitTx();
+
+ beginTx();
+ producer.send(outbound[0]);
+ producer.send(outbound[1]);
+ producer.send(outbound[2]);
+ commitTx();
+
+ // Get the first.
+ beginTx();
+ assertEquals(outbound[0], consumer.receive(1000));
+ consumer.close();
+ commitTx();
+
+ beginTx();
+ QueueBrowser browser = session.createBrowser((Queue)destination);
+ Enumeration enumeration = browser.getEnumeration();
+
+ // browse the second
+ assertTrue("should have received the second message", enumeration.hasMoreElements());
+ assertEquals(outbound[1], (Message)enumeration.nextElement());
+
+ // browse the third.
+ assertTrue("Should have received the third message", enumeration.hasMoreElements());
+ assertEquals(outbound[2], (Message)enumeration.nextElement());
+
+ // There should be no more.
+ boolean tooMany = false;
+ while (enumeration.hasMoreElements()) {
+ LOG.info("Got extra message: " + ((TextMessage)enumeration.nextElement()).getText());
+ tooMany = true;
+ }
+ assertFalse(tooMany);
+ browser.close();
+
+ // Re-open the consumer.
+ consumer = resourceProvider.createConsumer(session, destination);
+ // Receive the second.
+ assertEquals(outbound[1], consumer.receive(1000));
+ // Receive the third.
+ assertEquals(outbound[2], consumer.receive(1000));
+ consumer.close();
+
+ commitTx();
+ }
+
+}
diff --git a/apollo-itests/src/test/java/org/apache/activemq/apollo/JmsTestBase.java b/apollo-itests/src/test/java/org/apache/activemq/apollo/JmsTestBase.java
new file mode 100644
index 0000000..5622dea
--- /dev/null
+++ b/apollo-itests/src/test/java/org/apache/activemq/apollo/JmsTestBase.java
@@ -0,0 +1,267 @@
+/**
+ * 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;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.jms.*;
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicLong;
+
+/**
+ * Test cases used to test the JMS message consumer.
+ *
+ *
+ */
+public class JmsTestBase extends CombinationTestSupport {
+ protected static final Logger LOG = LoggerFactory.getLogger(BrokerProtocol.class);
+ public BrokerProtocol protocol;
+
+ public void initCombos() {
+ ArrayList<Object> protocols = new ArrayList<Object>();
+ protocols.add(new StompBrokerProtocol());
+ try {
+ Class.forName("org.apache.activemq.apollo.openwire.OpenwireProtocolHandler", false, JmsTestBase.class.getClassLoader());
+ protocols.add(new OpenwireBrokerProtocol());
+ } catch (ClassNotFoundException e) {
+ }
+ addCombinationValues("protocol", protocols.toArray());
+ }
+
+ public String brokerConfig = "xml:classpath:apollo.xml";
+
+ protected Object broker;
+ protected ConnectionFactory factory;
+ protected Connection connection;
+ protected List<Connection> connections = Collections.synchronizedList(new ArrayList<Connection>());
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ if (System.getProperty("basedir") == null) {
+ File file = new File(".");
+ System.setProperty("basedir", file.getAbsolutePath());
+ }
+ broker = protocol.create(brokerConfig);
+ protocol.start(broker);
+ factory = protocol.getConnectionFactory(broker);
+
+ connection = factory.createConnection(userName, password);
+ connections.add(connection);
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ for (Iterator iter = connections.iterator(); iter.hasNext();) {
+ Connection conn = (Connection)iter.next();
+ try {
+ conn.close();
+ } catch (Throwable e) {
+ }
+ iter.remove();
+ }
+
+ connection = null;
+ if(broker!=null) {
+ protocol.stop(broker);
+ broker = null;
+ }
+ super.tearDown();
+ }
+
+ public ConnectionFactory getConnectionFactory() throws Exception {
+ return factory;
+ }
+
+ /**
+ * Factory method to create a new connection
+ */
+ public Connection createConnection() throws Exception {
+ return getConnectionFactory().createConnection();
+ }
+
+ /**
+ * @param messsage
+ * @param firstSet
+ * @param secondSet
+ */
+ protected void assertTextMessagesEqual(String messsage, Message[] firstSet, Message[] secondSet)
+ throws JMSException {
+ assertEquals("Message count does not match: " + messsage, firstSet.length, secondSet.length);
+ for (int i = 0; i < secondSet.length; i++) {
+ TextMessage m1 = (TextMessage)firstSet[i];
+ TextMessage m2 = (TextMessage)secondSet[i];
+ if (m1 != null) {
+ m1.getText();
+ }
+ if (m2 != null) {
+ m2.getText();
+ }
+ assertFalse("Message " + (i + 1) + " did not match : " + messsage + ": expected {" + m1
+ + "}, but was {" + m2 + "}", m1 == null ^ m2 == null);
+ assertEquals("Message " + (i + 1) + " did not match: " + messsage + ": expected {" + m1
+ + "}, but was {" + m2 + "}", m1.getText(), m2.getText());
+ }
+ }
+
+
+ protected String getConsumerDestinationName() {
+ return getDestinationName();
+ }
+ protected String getProducerDestinationName() {
+ return getDestinationName();
+ }
+ protected String getDestinationName() {
+ return getName().replaceAll("[{}= @\\.]+", "_");
+ }
+
+ protected boolean topic = true;
+
+ protected Destination createDestination(String subject) {
+ return null;
+ }
+ protected Destination createDestination() {
+ return createDestination(getDestinationString());
+ }
+
+ /**
+ * Returns the name of the destination used in this test case
+ */
+ protected String getDestinationString() {
+ return getClass().getName() + "." + getName(true);
+ }
+
+
+ public static void recursiveDelete(File f) {
+ if (f.isDirectory()) {
+ File[] files = f.listFiles();
+ for (int i = 0; i < files.length; i++) {
+ recursiveDelete(files[i]);
+ }
+ }
+ f.delete();
+ }
+
+
+ static final private AtomicLong TEST_COUNTER = new AtomicLong();
+ public String userName;
+ public String password;
+ public String messageTextPrefix = "";
+
+
+ enum DestinationType {
+ QUEUE_TYPE,
+ TOPIC_TYPE,
+ TEMP_QUEUE_TYPE,
+ TEMP_TOPIC_TYPE
+ }
+
+ // /////////////////////////////////////////////////////////////////
+ //
+ // Test support methods.
+ //
+ // /////////////////////////////////////////////////////////////////
+ protected Destination createDestination(Session session, DestinationType type) throws JMSException {
+ String testMethod = getName();
+ if( testMethod.indexOf(" ")>0 ) {
+ testMethod = testMethod.substring(0, testMethod.indexOf(" "));
+ }
+ String name = "TEST." + getClass().getName() + "." +testMethod+"."+TEST_COUNTER.getAndIncrement();
+ switch (type) {
+ case QUEUE_TYPE:
+ return session.createQueue(name);
+ case TOPIC_TYPE:
+ return session.createTopic(name);
+ case TEMP_QUEUE_TYPE:
+ return session.createTemporaryQueue();
+ case TEMP_TOPIC_TYPE:
+ return session.createTemporaryTopic();
+ default:
+ throw new IllegalArgumentException("type: " + type);
+ }
+ }
+
+ protected void sendMessages(Destination destination, int count) throws Exception {
+ Connection connection = getConnectionFactory().createConnection();
+ connection.start();
+ sendMessages(connection, destination, count);
+ connection.close();
+ }
+
+ protected void sendMessages(Connection connection, Destination destination, int count) throws JMSException {
+ Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ sendMessages(session, destination, count);
+ session.close();
+ }
+
+ protected void sendMessages(Session session, Destination destination, int count) throws JMSException {
+ MessageProducer producer = session.createProducer(destination);
+ for (int i = 0; i < count; i++) {
+ producer.send(session.createTextMessage(messageTextPrefix + i));
+ }
+ producer.close();
+ }
+
+
+ protected void safeClose(Connection c) {
+ try {
+ c.close();
+ } catch (Throwable e) {
+ }
+ }
+
+ protected void safeClose(Session s) {
+ try {
+ s.close();
+ } catch (Throwable e) {
+ }
+ }
+
+ protected void safeClose(MessageConsumer c) {
+ try {
+ c.close();
+ } catch (Throwable e) {
+ }
+ }
+
+ protected void safeClose(MessageProducer p) {
+ try {
+ p.close();
+ } catch (Throwable e) {
+ }
+ }
+
+ protected void profilerPause(String prompt) throws IOException {
+ if (System.getProperty("profiler") != null) {
+ pause(prompt);
+ }
+ }
+
+ protected void pause(String prompt) throws IOException {
+ System.out.println();
+ System.out.println(prompt + "> Press enter to continue: ");
+ while (System.in.read() != '\n') {
+ }
+ }
+
+}
diff --git a/apollo-itests/src/test/java/org/apache/activemq/apollo/JmsTopicTransactionTest.java b/apollo-itests/src/test/java/org/apache/activemq/apollo/JmsTopicTransactionTest.java
new file mode 100755
index 0000000..dfa3a08
--- /dev/null
+++ b/apollo-itests/src/test/java/org/apache/activemq/apollo/JmsTopicTransactionTest.java
@@ -0,0 +1,53 @@
+/**
+ * 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;
+
+import junit.framework.Test;
+import org.apache.activemq.apollo.test.JmsResourceProvider;
+
+
+/**
+ *
+ */
+public class JmsTopicTransactionTest extends JmsTransactionTestSupport {
+
+ public static Test suite() {
+ return suite(JmsTopicTransactionTest.class);
+ }
+
+ /**
+ * @see org.apache.activemq.apollo.JmsTransactionTestSupport#getJmsResourceProvider()
+ */
+ protected JmsResourceProvider getJmsResourceProvider() {
+ JmsResourceProvider p = new JmsResourceProvider(this);
+ p.setTopic(true);
+ p.setDurableName("testsub");
+ p.setClientID("testclient");
+ return p;
+ }
+
+ @Override
+ public void runBare() throws Throwable {
+ if (protocol instanceof StompBrokerProtocol) {
+ // TODO - seem to have a broker hang on some of these tests when STOMP is used
+ return;
+ }
+ super.runBare(); //To change body of overridden methods use File | Settings | File Templates.
+ }
+
+
+}
diff --git a/apollo-itests/src/test/java/org/apache/activemq/apollo/JmsTransactionTestSupport.java b/apollo-itests/src/test/java/org/apache/activemq/apollo/JmsTransactionTestSupport.java
new file mode 100755
index 0000000..d3ce243
--- /dev/null
+++ b/apollo-itests/src/test/java/org/apache/activemq/apollo/JmsTransactionTestSupport.java
@@ -0,0 +1,680 @@
+/**
+ * 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;
+
+import org.apache.activemq.apollo.test.JmsResourceProvider;
+import org.fusesource.stomp.jms.StompJmsSession;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.jms.*;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ *
+ */
+public abstract class JmsTransactionTestSupport extends JmsTestBase implements MessageListener {
+
+ private static final Logger LOG = LoggerFactory.getLogger(JmsTransactionTestSupport.class);
+ private static final int MESSAGE_COUNT = 5;
+ private static final String MESSAGE_TEXT = "message";
+
+ protected Session session;
+ protected MessageConsumer consumer;
+ protected MessageProducer producer;
+ protected JmsResourceProvider resourceProvider;
+ protected Destination destination;
+ protected int batchCount = 10;
+ protected int batchSize = 20;
+
+ // for message listener test
+ private List<Message> unackMessages = new ArrayList<Message>(MESSAGE_COUNT);
+ private List<Message> ackMessages = new ArrayList<Message>(MESSAGE_COUNT);
+ private boolean resendPhase;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ resourceProvider = getJmsResourceProvider();
+ topic = resourceProvider.isTopic();
+ // We will be using transacted sessions.
+ setSessionTransacted();
+ reconnect();
+ }
+
+ protected void setSessionTransacted() {
+ resourceProvider.setTransacted(true);
+ }
+
+ protected ConnectionFactory newConnectionFactory() throws Exception {
+ return resourceProvider.createConnectionFactory();
+ }
+
+ protected void beginTx() throws Exception {
+ //no-op for local tx
+ }
+
+ protected void commitTx() throws Exception {
+ session.commit();
+ }
+
+ protected void rollbackTx() throws Exception {
+ session.rollback();
+ }
+
+ protected abstract JmsResourceProvider getJmsResourceProvider();
+
+ protected Connection connection() throws Exception {
+ return getJmsResourceProvider().createConnection(getConnectionFactory());
+ }
+
+ protected Session session(Connection connection) throws Exception {
+ return getJmsResourceProvider().createSession(connection);
+ }
+
+ /**
+ * Sends a batch of messages and validates that the messages are received.
+ *
+ * @throws Exception
+ */
+
+ public void testSendReceiveTransactedBatches() throws Exception {
+
+ String messageText = "Batch Message %s of %s in batch %s of %s";
+ for (int j = 0; j < batchCount; j++) {
+ LOG.debug("Producing batch " + j + " of " + batchSize + " messages");
+
+ beginTx();
+ for (int i = 0; i < batchSize; i++) {
+ producer.send(session.createTextMessage(String.format(messageText, i + 1, batchSize, j + 1, batchCount)));
+ }
+ messageSent();
+ commitTx();
+ LOG.debug("Consuming batch " + j + " of " + batchSize + " messages");
+
+ beginTx();
+ for (int i = 0; i < batchSize; i++) {
+ TextMessage message = (TextMessage)consumer.receive(1000 * 5);
+ LOG.debug("Received message : " + (message == null ? null : message.getText()));
+ assertNotNull("Received only " + i + " messages in batch " + j, message);
+ assertEquals(String.format(messageText, i + 1, batchSize, j + 1, batchCount), message.getText());
+ }
+
+ commitTx();
+ }
+ }
+
+ protected void messageSent() throws Exception {
+ }
+
+ /**
+ * Sends a batch of messages and validates that the rollbacked message was
+ * not consumed.
+ *
+ * @throws Exception
+ */
+ public void testSendRollback() throws Exception {
+ Message[] outbound = new Message[] {session.createTextMessage("First Message"), session.createTextMessage("Second Message")};
+
+ // sends a message
+ beginTx();
+ producer.send(outbound[0]);
+ commitTx();
+
+ // sends a message that gets rollbacked
+ beginTx();
+ producer.send(session.createTextMessage("I'm going to get rolled back."));
+ rollbackTx();
+
+ // sends a message
+ beginTx();
+ producer.send(outbound[1]);
+ commitTx();
+
+ // receives the first message
+ beginTx();
+ ArrayList<Message> messages = new ArrayList<Message>();
+ LOG.info("About to consume message 1");
+ Message message = consumer.receive(1000);
+ messages.add(message);
+ LOG.info("Received: " + message);
+
+ // receives the second message
+ LOG.info("About to consume message 2");
+ message = consumer.receive(4000);
+ messages.add(message);
+ LOG.info("Received: " + message);
+
+ // validates that the rollbacked was not consumed
+ commitTx();
+ Message inbound[] = messages.toArray(new Message[messages.size()]);
+ assertTextMessagesEqual("Rollback did not work.", outbound, inbound);
+ }
+
+ /**
+ * spec section 3.6 acking a message with automation acks has no effect.
+ * @throws Exception
+ */
+ public void testAckMessageInTx() throws Exception {
+ Message[] outbound = new Message[] {session.createTextMessage("First Message")};
+
+ // sends a message
+ beginTx();
+ producer.send(outbound[0]);
+ outbound[0].acknowledge();
+ commitTx();
+ outbound[0].acknowledge();
+
+ // receives the first message
+ beginTx();
+ ArrayList<Message> messages = new ArrayList<Message>();
+ LOG.info("About to consume message 1");
+ Message message = consumer.receive(1000);
+ messages.add(message);
+ LOG.info("Received: " + message);
+
+ // validates that the rollbacked was not consumed
+ commitTx();
+ Message inbound[] = new Message[messages.size()];
+ messages.toArray(inbound);
+ assertTextMessagesEqual("Message not delivered.", outbound, inbound);
+ }
+
+ /**
+ * Sends a batch of messages and validates that the message sent before
+ * session close is not consumed.
+ *
+ * This test only works with local transactions, not xa.
+ * @throws Exception
+ */
+ public void testSendSessionClose() throws Exception {
+ Message[] outbound = new Message[] {session.createTextMessage("First Message"), session.createTextMessage("Second Message")};
+
+ // sends a message
+ beginTx();
+ producer.send(outbound[0]);
+ commitTx();
+
+ // sends a message that gets rollbacked
+ beginTx();
+ producer.send(session.createTextMessage("I'm going to get rolled back."));
+ consumer.close();
+
+ reconnectSession();
+
+ // sends a message
+ producer.send(outbound[1]);
+ commitTx();
+
+ // receives the first message
+ ArrayList<Message> messages = new ArrayList<Message>();
+ LOG.info("About to consume message 1");
+ beginTx();
+ Message message = consumer.receive(1000);
+ messages.add(message);
+ LOG.info("Received: " + message);
+
+ // receives the second message
+ LOG.info("About to consume message 2");
+ message = consumer.receive(4000);
+ messages.add(message);
+ LOG.info("Received: " + message);
+
+ // validates that the rollbacked was not consumed
+ commitTx();
+ Message inbound[] = new Message[messages.size()];
+ messages.toArray(inbound);
+ assertTextMessagesEqual("Rollback did not work.", outbound, inbound);
+ }
+
+ /**
+ * Sends a batch of messages and validates that the message sent before
+ * session close is not consumed.
+ *
+ * @throws Exception
+ */
+ public void testSendSessionAndConnectionClose() throws Exception {
+ Message[] outbound = new Message[] {session.createTextMessage("First Message"), session.createTextMessage("Second Message")};
+
+ // sends a message
+ beginTx();
+ producer.send(outbound[0]);
+ commitTx();
+
+ // sends a message that gets rollbacked
+ beginTx();
+ producer.send(session.createTextMessage("I'm going to get rolled back."));
+ consumer.close();
+ session.close();
+
+ reconnect();
+
+ // sends a message
+ beginTx();
+ producer.send(outbound[1]);
+ commitTx();
+
+ // receives the first message
+ ArrayList<Message> messages = new ArrayList<Message>();
+ LOG.info("About to consume message 1");
+ beginTx();
+ Message message = consumer.receive(1000);
+ messages.add(message);
+ LOG.info("Received: " + message);
+
+ // receives the second message
+ LOG.info("About to consume message 2");
+ message = consumer.receive(4000);
+ messages.add(message);
+ LOG.info("Received: " + message);
+
+ // validates that the rollbacked was not consumed
+ commitTx();
+ Message inbound[] = new Message[messages.size()];
+ messages.toArray(inbound);
+ assertTextMessagesEqual("Rollback did not work.", outbound, inbound);
+ }
+
+ /**
+ * Sends a batch of messages and validates that the rollbacked message was
+ * redelivered.
+ *
+ * @throws Exception
+ */
+ public void testReceiveRollback() throws Exception {
+ if (session instanceof StompJmsSession) {
+ // TODO - rollback in stompjms doesn't work the same way
+ return;
+ }
+ Message[] outbound = new Message[] {session.createTextMessage("First Message"), session.createTextMessage("Second Message")};
+
+ // lets consume any outstanding messages from prev test runs
+ beginTx();
+ while (consumer.receive(1000) != null) {
+ }
+ commitTx();
+
+ // sent both messages
+ beginTx();
+ producer.send(outbound[0]);
+ producer.send(outbound[1]);
+ commitTx();
+
+ LOG.info("Sent 0: " + outbound[0]);
+ LOG.info("Sent 1: " + outbound[1]);
+
+ ArrayList<Message> messages = new ArrayList<Message>();
+ beginTx();
+ Message message = consumer.receive(1000);
+ messages.add(message);
+ assertEquals(outbound[0], message);
+ commitTx();
+
+ // rollback so we can get that last message again.
+ beginTx();
+ message = consumer.receive(1000);
+ assertNotNull(message);
+ assertEquals(outbound[1], message);
+ rollbackTx();
+
+ // Consume again.. the prev message should
+ // get redelivered.
+ beginTx();
+ message = consumer.receive(5000);
+ assertNotNull("Should have re-received the message again!", message);
+ messages.add(message);
+ commitTx();
+
+ Message inbound[] = new Message[messages.size()];
+ messages.toArray(inbound);
+ assertTextMessagesEqual("Rollback did not work", outbound, inbound);
+ }
+
+ /**
+ * Sends a batch of messages and validates that the rollbacked message was
+ * redelivered.
+ *
+ * @throws Exception
+ */
+ public void testReceiveTwoThenRollback() throws Exception {
+ if (session instanceof StompJmsSession) {
+ // TODO - rollback in stompjms doesn't work the same way
+ return;
+ }
+ Message[] outbound = new Message[] {session.createTextMessage("First Message"), session.createTextMessage("Second Message")};
+
+ // lets consume any outstanding messages from prev test runs
+ beginTx();
+ while (consumer.receive(1000) != null) {
+ }
+ commitTx();
+
+ //
+ beginTx();
+ producer.send(outbound[0]);
+ producer.send(outbound[1]);
+ commitTx();
+
+ LOG.info("Sent 0: " + outbound[0]);
+ LOG.info("Sent 1: " + outbound[1]);
+
+ ArrayList<Message> messages = new ArrayList<Message>();
+ beginTx();
+ Message message = consumer.receive(1000);
+ assertEquals(outbound[0], message);
+
+ message = consumer.receive(1000);
+ assertNotNull(message);
+ assertEquals(outbound[1], message);
+ rollbackTx();
+
+ // Consume again.. the prev message should
+ // get redelivered.
+ beginTx();
+ message = consumer.receive(5000);
+ assertNotNull("Should have re-received the first message again!", message);
+ messages.add(message);
+ assertEquals(outbound[0], message);
+ message = consumer.receive(5000);
+ assertNotNull("Should have re-received the second message again!", message);
+ messages.add(message);
+ assertEquals(outbound[1], message);
+
+ assertNull(consumer.receiveNoWait());
+ commitTx();
+
+ Message inbound[] = new Message[messages.size()];
+ messages.toArray(inbound);
+ assertTextMessagesEqual("Rollback did not work", outbound, inbound);
+ }
+
+ /**
+ * Sends a batch of messages and validates that the rollbacked message was
+ * not consumed.
+ *
+ * @throws Exception
+ */
+ /*
+ public void testSendReceiveWithPrefetchOne() throws Exception {
+ setPrefetchToOne();
+ Message[] outbound = new Message[] {session.createTextMessage("First Message"), session.createTextMessage("Second Message"), session.createTextMessage("Third Message"),
+ session.createTextMessage("Fourth Message")};
+
+ beginTx();
+ for (int i = 0; i < outbound.length; i++) {
+ // sends a message
+ producer.send(outbound[i]);
+ }
+ commitTx();
+
+ // receives the first message
+ beginTx();
+ for (int i = 0; i < outbound.length; i++) {
+ LOG.info("About to consume message 1");
+ Message message = consumer.receive(1000);
+ assertNotNull(message);
+ LOG.info("Received: " + message);
+ }
+
+ // validates that the rollbacked was not consumed
+ commitTx();
+ }
+ */
+
+ /**
+ * Perform the test that validates if the rollbacked message was redelivered
+ * multiple times.
+ *
+ * @throws Exception
+ */
+ public void testReceiveTwoThenRollbackManyTimes() throws Exception {
+ if (session instanceof StompJmsSession) {
+ // TODO - rollback in stompjms doesn't work the same way
+ return;
+ }
+ for (int i = 0; i < 5; i++) {
+ testReceiveTwoThenRollback();
+ }
+ }
+
+ /**
+ * Sends a batch of messages and validates that the rollbacked message was
+ * not consumed. This test differs by setting the message prefetch to one.
+ *
+ * @throws Exception
+ */
+ /*
+ public void testSendRollbackWithPrefetchOfOne() throws Exception {
+ setPrefetchToOne();
+ testSendRollback();
+ }
+ */
+
+ /**
+ * Sends a batch of messages and and validates that the rollbacked message
+ * was redelivered. This test differs by setting the message prefetch to
+ * one.
+ *
+ * @throws Exception
+ */
+ /*
+ public void testReceiveRollbackWithPrefetchOfOne() throws Exception {
+ setPrefetchToOne();
+ testReceiveRollback();
+ }
+ */
+
+ /**
+ * Tests if the messages can still be received if the consumer is closed
+ * (session is not closed).
+ *
+ * @throws Exception see http://jira.codehaus.org/browse/AMQ-143
+ */
+ public void testCloseConsumerBeforeCommit() throws Exception {
+ TextMessage[] outbound = new TextMessage[] {session.createTextMessage("First Message"), session.createTextMessage("Second Message")};
+
+ // lets consume any outstanding messages from prev test runs
+ beginTx();
+ while (consumer.receiveNoWait() != null) {
+ }
+
+ commitTx();
+
+ // sends the messages
+ beginTx();
+ producer.send(outbound[0]);
+ producer.send(outbound[1]);
+ commitTx();
+ LOG.info("Sent 0: " + outbound[0]);
+ LOG.info("Sent 1: " + outbound[1]);
+
+ beginTx();
+ TextMessage message = (TextMessage)consumer.receive(1000);
+ assertNotNull(message);
+ assertEquals(outbound[0].getText(), message.getText());
+ // Close the consumer before the commit. This should not cause the
+ // received message
+ // to rollback.
+ consumer.close();
+ commitTx();
+
+ // Create a new consumer
+ consumer = resourceProvider.createConsumer(session, destination);
+ LOG.info("Created consumer: " + consumer);
+
+ beginTx();
+ message = (TextMessage)consumer.receive(1000);
+ assertNotNull(message);
+ assertEquals(outbound[1].getText(), message.getText());
+ commitTx();
+ }
+
+ public void testChangeMutableObjectInObjectMessageThenRollback() throws Exception {
+ ArrayList<String> list = new ArrayList<String>();
+ list.add("First");
+ Message outbound = session.createObjectMessage(list);
+ outbound.setStringProperty("foo", "abc");
+
+ beginTx();
+ producer.send(outbound);
+ commitTx();
+
+ LOG.info("About to consume message 1");
+ beginTx();
+ Message message = consumer.receive(5000);
+
+ List<String> body = assertReceivedObjectMessageWithListBody(message);
+
+ // now lets try mutate it
+ try {
+ message.setStringProperty("foo", "def");
+ fail("Cannot change properties of the object!");
+ } catch (JMSException e) {
+ LOG.info("Caught expected exception: " + e, e);
+ }
+ body.clear();
+ body.add("This should never be seen!");
+ rollbackTx();
+
+ beginTx();
+ message = consumer.receive(5000);
+ List<String> secondBody = assertReceivedObjectMessageWithListBody(message);
+ assertNotSame("Second call should return a different body", secondBody, body);
+ commitTx();
+ }
+
+ @SuppressWarnings("unchecked")
+ protected List<String> assertReceivedObjectMessageWithListBody(Message message) throws JMSException {
+ assertNotNull("Should have received a message!", message);
+ assertEquals("foo header", "abc", message.getStringProperty("foo"));
+
+ assertTrue("Should be an object message but was: " + message, message instanceof ObjectMessage);
+ ObjectMessage objectMessage = (ObjectMessage)message;
+ List<String> body = (List<String>)objectMessage.getObject();
+ LOG.info("Received body: " + body);
+
+ assertEquals("Size of list should be 1", 1, body.size());
+ assertEquals("element 0 of list", "First", body.get(0));
+ return body;
+ }
+
+ /**
+ * Recreates the connection.
+ *
+ * @throws javax.jms.JMSException
+ */
+ protected void reconnect() throws Exception {
+ if (connection != null) {
+ // Close the prev connection.
+ connection.close();
+ }
+ session = null;
+ connection = resourceProvider.createConnection(getConnectionFactory());
+ reconnectSession();
+ connection.start();
+ }
+
+ /**
+ * Recreates the connection.
+ *
+ * @throws javax.jms.JMSException
+ */
+ protected void reconnectSession() throws JMSException {
+ if (session != null) {
+ session.close();
+ }
+
+ session = resourceProvider.createSession(connection);
+ destination = resourceProvider.createDestination(session, getDestinationName());
+ producer = resourceProvider.createProducer(session, destination);
+ consumer = resourceProvider.createConsumer(session, destination);
+ }
+
+ /**
+ * Sets the prefeftch policy to one.
+ */
+ /*
+ protected void setPrefetchToOne() {
+ ActiveMQPrefetchPolicy prefetchPolicy = getPrefetchPolicy();
+ prefetchPolicy.setQueuePrefetch(1);
+ prefetchPolicy.setTopicPrefetch(1);
+ prefetchPolicy.setDurableTopicPrefetch(1);
+ prefetchPolicy.setOptimizeDurableTopicPrefetch(1);
+ }
+
+ protected ActiveMQPrefetchPolicy getPrefetchPolicy() {
+ return ((ActiveMQConnection)connection).getPrefetchPolicy();
+ }
+ */
+
+ //This test won't work with xa tx so no beginTx() has been added.
+ public void testMessageListener() throws Exception {
+ // send messages
+ for (int i = 0; i < MESSAGE_COUNT; i++) {
+ producer.send(session.createTextMessage(MESSAGE_TEXT + i));
+ }
+ commitTx();
+ consumer.setMessageListener(this);
+ // wait receive
+ waitReceiveUnack();
+ assertEquals(unackMessages.size(), MESSAGE_COUNT);
+ // resend phase
+ waitReceiveAck();
+ assertEquals(ackMessages.size(), MESSAGE_COUNT);
+ // should no longer re-receive
+ consumer.setMessageListener(null);
+ assertNull(consumer.receive(500));
+ reconnect();
+ }
+
+ public void onMessage(Message message) {
+ if (!resendPhase) {
+ unackMessages.add(message);
+ if (unackMessages.size() == MESSAGE_COUNT) {
+ try {
+ rollbackTx();
+ resendPhase = true;
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ } else {
+ ackMessages.add(message);
+ if (ackMessages.size() == MESSAGE_COUNT) {
+ try {
+ commitTx();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+
+ private void waitReceiveUnack() throws Exception {
+ for (int i = 0; i < 100 && !resendPhase; i++) {
+ Thread.sleep(100);
+ }
+ assertTrue(resendPhase);
+ }
+
+ private void waitReceiveAck() throws Exception {
+ for (int i = 0; i < 100 && ackMessages.size() < MESSAGE_COUNT; i++) {
+ Thread.sleep(100);
+ }
+ assertFalse(ackMessages.size() < MESSAGE_COUNT);
+ }
+}
diff --git a/apollo-itests/src/test/java/org/apache/activemq/apollo/OpenwireBrokerProtocol.java b/apollo-itests/src/test/java/org/apache/activemq/apollo/OpenwireBrokerProtocol.java
new file mode 100644
index 0000000..1d4080f
--- /dev/null
+++ b/apollo-itests/src/test/java/org/apache/activemq/apollo/OpenwireBrokerProtocol.java
@@ -0,0 +1,45 @@
+/**
+ * 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;
+
+import org.apache.activemq.ActiveMQConnectionFactory;
+
+import static java.lang.String.*;
+
+import javax.jms.ConnectionFactory;
+
+/**
+ * <p>
+ * </p>
+ *
+ * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
+ */
+public class OpenwireBrokerProtocol extends BrokerProtocol {
+
+ @Override
+ ConnectionFactory getConnectionFactory(Object broker) {
+ ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory();
+ factory.setBrokerURL(format("tcp://localhost:%s", port(broker)));
+ return factory;
+ }
+
+ @Override
+ public String toString() {
+ return "OpenWire";
+ }
+
+}
diff --git a/apollo-itests/src/test/java/org/apache/activemq/apollo/StompBrokerProtocol.java b/apollo-itests/src/test/java/org/apache/activemq/apollo/StompBrokerProtocol.java
new file mode 100644
index 0000000..e8c2842
--- /dev/null
+++ b/apollo-itests/src/test/java/org/apache/activemq/apollo/StompBrokerProtocol.java
@@ -0,0 +1,44 @@
+/**
+ * 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;
+
+import org.fusesource.stomp.jms.StompJmsConnectionFactory;
+
+import javax.jms.ConnectionFactory;
+
+import static java.lang.String.format;
+
+/**
+ * <p>
+ * </p>
+ *
+ * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
+ */
+public class StompBrokerProtocol extends BrokerProtocol {
+
+ @Override
+ ConnectionFactory getConnectionFactory(Object broker) {
+ StompJmsConnectionFactory factory = new StompJmsConnectionFactory();
+ factory.setBrokerURI(format("tcp://localhost:%s", port(broker)));
+ return factory;
+ }
+
+ @Override
+ public String toString() {
+ return "STOMP";
+ }
+}
diff --git a/apollo-itests/src/test/java/org/apache/activemq/apollo/test/JmsResourceProvider.java b/apollo-itests/src/test/java/org/apache/activemq/apollo/test/JmsResourceProvider.java
new file mode 100755
index 0000000..fafcf94
--- /dev/null
+++ b/apollo-itests/src/test/java/org/apache/activemq/apollo/test/JmsResourceProvider.java
@@ -0,0 +1,235 @@
+/**
+ * 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.test;
+
+import org.apache.activemq.apollo.JmsTestBase;
+
+import javax.jms.*;
+
+/**
+ *
+ */
+public class JmsResourceProvider {
+
+ private boolean transacted;
+ private int ackMode = Session.AUTO_ACKNOWLEDGE;
+ private boolean isTopic;
+ private int deliveryMode = DeliveryMode.PERSISTENT;
+ private String durableName = "DummyName";
+ private String clientID = getClass().getName();
+ private JmsTestBase support;
+
+ public JmsResourceProvider(JmsTestBase support) {
+ this.support = support;
+ }
+
+ /**
+ * Creates a connection factory.
+ *
+ * @see org.apache.activemq.apollo.test.JmsResourceProvider#createConnectionFactory()
+ */
+ public ConnectionFactory createConnectionFactory() throws Exception {
+ return support.getConnectionFactory();
+ }
+
+ /**
+ * Creates a connection.
+ *
+ * @see org.apache.activemq.apollo.test.JmsResourceProvider#createConnection(javax.jms.ConnectionFactory)
+ */
+ public Connection createConnection(ConnectionFactory cf) throws JMSException {
+ Connection connection = cf.createConnection();
+ if (getClientID() != null) {
+ connection.setClientID(getClientID());
+ }
+ return connection;
+ }
+
+ /**
+ * @see org.apache.activemq.apollo.test.JmsResourceProvider#createSession(javax.jms.Connection)
+ */
+ public Session createSession(Connection conn) throws JMSException {
+ return conn.createSession(transacted, ackMode);
+ }
+
+ /**
+ * @see org.apache.activemq.apollo.test.JmsResourceProvider#createConsumer(javax.jms.Session,
+ * javax.jms.Destination)
+ */
+ public MessageConsumer createConsumer(Session session, Destination destination) throws JMSException {
+ if (isDurableSubscriber()) {
+ return session.createDurableSubscriber((Topic)destination, durableName);
+ }
+ return session.createConsumer(destination);
+ }
+
+ /**
+ * Creates a connection for a consumer.
+ *
+ * @param ssp - ServerSessionPool
+ * @return ConnectionConsumer
+ */
+ public ConnectionConsumer createConnectionConsumer(Connection connection, Destination destination, ServerSessionPool ssp) throws JMSException {
+ return connection.createConnectionConsumer(destination, null, ssp, 1);
+ }
+
+ /**
+ * Creates a producer.
+ *
+ * @see org.apache.activemq.apollo.test.JmsResourceProvider#createProducer(javax.jms.Session,
+ * javax.jms.Destination)
+ */
+ public MessageProducer createProducer(Session session, Destination destination) throws JMSException {
+ MessageProducer producer = session.createProducer(destination);
+ producer.setDeliveryMode(deliveryMode);
+ return producer;
+ }
+
+ /**
+ * Creates a destination, which can either a topic or a queue.
+ *
+ * @see org.apache.activemq.apollo.test.JmsResourceProvider#createDestination(javax.jms.Session,
+ * String)
+ */
+
+ public Destination createDestination(Session session, String name) throws JMSException {
+ if (isTopic) {
+ return session.createTopic("TOPIC." + name);
+ } else {
+ return session.createQueue("QUEUE." + name);
+ }
+ }
+
+ /**
+ * Returns true if the subscriber is durable.
+ *
+ * @return isDurableSubscriber
+ */
+ public boolean isDurableSubscriber() {
+ return isTopic && durableName != null;
+ }
+
+ /**
+ * Returns the acknowledgement mode.
+ *
+ * @return Returns the ackMode.
+ */
+ public int getAckMode() {
+ return ackMode;
+ }
+
+ /**
+ * Sets the acnknowledgement mode.
+ *
+ * @param ackMode The ackMode to set.
+ */
+ public void setAckMode(int ackMode) {
+ this.ackMode = ackMode;
+ }
+
+ /**
+ * Returns true if the destination is a topic, false if the destination is a
+ * queue.
+ *
+ * @return Returns the isTopic.
+ */
+ public boolean isTopic() {
+ return isTopic;
+ }
+
+ /**
+ * @param isTopic The isTopic to set.
+ */
+ public void setTopic(boolean isTopic) {
+ this.isTopic = isTopic;
+ }
+
+ /**
+ * Return true if the session is transacted.
+ *
+ * @return Returns the transacted.
+ */
+ public boolean isTransacted() {
+ return transacted;
+ }
+
+ /**
+ * Sets the session to be transacted.
+ *
+ * @param transacted
+ */
+ public void setTransacted(boolean transacted) {
+ this.transacted = transacted;
+ if (transacted) {
+ setAckMode(Session.SESSION_TRANSACTED);
+ }
+ }
+
+ /**
+ * Returns the delivery mode.
+ *
+ * @return deliveryMode
+ */
+ public int getDeliveryMode() {
+ return deliveryMode;
+ }
+
+ /**
+ * Sets the delivery mode.
+ *
+ * @param deliveryMode
+ */
+ public void setDeliveryMode(int deliveryMode) {
+ this.deliveryMode = deliveryMode;
+ }
+
+ /**
+ * Returns the client id.
+ *
+ * @return clientID
+ */
+ public String getClientID() {
+ return clientID;
+ }
+
+ /**
+ * Sets the client id.
+ *
+ * @param clientID
+ */
+ public void setClientID(String clientID) {
+ this.clientID = clientID;
+ }
+
+ /**
+ * Returns the durable name of the provider.
+ *
+ * @return durableName
+ */
+ public String getDurableName() {
+ return durableName;
+ }
+
+ /**
+ * Sets the durable name of the provider.
+ *
+ * @param durableName
+ */
+ public void setDurableName(String durableName) {
+ this.durableName = durableName;
+ }
+}
diff --git a/apollo-itests/src/test/resources/apollo-openwire.xml b/apollo-itests/src/test/resources/apollo-openwire.xml
deleted file mode 100644
index c8bc8c4..0000000
--- a/apollo-itests/src/test/resources/apollo-openwire.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<!--
- 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.
--->
-<broker xmlns="http://activemq.apache.org/schema/activemq/apollo">
- <notes>This broker configuration is what the unit tests in this module load up.</notes>
-
- <virtual_host id="default" purge_on_startup="true" auto_create_queues="true">
- <host_name>localhost</host_name>
-
- <queue name="mirrored.**" mirrored="true"/>
-
- </virtual_host>
-
- <connector id="tcp" protocol="openwire" bind="tcp://0.0.0.0:0"/>
-
-</broker>
\ No newline at end of file
diff --git a/apollo-itests/src/test/resources/apollo-stomp.xml b/apollo-itests/src/test/resources/apollo-stomp.xml
deleted file mode 100644
index 5d13c20..0000000
--- a/apollo-itests/src/test/resources/apollo-stomp.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<!--
- 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.
--->
-<broker xmlns="http://activemq.apache.org/schema/activemq/apollo">
- <notes>This broker configuration is what the unit tests in this module load up.</notes>
-
- <virtual_host id="default" purge_on_startup="true" auto_create_queues="true">
- <host_name>localhost</host_name>
-
- <queue name="mirrored.**" mirrored="true"/>
-
- </virtual_host>
-
- <connector id="tcp" protocol="stomp" bind="tcp://0.0.0.0:0"/>
-
-</broker>
\ No newline at end of file
diff --git a/apollo-itests/src/test/resources/apollo.xml b/apollo-itests/src/test/resources/apollo.xml
new file mode 100644
index 0000000..e0e7988
--- /dev/null
+++ b/apollo-itests/src/test/resources/apollo.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!--
+ 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.
+-->
+<broker xmlns="http://activemq.apache.org/schema/activemq/apollo">
+ <notes>This broker configuration is what the unit tests in this module load up.</notes>
+
+ <virtual_host id="default" purge_on_startup="true" auto_create_queues="true">
+ <host_name>localhost</host_name>
+ <queue name="mirrored.**" mirrored="true"/>
+ </virtual_host>
+
+ <connector id="tcp" bind="tcp://0.0.0.0:0"/>
+
+</broker>
\ No newline at end of file
diff --git a/apollo-itests/src/test/resources/log4j.properties b/apollo-itests/src/test/resources/log4j.properties
index 3801f0e..155bbcb 100755
--- a/apollo-itests/src/test/resources/log4j.properties
+++ b/apollo-itests/src/test/resources/log4j.properties
@@ -19,14 +19,22 @@
# The logging properties used during tests..
#
log4j.rootLogger=WARN, console, file
-log4j.logger.org.apache.activemq=TRACE
-log4j.logger.org.fusesource=TRACE
+
+#
+# Comment/Uncomment to enabled debugging in different areas.
+log4j.logger.org.apache.activemq.apollo=TRACE
+#log4j.logger.org.apache.activemq.apollo.broker=TRACE
+#log4j.logger.org.apache.activemq.apollo.broker.store=TRACE
+#log4j.logger.org.apache.activemq.apollo.openwire=TRACE
+#log4j.logger.org.apache.activemq.apollo.stomp=TRACE
+#log4j.logger.org.apache.activemq.apollo.web=TRACE
+#log4j.logger.org.apache.activemq.apollo.cli=TRACE
# Console will only display warnnings
log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.layout=org.apache.log4j.PatternLayout
log4j.appender.console.layout.ConversionPattern=%-5p | %t | %m%n
-log4j.appender.console.threshold=WARN
+log4j.appender.console.threshold=TRACE
# File appender will contain all info messages
log4j.appender.file=org.apache.log4j.FileAppender
diff --git a/apollo-itests/src/test/scala/org/apache/activemq/apollo/BrokerService.scala b/apollo-itests/src/test/scala/org/apache/activemq/apollo/BrokerService.scala
deleted file mode 100644
index bf7b5dd..0000000
--- a/apollo-itests/src/test/scala/org/apache/activemq/apollo/BrokerService.scala
+++ /dev/null
@@ -1,96 +0,0 @@
-/**
- * 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
-
-import broker.{BrokerFactory, Broker}
-import javax.jms.ConnectionFactory
-import java.net.InetSocketAddress
-import util.{Logging, ServiceControl}
-import java.util.Hashtable
-import javax.naming.InitialContext
-
-
-/**
- *
- */
-trait BrokerService extends Logging {
-
- var broker: Broker = null
- var port = 0
- var started = false
-
- def start = {
- try {
- info("Loading broker configuration from the classpath with URI: " + broker_config_uri)
- broker = BrokerFactory.createBroker(broker_config_uri)
- ServiceControl.start(broker, "Starting broker")
- port = broker.get_socket_address.asInstanceOf[InetSocketAddress].getPort
- }
- catch {
- case e:Throwable => e.printStackTrace
- throw e
- }
- }
-
-
- def stop = ServiceControl.stop(broker, "Stopping broker")
-
- def broker_config_uri:String
-
- def getConnectionFactory = {
- if (!started) {
- start
- }
- val jndiConfig = new Hashtable[String, String]
- jndiConfig.put("java.naming.factory.initial", getInitialContextFactoryClass)
- jndiConfig.put("java.naming.provider.url", getConnectionUri)
- jndiConfig.put("java.naming.security.principal", "admin")
- jndiConfig.put("java.naming.security.credentials", "password")
- val ctx = new InitialContext(jndiConfig)
- ctx.lookup("ConnectionFactory").asInstanceOf[ConnectionFactory]
- }
-
- protected def getInitialContextFactoryClass:String
-
- def getConnectionUri:String
-}
-
-/**
- *
- */
-class StompBroker extends BrokerService {
-
- def broker_config_uri = "xml:classpath:apollo-stomp.xml"
-
- protected def getInitialContextFactoryClass = "org.fusesource.stompjms.jndi.StompJmsInitialContextFactory"
-
- def getConnectionUri = "tcp://localhost:%s".format(port);
-
-}
-
-/**
- *
- */
-class OpenwireBroker extends BrokerService {
-
- def broker_config_uri = "xml:classpath:apollo-openwire.xml"
-
- protected def getInitialContextFactoryClass = "org.apache.activemq.jndi.ActiveMQInitialContextFactory"
-
- def getConnectionUri = "tcp://localhost:%s".format(port)
-
-}
diff --git a/apollo-itests/src/test/scala/org/apache/activemq/apollo/JMSMessageTest.java b/apollo-itests/src/test/scala/org/apache/activemq/apollo/JMSMessageTest.java
deleted file mode 100644
index 45bdb76..0000000
--- a/apollo-itests/src/test/scala/org/apache/activemq/apollo/JMSMessageTest.java
+++ /dev/null
@@ -1,488 +0,0 @@
-/**
- * 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;
-
-import junit.framework.Test;
-import org.fusesource.stomp.jms.StompJmsSession;
-
-import javax.jms.*;
-import java.net.URISyntaxException;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Vector;
-
-/**
- * Test cases used to test the JMS message consumer.
- *
- *
- */
-public class JMSMessageTest extends JmsTestSupport {
-
- public Destination destination;
- public int deliveryMode = DeliveryMode.NON_PERSISTENT;
- public int prefetch;
- public int ackMode;
- public DestinationType destinationType = DestinationType.QUEUE_TYPE;
- public boolean durableConsumer;
-
- /**
- * Run all these tests in both marshaling and non-marshaling mode.
- */
- public void initCombos() {
- super.initCombos();
- addCombinationValues("deliveryMode", new Object[]{Integer.valueOf(DeliveryMode.NON_PERSISTENT),
- Integer.valueOf(DeliveryMode.PERSISTENT)});
- addCombinationValues("destinationType", new Object[] {DestinationType.QUEUE_TYPE});
- }
-
- public void testTextMessage() throws Exception {
-
- // Receive a message with the JMS API
- connection.start();
- Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
- destination = createDestination(session, destinationType);
- MessageConsumer consumer = session.createConsumer(destination);
- MessageProducer producer = session.createProducer(destination);
-
- // Send the message.
- {
- TextMessage message = session.createTextMessage();
- message.setText("Hi");
- producer.send(message);
- }
-
- // Check the Message
- {
- TextMessage message = (TextMessage)consumer.receive(1000);
- assertNotNull(message);
- assertEquals("Hi", message.getText());
- }
-
- assertNull(consumer.receiveNoWait());
- }
-
- public static Test suite() {
- return suite(JMSMessageTest.class);
- }
-
- public static void main(String[] args) {
- junit.textui.TestRunner.run(suite());
- }
-
- public void testBytesMessageLength() throws Exception {
-
- // Receive a message with the JMS API
- connection.start();
- Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
- destination = createDestination(session, destinationType);
- MessageConsumer consumer = session.createConsumer(destination);
- MessageProducer producer = session.createProducer(destination);
-
- // Send the message
- {
- BytesMessage message = session.createBytesMessage();
- message.writeInt(1);
- message.writeInt(2);
- message.writeInt(3);
- message.writeInt(4);
- producer.send(message);
- }
-
- // Check the message.
- {
- BytesMessage message = (BytesMessage)consumer.receive(1000);
- assertNotNull(message);
- assertEquals(16, message.getBodyLength());
- }
-
- assertNull(consumer.receiveNoWait());
- }
-
- public void testObjectMessage() throws Exception {
-
- // Receive a message with the JMS API
- connection.start();
- Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
- destination = createDestination(session, destinationType);
- MessageConsumer consumer = session.createConsumer(destination);
- MessageProducer producer = session.createProducer(destination);
-
- // send the message.
- {
- ObjectMessage message = session.createObjectMessage();
- message.setObject("Hi");
- producer.send(message);
- }
-
- // Check the message
- {
- ObjectMessage message = (ObjectMessage)consumer.receive(1000);
- assertNotNull(message);
- assertEquals("Hi", message.getObject());
- }
- assertNull(consumer.receiveNoWait());
- }
-
- public void testBytesMessage() throws Exception {
-
- // Receive a message with the JMS API
- connection.start();
- Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
- destination = createDestination(session, destinationType);
- MessageConsumer consumer = session.createConsumer(destination);
- MessageProducer producer = session.createProducer(destination);
-
- // Send the message
- {
- BytesMessage message = session.createBytesMessage();
- message.writeBoolean(true);
- producer.send(message);
- }
-
- // Check the message
- {
- BytesMessage message = (BytesMessage)consumer.receive(1000);
- assertNotNull(message);
- assertTrue(message.readBoolean());
-
- // TODO - stompjms appears to reset the stream so this check fails
- if (!(session instanceof StompJmsSession)) {
- try {
- message.readByte();
- fail("Expected exception not thrown.");
- } catch (MessageEOFException e) {
- }
- }
-
- }
- assertNull(consumer.receiveNoWait());
- }
-
- public void testStreamMessage() throws Exception {
-
- // Receive a message with the JMS API
- connection.start();
- Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
- destination = createDestination(session, destinationType);
- MessageConsumer consumer = session.createConsumer(destination);
- MessageProducer producer = session.createProducer(destination);
-
- // Send the message.
- {
- StreamMessage message = session.createStreamMessage();
- message.writeString("This is a test to see how it works.");
- producer.send(message);
- }
-
- // Check the message.
- {
- StreamMessage message = (StreamMessage)consumer.receive(1000);
- assertNotNull(message);
-
- // Invalid conversion should throw exception and not move the stream
- // position.
- if (!(session instanceof StompJmsSession)) {
- // TODO - stompjms appears to a problem here that doesn't result in the right exception being thrown
- try {
- message.readByte();
- fail("Should have received NumberFormatException");
- } catch (NumberFormatException e) {
- }
- }
-
- assertEquals("This is a test to see how it works.", message.readString());
-
- // Invalid conversion should throw exception and not move the stream
- // position.
- try {
- message.readByte();
- fail("Should have received MessageEOFException");
- } catch (MessageEOFException e) {
- }
- }
- assertNull(consumer.receiveNoWait());
- }
-
- public void testMapMessage() throws Exception {
-
- // Receive a message with the JMS API
- connection.start();
- Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
- destination = createDestination(session, destinationType);
- MessageConsumer consumer = session.createConsumer(destination);
- MessageProducer producer = session.createProducer(destination);
-
- // send the message.
- {
- MapMessage message = session.createMapMessage();
- message.setBoolean("boolKey", true);
- producer.send(message);
- }
-
- // get the message.
- {
- MapMessage message = (MapMessage)consumer.receive(1000);
- assertNotNull(message);
- assertTrue(message.getBoolean("boolKey"));
- }
- assertNull(consumer.receiveNoWait());
- }
-
- static class ForeignMessage implements TextMessage {
-
- public int deliveryMode;
-
- private String messageId;
- private long timestamp;
- private String correlationId;
- private Destination replyTo;
- private Destination destination;
- private boolean redelivered;
- private String type;
- private long expiration;
- private int priority;
- private String text;
- private HashMap<String, Object> props = new HashMap<String, Object>();
-
- public String getJMSMessageID() throws JMSException {
- return messageId;
- }
-
- public void setJMSMessageID(String arg0) throws JMSException {
- messageId = arg0;
- }
-
- public long getJMSTimestamp() throws JMSException {
- return timestamp;
- }
-
- public void setJMSTimestamp(long arg0) throws JMSException {
- timestamp = arg0;
- }
-
- public byte[] getJMSCorrelationIDAsBytes() throws JMSException {
- return null;
- }
-
- public void setJMSCorrelationIDAsBytes(byte[] arg0) throws JMSException {
- }
-
- public void setJMSCorrelationID(String arg0) throws JMSException {
- correlationId = arg0;
- }
-
- public String getJMSCorrelationID() throws JMSException {
- return correlationId;
- }
-
- public Destination getJMSReplyTo() throws JMSException {
- return replyTo;
- }
-
- public void setJMSReplyTo(Destination arg0) throws JMSException {
- replyTo = arg0;
- }
-
- public Destination getJMSDestination() throws JMSException {
- return destination;
- }
-
- public void setJMSDestination(Destination arg0) throws JMSException {
- destination = arg0;
- }
-
- public int getJMSDeliveryMode() throws JMSException {
- return deliveryMode;
- }
-
- public void setJMSDeliveryMode(int arg0) throws JMSException {
- deliveryMode = arg0;
- }
-
- public boolean getJMSRedelivered() throws JMSException {
- return redelivered;
- }
-
- public void setJMSRedelivered(boolean arg0) throws JMSException {
- redelivered = arg0;
- }
-
- public String getJMSType() throws JMSException {
- return type;
- }
-
- public void setJMSType(String arg0) throws JMSException {
- type = arg0;
- }
-
- public long getJMSExpiration() throws JMSException {
- return expiration;
- }
-
- public void setJMSExpiration(long arg0) throws JMSException {
- expiration = arg0;
- }
-
- public int getJMSPriority() throws JMSException {
- return priority;
- }
-
- public void setJMSPriority(int arg0) throws JMSException {
- priority = arg0;
- }
-
- public void clearProperties() throws JMSException {
- }
-
- public boolean propertyExists(String arg0) throws JMSException {
- return false;
- }
-
- public boolean getBooleanProperty(String arg0) throws JMSException {
- return false;
- }
-
- public byte getByteProperty(String arg0) throws JMSException {
- return 0;
- }
-
- public short getShortProperty(String arg0) throws JMSException {
- return 0;
- }
-
- public int getIntProperty(String arg0) throws JMSException {
- return 0;
- }
-
- public long getLongProperty(String arg0) throws JMSException {
- return 0;
- }
-
- public float getFloatProperty(String arg0) throws JMSException {
- return 0;
- }
-
- public double getDoubleProperty(String arg0) throws JMSException {
- return 0;
- }
-
- public String getStringProperty(String arg0) throws JMSException {
- return (String)props.get(arg0);
- }
-
- public Object getObjectProperty(String arg0) throws JMSException {
- return props.get(arg0);
- }
-
- public Enumeration getPropertyNames() throws JMSException {
- return new Vector<String>(props.keySet()).elements();
- }
-
- public void setBooleanProperty(String arg0, boolean arg1) throws JMSException {
- }
-
- public void setByteProperty(String arg0, byte arg1) throws JMSException {
- }
-
- public void setShortProperty(String arg0, short arg1) throws JMSException {
- }
-
- public void setIntProperty(String arg0, int arg1) throws JMSException {
- }
-
- public void setLongProperty(String arg0, long arg1) throws JMSException {
- }
-
- public void setFloatProperty(String arg0, float arg1) throws JMSException {
- }
-
- public void setDoubleProperty(String arg0, double arg1) throws JMSException {
- }
-
- public void setStringProperty(String arg0, String arg1) throws JMSException {
- props.put(arg0, arg1);
- }
-
- public void setObjectProperty(String arg0, Object arg1) throws JMSException {
- props.put(arg0, arg1);
- }
-
- public void acknowledge() throws JMSException {
- }
-
- public void clearBody() throws JMSException {
- }
-
- public void setText(String arg0) throws JMSException {
- text = arg0;
- }
-
- public String getText() throws JMSException {
- return text;
- }
- }
-
- public void testForeignMessage() throws Exception {
-
- // Receive a message with the JMS API
- connection.start();
- Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
- destination = createDestination(session, destinationType);
- MessageConsumer consumer = session.createConsumer(destination);
- MessageProducer producer = session.createProducer(destination);
-
- // Send the message.
- {
- ForeignMessage message = new ForeignMessage();
- message.text = "Hello";
- message.setStringProperty("test", "value");
- long timeToLive = 10000L;
- long start = System.currentTimeMillis();
- producer.send(message, Session.AUTO_ACKNOWLEDGE, 7, timeToLive);
- long end = System.currentTimeMillis();
-
-
- //validate jms spec 1.1 section 3.4.11 table 3.1
- // JMSDestination, JMSDeliveryMode, JMSExpiration, JMSPriority, JMSMessageID, and JMSTimestamp
- //must be set by sending a message.
-
- // exception for jms destination as the format is provider defined so it is only set on the copy
- if (!(session instanceof StompJmsSession)) {
- // TODO - stompjms doesn't appear to set some/all of these, needs to be sorted
- assertNull(message.getJMSDestination());
- assertEquals(Session.AUTO_ACKNOWLEDGE, message.getJMSDeliveryMode());
- assertTrue(start + timeToLive <= message.getJMSExpiration());
- assertTrue(end + timeToLive >= message.getJMSExpiration());
- assertEquals(7, message.getJMSPriority());
- assertNotNull(message.getJMSMessageID());
- assertTrue(start <= message.getJMSTimestamp());
- assertTrue(end >= message.getJMSTimestamp());
- }
- }
-
- // Validate message is OK.
- {
- TextMessage message = (TextMessage)consumer.receive(1000);
- assertNotNull(message);
- assertEquals("Hello", message.getText());
- assertEquals("value", message.getStringProperty("test"));
- }
-
- assertNull(consumer.receiveNoWait());
- }
-
-}
diff --git a/apollo-itests/src/test/scala/org/apache/activemq/apollo/JmsQueueTransactionTest.java b/apollo-itests/src/test/scala/org/apache/activemq/apollo/JmsQueueTransactionTest.java
deleted file mode 100755
index 1186296..0000000
--- a/apollo-itests/src/test/scala/org/apache/activemq/apollo/JmsQueueTransactionTest.java
+++ /dev/null
@@ -1,213 +0,0 @@
-/**
- * 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;
-
-import junit.framework.Test;
-import org.apache.activemq.apollo.test.JmsResourceProvider;
-import org.fusesource.stomp.jms.StompJmsSession;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.jms.*;
-import java.util.ArrayList;
-import java.util.Enumeration;
-
-/**
- *
- */
-public class JmsQueueTransactionTest extends JmsTransactionTestSupport {
- private static final Logger LOG = LoggerFactory.getLogger(JmsQueueTransactionTest.class);
-
- public static Test suite() {
- return suite(JmsQueueTransactionTest.class);
- }
-
- /**
- * @see org.apache.activemq.apollo.JmsTransactionTestSupport#getJmsResourceProvider()
- */
- protected JmsResourceProvider getJmsResourceProvider() {
- JmsResourceProvider p = new JmsResourceProvider(this);
- p.setTopic(false);
- return p;
- }
-
- /**
- * Tests if the the connection gets reset, the messages will still be
- * received.
- *
- * @throws Exception
- */
- public void testReceiveTwoThenCloseConnection() throws Exception {
- Message[] outbound = new Message[] {session.createTextMessage("First Message"), session.createTextMessage("Second Message")};
-
- // lets consume any outstanding messages from previous test runs
- beginTx();
- while (consumer.receive(1000) != null) {
- }
- commitTx();
-
- beginTx();
- producer.send(outbound[0]);
- producer.send(outbound[1]);
- commitTx();
-
- LOG.info("Sent 0: " + outbound[0]);
- LOG.info("Sent 1: " + outbound[1]);
-
- ArrayList<Message> messages = new ArrayList<Message>();
- beginTx();
- Message message = consumer.receive(2000);
- ((TextMessage)message).getText();
- assertEquals(outbound[0], message);
-
- message = consumer.receive(2000);
- ((TextMessage)message).getText();
- assertNotNull(message);
- assertEquals(outbound[1], message);
-
- // Close and reopen connection.
- reconnect();
-
- // Consume again.. the previous message should
- // get redelivered.
- beginTx();
- message = consumer.receive(2000);
- assertNotNull("Should have re-received the first message again!", message);
- messages.add(message);
- assertEquals(outbound[0], message);
-
- message = consumer.receive(5000);
- assertNotNull("Should have re-received the second message again!", message);
- messages.add(message);
- assertEquals(outbound[1], message);
- commitTx();
-
- Message inbound[] = new Message[messages.size()];
- messages.toArray(inbound);
-
- assertTextMessagesEqual("Rollback did not work", outbound, inbound);
- }
-
- /**
- * Tests sending and receiving messages with two sessions(one for producing
- * and another for consuming).
- *
- * @throws Exception
- */
- public void testSendReceiveInSeperateSessionTest() throws Exception {
- session.close();
- int batchCount = 10;
-
- for (int i = 0; i < batchCount; i++) {
- String messageText = String.format("Test message %s of %s", i, batchCount);
- // Session that sends messages
- {
- Session session = resourceProvider.createSession(connection);
- this.session = session;
- MessageProducer producer = resourceProvider.createProducer(session, destination);
- // consumer = resourceProvider.createConsumer(session,
- // destination);
- beginTx();
- LOG.debug("Sending message : " + messageText);
- producer.send(session.createTextMessage(messageText));
- commitTx();
- session.close();
- }
-
- // Session that consumes messages
- {
- Session session = resourceProvider.createSession(connection);
- this.session = session;
- MessageConsumer consumer = resourceProvider.createConsumer(session, destination);
-
- beginTx();
- TextMessage message = (TextMessage)consumer.receive(1000 * 5);
- assertNotNull("Received only " + i + " messages in batch ", message);
- LOG.debug("Received message : " + message.getText());
- assertEquals(messageText, message.getText());
-
- commitTx();
- session.close();
- }
- }
- }
-
- /**
- * Tests the queue browser. Browses the messages then the consumer tries to
- * receive them. The messages should still be in the queue even when it was
- * browsed.
- *
- * @throws Exception
- */
- public void testReceiveBrowseReceive() throws Exception {
- if (session instanceof StompJmsSession) {
- // browsing not supported by stomp
- return;
- }
- Message[] outbound = new Message[] {session.createTextMessage("First Message"), session.createTextMessage("Second Message"), session.createTextMessage("Third Message")};
-
- // lets consume any outstanding messages from previous test runs
- beginTx();
- while (consumer.receive(1000) != null) {
- }
- commitTx();
-
- beginTx();
- producer.send(outbound[0]);
- producer.send(outbound[1]);
- producer.send(outbound[2]);
- commitTx();
-
- // Get the first.
- beginTx();
- assertEquals(outbound[0], consumer.receive(1000));
- consumer.close();
- commitTx();
-
- beginTx();
- QueueBrowser browser = session.createBrowser((Queue)destination);
- Enumeration enumeration = browser.getEnumeration();
-
- // browse the second
- assertTrue("should have received the second message", enumeration.hasMoreElements());
- assertEquals(outbound[1], (Message)enumeration.nextElement());
-
- // browse the third.
- assertTrue("Should have received the third message", enumeration.hasMoreElements());
- assertEquals(outbound[2], (Message)enumeration.nextElement());
-
- // There should be no more.
- boolean tooMany = false;
- while (enumeration.hasMoreElements()) {
- LOG.info("Got extra message: " + ((TextMessage)enumeration.nextElement()).getText());
- tooMany = true;
- }
- assertFalse(tooMany);
- browser.close();
-
- // Re-open the consumer.
- consumer = resourceProvider.createConsumer(session, destination);
- // Receive the second.
- assertEquals(outbound[1], consumer.receive(1000));
- // Receive the third.
- assertEquals(outbound[2], consumer.receive(1000));
- consumer.close();
-
- commitTx();
- }
-
-}
diff --git a/apollo-itests/src/test/scala/org/apache/activemq/apollo/JmsTestSupport.java b/apollo-itests/src/test/scala/org/apache/activemq/apollo/JmsTestSupport.java
deleted file mode 100644
index be4c9f8..0000000
--- a/apollo-itests/src/test/scala/org/apache/activemq/apollo/JmsTestSupport.java
+++ /dev/null
@@ -1,171 +0,0 @@
-/**
- * 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;
-
-import javax.jms.*;
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import java.util.concurrent.atomic.AtomicLong;
-
-/**
- * Test cases used to test the JMS message consumer.
- *
- *
- */
-public class JmsTestSupport extends TestSupport {
-
- static final private AtomicLong TEST_COUNTER = new AtomicLong();
- public String userName;
- public String password;
- public String messageTextPrefix = "";
-
- protected ConnectionFactory factory;
- protected Connection connection;
-
- protected List<Connection> connections = Collections.synchronizedList(new ArrayList<Connection>());
-
- enum DestinationType {
- QUEUE_TYPE,
- TOPIC_TYPE,
- TEMP_QUEUE_TYPE,
- TEMP_TOPIC_TYPE
- }
-
- // /////////////////////////////////////////////////////////////////
- //
- // Test support methods.
- //
- // /////////////////////////////////////////////////////////////////
- protected Destination createDestination(Session session, DestinationType type) throws JMSException {
- String testMethod = getName();
- if( testMethod.indexOf(" ")>0 ) {
- testMethod = testMethod.substring(0, testMethod.indexOf(" "));
- }
- String name = "TEST." + getClass().getName() + "." +testMethod+"."+TEST_COUNTER.getAndIncrement();
- switch (type) {
- case QUEUE_TYPE:
- return session.createQueue(name);
- case TOPIC_TYPE:
- return session.createTopic(name);
- case TEMP_QUEUE_TYPE:
- return session.createTemporaryQueue();
- case TEMP_TOPIC_TYPE:
- return session.createTemporaryTopic();
- default:
- throw new IllegalArgumentException("type: " + type);
- }
- }
-
- protected void sendMessages(Destination destination, int count) throws Exception {
- ConnectionFactory factory = createConnectionFactory();
- Connection connection = factory.createConnection();
- connection.start();
- sendMessages(connection, destination, count);
- connection.close();
- }
-
- protected void sendMessages(Connection connection, Destination destination, int count) throws JMSException {
- Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
- sendMessages(session, destination, count);
- session.close();
- }
-
- protected void sendMessages(Session session, Destination destination, int count) throws JMSException {
- MessageProducer producer = session.createProducer(destination);
- for (int i = 0; i < count; i++) {
- producer.send(session.createTextMessage(messageTextPrefix + i));
- }
- producer.close();
- }
-
- public ConnectionFactory createConnectionFactory() throws Exception {
- return broker.getConnectionFactory();
- }
-
- protected void setUp() throws Exception {
- super.setUp();
-
- if (System.getProperty("basedir") == null) {
- File file = new File(".");
- System.setProperty("basedir", file.getAbsolutePath());
- }
-
- broker.start();
- factory = createConnectionFactory();
- connection = factory.createConnection(userName, password);
- connections.add(connection);
- }
-
- protected void tearDown() throws Exception {
- for (Iterator iter = connections.iterator(); iter.hasNext();) {
- Connection conn = (Connection)iter.next();
- try {
- conn.close();
- } catch (Throwable e) {
- }
- iter.remove();
- }
- broker.stop();
- super.tearDown();
- }
-
- protected void safeClose(Connection c) {
- try {
- c.close();
- } catch (Throwable e) {
- }
- }
-
- protected void safeClose(Session s) {
- try {
- s.close();
- } catch (Throwable e) {
- }
- }
-
- protected void safeClose(MessageConsumer c) {
- try {
- c.close();
- } catch (Throwable e) {
- }
- }
-
- protected void safeClose(MessageProducer p) {
- try {
- p.close();
- } catch (Throwable e) {
- }
- }
-
- protected void profilerPause(String prompt) throws IOException {
- if (System.getProperty("profiler") != null) {
- pause(prompt);
- }
- }
-
- protected void pause(String prompt) throws IOException {
- System.out.println();
- System.out.println(prompt + "> Press enter to continue: ");
- while (System.in.read() != '\n') {
- }
- }
-
-}
diff --git a/apollo-itests/src/test/scala/org/apache/activemq/apollo/JmsTopicTransactionTest.java b/apollo-itests/src/test/scala/org/apache/activemq/apollo/JmsTopicTransactionTest.java
deleted file mode 100755
index 226d28d..0000000
--- a/apollo-itests/src/test/scala/org/apache/activemq/apollo/JmsTopicTransactionTest.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/**
- * 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;
-
-import junit.framework.Test;
-import org.apache.activemq.apollo.test.JmsResourceProvider;
-
-
-/**
- *
- */
-public class JmsTopicTransactionTest extends JmsTransactionTestSupport {
-
- public static Test suite() {
- return suite(JmsTopicTransactionTest.class);
- }
-
- /**
- * @see org.apache.activemq.apollo.JmsTransactionTestSupport#getJmsResourceProvider()
- */
- protected JmsResourceProvider getJmsResourceProvider() {
- JmsResourceProvider p = new JmsResourceProvider(this);
- p.setTopic(true);
- p.setDurableName("testsub");
- p.setClientID("testclient");
- return p;
- }
-
- @Override
- public void runBare() throws Throwable {
- if (broker instanceof StompBroker) {
- // TODO - seem to have a broker hang on some of these tests when STOMP is used
- return;
- }
- super.runBare(); //To change body of overridden methods use File | Settings | File Templates.
- }
-
-
-}
diff --git a/apollo-itests/src/test/scala/org/apache/activemq/apollo/JmsTransactionTestSupport.java b/apollo-itests/src/test/scala/org/apache/activemq/apollo/JmsTransactionTestSupport.java
deleted file mode 100755
index 77152a1..0000000
--- a/apollo-itests/src/test/scala/org/apache/activemq/apollo/JmsTransactionTestSupport.java
+++ /dev/null
@@ -1,724 +0,0 @@
-/**
- * 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;
-
-import org.apache.activemq.apollo.test.JmsResourceProvider;
-import org.fusesource.stomp.jms.StompJmsSession;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.jms.*;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- *
- */
-public abstract class JmsTransactionTestSupport extends JmsTestSupport implements MessageListener {
-
- private static final Logger LOG = LoggerFactory.getLogger(JmsTransactionTestSupport.class);
- private static final int MESSAGE_COUNT = 5;
- private static final String MESSAGE_TEXT = "message";
-
- protected Session session;
- protected MessageConsumer consumer;
- protected MessageProducer producer;
- protected JmsResourceProvider resourceProvider;
- protected Destination destination;
- protected int batchCount = 10;
- protected int batchSize = 20;
-
- // for message listener test
- private List<Message> unackMessages = new ArrayList<Message>(MESSAGE_COUNT);
- private List<Message> ackMessages = new ArrayList<Message>(MESSAGE_COUNT);
- private boolean resendPhase;
-
- public JmsTransactionTestSupport() {
- super();
- }
-
- public void initCombos() {
- super.initCombos();
- }
-
- /*
- public JmsTransactionTestSupport(String name) {
- super(name);
- }
- */
-
- /*
- * (non-Javadoc)
- *
- * @see junit.framework.TestCase#setUp()
- */
- protected void setUp() throws Exception {
- broker.start();
- //broker.waitUntilStarted();
-
- resourceProvider = getJmsResourceProvider();
- topic = resourceProvider.isTopic();
- // We will be using transacted sessions.
- setSessionTransacted();
- connectionFactory = newConnectionFactory();
- reconnect();
- }
-
- protected void setSessionTransacted() {
- resourceProvider.setTransacted(true);
- }
-
- protected ConnectionFactory newConnectionFactory() throws Exception {
- return resourceProvider.createConnectionFactory();
- }
-
- protected void beginTx() throws Exception {
- //no-op for local tx
- }
-
- protected void commitTx() throws Exception {
- session.commit();
- }
-
- protected void rollbackTx() throws Exception {
- session.rollback();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see junit.framework.TestCase#tearDown()
- */
- protected void tearDown() throws Exception {
- LOG.info("Closing down connection");
-
- session.close();
- session = null;
- connection.stop();
- connection = null;
-
- broker.stop();
- broker = null;
-
- LOG.info("Connection closed.");
- }
-
- protected abstract JmsResourceProvider getJmsResourceProvider();
-
- protected Connection connection() throws Exception {
- return getJmsResourceProvider().createConnection(getConnectionFactory());
- }
-
- protected Session session(Connection connection) throws Exception {
- return getJmsResourceProvider().createSession(connection);
- }
-
- /**
- * Sends a batch of messages and validates that the messages are received.
- *
- * @throws Exception
- */
-
- public void testSendReceiveTransactedBatches() throws Exception {
-
- String messageText = "Batch Message %s of %s in batch %s of %s";
- for (int j = 0; j < batchCount; j++) {
- LOG.debug("Producing batch " + j + " of " + batchSize + " messages");
-
- beginTx();
- for (int i = 0; i < batchSize; i++) {
- producer.send(session.createTextMessage(String.format(messageText, i + 1, batchSize, j + 1, batchCount)));
- }
- messageSent();
- commitTx();
- LOG.debug("Consuming batch " + j + " of " + batchSize + " messages");
-
- beginTx();
- for (int i = 0; i < batchSize; i++) {
- TextMessage message = (TextMessage)consumer.receive(1000 * 5);
- LOG.debug("Received message : " + (message == null ? null : message.getText()));
- assertNotNull("Received only " + i + " messages in batch " + j, message);
- assertEquals(String.format(messageText, i + 1, batchSize, j + 1, batchCount), message.getText());
- }
-
- commitTx();
- }
- }
-
- protected void messageSent() throws Exception {
- }
-
- /**
- * Sends a batch of messages and validates that the rollbacked message was
- * not consumed.
- *
- * @throws Exception
- */
- public void testSendRollback() throws Exception {
- Message[] outbound = new Message[] {session.createTextMessage("First Message"), session.createTextMessage("Second Message")};
-
- // sends a message
- beginTx();
- producer.send(outbound[0]);
- commitTx();
-
- // sends a message that gets rollbacked
- beginTx();
- producer.send(session.createTextMessage("I'm going to get rolled back."));
- rollbackTx();
-
- // sends a message
- beginTx();
- producer.send(outbound[1]);
- commitTx();
-
- // receives the first message
- beginTx();
- ArrayList<Message> messages = new ArrayList<Message>();
- LOG.info("About to consume message 1");
- Message message = consumer.receive(1000);
- messages.add(message);
- LOG.info("Received: " + message);
-
- // receives the second message
- LOG.info("About to consume message 2");
- message = consumer.receive(4000);
- messages.add(message);
- LOG.info("Received: " + message);
-
- // validates that the rollbacked was not consumed
- commitTx();
- Message inbound[] = messages.toArray(new Message[messages.size()]);
- assertTextMessagesEqual("Rollback did not work.", outbound, inbound);
- }
-
- /**
- * spec section 3.6 acking a message with automation acks has no effect.
- * @throws Exception
- */
- public void testAckMessageInTx() throws Exception {
- Message[] outbound = new Message[] {session.createTextMessage("First Message")};
-
- // sends a message
- beginTx();
- producer.send(outbound[0]);
- outbound[0].acknowledge();
- commitTx();
- outbound[0].acknowledge();
-
- // receives the first message
- beginTx();
- ArrayList<Message> messages = new ArrayList<Message>();
- LOG.info("About to consume message 1");
- Message message = consumer.receive(1000);
- messages.add(message);
- LOG.info("Received: " + message);
-
- // validates that the rollbacked was not consumed
- commitTx();
- Message inbound[] = new Message[messages.size()];
- messages.toArray(inbound);
- assertTextMessagesEqual("Message not delivered.", outbound, inbound);
- }
-
- /**
- * Sends a batch of messages and validates that the message sent before
- * session close is not consumed.
- *
- * This test only works with local transactions, not xa.
- * @throws Exception
- */
- public void testSendSessionClose() throws Exception {
- Message[] outbound = new Message[] {session.createTextMessage("First Message"), session.createTextMessage("Second Message")};
-
- // sends a message
- beginTx();
- producer.send(outbound[0]);
- commitTx();
-
- // sends a message that gets rollbacked
- beginTx();
- producer.send(session.createTextMessage("I'm going to get rolled back."));
- consumer.close();
-
- reconnectSession();
-
- // sends a message
- producer.send(outbound[1]);
- commitTx();
-
- // receives the first message
- ArrayList<Message> messages = new ArrayList<Message>();
- LOG.info("About to consume message 1");
- beginTx();
- Message message = consumer.receive(1000);
- messages.add(message);
- LOG.info("Received: " + message);
-
- // receives the second message
- LOG.info("About to consume message 2");
- message = consumer.receive(4000);
- messages.add(message);
- LOG.info("Received: " + message);
-
- // validates that the rollbacked was not consumed
- commitTx();
- Message inbound[] = new Message[messages.size()];
- messages.toArray(inbound);
- assertTextMessagesEqual("Rollback did not work.", outbound, inbound);
- }
-
- /**
- * Sends a batch of messages and validates that the message sent before
- * session close is not consumed.
- *
- * @throws Exception
- */
- public void testSendSessionAndConnectionClose() throws Exception {
- Message[] outbound = new Message[] {session.createTextMessage("First Message"), session.createTextMessage("Second Message")};
-
- // sends a message
- beginTx();
- producer.send(outbound[0]);
- commitTx();
-
- // sends a message that gets rollbacked
- beginTx();
- producer.send(session.createTextMessage("I'm going to get rolled back."));
- consumer.close();
- session.close();
-
- reconnect();
-
- // sends a message
- beginTx();
- producer.send(outbound[1]);
- commitTx();
-
- // receives the first message
- ArrayList<Message> messages = new ArrayList<Message>();
- LOG.info("About to consume message 1");
- beginTx();
- Message message = consumer.receive(1000);
- messages.add(message);
- LOG.info("Received: " + message);
-
- // receives the second message
- LOG.info("About to consume message 2");
- message = consumer.receive(4000);
- messages.add(message);
- LOG.info("Received: " + message);
-
- // validates that the rollbacked was not consumed
- commitTx();
- Message inbound[] = new Message[messages.size()];
- messages.toArray(inbound);
- assertTextMessagesEqual("Rollback did not work.", outbound, inbound);
- }
-
- /**
- * Sends a batch of messages and validates that the rollbacked message was
- * redelivered.
- *
- * @throws Exception
- */
- public void testReceiveRollback() throws Exception {
- if (session instanceof StompJmsSession) {
- // TODO - rollback in stompjms doesn't work the same way
- return;
- }
- Message[] outbound = new Message[] {session.createTextMessage("First Message"), session.createTextMessage("Second Message")};
-
- // lets consume any outstanding messages from prev test runs
- beginTx();
- while (consumer.receive(1000) != null) {
- }
- commitTx();
-
- // sent both messages
- beginTx();
- producer.send(outbound[0]);
- producer.send(outbound[1]);
- commitTx();
-
- LOG.info("Sent 0: " + outbound[0]);
- LOG.info("Sent 1: " + outbound[1]);
-
- ArrayList<Message> messages = new ArrayList<Message>();
- beginTx();
- Message message = consumer.receive(1000);
- messages.add(message);
- assertEquals(outbound[0], message);
- commitTx();
-
- // rollback so we can get that last message again.
- beginTx();
- message = consumer.receive(1000);
- assertNotNull(message);
- assertEquals(outbound[1], message);
- rollbackTx();
-
- // Consume again.. the prev message should
- // get redelivered.
- beginTx();
- message = consumer.receive(5000);
- assertNotNull("Should have re-received the message again!", message);
- messages.add(message);
- commitTx();
-
- Message inbound[] = new Message[messages.size()];
- messages.toArray(inbound);
- assertTextMessagesEqual("Rollback did not work", outbound, inbound);
- }
-
- /**
- * Sends a batch of messages and validates that the rollbacked message was
- * redelivered.
- *
- * @throws Exception
- */
- public void testReceiveTwoThenRollback() throws Exception {
- if (session instanceof StompJmsSession) {
- // TODO - rollback in stompjms doesn't work the same way
- return;
- }
- Message[] outbound = new Message[] {session.createTextMessage("First Message"), session.createTextMessage("Second Message")};
-
- // lets consume any outstanding messages from prev test runs
- beginTx();
- while (consumer.receive(1000) != null) {
- }
- commitTx();
-
- //
- beginTx();
- producer.send(outbound[0]);
- producer.send(outbound[1]);
- commitTx();
-
- LOG.info("Sent 0: " + outbound[0]);
- LOG.info("Sent 1: " + outbound[1]);
-
- ArrayList<Message> messages = new ArrayList<Message>();
- beginTx();
- Message message = consumer.receive(1000);
- assertEquals(outbound[0], message);
-
- message = consumer.receive(1000);
- assertNotNull(message);
- assertEquals(outbound[1], message);
- rollbackTx();
-
- // Consume again.. the prev message should
- // get redelivered.
- beginTx();
- message = consumer.receive(5000);
- assertNotNull("Should have re-received the first message again!", message);
- messages.add(message);
- assertEquals(outbound[0], message);
- message = consumer.receive(5000);
- assertNotNull("Should have re-received the second message again!", message);
- messages.add(message);
- assertEquals(outbound[1], message);
-
- assertNull(consumer.receiveNoWait());
- commitTx();
-
- Message inbound[] = new Message[messages.size()];
- messages.toArray(inbound);
- assertTextMessagesEqual("Rollback did not work", outbound, inbound);
- }
-
- /**
- * Sends a batch of messages and validates that the rollbacked message was
- * not consumed.
- *
- * @throws Exception
- */
- /*
- public void testSendReceiveWithPrefetchOne() throws Exception {
- setPrefetchToOne();
- Message[] outbound = new Message[] {session.createTextMessage("First Message"), session.createTextMessage("Second Message"), session.createTextMessage("Third Message"),
- session.createTextMessage("Fourth Message")};
-
- beginTx();
- for (int i = 0; i < outbound.length; i++) {
- // sends a message
- producer.send(outbound[i]);
- }
- commitTx();
-
- // receives the first message
- beginTx();
- for (int i = 0; i < outbound.length; i++) {
- LOG.info("About to consume message 1");
- Message message = consumer.receive(1000);
- assertNotNull(message);
- LOG.info("Received: " + message);
- }
-
- // validates that the rollbacked was not consumed
- commitTx();
- }
- */
-
- /**
- * Perform the test that validates if the rollbacked message was redelivered
- * multiple times.
- *
- * @throws Exception
- */
- public void testReceiveTwoThenRollbackManyTimes() throws Exception {
- if (session instanceof StompJmsSession) {
- // TODO - rollback in stompjms doesn't work the same way
- return;
- }
- for (int i = 0; i < 5; i++) {
- testReceiveTwoThenRollback();
- }
- }
-
- /**
- * Sends a batch of messages and validates that the rollbacked message was
- * not consumed. This test differs by setting the message prefetch to one.
- *
- * @throws Exception
- */
- /*
- public void testSendRollbackWithPrefetchOfOne() throws Exception {
- setPrefetchToOne();
- testSendRollback();
- }
- */
-
- /**
- * Sends a batch of messages and and validates that the rollbacked message
- * was redelivered. This test differs by setting the message prefetch to
- * one.
- *
- * @throws Exception
- */
- /*
- public void testReceiveRollbackWithPrefetchOfOne() throws Exception {
- setPrefetchToOne();
- testReceiveRollback();
- }
- */
-
- /**
- * Tests if the messages can still be received if the consumer is closed
- * (session is not closed).
- *
- * @throws Exception see http://jira.codehaus.org/browse/AMQ-143
- */
- public void testCloseConsumerBeforeCommit() throws Exception {
- TextMessage[] outbound = new TextMessage[] {session.createTextMessage("First Message"), session.createTextMessage("Second Message")};
-
- // lets consume any outstanding messages from prev test runs
- beginTx();
- while (consumer.receiveNoWait() != null) {
- }
-
- commitTx();
-
- // sends the messages
- beginTx();
- producer.send(outbound[0]);
- producer.send(outbound[1]);
- commitTx();
- LOG.info("Sent 0: " + outbound[0]);
- LOG.info("Sent 1: " + outbound[1]);
-
- beginTx();
- TextMessage message = (TextMessage)consumer.receive(1000);
- assertNotNull(message);
- assertEquals(outbound[0].getText(), message.getText());
- // Close the consumer before the commit. This should not cause the
- // received message
- // to rollback.
- consumer.close();
- commitTx();
-
- // Create a new consumer
- consumer = resourceProvider.createConsumer(session, destination);
- LOG.info("Created consumer: " + consumer);
-
- beginTx();
- message = (TextMessage)consumer.receive(1000);
- assertNotNull(message);
- assertEquals(outbound[1].getText(), message.getText());
- commitTx();
- }
-
- public void testChangeMutableObjectInObjectMessageThenRollback() throws Exception {
- ArrayList<String> list = new ArrayList<String>();
- list.add("First");
- Message outbound = session.createObjectMessage(list);
- outbound.setStringProperty("foo", "abc");
-
- beginTx();
- producer.send(outbound);
- commitTx();
-
- LOG.info("About to consume message 1");
- beginTx();
- Message message = consumer.receive(5000);
-
- List<String> body = assertReceivedObjectMessageWithListBody(message);
-
- // now lets try mutate it
- try {
- message.setStringProperty("foo", "def");
- fail("Cannot change properties of the object!");
- } catch (JMSException e) {
- LOG.info("Caught expected exception: " + e, e);
- }
- body.clear();
- body.add("This should never be seen!");
- rollbackTx();
-
- beginTx();
- message = consumer.receive(5000);
- List<String> secondBody = assertReceivedObjectMessageWithListBody(message);
- assertNotSame("Second call should return a different body", secondBody, body);
- commitTx();
- }
-
- @SuppressWarnings("unchecked")
- protected List<String> assertReceivedObjectMessageWithListBody(Message message) throws JMSException {
- assertNotNull("Should have received a message!", message);
- assertEquals("foo header", "abc", message.getStringProperty("foo"));
-
- assertTrue("Should be an object message but was: " + message, message instanceof ObjectMessage);
- ObjectMessage objectMessage = (ObjectMessage)message;
- List<String> body = (List<String>)objectMessage.getObject();
- LOG.info("Received body: " + body);
-
- assertEquals("Size of list should be 1", 1, body.size());
- assertEquals("element 0 of list", "First", body.get(0));
- return body;
- }
-
- /**
- * Recreates the connection.
- *
- * @throws javax.jms.JMSException
- */
- protected void reconnect() throws Exception {
-
- if (connection != null) {
- // Close the prev connection.
- connection.close();
- }
- session = null;
- connection = resourceProvider.createConnection(connectionFactory);
- reconnectSession();
- connection.start();
- }
-
- /**
- * Recreates the connection.
- *
- * @throws javax.jms.JMSException
- */
- protected void reconnectSession() throws JMSException {
- if (session != null) {
- session.close();
- }
-
- session = resourceProvider.createSession(connection);
- destination = resourceProvider.createDestination(session, getSubject());
- producer = resourceProvider.createProducer(session, destination);
- consumer = resourceProvider.createConsumer(session, destination);
- }
-
- /**
- * Sets the prefeftch policy to one.
- */
- /*
- protected void setPrefetchToOne() {
- ActiveMQPrefetchPolicy prefetchPolicy = getPrefetchPolicy();
- prefetchPolicy.setQueuePrefetch(1);
- prefetchPolicy.setTopicPrefetch(1);
- prefetchPolicy.setDurableTopicPrefetch(1);
- prefetchPolicy.setOptimizeDurableTopicPrefetch(1);
- }
-
- protected ActiveMQPrefetchPolicy getPrefetchPolicy() {
- return ((ActiveMQConnection)connection).getPrefetchPolicy();
- }
- */
-
- //This test won't work with xa tx so no beginTx() has been added.
- public void testMessageListener() throws Exception {
- // send messages
- for (int i = 0; i < MESSAGE_COUNT; i++) {
- producer.send(session.createTextMessage(MESSAGE_TEXT + i));
- }
- commitTx();
- consumer.setMessageListener(this);
- // wait receive
- waitReceiveUnack();
- assertEquals(unackMessages.size(), MESSAGE_COUNT);
- // resend phase
- waitReceiveAck();
- assertEquals(ackMessages.size(), MESSAGE_COUNT);
- // should no longer re-receive
- consumer.setMessageListener(null);
- assertNull(consumer.receive(500));
- reconnect();
- }
-
- public void onMessage(Message message) {
- if (!resendPhase) {
- unackMessages.add(message);
- if (unackMessages.size() == MESSAGE_COUNT) {
- try {
- rollbackTx();
- resendPhase = true;
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- } else {
- ackMessages.add(message);
- if (ackMessages.size() == MESSAGE_COUNT) {
- try {
- commitTx();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
- }
-
- private void waitReceiveUnack() throws Exception {
- for (int i = 0; i < 100 && !resendPhase; i++) {
- Thread.sleep(100);
- }
- assertTrue(resendPhase);
- }
-
- private void waitReceiveAck() throws Exception {
- for (int i = 0; i < 100 && ackMessages.size() < MESSAGE_COUNT; i++) {
- Thread.sleep(100);
- }
- assertFalse(ackMessages.size() < MESSAGE_COUNT);
- }
-}
diff --git a/apollo-itests/src/test/scala/org/apache/activemq/apollo/TestSupport.java b/apollo-itests/src/test/scala/org/apache/activemq/apollo/TestSupport.java
deleted file mode 100644
index fb36cc0..0000000
--- a/apollo-itests/src/test/scala/org/apache/activemq/apollo/TestSupport.java
+++ /dev/null
@@ -1,237 +0,0 @@
-/**
- * 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;
-
-import java.io.File;
-import javax.jms.*;
-
-/**
- * Useful base class for unit test cases
- *
- *
- */
-public abstract class TestSupport extends CombinationTestSupport {
-
- protected BrokerService broker;
- protected ConnectionFactory connectionFactory;
- protected boolean topic = true;
-
- public void initCombos() {
- Object[] brokers;
- // TODO - until openwire is built normally do a quick/dirty check
- boolean openwireEnabled = false;
- try {
- Class.forName("org.apache.activemq.apollo.openwire.OpenwireProtocolHandler", false, TestSupport.class.getClassLoader());
- openwireEnabled = true;
- } catch (ClassNotFoundException e) {
-
- }
-
- if (openwireEnabled) {
- brokers = new Object[] { new StompBroker(), new OpenwireBroker() };
- } else {
- brokers = new Object[] { new StompBroker() };
- }
- addCombinationValues("broker", brokers);
- }
-
- /*
- public PersistenceAdapterChoice defaultPersistenceAdapter = PersistenceAdapterChoice.KahaDB;
- */
-
- /*
- protected Message createMessage() {
- return new ActiveMQMessage();
- }
- */
-
- /*
- protected Destination createDestination(String subject) {
- if (topic) {
- return new ActiveMQTopic(subject);
- } else {
- return new ActiveMQQueue(subject);
- }
- }
- */
-
- public void setBroker(BrokerService broker) {
- this.broker = broker;
- }
-
- protected Destination createDestination(String subject) {
- return null;
- }
-
- protected Destination createDestination() {
- return createDestination(getDestinationString());
- }
-
- /**
- * Returns the name of the destination used in this test case
- */
- protected String getDestinationString() {
- return getClass().getName() + "." + getName(true);
- }
-
- /**
- * @param messsage
- * @param firstSet
- * @param secondSet
- */
- protected void assertTextMessagesEqual(String messsage, Message[] firstSet, Message[] secondSet)
- throws JMSException {
- assertEquals("Message count does not match: " + messsage, firstSet.length, secondSet.length);
- for (int i = 0; i < secondSet.length; i++) {
- TextMessage m1 = (TextMessage)firstSet[i];
- TextMessage m2 = (TextMessage)secondSet[i];
- if (m1 != null) {
- m1.getText();
- }
- if (m2 != null) {
- m2.getText();
- }
- assertFalse("Message " + (i + 1) + " did not match : " + messsage + ": expected {" + m1
- + "}, but was {" + m2 + "}", m1 == null ^ m2 == null);
- assertEquals("Message " + (i + 1) + " did not match: " + messsage + ": expected {" + m1
- + "}, but was {" + m2 + "}", m1.getText(), m2.getText());
- }
- }
-
- public ConnectionFactory createConnectionFactory() throws Exception {
- return broker.getConnectionFactory();
- }
-
- /**
- * Factory method to create a new connection
- */
- public Connection createConnection() throws Exception {
- return getConnectionFactory().createConnection();
- }
-
- public ConnectionFactory getConnectionFactory() throws Exception {
- if (connectionFactory == null) {
- connectionFactory = createConnectionFactory();
- assertTrue("Should have created a connection factory!", connectionFactory != null);
- }
- return connectionFactory;
- }
-
- protected String getConsumerSubject() {
- return getSubject();
- }
-
- protected String getProducerSubject() {
- return getSubject();
- }
-
- protected String getSubject() {
- return getName().replaceAll("[{}= @\\.]+", "_");
- }
-
- public static void recursiveDelete(File f) {
- if (f.isDirectory()) {
- File[] files = f.listFiles();
- for (int i = 0; i < files.length; i++) {
- recursiveDelete(files[i]);
- }
- }
- f.delete();
- }
-
- public static void removeMessageStore() {
- if (System.getProperty("activemq.store.dir") != null) {
- recursiveDelete(new File(System.getProperty("activemq.store.dir")));
- }
- if (System.getProperty("derby.system.home") != null) {
- recursiveDelete(new File(System.getProperty("derby.system.home")));
- }
- }
-
- /*
- public static DestinationStatistics getDestinationStatistics(BrokerService broker, ActiveMQDestination destination) {
- DestinationStatistics result = null;
- org.apache.activemq.broker.region.Destination dest = getDestination(broker, destination);
- if (dest != null) {
- result = dest.getDestinationStatistics();
- }
- return result;
- }
- */
-
- /*
- public static org.apache.activemq.broker.region.Destination getDestination(BrokerService target, ActiveMQDestination destination) {
- org.apache.activemq.broker.region.Destination result = null;
- for (org.apache.activemq.broker.region.Destination dest : getDestinationMap(target, destination).values()) {
- if (dest.getName().equals(destination.getPhysicalName())) {
- result = dest;
- break;
- }
- }
- return result;
- }
- */
-
- /*
- private static Map<ActiveMQDestination, org.apache.activemq.broker.region.Destination> getDestinationMap(BrokerService target,
- ActiveMQDestination destination) {
- RegionBroker regionBroker = (RegionBroker) target.getRegionBroker();
- return destination.isQueue() ?
- regionBroker.getQueueRegion().getDestinationMap() :
- regionBroker.getTopicRegion().getDestinationMap();
- }
- */
-
-
- //public static enum PersistenceAdapterChoice {KahaDB, AMQ, JDBC, MEM };
-
- /*
- public PersistenceAdapter setDefaultPersistenceAdapter(BrokerService broker) throws IOException {
- return setPersistenceAdapter(broker, defaultPersistenceAdapter);
- }
- */
-
- /*
- public PersistenceAdapter setPersistenceAdapter(BrokerService broker, PersistenceAdapterChoice choice) throws IOException {
- PersistenceAdapter adapter = null;
- switch (choice) {
- case AMQ:
- adapter = new AMQPersistenceAdapter();
- break;
- case JDBC:
- adapter = new JDBCPersistenceAdapter();
- break;
- case KahaDB:
- adapter = new KahaDBPersistenceAdapter();
- break;
- case MEM:
- adapter = new MemoryPersistenceAdapter();
- break;
- }
- broker.setPersistenceAdapter(adapter);
- return adapter;
- }
- */
-
- /**
- * Test if base directory contains spaces
- */
- protected void assertBaseDirectoryContainsSpaces() {
- assertFalse("Base directory cannot contain spaces.", new File(System.getProperty("basedir", ".")).getAbsoluteFile().toString().contains(" "));
- }
-
-}
diff --git a/apollo-itests/src/test/scala/org/apache/activemq/apollo/test/JmsResourceProvider.java b/apollo-itests/src/test/scala/org/apache/activemq/apollo/test/JmsResourceProvider.java
deleted file mode 100755
index 935aa95..0000000
--- a/apollo-itests/src/test/scala/org/apache/activemq/apollo/test/JmsResourceProvider.java
+++ /dev/null
@@ -1,236 +0,0 @@
-/**
- * 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.test;
-
-import org.apache.activemq.apollo.TestSupport;
-
-import javax.jms.*;
-import java.util.regex.Pattern;
-
-/**
- *
- */
-public class JmsResourceProvider {
-
- private boolean transacted;
- private int ackMode = Session.AUTO_ACKNOWLEDGE;
- private boolean isTopic;
- private int deliveryMode = DeliveryMode.PERSISTENT;
- private String durableName = "DummyName";
- private String clientID = getClass().getName();
- private TestSupport support;
-
- public JmsResourceProvider(TestSupport support) {
- this.support = support;
- }
-
- /**
- * Creates a connection factory.
- *
- * @see org.apache.activemq.apollo.test.JmsResourceProvider#createConnectionFactory()
- */
- public ConnectionFactory createConnectionFactory() throws Exception {
- return support.createConnectionFactory();
- }
-
- /**
- * Creates a connection.
- *
- * @see org.apache.activemq.apollo.test.JmsResourceProvider#createConnection(javax.jms.ConnectionFactory)
- */
- public Connection createConnection(ConnectionFactory cf) throws JMSException {
- Connection connection = cf.createConnection();
- if (getClientID() != null) {
- connection.setClientID(getClientID());
- }
- return connection;
- }
-
- /**
- * @see org.apache.activemq.apollo.test.JmsResourceProvider#createSession(javax.jms.Connection)
- */
- public Session createSession(Connection conn) throws JMSException {
- return conn.createSession(transacted, ackMode);
- }
-
- /**
- * @see org.apache.activemq.apollo.test.JmsResourceProvider#createConsumer(javax.jms.Session,
- * javax.jms.Destination)
- */
- public MessageConsumer createConsumer(Session session, Destination destination) throws JMSException {
- if (isDurableSubscriber()) {
- return session.createDurableSubscriber((Topic)destination, durableName);
- }
- return session.createConsumer(destination);
- }
-
- /**
- * Creates a connection for a consumer.
- *
- * @param ssp - ServerSessionPool
- * @return ConnectionConsumer
- */
- public ConnectionConsumer createConnectionConsumer(Connection connection, Destination destination, ServerSessionPool ssp) throws JMSException {
- return connection.createConnectionConsumer(destination, null, ssp, 1);
- }
-
- /**
- * Creates a producer.
- *
- * @see org.apache.activemq.apollo.test.JmsResourceProvider#createProducer(javax.jms.Session,
- * javax.jms.Destination)
- */
- public MessageProducer createProducer(Session session, Destination destination) throws JMSException {
- MessageProducer producer = session.createProducer(destination);
- producer.setDeliveryMode(deliveryMode);
- return producer;
- }
-
- /**
- * Creates a destination, which can either a topic or a queue.
- *
- * @see org.apache.activemq.apollo.test.JmsResourceProvider#createDestination(javax.jms.Session,
- * String)
- */
-
- public Destination createDestination(Session session, String name) throws JMSException {
- if (isTopic) {
- return session.createTopic("TOPIC." + name);
- } else {
- return session.createQueue("QUEUE." + name);
- }
- }
-
- /**
- * Returns true if the subscriber is durable.
- *
- * @return isDurableSubscriber
- */
- public boolean isDurableSubscriber() {
- return isTopic && durableName != null;
- }
-
- /**
- * Returns the acknowledgement mode.
- *
- * @return Returns the ackMode.
- */
- public int getAckMode() {
- return ackMode;
- }
-
- /**
- * Sets the acnknowledgement mode.
- *
- * @param ackMode The ackMode to set.
- */
- public void setAckMode(int ackMode) {
- this.ackMode = ackMode;
- }
-
- /**
- * Returns true if the destination is a topic, false if the destination is a
- * queue.
- *
- * @return Returns the isTopic.
- */
- public boolean isTopic() {
- return isTopic;
- }
-
- /**
- * @param isTopic The isTopic to set.
- */
- public void setTopic(boolean isTopic) {
- this.isTopic = isTopic;
- }
-
- /**
- * Return true if the session is transacted.
- *
- * @return Returns the transacted.
- */
- public boolean isTransacted() {
- return transacted;
- }
-
- /**
- * Sets the session to be transacted.
- *
- * @param transacted
- */
- public void setTransacted(boolean transacted) {
- this.transacted = transacted;
- if (transacted) {
- setAckMode(Session.SESSION_TRANSACTED);
- }
- }
-
- /**
- * Returns the delivery mode.
- *
- * @return deliveryMode
- */
- public int getDeliveryMode() {
- return deliveryMode;
- }
-
- /**
- * Sets the delivery mode.
- *
- * @param deliveryMode
- */
- public void setDeliveryMode(int deliveryMode) {
- this.deliveryMode = deliveryMode;
- }
-
- /**
- * Returns the client id.
- *
- * @return clientID
- */
- public String getClientID() {
- return clientID;
- }
-
- /**
- * Sets the client id.
- *
- * @param clientID
- */
- public void setClientID(String clientID) {
- this.clientID = clientID;
- }
-
- /**
- * Returns the durable name of the provider.
- *
- * @return durableName
- */
- public String getDurableName() {
- return durableName;
- }
-
- /**
- * Sets the durable name of the provider.
- *
- * @param durableName
- */
- public void setDurableName(String durableName) {
- this.durableName = durableName;
- }
-}
diff --git a/apollo-leveldb/src/main/resources/META-INF/services/org.apache.activemq.apollo/dto-module.index b/apollo-leveldb/src/main/resources/META-INF/services/org.apache.activemq.apollo/dto-module.index
new file mode 100644
index 0000000..17e46fb
--- /dev/null
+++ b/apollo-leveldb/src/main/resources/META-INF/services/org.apache.activemq.apollo/dto-module.index
@@ -0,0 +1,17 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+org.apache.activemq.apollo.broker.store.leveldb.dto.Module
\ No newline at end of file
diff --git a/apollo-leveldb/src/main/resources/META-INF/services/org.apache.activemq.apollo/jaxb-module.index b/apollo-leveldb/src/main/resources/META-INF/services/org.apache.activemq.apollo/jaxb-module.index
deleted file mode 100644
index 2831f42..0000000
--- a/apollo-leveldb/src/main/resources/META-INF/services/org.apache.activemq.apollo/jaxb-module.index
+++ /dev/null
@@ -1,17 +0,0 @@
-## ---------------------------------------------------------------------------
-## 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.
-## ---------------------------------------------------------------------------
-org.apache.activemq.apollo.broker.store.leveldb.ExtensionJaxbModule
\ No newline at end of file
diff --git a/apollo-leveldb/src/main/scala/org/apache/activemq/apollo/broker/store/leveldb/dto/Module.scala b/apollo-leveldb/src/main/scala/org/apache/activemq/apollo/broker/store/leveldb/dto/Module.scala
new file mode 100644
index 0000000..b8110ee
--- /dev/null
+++ b/apollo-leveldb/src/main/scala/org/apache/activemq/apollo/broker/store/leveldb/dto/Module.scala
@@ -0,0 +1,27 @@
+/**
+ * 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.broker.store.leveldb.dto
+import org.apache.activemq.apollo.util.DtoModule
+
+
+/**
+ * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
+ */
+class Module extends DtoModule {
+ def dto_package = "org.apache.activemq.apollo.broker.store.leveldb.dto"
+ def extension_classes = Array(classOf[LevelDBStoreDTO], classOf[LevelDBStoreStatusDTO])
+}
\ No newline at end of file
diff --git a/apollo-leveldb/src/main/scala/org/apache/activemq/apollo/broker/store/leveldb/leveldb/ExtensionJaxbModule.scala b/apollo-leveldb/src/main/scala/org/apache/activemq/apollo/broker/store/leveldb/leveldb/ExtensionJaxbModule.scala
deleted file mode 100644
index 041f128..0000000
--- a/apollo-leveldb/src/main/scala/org/apache/activemq/apollo/broker/store/leveldb/leveldb/ExtensionJaxbModule.scala
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- * 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.broker.store.leveldb
-
-import org.apache.activemq.apollo.util.JaxbModule
-
-
-/**
- * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
- */
-class ExtensionJaxbModule extends JaxbModule {
- def xml_package = "org.apache.activemq.apollo.broker.store.leveldb.dto"
-}
\ No newline at end of file
diff --git a/apollo-leveldb/src/main/scala/org/apache/activemq/apollo/broker/store/leveldb/leveldb/LevelDBClient.scala b/apollo-leveldb/src/main/scala/org/apache/activemq/apollo/broker/store/leveldb/leveldb/LevelDBClient.scala
index 4936d68..22479c2 100755
--- a/apollo-leveldb/src/main/scala/org/apache/activemq/apollo/broker/store/leveldb/leveldb/LevelDBClient.scala
+++ b/apollo-leveldb/src/main/scala/org/apache/activemq/apollo/broker/store/leveldb/leveldb/LevelDBClient.scala
@@ -46,7 +46,7 @@
object LevelDBClient extends Log {
final val STORE_SCHEMA_PREFIX = "leveldb_store:"
- final val STORE_SCHEMA_VERSION = 1
+ final val STORE_SCHEMA_VERSION = 2
final val queue_prefix = 'q'.toByte
final val queue_entry_prefix = 'e'.toByte
diff --git a/apollo-leveldb/src/main/scala/org/apache/activemq/apollo/broker/store/leveldb/leveldb/RecordLog.scala b/apollo-leveldb/src/main/scala/org/apache/activemq/apollo/broker/store/leveldb/leveldb/RecordLog.scala
index f8a227e..fd9dd83 100644
--- a/apollo-leveldb/src/main/scala/org/apache/activemq/apollo/broker/store/leveldb/leveldb/RecordLog.scala
+++ b/apollo-leveldb/src/main/scala/org/apache/activemq/apollo/broker/store/leveldb/leveldb/RecordLog.scala
@@ -199,7 +199,6 @@
override def check_read_flush(end_offset:Long) = {
if( flushed_offset.get() < end_offset ) {
this.synchronized {
- println("read flush")
flush
}
}
diff --git a/apollo-openwire-generator/pom.xml b/apollo-openwire-generator/pom.xml
new file mode 100644
index 0000000..5b237cc
--- /dev/null
+++ b/apollo-openwire-generator/pom.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+ <!--
+ 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.
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>apollo-scala</artifactId>
+ <version>1.0</version>
+ <relativePath>../apollo-scala</relativePath>
+ </parent>
+
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>apollo-openwire-generator</artifactId>
+ <version>1.0</version>
+
+ <name>${project.artifactId}</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-openwire-generator</artifactId>
+ <version>5.5.1</version>
+ </dependency>
+
+ <!-- Scala Support -->
+ <dependency>
+ <groupId>org.scala-lang</groupId>
+ <artifactId>scala-library</artifactId>
+ <scope>compile</scope>
+ <version>${scala-version}</version>
+ </dependency>
+
+ </dependencies>
+
+</project>
diff --git a/apollo-openwire-generator/src/main/scala/org/apache/activemq/apollo/openwire/generator/ApolloMarshallingGenerator.scala b/apollo-openwire-generator/src/main/scala/org/apache/activemq/apollo/openwire/generator/ApolloMarshallingGenerator.scala
new file mode 100644
index 0000000..ade816a
--- /dev/null
+++ b/apollo-openwire-generator/src/main/scala/org/apache/activemq/apollo/openwire/generator/ApolloMarshallingGenerator.scala
@@ -0,0 +1,744 @@
+/**
+ * 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.openwire.generator
+
+import java.io.File
+import java.io.FileWriter
+import java.io.PrintWriter
+import java.util.ArrayList
+import java.util.Collections
+import java.util.Comparator
+import java.util.List
+
+import org.apache.activemq.openwire.tool.MultiSourceGenerator
+import collection.JavaConversions._
+import org.apache.tools.ant.Project
+import org.apache.tools.ant.taskdefs.FixCRLF
+import org.apache.tools.ant.taskdefs.FixCRLF.CrLf
+import org.codehaus.jam._
+
+/**
+ * <p>
+ * </p>
+ *
+ * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
+ */
+class ApolloMarshallingGenerator extends MultiSourceGenerator {
+ override def run: AnyRef = {
+ if (destDir == null) {
+ destDir = new File(targetDir + "/org/apache/activemq/apollo/openwire/codec/v" + getOpenwireVersion)
+ }
+ var answer: AnyRef = super.run
+ processFactory
+ return answer
+ }
+
+
+ def includeInThisVersion(annotation: JAnnotation) = {
+ Option(annotation.getValue("version")).map(_.asInt() <= getOpenwireVersion).getOrElse(true)
+ }
+
+ override protected def isValidClass(jclass: JClass): Boolean = {
+ val annotation = jclass.getAnnotation("openwire:marshaller")
+ if (annotation == null) {
+ return false
+ }
+ if(!includeInThisVersion(annotation)) {
+ return false
+ }
+ return !manuallyMaintainedClasses.contains(jclass.getSimpleName)
+ }
+
+ override def isValidProperty(it: JProperty): Boolean = {
+ val getter = it.getGetter
+ if( getter == null || it.getSetter == null || getter.isStatic )
+ return false
+ val annotation = getter.getAnnotation("openwire:property")
+ if (annotation == null) {
+ return false
+ }
+ if(!includeInThisVersion(annotation)) {
+ return false
+ }
+ return true
+ }
+
+ protected def generateFile(out: PrintWriter): Unit = {
+ generateLicence(out)
+ out.println("")
+ out.println("package org.apache.activemq.apollo.openwire.codec.v" + getOpenwireVersion + ";")
+ out.println("")
+ out.println("import org.fusesource.hawtbuf.DataByteArrayInputStream;")
+ out.println("import org.fusesource.hawtbuf.DataByteArrayOutputStream;")
+ out.println("import java.io.IOException;")
+ out.println("")
+ out.println("import org.apache.activemq.apollo.openwire.codec.*;")
+ out.println("import org.apache.activemq.apollo.openwire.command.*;")
+
+ out.println("")
+ out.println("")
+
+ getJclass.getImportedPackages.foreach { pkg =>
+ pkg.getClasses.foreach { clazz =>
+ out.println("import " + clazz.getQualifiedName + ";")
+ }
+ }
+
+ out.println("")
+ out.println("/**")
+ out.println(" * Marshalling code for Open Wire Format for " + getClassName() + "")
+ out.println(" *")
+ out.println(" *")
+ out.println(" * NOTE!: This file is auto generated - do not modify!");
+ out.println(" * Modify the 'apollo-openwire-generator' module instead.");
+ out.println(" *")
+ out.println(" */")
+ out.println("public " + getAbstractClassText + "class " + getClassName() + " extends " + getBaseClass + " {")
+ out.println("")
+ if (!isAbstractClass) {
+ out.println(" /**")
+ out.println(" * Return the type of Data Structure we marshal")
+ out.println(" * @return short representation of the type data structure")
+ out.println(" */")
+ out.println(" public byte getDataStructureType() {")
+ out.println(" return " + getJclass.getSimpleName + ".DATA_STRUCTURE_TYPE;")
+ out.println(" }")
+ out.println(" ")
+ out.println(" /**")
+ out.println(" * @return a new object instance")
+ out.println(" */")
+ out.println(" public DataStructure createObject() {")
+ out.println(" return new " + getJclass.getSimpleName + "();")
+ out.println(" }")
+ out.println("")
+ }
+ out.println(" /**")
+ out.println(" * Un-marshal an object instance from the data input stream")
+ out.println(" *")
+ out.println(" * @param o the object to un-marshal")
+ out.println(" * @param dataIn the data input stream to build the object from")
+ out.println(" * @throws IOException")
+ out.println(" */")
+ out.println(" public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataByteArrayInputStream dataIn, BooleanStream bs) throws IOException {")
+ out.println(" super.tightUnmarshal(wireFormat, o, dataIn, bs);")
+ if (!getProperties.isEmpty) {
+ out.println("")
+ out.println(" " + getJclass.getSimpleName + " info = (" + getJclass.getSimpleName + ")o;")
+ }
+ if (isMarshallerAware) {
+ out.println("")
+ out.println(" info.beforeUnmarshall(wireFormat);")
+ out.println(" ")
+ }
+ generateTightUnmarshalBody(out)
+ if (isMarshallerAware) {
+ out.println("")
+ out.println(" info.afterUnmarshall(wireFormat);")
+ }
+ out.println("")
+ out.println(" }")
+ out.println("")
+ out.println("")
+ out.println(" /**")
+ out.println(" * Write the booleans that this object uses to a BooleanStream")
+ out.println(" */")
+ out.println(" public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {")
+ if (!getProperties.isEmpty) {
+ out.println("")
+ out.println(" " + getJclass.getSimpleName + " info = (" + getJclass.getSimpleName + ")o;")
+ }
+ if (isMarshallerAware) {
+ out.println("")
+ out.println(" info.beforeMarshall(wireFormat);")
+ }
+ out.println("")
+ out.println(" int rc = super.tightMarshal1(wireFormat, o, bs);")
+ var baseSize: Int = generateTightMarshal1Body(out)
+ out.println("")
+ out.println(" return rc + " + baseSize + ";")
+ out.println(" }")
+ out.println("")
+ out.println(" /**")
+ out.println(" * Write a object instance to data output stream")
+ out.println(" *")
+ out.println(" * @param o the instance to be marshaled")
+ out.println(" * @param dataOut the output stream")
+ out.println(" * @throws IOException thrown if an error occurs")
+ out.println(" */")
+ out.println(" public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataByteArrayOutputStream dataOut, BooleanStream bs) throws IOException {")
+ out.println(" super.tightMarshal2(wireFormat, o, dataOut, bs);")
+ if (!getProperties.isEmpty) {
+ out.println("")
+ out.println(" " + getJclass.getSimpleName + " info = (" + getJclass.getSimpleName + ")o;")
+ }
+ generateTightMarshal2Body(out)
+ if (isMarshallerAware) {
+ out.println("")
+ out.println(" info.afterMarshall(wireFormat);")
+ }
+ out.println("")
+ out.println(" }")
+ out.println("")
+ out.println(" /**")
+ out.println(" * Un-marshal an object instance from the data input stream")
+ out.println(" *")
+ out.println(" * @param o the object to un-marshal")
+ out.println(" * @param dataIn the data input stream to build the object from")
+ out.println(" * @throws IOException")
+ out.println(" */")
+ out.println(" public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataByteArrayInputStream dataIn) throws IOException {")
+ out.println(" super.looseUnmarshal(wireFormat, o, dataIn);")
+ if (!getProperties.isEmpty) {
+ out.println("")
+ out.println(" " + getJclass.getSimpleName + " info = (" + getJclass.getSimpleName + ")o;")
+ }
+ if (isMarshallerAware) {
+ out.println("")
+ out.println(" info.beforeUnmarshall(wireFormat);")
+ out.println(" ")
+ }
+ generateLooseUnmarshalBody(out)
+ if (isMarshallerAware) {
+ out.println("")
+ out.println(" info.afterUnmarshall(wireFormat);")
+ }
+ out.println("")
+ out.println(" }")
+ out.println("")
+ out.println("")
+ out.println(" /**")
+ out.println(" * Write the booleans that this object uses to a BooleanStream")
+ out.println(" */")
+ out.println(" public void looseMarshal(OpenWireFormat wireFormat, Object o, DataByteArrayOutputStream dataOut) throws IOException {")
+ if (!getProperties.isEmpty) {
+ out.println("")
+ out.println(" " + getJclass.getSimpleName + " info = (" + getJclass.getSimpleName + ")o;")
+ }
+ if (isMarshallerAware) {
+ out.println("")
+ out.println(" info.beforeMarshall(wireFormat);")
+ }
+ out.println("")
+ out.println(" super.looseMarshal(wireFormat, o, dataOut);")
+ generateLooseMarshalBody(out)
+ out.println("")
+ out.println(" }")
+ out.println("}")
+ }
+
+ private def generateLicence(out: PrintWriter): Unit = {
+ out.println("/**")
+ out.println(" * Licensed to the Apache Software Foundation (ASF) under one or more")
+ out.println(" * contributor license agreements. See the NOTICE file distributed with")
+ out.println(" * this work for additional information regarding copyright ownership.")
+ out.println(" * The ASF licenses this file to You under the Apache License, Version 2.0")
+ out.println(" * (the \"License\"); you may not use this file except in compliance with")
+ out.println(" * the License. You may obtain a copy of the License at")
+ out.println(" *")
+ out.println(" * http://www.apache.org/licenses/LICENSE-2.0")
+ out.println(" *")
+ out.println(" * Unless required by applicable law or agreed to in writing, software")
+ out.println(" * distributed under the License is distributed on an \"AS IS\" BASIS,")
+ out.println(" * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.")
+ out.println(" * See the License for the specific language governing permissions and")
+ out.println(" * limitations under the License.")
+ out.println(" */")
+ }
+
+ protected def processFactory: Unit = {
+ if (factoryFile == null) {
+ factoryFile = new File(destDir, factoryFileName + filePostFix)
+ }
+ var out: PrintWriter = null
+ try {
+ out = new PrintWriter(new FileWriter(factoryFile))
+ generateFactory(out)
+ } catch {
+ case e: Exception => {
+ throw new RuntimeException(e)
+ }
+ } finally {
+ if (out != null) {
+ out.close
+ }
+ }
+ }
+
+ protected def generateFactory(out: PrintWriter): Unit = {
+ generateLicence(out)
+ out.println("")
+ out.println("package org.apache.activemq.apollo.openwire.codec.v" + getOpenwireVersion + ";")
+ out.println("")
+ out.println("import org.apache.activemq.apollo.openwire.codec.DataStreamMarshaller;")
+ out.println("import org.apache.activemq.apollo.openwire.codec.OpenWireFormat;")
+ out.println("")
+ out.println("/**")
+ out.println(" * MarshallerFactory for Open Wire Format.")
+ out.println(" *")
+ out.println(" *")
+ out.println(" * NOTE!: This file is auto generated - do not modify!");
+ out.println(" * Modify the 'apollo-openwire-generator' module instead.");
+ out.println(" *")
+ out.println(" * ")
+ out.println(" */")
+ out.println("public class MarshallerFactory {")
+ out.println("")
+ out.println(" /**")
+ out.println(" * Creates a Map of command type -> Marshallers")
+ out.println(" */")
+ out.println(" static final private DataStreamMarshaller marshaller[] = new DataStreamMarshaller[256];")
+ out.println(" static {")
+ out.println("")
+
+ getConcreteClasses.sortBy( _.getSimpleName ).foreach {jclass =>
+ out.println(" add(new " + jclass.getSimpleName + "Marshaller());")
+ }
+
+ out.println("")
+ out.println(" }")
+ out.println("")
+ out.println(" static private void add(DataStreamMarshaller dsm) {")
+ out.println(" marshaller[dsm.getDataStructureType()] = dsm;")
+ out.println(" }")
+ out.println(" ")
+ out.println(" static public DataStreamMarshaller[] createMarshallerMap(OpenWireFormat wireFormat) {")
+ out.println(" return marshaller;")
+ out.println(" }")
+ out.println("}")
+ }
+
+ protected override def processClass(jclass: JClass): Unit = {
+ super.processClass(jclass)
+
+ // Fix CRLF issues
+ var project: Project = new Project
+ project.init
+ var fixCRLF: FixCRLF = new FixCRLF
+ fixCRLF.setProject(project)
+ fixCRLF.setSrcdir(destFile.getParentFile)
+ fixCRLF.setIncludes(destFile.getName)
+ var kind = new FixCRLF.CrLf()
+ kind.setValue("unix")
+ fixCRLF.setEol(kind)
+ fixCRLF.execute
+
+ if (!jclass.isAbstract) {
+ concreteClasses.add(jclass)
+ }
+ }
+
+ protected override def getClassName(jclass: JClass): String = {
+ return super.getClassName(jclass) + "Marshaller"
+ }
+
+ protected override def getBaseClassName(jclass: JClass): String = {
+ var answer: String = "BaseDataStreamMarshaller"
+ var superclass: JClass = jclass.getSuperclass
+ if (superclass != null) {
+ var superName: String = superclass.getSimpleName
+ if (!(superName == "Object") && !(superName == "JNDIBaseStorable") && !(superName == "DataStructureSupport")) {
+ answer = superName + "Marshaller"
+ }
+ }
+ return answer
+ }
+
+ protected override def initialiseManuallyMaintainedClasses: Unit = {
+ }
+
+ protected def generateTightUnmarshalBody(out: PrintWriter): Unit = {
+ getProperties.foreach {property =>
+ var annotation: JAnnotation = property.getAnnotation("openwire:property")
+ var size: JAnnotationValue = annotation.getValue("size")
+ var propertyType: JClass = property.getType
+ var propertyTypeName: String = propertyType.getSimpleName
+ if (propertyType.isArrayType && !(propertyTypeName == "byte[]")) {
+ generateTightUnmarshalBodyForArrayProperty(out, property, size)
+ } else {
+ generateTightUnmarshalBodyForProperty(out, property, size)
+ }
+ }
+ }
+
+ protected def generateTightUnmarshalBodyForProperty(out: PrintWriter, property: JProperty, size: JAnnotationValue): Unit = {
+ var setter = property.getSetter.getSimpleName
+ var property_type = property.getType.getSimpleName
+ if (property_type == "boolean") {
+ out.println(" info." + setter + "(bs.readBoolean());")
+ } else if (property_type == "byte") {
+ out.println(" info." + setter + "(dataIn.readByte());")
+ } else if (property_type == "char") {
+ out.println(" info." + setter + "(dataIn.readChar());")
+ } else if (property_type == "short") {
+ out.println(" info." + setter + "(dataIn.readShort());")
+ } else if (property_type == "int") {
+ out.println(" info." + setter + "(dataIn.readInt());")
+ } else if (property_type == "long") {
+ out.println(" info." + setter + "(tightUnmarshalLong(wireFormat, dataIn, bs));")
+ } else if (property_type == "UTF8Buffer") {
+ out.println(" info." + setter + "(tightUnmarshalString(dataIn, bs));")
+ } else if (property_type == "String") {
+ out.println(" info." + setter + "(tightUnmarshalString(dataIn, bs));")
+ } else if (property_type == "byte[]") {
+ if (size != null) {
+ out.println(" info." + setter + "(tightUnmarshalConstByteArray(dataIn, bs, " + size.asInt + "));")
+ } else {
+ out.println(" info." + setter + "(tightUnmarshalByteArray(dataIn, bs));")
+ }
+ } else if (property_type == "Buffer") {
+ out.println(" info." + setter + "(tightUnmarshalBuffer(dataIn, bs));")
+ } else if (isThrowable(property.getType)) {
+ out.println(" info." + setter + "((" + property.getType.getQualifiedName + ")tightUnmarsalThrowable(wireFormat, dataIn, bs));")
+ } else if (isCachedProperty(property)) {
+ out.println(" info." + setter + "((" + property.getType.getQualifiedName + ")tightUnmarsalCachedObject(wireFormat, dataIn, bs));")
+ } else {
+ out.println(" info." + setter + "((" + property.getType.getQualifiedName + ")tightUnmarsalNestedObject(wireFormat, dataIn, bs));")
+ }
+ }
+
+ protected def generateTightUnmarshalBodyForArrayProperty(out: PrintWriter, property: JProperty, size: JAnnotationValue): Unit = {
+ var propertyType: JClass = property.getType
+ var arrayType: String = propertyType.getArrayComponentType.getQualifiedName
+ var setter: String = property.getSetter.getSimpleName
+ out.println
+ if (size != null) {
+ out.println(" {")
+ out.println(" " + arrayType + " value[] = new " + arrayType + "[" + size.asInt + "];")
+ out.println(" " + "for( int i=0; i < " + size.asInt + "; i++ ) {")
+ out.println(" value[i] = (" + arrayType + ") tightUnmarsalNestedObject(wireFormat,dataIn, bs);")
+ out.println(" }")
+ out.println(" info." + setter + "(value);")
+ out.println(" }")
+ } else {
+ out.println(" if (bs.readBoolean()) {")
+ out.println(" short size = dataIn.readShort();")
+ out.println(" " + arrayType + " value[] = new " + arrayType + "[size];")
+ out.println(" for( int i=0; i < size; i++ ) {")
+ out.println(" value[i] = (" + arrayType + ") tightUnmarsalNestedObject(wireFormat,dataIn, bs);")
+ out.println(" }")
+ out.println(" info." + setter + "(value);")
+ out.println(" }")
+ out.println(" else {")
+ out.println(" info." + setter + "(null);")
+ out.println(" }")
+ }
+ }
+
+ protected def generateTightMarshal1Body(out: PrintWriter): Int = {
+ var baseSize: Int = 0
+ getProperties.foreach {property =>
+ var annotation: JAnnotation = property.getAnnotation("openwire:property")
+ var size: JAnnotationValue = annotation.getValue("size")
+ var propertyType: JClass = property.getType
+ var property_type: String = propertyType.getSimpleName
+ var getter: String = "info." + property.getGetter.getSimpleName + "()"
+ if (property_type == "boolean") {
+ out.println(" bs.writeBoolean(" + getter + ");")
+ } else if (property_type == "byte") {
+ baseSize += 1
+ } else if (property_type == "char") {
+ baseSize += 2
+ } else if (property_type == "short") {
+ baseSize += 2
+ } else if (property_type == "int") {
+ baseSize += 4
+ } else if (property_type == "long") {
+ out.println(" rc += tightMarshalLong1(wireFormat, " + getter + ", bs);")
+ } else if (property_type == "UTF8Buffer") {
+ out.println(" rc += tightMarshalString1(" + getter + ", bs);")
+ } else if (property_type == "String") {
+ out.println(" rc += tightMarshalString1(" + getter + ", bs);")
+ } else if (property_type == "byte[]") {
+ if (size == null) {
+ out.println(" rc += tightMarshalByteArray1(" + getter + ", bs);")
+ } else {
+ out.println(" rc += tightMarshalConstByteArray1(" + getter + ", bs, " + size.asInt + ");")
+ }
+ } else if (property_type == "Buffer") {
+ out.println(" rc += tightMarshalBuffer1(" + getter + ", bs);")
+ } else if (propertyType.isArrayType) {
+ if (size != null) {
+ out.println(" rc += tightMarshalObjectArrayConstSize1(wireFormat, " + getter + ", bs, " + size.asInt + ");")
+ } else {
+ out.println(" rc += tightMarshalObjectArray1(wireFormat, " + getter + ", bs);")
+ }
+ } else if (isThrowable(propertyType)) {
+ out.println(" rc += tightMarshalThrowable1(wireFormat, " + getter + ", bs);")
+ } else {
+ if (isCachedProperty(property)) {
+ out.println(" rc += tightMarshalCachedObject1(wireFormat, (DataStructure)" + getter + ", bs);")
+ } else {
+ out.println(" rc += tightMarshalNestedObject1(wireFormat, (DataStructure)" + getter + ", bs);")
+ }
+ }
+ }
+ return baseSize
+ }
+
+ protected def generateTightMarshal2Body(out: PrintWriter): Unit = {
+ getProperties.foreach {property =>
+ var annotation: JAnnotation = property.getAnnotation("openwire:property")
+ var size: JAnnotationValue = annotation.getValue("size")
+ var propertyType: JClass = property.getType
+ var property_type: String = propertyType.getSimpleName
+ var getter: String = "info." + property.getGetter.getSimpleName + "()"
+ if (property_type == "boolean") {
+ out.println(" bs.readBoolean();")
+ } else if (property_type == "byte") {
+ out.println(" dataOut.writeByte(" + getter + ");")
+ } else if (property_type == "char") {
+ out.println(" dataOut.writeChar(" + getter + ");")
+ } else if (property_type == "short") {
+ out.println(" dataOut.writeShort(" + getter + ");")
+ } else if (property_type == "int") {
+ out.println(" dataOut.writeInt(" + getter + ");")
+ } else if (property_type == "long") {
+ out.println(" tightMarshalLong2(wireFormat, " + getter + ", dataOut, bs);")
+ } else if (property_type == "UTF8Buffer") {
+ out.println(" tightMarshalString2(" + getter + ", dataOut, bs);")
+ } else if (property_type == "String") {
+ out.println(" tightMarshalString2(" + getter + ", dataOut, bs);")
+ } else if (property_type == "byte[]") {
+ if (size != null) {
+ out.println(" tightMarshalConstByteArray2(" + getter + ", dataOut, bs, " + size.asInt + ");")
+ } else {
+ out.println(" tightMarshalByteArray2(" + getter + ", dataOut, bs);")
+ }
+ } else if (property_type == "Buffer") {
+ out.println(" tightMarshalBuffer2(" + getter + ", dataOut, bs);")
+ } else if (propertyType.isArrayType) {
+ if (size != null) {
+ out.println(" tightMarshalObjectArrayConstSize2(wireFormat, " + getter + ", dataOut, bs, " + size.asInt + ");")
+ } else {
+ out.println(" tightMarshalObjectArray2(wireFormat, " + getter + ", dataOut, bs);")
+ }
+ } else if (isThrowable(propertyType)) {
+ out.println(" tightMarshalThrowable2(wireFormat, " + getter + ", dataOut, bs);")
+ } else {
+ if (isCachedProperty(property)) {
+ out.println(" tightMarshalCachedObject2(wireFormat, (DataStructure)" + getter + ", dataOut, bs);")
+ } else {
+ out.println(" tightMarshalNestedObject2(wireFormat, (DataStructure)" + getter + ", dataOut, bs);")
+ }
+ }
+ }
+ }
+
+ protected def generateLooseMarshalBody(out: PrintWriter): Unit = {
+ getProperties.foreach {property =>
+ var annotation: JAnnotation = property.getAnnotation("openwire:property")
+ var size: JAnnotationValue = annotation.getValue("size")
+ var propertyType: JClass = property.getType
+ var property_type: String = propertyType.getSimpleName
+ var getter: String = "info." + property.getGetter.getSimpleName + "()"
+ if (property_type == "boolean") {
+ out.println(" dataOut.writeBoolean(" + getter + ");")
+ } else if (property_type == "byte") {
+ out.println(" dataOut.writeByte(" + getter + ");")
+ } else if (property_type == "char") {
+ out.println(" dataOut.writeChar(" + getter + ");")
+ } else if (property_type == "short") {
+ out.println(" dataOut.writeShort(" + getter + ");")
+ } else if (property_type == "int") {
+ out.println(" dataOut.writeInt(" + getter + ");")
+ } else if (property_type == "long") {
+ out.println(" looseMarshalLong(wireFormat, " + getter + ", dataOut);")
+ } else if (property_type == "UTF8Buffer") {
+ out.println(" looseMarshalString(" + getter + ", dataOut);")
+ } else if (property_type == "String") {
+ out.println(" looseMarshalString(" + getter + ", dataOut);")
+ } else if (property_type == "byte[]") {
+ if (size != null) {
+ out.println(" looseMarshalConstByteArray(wireFormat, " + getter + ", dataOut, " + size.asInt + ");")
+ } else {
+ out.println(" looseMarshalByteArray(wireFormat, " + getter + ", dataOut);")
+ }
+ } else if (property_type == "Buffer") {
+ out.println(" looseMarshalBuffer(wireFormat, " + getter + ", dataOut);")
+ } else if (propertyType.isArrayType) {
+ if (size != null) {
+ out.println(" looseMarshalObjectArrayConstSize(wireFormat, " + getter + ", dataOut, " + size.asInt + ");")
+ } else {
+ out.println(" looseMarshalObjectArray(wireFormat, " + getter + ", dataOut);")
+ }
+ } else if (isThrowable(propertyType)) {
+ out.println(" looseMarshalThrowable(wireFormat, " + getter + ", dataOut);")
+ } else {
+ if (isCachedProperty(property)) {
+ out.println(" looseMarshalCachedObject(wireFormat, (DataStructure)" + getter + ", dataOut);")
+ } else {
+ out.println(" looseMarshalNestedObject(wireFormat, (DataStructure)" + getter + ", dataOut);")
+ }
+ }
+ }
+ }
+
+ protected def generateLooseUnmarshalBody(out: PrintWriter): Unit = {
+ getProperties.foreach {property =>
+ var annotation = property.getAnnotation("openwire:property")
+ var size = annotation.getValue("size")
+ var propertyType = property.getType
+ var propertyTypeName: String = propertyType.getSimpleName
+ if (propertyType.isArrayType && !(propertyTypeName == "byte[]")) {
+ generateLooseUnmarshalBodyForArrayProperty(out, property, size)
+ } else {
+ generateLooseUnmarshalBodyForProperty(out, property, size)
+ }
+ }
+ }
+
+ protected def generateLooseUnmarshalBodyForProperty(out: PrintWriter, property: JProperty, size: JAnnotationValue): Unit = {
+ var setter: String = property.getSetter.getSimpleName
+ var property_type: String = property.getType.getSimpleName
+ if (property_type == "boolean") {
+ out.println(" info." + setter + "(dataIn.readBoolean());")
+ } else if (property_type == "byte") {
+ out.println(" info." + setter + "(dataIn.readByte());")
+ } else if (property_type == "char") {
+ out.println(" info." + setter + "(dataIn.readChar());")
+ } else if (property_type == "short") {
+ out.println(" info." + setter + "(dataIn.readShort());")
+ } else if (property_type == "int") {
+ out.println(" info." + setter + "(dataIn.readInt());")
+ } else if (property_type == "long") {
+ out.println(" info." + setter + "(looseUnmarshalLong(wireFormat, dataIn));")
+ } else if (property_type == "UTF8Buffer") {
+ out.println(" info." + setter + "(looseUnmarshalString(dataIn));")
+ } else if (property_type == "String") {
+ out.println(" info." + setter + "(looseUnmarshalString(dataIn));")
+ } else if (property_type == "byte[]") {
+ if (size != null) {
+ out.println(" info." + setter + "(looseUnmarshalConstByteArray(dataIn, " + size.asInt + "));")
+ } else {
+ out.println(" info." + setter + "(looseUnmarshalByteArray(dataIn));")
+ }
+ } else if (property_type == "Buffer") {
+ out.println(" info." + setter + "(looseUnmarshalBuffer(dataIn));")
+ } else if (isThrowable(property.getType)) {
+ out.println(" info." + setter + "((" + property.getType.getQualifiedName + ")looseUnmarsalThrowable(wireFormat, dataIn));")
+ } else if (isCachedProperty(property)) {
+ out.println(" info." + setter + "((" + property.getType.getQualifiedName + ")looseUnmarsalCachedObject(wireFormat, dataIn));")
+ } else {
+ out.println(" info." + setter + "((" + property.getType.getQualifiedName + ")looseUnmarsalNestedObject(wireFormat, dataIn));")
+ }
+ }
+
+ protected def generateLooseUnmarshalBodyForArrayProperty(out: PrintWriter, property: JProperty, size: JAnnotationValue): Unit = {
+ var propertyType: JClass = property.getType
+ var arrayType: String = propertyType.getArrayComponentType.getQualifiedName
+ var setter: String = property.getSetter.getSimpleName
+ out.println
+ if (size != null) {
+ out.println(" {")
+ out.println(" " + arrayType + " value[] = new " + arrayType + "[" + size.asInt + "];")
+ out.println(" " + "for( int i=0; i < " + size.asInt + "; i++ ) {")
+ out.println(" value[i] = (" + arrayType + ")looseUnmarsalNestedObject(wireFormat,dataIn);")
+ out.println(" }")
+ out.println(" info." + setter + "(value);")
+ out.println(" }")
+ } else {
+ out.println(" if (dataIn.readBoolean()) {")
+ out.println(" short size = dataIn.readShort();")
+ out.println(" " + arrayType + " value[] = new " + arrayType + "[size];")
+ out.println(" for( int i=0; i < size; i++ ) {")
+ out.println(" value[i] = (" + arrayType + ")looseUnmarsalNestedObject(wireFormat,dataIn);")
+ out.println(" }")
+ out.println(" info." + setter + "(value);")
+ out.println(" }")
+ out.println(" else {")
+ out.println(" info." + setter + "(null);")
+ out.println(" }")
+ }
+ }
+
+ override def isMarshallAware(j: JClass): Boolean = {
+ if (filePostFix.endsWith("java")) {
+ j.getInterfaces.foreach { x=>
+ if (x.getQualifiedName == "org.apache.activemq.apollo.openwire.command.MarshallAware") {
+ return true
+ }
+ }
+ return false
+ } else {
+ var simpleName = j.getSimpleName
+ return (simpleName == "ActiveMQMessage") || (simpleName == "WireFormatInfo")
+ }
+ }
+
+ /**
+ * Returns whether or not the given annotation has a mandatory flag on it or
+ * not
+ */
+ protected def getMandatoryFlag(annotation: JAnnotation): String = {
+ var value: JAnnotationValue = annotation.getValue("mandatory")
+ if (value != null) {
+ var text: String = value.asString
+ if (text != null && text.equalsIgnoreCase("true")) {
+ return "true"
+ }
+ }
+ return "false"
+ }
+
+ def getConcreteClasses: List[JClass] = {
+ return concreteClasses
+ }
+
+ def setConcreteClasses(concreteClasses: List[JClass]): Unit = {
+ this.concreteClasses = concreteClasses
+ }
+
+ def getFactoryFile: File = {
+ return factoryFile
+ }
+
+ def setFactoryFile(factoryFile: File): Unit = {
+ this.factoryFile = factoryFile
+ }
+
+ def getFactoryFileName: String = {
+ return factoryFileName
+ }
+
+ def setFactoryFileName(factoryFileName: String): Unit = {
+ this.factoryFileName = factoryFileName
+ }
+
+ def getIndent: String = {
+ return indent
+ }
+
+ def setIndent(indent: String): Unit = {
+ this.indent = indent
+ }
+
+ def getTargetDir: String = {
+ return targetDir
+ }
+
+ def setTargetDir(sourceDir: String): Unit = {
+ this.targetDir = sourceDir
+ }
+
+ protected var concreteClasses: List[JClass] = new ArrayList[JClass]
+ protected var factoryFile: File = null
+ protected var factoryFileName: String = "MarshallerFactory"
+ protected var indent: String = " "
+ protected var targetDir: String = "src/main/java"
+}
+
diff --git a/apollo-openwire-generator/src/main/scala/org/apache/activemq/apollo/openwire/generator/GeneratorTask.scala b/apollo-openwire-generator/src/main/scala/org/apache/activemq/apollo/openwire/generator/GeneratorTask.scala
new file mode 100644
index 0000000..e858f5b
--- /dev/null
+++ b/apollo-openwire-generator/src/main/scala/org/apache/activemq/apollo/openwire/generator/GeneratorTask.scala
@@ -0,0 +1,104 @@
+/**
+ * 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.openwire.generator
+
+import java.io.File
+import org.apache.tools.ant.BuildException
+import org.apache.tools.ant.Project
+import org.apache.tools.ant.Task
+import org.codehaus.jam.JamService
+import org.codehaus.jam.JamServiceFactory
+import org.codehaus.jam.JamServiceParams
+import org.apache.activemq.openwire.tool.{JavaTestsGenerator, JavaMarshallingGenerator}
+import reflect.BeanProperty
+
+
+/**
+ * <p>
+ * </p>
+ *
+ * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
+ */
+object GeneratorTask {
+ def main(args: Array[String]): Unit = {
+ var project = new Project
+ project.init
+ var generator = new GeneratorTask
+ generator.setProject(project)
+ if (args.length > 0) {
+ generator.version = Integer.parseInt(args(0))
+ }
+ if (args.length > 1) {
+ generator.sourceDir = new File(args(1))
+ }
+ if (args.length > 2) {
+ generator.targetDir = new File(args(2))
+ }
+ generator.execute
+ }
+}
+
+/**
+ * <p>
+ * </p>
+ *
+ * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
+ */
+class GeneratorTask extends Task {
+
+ @BeanProperty
+ var first = 1
+
+ @BeanProperty
+ var version = 1
+
+ @BeanProperty
+ var sourceDir = new File("./src/main/scala")
+
+ @BeanProperty
+ var targetDir = new File("./src/main/scala")
+
+ override def execute: Unit = {
+ try {
+
+ println("Parsing source files in: " + sourceDir)
+ var jamServiceFactory = JamServiceFactory.getInstance
+ var params = jamServiceFactory.createServiceParams
+ var dirs = Array(sourceDir)
+ params.includeSourcePattern(dirs, "**/*.java")
+
+ var jam = jamServiceFactory.createService(params)
+
+ for( i <- first.to(version)) {
+ println("======================================================")
+ println(" Generating Marshallers for OpenWire version: " + i)
+ println("======================================================")
+ var script = new ApolloMarshallingGenerator
+ script.setJam(jam)
+ script.setTargetDir(targetDir.getCanonicalPath)
+ script.setOpenwireVersion(i)
+ script.run
+ }
+
+ } catch {
+ case e: Exception => throw new BuildException(e)
+ }
+ }
+
+}
+
diff --git a/apollo-openwire/pom.xml b/apollo-openwire/pom.xml
index a7ed3a3..9355ff5 100644
--- a/apollo-openwire/pom.xml
+++ b/apollo-openwire/pom.xml
@@ -13,30 +13,35 @@
License for the specific language governing permissions and
limitations under the License.
-->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.activemq</groupId>
<artifactId>apollo-scala</artifactId>
- <version>1.0-SNAPSHOT</version>
+ <version>1.0</version>
<relativePath>../apollo-scala</relativePath>
</parent>
<groupId>org.apache.activemq</groupId>
<artifactId>apollo-openwire</artifactId>
- <version>1.0-SNAPSHOT</version>
+ <version>1.0</version>
<name>${project.artifactId}</name>
+ <properties>
+ <openwire-src>${basedir}/src/main/scala</openwire-src>
+ <openwire-first>1</openwire-first>
+ <openwire-version>8</openwire-version>
+ </properties>
+
<dependencies>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>apollo-broker</artifactId>
- <version>1.0-SNAPSHOT</version>
+ <version>1.0</version>
</dependency>
<!-- Scala Support -->
@@ -60,33 +65,47 @@
<!-- so we can test against a persisentce store -->
<dependency>
<groupId>org.apache.activemq</groupId>
- <artifactId>apollo-leveldb</artifactId>
- <version>1.0-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.activemq</groupId>
- <artifactId>apollo-bdb</artifactId>
- <version>1.0-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.activemq</groupId>
<artifactId>apollo-broker</artifactId>
- <version>1.0-SNAPSHOT</version>
+ <version>1.0</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>apollo-util</artifactId>
- <version>1.0-SNAPSHOT</version>
+ <version>1.0</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>apollo-bdb</artifactId>
+ <version>1.0</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>apollo-leveldb</artifactId>
+ <version>1.0</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.eclipse.jetty.aggregate</groupId>
+ <artifactId>jetty-all-server</artifactId>
+ <version>${jetty-version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>apollo-web</artifactId>
+ <version>1.0</version>
+ <scope>test</scope>
+ </dependency>
+
+
+ <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
@@ -105,24 +124,73 @@
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>apollo-openwire-generator</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+
</dependencies>
<build>
<plugins>
- <!-- Generate a test jar for the test cases in this package -->
<plugin>
- <artifactId>maven-jar-plugin</artifactId>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <version>1.7</version>
+ <executions>
+ <execution>
+ <id>default</id>
+ <phase>generate-sources</phase>
+ <configuration>
+ <tasks>
+ <echo>Running OpenWire Generator</echo>
+ <taskdef name="generate" classname="org.apache.activemq.apollo.openwire.generator.GeneratorTask" classpathref="maven.test.classpath" />
+ <generate first="${openwire-first}" version="${openwire-version}" sourceDir="${openwire-src}" targetDir="${project.build.directory}/generated-sources/openwire" />
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>1.7</version>
+ <executions>
+ <execution>
+ <id>default</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>add-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>${project.build.directory}/generated-sources/openwire</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.fusesource.scalate</groupId>
+ <artifactId>maven-scalate-plugin</artifactId>
+ <version>${scalate-version}</version>
<executions>
<execution>
<goals>
- <goal>test-jar</goal>
+ <goal>precompile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
- </build>
+ </build>
</project>
diff --git a/apollo-openwire/src/main/resources/META-INF/services/org.apache.activemq.apollo/dto-module.index b/apollo-openwire/src/main/resources/META-INF/services/org.apache.activemq.apollo/dto-module.index
new file mode 100644
index 0000000..4b83168
--- /dev/null
+++ b/apollo-openwire/src/main/resources/META-INF/services/org.apache.activemq.apollo/dto-module.index
@@ -0,0 +1,17 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+org.apache.activemq.apollo.stomp.openwire.Module
\ No newline at end of file
diff --git a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/DestinationAdvisoryRouterListener.scala b/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/DestinationAdvisoryRouterListener.scala
index a5ee0dc..1826553 100644
--- a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/DestinationAdvisoryRouterListener.scala
+++ b/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/DestinationAdvisoryRouterListener.scala
@@ -27,6 +27,7 @@
import java.util.Map.Entry
import org.apache.activemq.apollo.broker._
import org.fusesource.hawtdispatch._
+import org.fusesource.hawtbuf.UTF8Buffer
/**
* <p>
@@ -58,7 +59,7 @@
final val advisoryProducerId = new ProducerId
final val messageIdGenerator = new LongSequenceGenerator
- advisoryProducerId.setConnectionId(ID_GENERATOR.generateId)
+ advisoryProducerId.setConnectionId(new UTF8Buffer(ID_GENERATOR.generateId))
class ProducerRoute extends DeliveryProducerRoute(router) {
@@ -80,7 +81,7 @@
def on_create(dest: DomainDestination, security: SecurityContext) = {
val ow_destination = to_activemq_destination(Array(dest.destination_dto))
- if (!AdvisorySupport.isAdvisoryTopic(ow_destination)) {
+ if (ow_destination!=null && !AdvisorySupport.isAdvisoryTopic(ow_destination)) {
destination_advisories.getOrElseUpdate(ow_destination, {
var info = new DestinationInfo(null, DestinationInfo.ADD_OPERATION_TYPE, ow_destination)
val topic = AdvisorySupport.getDestinationAdvisoryTopic(ow_destination);
@@ -93,7 +94,7 @@
def on_destroy(dest: DomainDestination, security: SecurityContext) = {
val destination = to_activemq_destination(Array(dest.destination_dto))
- if (!AdvisorySupport.isAdvisoryTopic(destination)) {
+ if (destination!=null && !AdvisorySupport.isAdvisoryTopic(destination)) {
for (info <- destination_advisories.remove(destination)) {
var info = new DestinationInfo(null, DestinationInfo.REMOVE_OPERATION_TYPE, destination)
val topic = AdvisorySupport.getDestinationAdvisoryTopic(destination);
@@ -104,7 +105,7 @@
def on_bind(dest: DomainDestination, consumer: DeliveryConsumer, security: SecurityContext) = {
val destination = to_activemq_destination(Array(dest.destination_dto))
- if (AdvisorySupport.isDestinationAdvisoryTopic(destination) && !destination_advisories.isEmpty) {
+ if (destination!=null && AdvisorySupport.isDestinationAdvisoryTopic(destination) && !destination_advisories.isEmpty) {
// replay the destination advisories..
val producer = new ProducerRoute {
override def on_connected = {
@@ -160,7 +161,7 @@
//set the data structure
message.setDataStructure(command);
message.setPersistent(false);
- message.setType(AdvisorySupport.ADIVSORY_MESSAGE_TYPE);
+ message.setType(AdvisorySupport.ADIVSORY_MESSAGE_TYPE_BUFFER);
message.setMessageId(new MessageId(advisoryProducerId, messageIdGenerator.getNextSequenceId()));
// message.setTargetConsumerId(targetConsumerId);
message.setDestination(topic);
@@ -175,7 +176,7 @@
def send(delivery:Delivery): Unit = {
val message = delivery.message.asInstanceOf[OpenwireMessage].message
- val dest: Array[DestinationDTO] = to_destination_dto(message.getDestination)
+ val dest: Array[DestinationDTO] = to_destination_dto(message.getDestination,null)
val key = dest.toList
val route = producerRoutes.get(key) match {
diff --git a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/DestinationConverter.scala b/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/DestinationConverter.scala
index 1dc1b0c..03f80c4 100644
--- a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/DestinationConverter.scala
+++ b/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/DestinationConverter.scala
@@ -16,11 +16,10 @@
*/
package org.apache.activemq.apollo.openwire
-import command._
-import org.apache.activemq.apollo.util.path.Path
-import java.util.regex.{Matcher, Pattern}
import org.apache.activemq.apollo.dto.{TopicDestinationDTO, QueueDestinationDTO, DestinationDTO}
-import org.apache.activemq.apollo.broker.{DestinationParser, LocalRouter}
+import org.apache.activemq.apollo.broker.DestinationParser
+import org.apache.activemq.apollo.openwire.command._
+import java.lang.String
/**
* <p>
@@ -31,79 +30,71 @@
object DestinationConverter {
val OPENWIRE_PARSER = new DestinationParser();
+ OPENWIRE_PARSER.queue_prefix = ActiveMQDestination.QUEUE_QUALIFIED_PREFIX
+ OPENWIRE_PARSER.topic_prefix = ActiveMQDestination.TOPIC_QUALIFIED_PREFIX
+ OPENWIRE_PARSER.temp_queue_prefix = ActiveMQDestination.TEMP_QUEUE_QUALIFED_PREFIX
+ OPENWIRE_PARSER.temp_topic_prefix = ActiveMQDestination.TEMP_TOPIC_QUALIFED_PREFIX
+ OPENWIRE_PARSER.dsub_prefix = null
OPENWIRE_PARSER.path_separator = "."
OPENWIRE_PARSER.any_child_wildcard = "*"
OPENWIRE_PARSER.any_descendant_wildcard = ">"
+ OPENWIRE_PARSER.sanitize_destinations = true
- def to_destination_dto(domain: String, parts:Array[String]): DestinationDTO = domain match {
- case "queue" => new QueueDestinationDTO(parts)
- case "topic" => new TopicDestinationDTO(parts)
- case _ => throw new Exception("Uknown destination domain: " + domain);
- }
+ def to_destination_dto(dest: ActiveMQDestination, handler:OpenwireProtocolHandler): Array[DestinationDTO] = {
+ def fallback(value:String) = {
+ OPENWIRE_PARSER.decode_single_destination(dest.getQualifiedPrefix+value, null)
+ }
+ val rc = OPENWIRE_PARSER.decode_multi_destination(dest.getPhysicalName.toString, fallback)
+ rc.foreach { dest =>
+ if( dest.temp() ) {
+ import collection.JavaConversions._
+ // Put it back together...
+ val name = dest.path.map(OPENWIRE_PARSER.unsanitize_destination_part(_)).mkString(OPENWIRE_PARSER.path_separator)
- def to_destination_dto(domain: String, path: Path): Array[DestinationDTO] = {
- Array(to_destination_dto(domain, OPENWIRE_PARSER.path_parts(path)))
- }
-
- def to_destination_dto(dest: ActiveMQDestination): Array[DestinationDTO] = {
- if( !dest.isComposite ) {
- import ActiveMQDestination._
- val physicalName = dest.getPhysicalName.replaceAll(Pattern.quote(":"), Matcher.quoteReplacement("%58"))
-
- var path = OPENWIRE_PARSER.decode_path(physicalName)
- dest.getDestinationType match {
- case QUEUE_TYPE =>
- to_destination_dto("queue", path)
- case TOPIC_TYPE =>
- to_destination_dto("topic", path)
- case TEMP_QUEUE_TYPE =>
- to_destination_dto("queue", Path("ActiveMQ", "Temp") + path)
- case TEMP_TOPIC_TYPE =>
- to_destination_dto("topic", Path("ActiveMQ", "Temp") + path)
- }
- } else {
- dest.getCompositeDestinations.map { c =>
- to_destination_dto(c)(0)
+ val (connectionid, rest) = name.splitAt(name.lastIndexOf(':'))
+ val real_path = ("temp" :: handler.broker.id :: OPENWIRE_PARSER.sanitize_destination_part(connectionid) :: OPENWIRE_PARSER.sanitize_destination_part(rest.substring(1)) :: Nil).toArray
+ dest.path = java.util.Arrays.asList(real_path:_*)
}
}
+ rc
}
- def to_activemq_destination(dest:Array[DestinationDTO]):ActiveMQDestination = {
+ def to_activemq_destination(dests:Array[DestinationDTO]):ActiveMQDestination = {
import collection.JavaConversions._
-
- val rc = dest.map { dest =>
- var temp = false // dest.temp_owner != null
- val name = OPENWIRE_PARSER.encode_path(asScalaBuffer(dest.path).toList match {
- case "ActiveMQ" :: "Temp" :: rest =>
- temp = true
- rest
- case rest =>
- rest
- }).replaceAll(Pattern.quote("%58"), Matcher.quoteReplacement(":"))
-
+ var wrapper: (String)=> ActiveMQDestination = null
+
+ val rc = OPENWIRE_PARSER.encode_destination(dests.flatMap{ dest=>
+ val temp = dest.path.headOption == Some("temp")
dest match {
case dest:QueueDestinationDTO =>
if( temp ) {
- new ActiveMQTempQueue(name)
+ if(wrapper==null)
+ wrapper = (x)=>new ActiveMQTempQueue(x)
+ var path: Array[String] = Array(dest.path.toList.drop(2).map(OPENWIRE_PARSER.unsanitize_destination_part(_)).mkString(":"))
+ Some(new QueueDestinationDTO(path).temp(true))
} else {
- new ActiveMQQueue(name)
+ if(wrapper==null)
+ wrapper = (x)=>new ActiveMQQueue(x)
+ Some(dest)
}
case dest:TopicDestinationDTO =>
if( temp ) {
- new ActiveMQTempTopic(name)
+ if(wrapper==null)
+ wrapper = (x)=>new ActiveMQTempTopic(x)
+ var path: Array[String] = Array(dest.path.toList.drop(2).map(OPENWIRE_PARSER.unsanitize_destination_part(_)).mkString(":"))
+ Some(new TopicDestinationDTO(path).temp(true))
} else {
- new ActiveMQTopic(name)
+ if(wrapper==null)
+ wrapper = (x)=>new ActiveMQTopic(x)
+ Some(dest)
}
+ case _ => None
}
- }
+ })
- if( rc.length == 1) {
- rc(0)
- } else {
- val c = new ActiveMQQueue()
- c.setCompositeDestinations(rc)
- c
- }
-
+ if ( wrapper==null )
+ null
+ else
+ wrapper(rc)
}
}
\ No newline at end of file
diff --git a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/OpenwireCodec.scala b/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/OpenwireCodec.scala
index 60ffd04..dc1e3b1 100644
--- a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/OpenwireCodec.scala
+++ b/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/OpenwireCodec.scala
@@ -23,10 +23,13 @@
import java.nio.ByteBuffer
import java.nio.channels.{SocketChannel, WritableByteChannel, ReadableByteChannel}
import java.io.EOFException
-import org.fusesource.hawtbuf.{BufferEditor, DataByteArrayOutputStream, Buffer}
import org.apache.activemq.apollo.broker.{Sizer, Message}
import org.apache.activemq.apollo.openwire.codec.OpenWireFormat
import org.apache.activemq.apollo.openwire.command._
+import org.apache.activemq.apollo.broker.BufferConversions._
+import org.fusesource.hawtbuf.{DataByteArrayInputStream, DataByteArrayOutputStream, AbstractVarIntSupport, Buffer}
+
+case class CachedEncoding(tight:Boolean, version:Int, buffer:Buffer)
/**
* <p>
@@ -35,11 +38,64 @@
* @author <a href="http://hiramchirino.com">Hiram Chirino</a>
*/
object OpenwireCodec extends Sizer[Command] {
+
+ final val DB_VERSION = OpenWireFormat.DEFAULT_VERSION
+ final val DB_TIGHT_ENCODING = true
+
def encode(message: Message):MessageRecord = {
- throw new UnsupportedOperationException
+ val rc = new MessageRecord
+ rc.protocol = PROTOCOL
+ rc.expiration = message.expiration
+
+ val msg = message.asInstanceOf[OpenwireMessage];
+ rc.buffer = msg.message.getCachedEncoding match {
+ case CachedEncoding(tight, version, buffer) =>
+
+ val boas = new DataByteArrayOutputStream(
+ 1 +
+ AbstractVarIntSupport.computeVarIntSize(version)+
+ buffer.length()
+ )
+
+ boas.writeBoolean(tight)
+ boas.writeVarInt(version)
+ boas.write(buffer)
+ boas.toBuffer
+
+ case _ =>
+
+ val db_format = new OpenWireFormat();
+ db_format.setCacheEnabled(false)
+ db_format.setTightEncodingEnabled(DB_TIGHT_ENCODING)
+ db_format.setVersion(DB_VERSION)
+
+ val size = msg.message.getEncodedSize
+ val boas = new DataByteArrayOutputStream(if(size==0) 1024 else size + 20)
+ boas.writeBoolean(DB_TIGHT_ENCODING)
+ boas.writeVarInt(DB_VERSION)
+ db_format.marshal(msg.message, boas);
+ boas.toBuffer
+
+ }
+ rc
}
+
def decode(message: MessageRecord) = {
- throw new UnsupportedOperationException
+ val buffer = message.buffer.buffer();
+ val bais = new DataByteArrayInputStream(message.buffer)
+ var tight: Boolean = bais.readBoolean()
+ var version: Int = bais.readVarInt()
+ buffer.moveHead(bais.getPos-buffer.offset)
+
+ val db_format = new OpenWireFormat();
+ db_format.setCacheEnabled(false)
+ db_format.setTightEncodingEnabled(tight)
+ db_format.setVersion(version)
+
+ val msg = db_format.unmarshal(bais).asInstanceOf[ActiveMQMessage]
+ msg.setEncodedSize(buffer.length)
+ msg.setCachedEncoding(CachedEncoding(tight, version, buffer))
+ new OpenwireMessage(msg)
}
def size(value: Command) = {
@@ -63,8 +119,7 @@
var next_write_buffer = new DataByteArrayOutputStream(write_buffer_size)
var write_buffer = ByteBuffer.allocate(0)
- val format = new OpenWireFormat();
-
+ val format = new OpenWireFormat(1);
def full = next_write_buffer.size() >= (write_buffer_size >> 1)
def is_empty = write_buffer.remaining() == 0
@@ -84,8 +139,21 @@
} else {
val was_empty = is_empty
command match {
- case frame:Command=>
- format.marshal(frame, next_write_buffer)
+ case command:ActiveMQMessage=>
+ command.getCachedEncoding match {
+ case CachedEncoding(tight, version, buffer) =>
+ // We might be able to re-use the origin format of the message.
+ if( !format.isCacheEnabled && format.isTightEncodingEnabled==tight && format.getVersion==version ) {
+ next_write_buffer.write(buffer)
+ } else {
+ format.marshal(command, next_write_buffer)
+ }
+ case _ =>
+ format.marshal(command, next_write_buffer)
+ }
+
+ case command:Command=>
+ format.marshal(command, next_write_buffer)
}
if( was_empty ) {
ProtocolCodec.BufferState.WAS_EMPTY
@@ -199,7 +267,19 @@
read_waiting_on += 4
next_action = read_header
- rc.asInstanceOf[Command]
+ var command: Command = rc.asInstanceOf[Command]
+
+ // If value caching is NOT enabled, then we potentially re-use the encode
+ // value of the message.
+ command match {
+ case message:ActiveMQMessage =>
+ message.setEncodedSize(size)
+ if( !format.isCacheEnabled ) {
+ message.setCachedEncoding(CachedEncoding(format.isTightEncodingEnabled, format.getVersion, buf))
+ }
+ case _ =>
+ }
+ command
}
def getLastWriteSize = 0
diff --git a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/OpenwireProtocolFactory.scala b/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/OpenwireProtocolFactory.scala
index ccbccad..84726fd 100644
--- a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/OpenwireProtocolFactory.scala
+++ b/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/OpenwireProtocolFactory.scala
@@ -22,6 +22,7 @@
import OpenwireConstants._
import org.apache.activemq.apollo.broker.protocol.{ProtocolCodecFactory, Protocol, ProtocolFactory}
import org.fusesource.hawtbuf.Buffer
+import org.apache.activemq.apollo.util.Log
/**
* <p>
@@ -47,7 +48,7 @@
*
* @author <a href="http://hiramchirino.com">Hiram Chirino</a>
*/
-object OpenwireProtocol extends OpenwireProtocolCodecFactory with Protocol {
+object OpenwireProtocol extends OpenwireProtocolCodecFactory with Protocol with Log {
def createProtocolHandler = new OpenwireProtocolHandler
@@ -58,6 +59,11 @@
def decode(message: MessageRecord) = {
OpenwireCodec.decode(message)
}
+
+ lazy val log_exerimental_warning = {
+ warn("The OpenWire protocol implementation is still experimental and not recommended for production use. Production users should use ActiveMQ instead.")
+ null
+ }
}
/**
@@ -71,13 +77,16 @@
def id = PROTOCOL
- def createProtocolCodec() = new OpenwireCodec();
+ def createProtocolCodec() = {
+ OpenwireProtocol.log_exerimental_warning
+ new OpenwireCodec();
+ }
def isIdentifiable() = true
- def maxIdentificaionLength() = 4 + MAGIC.length
+ def maxIdentificaionLength() = 5 + MAGIC.length
def matchesIdentification(buffer: Buffer):Boolean = {
- buffer.length >= 4 + MAGIC.length && buffer.containsAt(MAGIC, 4)
+ buffer.length >= 4 + MAGIC.length && buffer.containsAt(MAGIC, 5)
}
}
diff --git a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/OpenwireProtocolHandler.scala b/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/OpenwireProtocolHandler.scala
index 9ad8f10..7e3ff70 100644
--- a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/OpenwireProtocolHandler.scala
+++ b/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/OpenwireProtocolHandler.scala
@@ -36,11 +36,11 @@
import command._
import org.apache.activemq.apollo.openwire.dto.{OpenwireConnectionStatusDTO,OpenwireDTO}
import org.apache.activemq.apollo.dto.{AcceptingConnectorDTO, TopicDestinationDTO, DurableSubscriptionDestinationDTO, DestinationDTO}
-import org.apache.activemq.apollo.openwire.DestinationConverter._
import org.apache.activemq.apollo.broker._
import protocol._
import security.SecurityContext
-
+import DestinationConverter._
+import Buffer._
object OpenwireProtocolHandler extends Log {
def unit:Unit = {}
@@ -51,7 +51,7 @@
val preferred_wireformat_settings = new WireFormatInfo();
preferred_wireformat_settings.setVersion(OpenWireFormat.DEFAULT_VERSION);
preferred_wireformat_settings.setStackTraceEnabled(true);
- preferred_wireformat_settings.setCacheEnabled(true);
+ preferred_wireformat_settings.setCacheEnabled(false);
preferred_wireformat_settings.setTcpNoDelayEnabled(true);
preferred_wireformat_settings.setTightEncodingEnabled(true);
preferred_wireformat_settings.setSizePrefixDisabled(false);
@@ -66,6 +66,7 @@
*/
class OpenwireProtocolHandler extends ProtocolHandler {
+ var connection_log:Log = OpenwireProtocolHandler
var minimum_protocol_version = 1
import OpenwireProtocolHandler._
@@ -97,7 +98,6 @@
private def queue = connection.dispatch_queue
- var session_id: AsciiBuffer = _
var wire_format: OpenWireFormat = _
var login: Option[AsciiBuffer] = None
var passcode: Option[AsciiBuffer] = None
@@ -111,6 +111,9 @@
var current_command: Object = _
var codec:OpenwireCodec = _
+ var temp_destination_map = HashMap[ActiveMQDestination, DestinationDTO]()
+
+ def session_id = security_context.session_id
override def create_connection_status = {
var rc = new OpenwireConnectionStatusDTO
@@ -171,15 +174,14 @@
override def on_transport_failure(error: IOException) = {
if (!connection.stopped) {
- error.printStackTrace
suspend_read("shutdown")
- debug(error, "Shutting connection down due to: %s", error)
+ connection_log.info(error, "Shutting connection '%s' down due to: %s", security_context.remote_address, error)
connection.stop
}
}
override def on_transport_connected():Unit = {
- security_context.connection_id = Some(connection.id)
+ connection_log = connection.connector.broker.connection_log
security_context.local_address = connection.transport.getLocalAddress
security_context.remote_address = connection.transport.getRemoteAddress
@@ -197,6 +199,7 @@
reset {
suspend_read("virtual host lookup")
this.host = broker.get_default_virtual_host
+ connection_log = this.host.connection_log
resume_read
if(host==null) {
async_die("Could not find default virtual host")
@@ -354,7 +357,8 @@
def die[T](msg: String, actual:Command=null):T = {
if (!dead) {
dead = true
- debug("Shutting connection down due to: " + msg)
+
+ connection_log.info("OpenWire connection '%s' error: %s", security_context.remote_address, msg)
// TODO: if there are too many open connections we should just close the connection
// without waiting for the error to get sent to the client.
queue.after(die_delay, TimeUnit.MILLISECONDS) {
@@ -409,9 +413,9 @@
// Give the client some info about this broker.
val brokerInfo = new BrokerInfo();
- brokerInfo.setBrokerId(new BrokerId(host.config.id));
- brokerInfo.setBrokerName(host.config.id);
- brokerInfo.setBrokerURL(host.broker.get_connect_address);
+ brokerInfo.setBrokerId(new BrokerId(utf8(host.config.id)));
+ brokerInfo.setBrokerName(utf8(host.config.id));
+ brokerInfo.setBrokerURL(utf8(host.broker.get_connect_address));
connection_session.offer(brokerInfo);
}
@@ -421,11 +425,12 @@
def on_connection_info(info: ConnectionInfo) = {
val id = info.getConnectionId()
- if (!all_connections.contains(id)) {
+ if (connection_context==null) {
new ConnectionContext(info).attach
- security_context.user = info.getUserName
- security_context.password = info.getPassword
+ security_context.user = Option(info.getUserName).map(_.toString).getOrElse(null)
+ security_context.password = Option(info.getPassword).map(_.toString).getOrElse(null)
+ security_context.session_id = Some(OPENWIRE_PARSER.sanitize_destination_part(info.getConnectionId.toString))
reset {
if( host.authenticator!=null && host.authorizer!=null ) {
@@ -458,7 +463,7 @@
def on_session_info(info: SessionInfo) = {
val id = info.getSessionId();
if (!all_sessions.contains(id)) {
- val parent = all_connections.get(id.getParentId()).getOrElse(die("Cannot add a session to a connection that had not been registered."))
+ val parent = get_context(id.getParentId())
new SessionContext(parent, info).attach
}
ack(info);
@@ -484,7 +489,7 @@
}
def on_destination_info(info:DestinationInfo) = {
- val destinations = to_destination_dto(info.getDestination)
+ val destinations = to_destination_dto(info.getDestination, this)
// if( info.getDestination.isTemporary ) {
// destinations.foreach(_.temp_owner = connection.id)
// }
@@ -506,7 +511,7 @@
def on_remove_info(info: RemoveInfo) = {
info.getObjectId match {
- case id: ConnectionId => all_connections.get(id).foreach(_.dettach)
+ case id: ConnectionId => Option(connection_context).foreach(_.dettach)
case id: SessionId => all_sessions.get(id).foreach(_.dettach)
case id: ProducerId => all_producers.get(id).foreach(_.dettach)
case id: ConsumerId => all_consumers.get(id).foreach(_.dettach )
@@ -516,8 +521,15 @@
ack(info)
}
+ def get_context(id:ConnectionId) = {
+ if(connection_context!=null && connection_context.info.getConnectionId == id)
+ connection_context
+ else
+ die("Cannot add a session to a connection that had not been registered.")
+ }
+
def on_transaction_info(info:TransactionInfo) = {
- val parent = all_connections.get(info.getConnectionId()).getOrElse(die("Cannot add a session to a connection that had not been registered."))
+ val parent = get_context(info.getConnectionId())
val id = info.getTransactionId
info.getType match {
case TransactionInfo.BEGIN =>
@@ -591,7 +603,7 @@
def perform_send(msg:ActiveMQMessage, uow:StoreUOW=null): Unit = {
- val destiantion = to_destination_dto(msg.getDestination)
+ val destiantion = to_destination_dto(msg.getDestination, this)
val key = destiantion.toList
producerRoutes.get(key) match {
case null =>
@@ -634,7 +646,13 @@
// We may need to add some headers..
val delivery = new Delivery
delivery.message = new OpenwireMessage(message)
- delivery.size = message.getSize
+ delivery.size = {
+ val rc = message.getEncodedSize
+ if( rc != 0 )
+ rc
+ else
+ message.getSize
+ }
delivery.uow = uow
if( message.isResponseRequired ) {
@@ -685,8 +703,8 @@
// host.createQueue(destination);
// return ack(info);
// }
-
- val all_connections = new HashMap[ConnectionId, ConnectionContext]();
+ var connection_context:ConnectionContext= null
+
val all_sessions = new HashMap[SessionId, SessionContext]();
val all_producers = new HashMap[ProducerId, ProducerContext]();
val all_consumers = new HashMap[ConsumerId, ConsumerContext]();
@@ -701,15 +719,18 @@
def default_session_id = new SessionId(info.getConnectionId(), -1)
def attach = {
+ if( connection_context!=null ) {
+ die("Only one logic connection is supported.")
+ }
// create the default session.
new SessionContext(this, new SessionInfo(default_session_id)).attach
- all_connections.put(info.getConnectionId, this)
+ connection_context = this
}
def dettach = {
sessions.values.toArray.foreach(_.dettach)
transactions.values.toArray.foreach(_.dettach)
- all_connections.remove(info.getConnectionId)
+ connection_context = null
}
}
@@ -811,7 +832,7 @@
def attach = {
if( info.getDestination == null ) fail("destination was not set")
- destination = to_destination_dto(info.getDestination)
+ destination = to_destination_dto(info.getDestination, OpenwireProtocolHandler.this)
// if they are temp dests.. attach our owner id so that we don't
// get rejected.
@@ -827,7 +848,7 @@
case null=> null
case x=>
try {
- SelectorParser.parse(x)
+ SelectorParser.parse(x.toString)
} catch {
case e:FilterException =>
fail("Invalid selector expression: "+e.getMessage)
@@ -843,7 +864,7 @@
subscription_id += info.getSubscriptionName
val rc = new DurableSubscriptionDestinationDTO(subscription_id)
- rc.selector = info.getSelector
+ rc.selector = Option(info.getSelector).map(_.toString).getOrElse(null)
destination.foreach { _ match {
case x:TopicDestinationDTO=>
diff --git a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/BaseDataStreamMarshaller.java b/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/BaseDataStreamMarshaller.java
new file mode 100644
index 0000000..b8d1829
--- /dev/null
+++ b/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/BaseDataStreamMarshaller.java
@@ -0,0 +1,621 @@
+/**
+ * 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.openwire.codec;
+
+import org.apache.activemq.apollo.openwire.command.DataStructure;
+import org.fusesource.hawtbuf.Buffer;
+import org.fusesource.hawtbuf.DataByteArrayInputStream;
+import org.fusesource.hawtbuf.DataByteArrayOutputStream;
+import org.fusesource.hawtbuf.UTF8Buffer;
+
+import java.io.IOException;
+import java.lang.reflect.Constructor;
+
+public abstract class BaseDataStreamMarshaller implements DataStreamMarshaller {
+
+ public static final Constructor STACK_TRACE_ELEMENT_CONSTRUCTOR;
+
+ static {
+ Constructor constructor = null;
+ try {
+ constructor = StackTraceElement.class.getConstructor(new Class[] {UTF8Buffer.class, UTF8Buffer.class,
+ UTF8Buffer.class, int.class});
+ } catch (Throwable e) {
+ }
+ STACK_TRACE_ELEMENT_CONSTRUCTOR = constructor;
+ }
+
+ public abstract byte getDataStructureType();
+
+ public abstract DataStructure createObject();
+
+ public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
+ return 0;
+ }
+
+ public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataByteArrayOutputStream dataOut, BooleanStream bs)
+ throws IOException {
+ }
+
+ public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataByteArrayInputStream dataIn, BooleanStream bs)
+ throws IOException {
+ }
+
+ public int tightMarshalLong1(OpenWireFormat wireFormat, long o, BooleanStream bs) throws IOException {
+ if (o == 0) {
+ bs.writeBoolean(false);
+ bs.writeBoolean(false);
+ return 0;
+ } else if ((o & 0xFFFFFFFFFFFF0000L) == 0) {
+ bs.writeBoolean(false);
+ bs.writeBoolean(true);
+ return 2;
+ } else if ((o & 0xFFFFFFFF00000000L) == 0) {
+ bs.writeBoolean(true);
+ bs.writeBoolean(false);
+ return 4;
+ } else {
+ bs.writeBoolean(true);
+ bs.writeBoolean(true);
+ return 8;
+ }
+ }
+
+ public void tightMarshalLong2(OpenWireFormat wireFormat, long o, DataByteArrayOutputStream dataOut, BooleanStream bs)
+ throws IOException {
+ if (bs.readBoolean()) {
+ if (bs.readBoolean()) {
+ dataOut.writeLong(o);
+ } else {
+ dataOut.writeInt((int)o);
+ }
+ } else {
+ if (bs.readBoolean()) {
+ dataOut.writeShort((int)o);
+ }
+ }
+ }
+
+ public long tightUnmarshalLong(OpenWireFormat wireFormat, DataByteArrayInputStream dataIn, BooleanStream bs)
+ throws IOException {
+ if (bs.readBoolean()) {
+ if (bs.readBoolean()) {
+ return dataIn.readLong();
+ } else {
+ return toLong(dataIn.readInt());
+ }
+ } else {
+ if (bs.readBoolean()) {
+ return toLong(dataIn.readShort());
+ } else {
+ return 0;
+ }
+ }
+ }
+
+ protected long toLong(short value) {
+ // lets handle negative values
+ long answer = value;
+ return answer & 0xffffL;
+ }
+
+ protected long toLong(int value) {
+ // lets handle negative values
+ long answer = value;
+ return answer & 0xffffffffL;
+ }
+
+ protected DataStructure tightUnmarsalNestedObject(OpenWireFormat wireFormat, DataByteArrayInputStream dataIn,
+ BooleanStream bs) throws IOException {
+ return wireFormat.tightUnmarshalNestedObject(dataIn, bs);
+ }
+
+ protected int tightMarshalNestedObject1(OpenWireFormat wireFormat, DataStructure o, BooleanStream bs)
+ throws IOException {
+ return wireFormat.tightMarshalNestedObject1(o, bs);
+ }
+
+ protected void tightMarshalNestedObject2(OpenWireFormat wireFormat, DataStructure o, DataByteArrayOutputStream dataOut,
+ BooleanStream bs) throws IOException {
+ wireFormat.tightMarshalNestedObject2(o, dataOut, bs);
+ }
+
+ protected DataStructure tightUnmarsalCachedObject(OpenWireFormat wireFormat, DataByteArrayInputStream dataIn,
+ BooleanStream bs) throws IOException {
+ if (wireFormat.isCacheEnabled()) {
+ if (bs.readBoolean()) {
+ short index = dataIn.readShort();
+ DataStructure object = wireFormat.tightUnmarshalNestedObject(dataIn, bs);
+ wireFormat.setInUnmarshallCache(index, object);
+ return object;
+ } else {
+ short index = dataIn.readShort();
+ return wireFormat.getFromUnmarshallCache(index);
+ }
+ } else {
+ return wireFormat.tightUnmarshalNestedObject(dataIn, bs);
+ }
+ }
+
+ protected int tightMarshalCachedObject1(OpenWireFormat wireFormat, DataStructure o, BooleanStream bs)
+ throws IOException {
+ if (wireFormat.isCacheEnabled()) {
+ Short index = wireFormat.getMarshallCacheIndex(o);
+ bs.writeBoolean(index == null);
+ if (index == null) {
+ int rc = wireFormat.tightMarshalNestedObject1(o, bs);
+ wireFormat.addToMarshallCache(o);
+ return 2 + rc;
+ } else {
+ return 2;
+ }
+ } else {
+ return wireFormat.tightMarshalNestedObject1(o, bs);
+ }
+ }
+
+ protected void tightMarshalCachedObject2(OpenWireFormat wireFormat, DataStructure o, DataByteArrayOutputStream dataOut,
+ BooleanStream bs) throws IOException {
+ if (wireFormat.isCacheEnabled()) {
+ Short index = wireFormat.getMarshallCacheIndex(o);
+ if (bs.readBoolean()) {
+ dataOut.writeShort(index.shortValue());
+ wireFormat.tightMarshalNestedObject2(o, dataOut, bs);
+ } else {
+ dataOut.writeShort(index.shortValue());
+ }
+ } else {
+ wireFormat.tightMarshalNestedObject2(o, dataOut, bs);
+ }
+ }
+
+ protected Throwable tightUnmarsalThrowable(OpenWireFormat wireFormat, DataByteArrayInputStream dataIn, BooleanStream bs)
+ throws IOException {
+ if (bs.readBoolean()) {
+ UTF8Buffer clazz = tightUnmarshalString(dataIn, bs);
+ UTF8Buffer message = tightUnmarshalString(dataIn, bs);
+ Throwable o = createThrowable(clazz, message);
+ if (wireFormat.isStackTraceEnabled()) {
+ if (STACK_TRACE_ELEMENT_CONSTRUCTOR != null) {
+ StackTraceElement ss[] = new StackTraceElement[dataIn.readShort()];
+ for (int i = 0; i < ss.length; i++) {
+ try {
+ ss[i] = (StackTraceElement)STACK_TRACE_ELEMENT_CONSTRUCTOR
+ .newInstance(new Object[] {tightUnmarshalString(dataIn, bs),
+ tightUnmarshalString(dataIn, bs),
+ tightUnmarshalString(dataIn, bs),
+ Integer.valueOf(dataIn.readInt())});
+ } catch (IOException e) {
+ throw e;
+ } catch (Throwable e) {
+ }
+ }
+ o.setStackTrace(ss);
+ } else {
+ short size = dataIn.readShort();
+ for (int i = 0; i < size; i++) {
+ tightUnmarshalString(dataIn, bs);
+ tightUnmarshalString(dataIn, bs);
+ tightUnmarshalString(dataIn, bs);
+ dataIn.readInt();
+ }
+ }
+ o.initCause(tightUnmarsalThrowable(wireFormat, dataIn, bs));
+
+ }
+ return o;
+ } else {
+ return null;
+ }
+ }
+
+ private Throwable createThrowable(UTF8Buffer className, UTF8Buffer message) {
+ try {
+ Class clazz = Class.forName(className.toString(), false, BaseDataStreamMarshaller.class.getClassLoader());
+ Constructor constructor = clazz.getConstructor(new Class[] {UTF8Buffer.class});
+ return (Throwable)constructor.newInstance(new Object[] {message.toString()});
+ } catch (Throwable e) {
+ return new Throwable(className + ": " + message);
+ }
+ }
+
+ protected int tightMarshalThrowable1(OpenWireFormat wireFormat, Throwable o, BooleanStream bs)
+ throws IOException {
+ if (o == null) {
+ bs.writeBoolean(false);
+ return 0;
+ } else {
+ int rc = 0;
+ bs.writeBoolean(true);
+ rc += tightMarshalString1(new UTF8Buffer(o.getClass().getName()), bs);
+ rc += tightMarshalString1(new UTF8Buffer(o.getMessage()), bs);
+ if (wireFormat.isStackTraceEnabled()) {
+ rc += 2;
+ StackTraceElement[] stackTrace = o.getStackTrace();
+ for (int i = 0; i < stackTrace.length; i++) {
+ StackTraceElement element = stackTrace[i];
+ rc += tightMarshalString1(new UTF8Buffer(element.getClassName()), bs);
+ rc += tightMarshalString1(new UTF8Buffer(element.getMethodName()), bs);
+ rc += tightMarshalString1(new UTF8Buffer(element.getFileName()), bs);
+ rc += 4;
+ }
+ rc += tightMarshalThrowable1(wireFormat, o.getCause(), bs);
+ }
+ return rc;
+ }
+ }
+
+ protected void tightMarshalThrowable2(OpenWireFormat wireFormat, Throwable o, DataByteArrayOutputStream dataOut,
+ BooleanStream bs) throws IOException {
+ if (bs.readBoolean()) {
+ tightMarshalString2(new UTF8Buffer(o.getClass().getName()), dataOut, bs);
+ tightMarshalString2(new UTF8Buffer(o.getMessage()), dataOut, bs);
+ if (wireFormat.isStackTraceEnabled()) {
+ StackTraceElement[] stackTrace = o.getStackTrace();
+ dataOut.writeShort(stackTrace.length);
+ for (int i = 0; i < stackTrace.length; i++) {
+ StackTraceElement element = stackTrace[i];
+ tightMarshalString2(new UTF8Buffer(element.getClassName()), dataOut, bs);
+ tightMarshalString2(new UTF8Buffer(element.getMethodName()), dataOut, bs);
+ tightMarshalString2(new UTF8Buffer(element.getFileName()), dataOut, bs);
+ dataOut.writeInt(element.getLineNumber());
+ }
+ tightMarshalThrowable2(wireFormat, o.getCause(), dataOut, bs);
+ }
+ }
+ }
+
+ @SuppressWarnings("deprecation")
+ protected UTF8Buffer tightUnmarshalString(DataByteArrayInputStream dataIn, BooleanStream bs) throws IOException {
+ if (bs.readBoolean()) {
+ boolean ascii = bs.readBoolean(); // ignored for now.
+ int size = dataIn.readShort();
+ return dataIn.readBuffer(size).utf8();
+ } else {
+ return null;
+ }
+ }
+
+ protected int tightMarshalString1(UTF8Buffer value, BooleanStream bs) throws IOException {
+ bs.writeBoolean(value != null);
+ if (value != null) {
+
+ boolean ascii = false;
+// we could check to see if its' really ascii.. for now punt.
+// boolean ascii = true;
+// int last = value.offset+value.length;
+// for (int i = value.offset; i < last; i++) {
+// if( (value.data[i] & 0x80) !=0 ) {
+// ascii = false;
+// }
+// }
+
+ bs.writeBoolean(ascii);
+ return value.length() + 2;
+
+ } else {
+ return 0;
+ }
+ }
+
+ protected void tightMarshalString2(UTF8Buffer value, DataByteArrayOutputStream dataOut, BooleanStream bs) throws IOException {
+ if (bs.readBoolean()) {
+ // If we verified it only holds ascii values
+ bs.readBoolean();
+ dataOut.writeShort(value.length);
+ dataOut.write(value);
+ }
+ }
+
+ protected int tightMarshalObjectArray1(OpenWireFormat wireFormat, DataStructure[] objects,
+ BooleanStream bs) throws IOException {
+ if (objects != null) {
+ int rc = 0;
+ bs.writeBoolean(true);
+ rc += 2;
+ for (int i = 0; i < objects.length; i++) {
+ rc += tightMarshalNestedObject1(wireFormat, objects[i], bs);
+ }
+ return rc;
+ } else {
+ bs.writeBoolean(false);
+ return 0;
+ }
+ }
+
+ protected void tightMarshalObjectArray2(OpenWireFormat wireFormat, DataStructure[] objects,
+ DataByteArrayOutputStream dataOut, BooleanStream bs) throws IOException {
+ if (bs.readBoolean()) {
+ dataOut.writeShort(objects.length);
+ for (int i = 0; i < objects.length; i++) {
+ tightMarshalNestedObject2(wireFormat, objects[i], dataOut, bs);
+ }
+ }
+ }
+
+ protected int tightMarshalConstByteArray1(byte[] data, BooleanStream bs, int i) throws IOException {
+ return i;
+ }
+
+ protected void tightMarshalConstByteArray2(byte[] data, DataByteArrayOutputStream dataOut, BooleanStream bs, int i)
+ throws IOException {
+ dataOut.write(data, 0, i);
+ }
+
+ protected byte[] tightUnmarshalConstByteArray(DataByteArrayInputStream dataIn, BooleanStream bs, int i)
+ throws IOException {
+ byte data[] = new byte[i];
+ dataIn.readFully(data);
+ return data;
+ }
+
+ protected int tightMarshalByteArray1(byte[] data, BooleanStream bs) throws IOException {
+ bs.writeBoolean(data != null);
+ if (data != null) {
+ return data.length + 4;
+ } else {
+ return 0;
+ }
+ }
+
+ protected void tightMarshalByteArray2(byte[] data, DataByteArrayOutputStream dataOut, BooleanStream bs)
+ throws IOException {
+ if (bs.readBoolean()) {
+ dataOut.writeInt(data.length);
+ dataOut.write(data);
+ }
+ }
+
+ protected byte[] tightUnmarshalByteArray(DataByteArrayInputStream dataIn, BooleanStream bs) throws IOException {
+ byte rc[] = null;
+ if (bs.readBoolean()) {
+ int size = dataIn.readInt();
+ rc = new byte[size];
+ dataIn.readFully(rc);
+ }
+ return rc;
+ }
+
+ protected int tightMarshalBuffer1(Buffer data, BooleanStream bs) throws IOException {
+ bs.writeBoolean(data != null);
+ if (data != null) {
+ return data.getLength() + 4;
+ } else {
+ return 0;
+ }
+ }
+
+ protected void tightMarshalBuffer2(Buffer data, DataByteArrayOutputStream dataOut, BooleanStream bs)
+ throws IOException {
+ if (bs.readBoolean()) {
+ dataOut.writeInt(data.getLength());
+ dataOut.write(data.getData(), data.getOffset(), data.getLength());
+ }
+ }
+
+ protected Buffer tightUnmarshalBuffer(DataByteArrayInputStream dataIn, BooleanStream bs) throws IOException {
+ Buffer rc = null;
+ if (bs.readBoolean()) {
+ int size = dataIn.readInt();
+ byte[] t = new byte[size];
+ dataIn.readFully(t);
+ return new Buffer(t, 0, size);
+ }
+ return rc;
+ }
+
+ //
+ // The loose marshaling logic
+ //
+
+ public void looseMarshal(OpenWireFormat wireFormat, Object o, DataByteArrayOutputStream dataOut) throws IOException {
+ }
+
+ public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataByteArrayInputStream dataIn) throws IOException {
+ }
+
+ public void looseMarshalLong(OpenWireFormat wireFormat, long o, DataByteArrayOutputStream dataOut) throws IOException {
+ dataOut.writeLong(o);
+ }
+
+ public long looseUnmarshalLong(OpenWireFormat wireFormat, DataByteArrayInputStream dataIn) throws IOException {
+ return dataIn.readLong();
+ }
+
+ protected DataStructure looseUnmarsalNestedObject(OpenWireFormat wireFormat, DataByteArrayInputStream dataIn)
+ throws IOException {
+ return wireFormat.looseUnmarshalNestedObject(dataIn);
+ }
+
+ protected void looseMarshalNestedObject(OpenWireFormat wireFormat, DataStructure o, DataByteArrayOutputStream dataOut)
+ throws IOException {
+ wireFormat.looseMarshalNestedObject(o, dataOut);
+ }
+
+ protected DataStructure looseUnmarsalCachedObject(OpenWireFormat wireFormat, DataByteArrayInputStream dataIn)
+ throws IOException {
+ if (wireFormat.isCacheEnabled()) {
+ if (dataIn.readBoolean()) {
+ short index = dataIn.readShort();
+ DataStructure object = wireFormat.looseUnmarshalNestedObject(dataIn);
+ wireFormat.setInUnmarshallCache(index, object);
+ return object;
+ } else {
+ short index = dataIn.readShort();
+ return wireFormat.getFromUnmarshallCache(index);
+ }
+ } else {
+ return wireFormat.looseUnmarshalNestedObject(dataIn);
+ }
+ }
+
+ protected void looseMarshalCachedObject(OpenWireFormat wireFormat, DataStructure o, DataByteArrayOutputStream dataOut)
+ throws IOException {
+ if (wireFormat.isCacheEnabled()) {
+ Short index = wireFormat.getMarshallCacheIndex(o);
+ dataOut.writeBoolean(index == null);
+ if (index == null) {
+ index = wireFormat.addToMarshallCache(o);
+ dataOut.writeShort(index.shortValue());
+ wireFormat.looseMarshalNestedObject(o, dataOut);
+ } else {
+ dataOut.writeShort(index.shortValue());
+ }
+ } else {
+ wireFormat.looseMarshalNestedObject(o, dataOut);
+ }
+ }
+
+ protected Throwable looseUnmarsalThrowable(OpenWireFormat wireFormat, DataByteArrayInputStream dataIn)
+ throws IOException {
+ if (dataIn.readBoolean()) {
+ UTF8Buffer clazz = looseUnmarshalString(dataIn);
+ UTF8Buffer message = looseUnmarshalString(dataIn);
+ Throwable o = createThrowable(clazz, message);
+ if (wireFormat.isStackTraceEnabled()) {
+ if (STACK_TRACE_ELEMENT_CONSTRUCTOR != null) {
+ StackTraceElement ss[] = new StackTraceElement[dataIn.readShort()];
+ for (int i = 0; i < ss.length; i++) {
+ try {
+ ss[i] = (StackTraceElement)STACK_TRACE_ELEMENT_CONSTRUCTOR
+ .newInstance(new Object[] {looseUnmarshalString(dataIn),
+ looseUnmarshalString(dataIn),
+ looseUnmarshalString(dataIn),
+ Integer.valueOf(dataIn.readInt())});
+ } catch (IOException e) {
+ throw e;
+ } catch (Throwable e) {
+ }
+ }
+ o.setStackTrace(ss);
+ } else {
+ short size = dataIn.readShort();
+ for (int i = 0; i < size; i++) {
+ looseUnmarshalString(dataIn);
+ looseUnmarshalString(dataIn);
+ looseUnmarshalString(dataIn);
+ dataIn.readInt();
+ }
+ }
+ o.initCause(looseUnmarsalThrowable(wireFormat, dataIn));
+
+ }
+ return o;
+ } else {
+ return null;
+ }
+ }
+
+ protected void looseMarshalThrowable(OpenWireFormat wireFormat, Throwable o, DataByteArrayOutputStream dataOut)
+ throws IOException {
+ dataOut.writeBoolean(o != null);
+ if (o != null) {
+ looseMarshalString(new UTF8Buffer(o.getClass().getName()), dataOut);
+ looseMarshalString(new UTF8Buffer(o.getMessage()), dataOut);
+ if (wireFormat.isStackTraceEnabled()) {
+ StackTraceElement[] stackTrace = o.getStackTrace();
+ dataOut.writeShort(stackTrace.length);
+ for (int i = 0; i < stackTrace.length; i++) {
+ StackTraceElement element = stackTrace[i];
+ looseMarshalString(new UTF8Buffer(element.getClassName()), dataOut);
+ looseMarshalString(new UTF8Buffer(element.getMethodName()), dataOut);
+ looseMarshalString(new UTF8Buffer(element.getFileName()), dataOut);
+ dataOut.writeInt(element.getLineNumber());
+ }
+ looseMarshalThrowable(wireFormat, o.getCause(), dataOut);
+ }
+ }
+ }
+
+ protected UTF8Buffer looseUnmarshalString(DataByteArrayInputStream dataIn) throws IOException {
+ if (dataIn.readBoolean()) {
+ int size = dataIn.readShort();
+ return dataIn.readBuffer(size).utf8();
+ } else {
+ return null;
+ }
+ }
+
+ protected void looseMarshalString(UTF8Buffer value, DataByteArrayOutputStream dataOut) throws IOException {
+ dataOut.writeBoolean(value != null);
+ if (value != null) {
+ dataOut.writeShort(value.length);
+ dataOut.write(value);
+ }
+ }
+
+ protected void looseMarshalObjectArray(OpenWireFormat wireFormat, DataStructure[] objects,
+ DataByteArrayOutputStream dataOut) throws IOException {
+ dataOut.writeBoolean(objects != null);
+ if (objects != null) {
+ dataOut.writeShort(objects.length);
+ for (int i = 0; i < objects.length; i++) {
+ looseMarshalNestedObject(wireFormat, objects[i], dataOut);
+ }
+ }
+ }
+
+ protected void looseMarshalConstByteArray(OpenWireFormat wireFormat, byte[] data, DataByteArrayOutputStream dataOut,
+ int i) throws IOException {
+ dataOut.write(data, 0, i);
+ }
+
+ protected byte[] looseUnmarshalConstByteArray(DataByteArrayInputStream dataIn, int i) throws IOException {
+ byte data[] = new byte[i];
+ dataIn.readFully(data);
+ return data;
+ }
+
+ protected void looseMarshalByteArray(OpenWireFormat wireFormat, byte[] data, DataByteArrayOutputStream dataOut)
+ throws IOException {
+ dataOut.writeBoolean(data != null);
+ if (data != null) {
+ dataOut.writeInt(data.length);
+ dataOut.write(data);
+ }
+ }
+
+ protected byte[] looseUnmarshalByteArray(DataByteArrayInputStream dataIn) throws IOException {
+ byte rc[] = null;
+ if (dataIn.readBoolean()) {
+ int size = dataIn.readInt();
+ rc = new byte[size];
+ dataIn.readFully(rc);
+ }
+ return rc;
+ }
+
+ protected void looseMarshalBuffer(OpenWireFormat wireFormat, Buffer data, DataByteArrayOutputStream dataOut)
+ throws IOException {
+ dataOut.writeBoolean(data != null);
+ if (data != null) {
+ dataOut.writeInt(data.getLength());
+ dataOut.write(data.getData(), data.getOffset(), data.getLength());
+ }
+ }
+
+ protected Buffer looseUnmarshalBuffer(DataByteArrayInputStream dataIn) throws IOException {
+ Buffer rc = null;
+ if (dataIn.readBoolean()) {
+ int size = dataIn.readInt();
+ byte[] t = new byte[size];
+ dataIn.readFully(t);
+ rc = new Buffer(t, 0, size);
+ }
+ return rc;
+ }
+}
diff --git a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/DataStreamMarshaller.java b/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/DataStreamMarshaller.java
index 335ddfe..bc6a88b 100755
--- a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/DataStreamMarshaller.java
+++ b/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/DataStreamMarshaller.java
@@ -16,11 +16,11 @@
*/
package org.apache.activemq.apollo.openwire.codec;
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-
import org.apache.activemq.apollo.openwire.command.DataStructure;
+import org.fusesource.hawtbuf.DataByteArrayInputStream;
+import org.fusesource.hawtbuf.DataByteArrayOutputStream;
+
+import java.io.IOException;
public interface DataStreamMarshaller {
@@ -28,10 +28,10 @@
DataStructure createObject();
int tightMarshal1(OpenWireFormat format, Object c, BooleanStream bs) throws IOException;
- void tightMarshal2(OpenWireFormat format, Object c, DataOutput ds, BooleanStream bs) throws IOException;
- void tightUnmarshal(OpenWireFormat format, Object data, DataInput dis, BooleanStream bs) throws IOException;
+ void tightMarshal2(OpenWireFormat format, Object c, DataByteArrayOutputStream ds, BooleanStream bs) throws IOException;
+ void tightUnmarshal(OpenWireFormat format, Object data, DataByteArrayInputStream dis, BooleanStream bs) throws IOException;
- void looseMarshal(OpenWireFormat format, Object c, DataOutput ds) throws IOException;
- void looseUnmarshal(OpenWireFormat format, Object data, DataInput dis) throws IOException;
+ void looseMarshal(OpenWireFormat format, Object c, DataByteArrayOutputStream ds) throws IOException;
+ void looseUnmarshal(OpenWireFormat format, Object data, DataByteArrayInputStream dis) throws IOException;
}
diff --git a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/OpenWireFormat.java b/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/OpenWireFormat.java
index e891a3c..9d76e38 100644
--- a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/OpenWireFormat.java
+++ b/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/OpenWireFormat.java
@@ -24,13 +24,12 @@
import org.fusesource.hawtbuf.DataByteArrayInputStream;
import org.fusesource.hawtbuf.DataByteArrayOutputStream;
-import java.io.DataInput;
-import java.io.DataOutput;
import java.io.IOException;
import java.lang.reflect.Method;
import java.nio.channels.ReadableByteChannel;
import java.util.HashMap;
import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicBoolean;
/**
@@ -194,7 +193,7 @@
public synchronized Object unmarshal(Buffer sequence) throws IOException {
bytesIn.restart(sequence);
- // DataInputStream dis = new DataInputStream(new
+ // DataByteArrayInputStreamStream dis = new DataByteArrayInputStreamStream(new
// ByteArrayInputStream(sequence));
if (!sizePrefixDisabled) {
@@ -219,7 +218,7 @@
return command;
}
- public synchronized void marshal(Object o, DataOutput dataOut) throws IOException {
+ public synchronized void marshal(Object o, DataByteArrayOutputStream dataOut) throws IOException {
if (cacheEnabled) {
runMarshallCacheEvictionSweep();
@@ -248,7 +247,7 @@
dsm.tightMarshal2(this, c, dataOut, bs);
} else {
- DataOutput looseOut = dataOut;
+ DataByteArrayOutputStream looseOut = dataOut;
if (!sizePrefixDisabled) {
bytesOut.restart();
@@ -274,8 +273,8 @@
}
}
- public Object unmarshal(DataInput dis) throws IOException {
- DataInput dataIn = dis;
+ public Object unmarshal(DataByteArrayInputStream dis) throws IOException {
+ DataByteArrayInputStream dataIn = dis;
if (!sizePrefixDisabled) {
int size = dis.readInt();
if (size > maxFrameSize) {
@@ -315,7 +314,7 @@
* Used by NIO or AIO transports; note that the size is not written as part
* of this method.
*/
- public void tightMarshal2(Object o, DataOutput ds, BooleanStream bs) throws IOException {
+ public void tightMarshal2(Object o, DataByteArrayOutputStream ds, BooleanStream bs) throws IOException {
if (cacheEnabled) {
runMarshallCacheEvictionSweep();
}
@@ -333,6 +332,8 @@
}
}
+ final static ConcurrentHashMap<Integer, DataStreamMarshaller[]> versions = new ConcurrentHashMap<Integer, DataStreamMarshaller[]>();
+
/**
* Allows you to dynamically switch the version of the openwire protocol
* being used.
@@ -340,23 +341,29 @@
* @param version
*/
public void setVersion(int version) {
- String mfName = getClass().getPackage().getName()+".v" + version + ".MarshallerFactory";
- Class mfClass;
- try {
- mfClass = Class.forName(mfName, false, getClass().getClassLoader());
- } catch (ClassNotFoundException e) {
- throw (IllegalArgumentException) new IllegalArgumentException("Invalid version: " + version + ", could not load " + mfName).initCause(e);
+ // We use the version cache to avoid doing reflection every time the version gets set.
+ DataStreamMarshaller[] marshallers = versions.get(version);
+ if( marshallers ==null ) {
+ String mfName = getClass().getPackage().getName()+".v" + version + ".MarshallerFactory";
+ Class mfClass;
+ try {
+ mfClass = Class.forName(mfName, false, getClass().getClassLoader());
+ } catch (ClassNotFoundException e) {
+ throw (IllegalArgumentException) new IllegalArgumentException("Invalid version: " + version + ", could not load " + mfName).initCause(e);
+ }
+ try {
+ Method method = mfClass.getMethod("createMarshallerMap", new Class[] { OpenWireFormat.class });
+ marshallers = (DataStreamMarshaller[]) method.invoke(null, new Object[] { this });
+ } catch (Throwable e) {
+ throw (IllegalArgumentException) new IllegalArgumentException("Invalid version: " + version + ", " + mfName + " does not properly implement the createMarshallerMap method.").initCause(e);
+ }
+ versions.put(version, marshallers);
}
- try {
- Method method = mfClass.getMethod("createMarshallerMap", new Class[] { OpenWireFormat.class });
- dataMarshallers = (DataStreamMarshaller[]) method.invoke(null, new Object[] { this });
- } catch (Throwable e) {
- throw (IllegalArgumentException) new IllegalArgumentException("Invalid version: " + version + ", " + mfName + " does not properly implement the createMarshallerMap method.").initCause(e);
- }
+ this.dataMarshallers = marshallers;
this.version = version;
}
- public Object doUnmarshal(DataInput dis) throws IOException {
+ public Object doUnmarshal(DataByteArrayInputStream dis) throws IOException {
byte dataType = dis.readByte();
receivingMessage.set(true);
if (dataType != NULL_TYPE) {
@@ -408,7 +415,7 @@
return 1 + dsm.tightMarshal1(this, o, bs);
}
- public void tightMarshalNestedObject2(DataStructure o, DataOutput ds, BooleanStream bs) throws IOException {
+ public void tightMarshalNestedObject2(DataStructure o, DataByteArrayOutputStream ds, BooleanStream bs) throws IOException {
if (!bs.readBoolean()) {
return;
}
@@ -430,7 +437,7 @@
}
}
- public DataStructure tightUnmarshalNestedObject(DataInput dis, BooleanStream bs) throws IOException {
+ public DataStructure tightUnmarshalNestedObject(DataByteArrayInputStream dis, BooleanStream bs) throws IOException {
if (bs.readBoolean()) {
byte dataType = dis.readByte();
@@ -463,7 +470,7 @@
}
}
- public DataStructure looseUnmarshalNestedObject(DataInput dis) throws IOException {
+ public DataStructure looseUnmarshalNestedObject(DataByteArrayInputStream dis) throws IOException {
if (dis.readBoolean()) {
byte dataType = dis.readByte();
@@ -480,7 +487,7 @@
}
}
- public void looseMarshalNestedObject(DataStructure o, DataOutput dataOut) throws IOException {
+ public void looseMarshalNestedObject(DataStructure o, DataByteArrayOutputStream dataOut) throws IOException {
dataOut.writeBoolean(o != null);
if (o != null) {
byte type = o.getDataStructureType();
diff --git a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ActiveMQBytesMessageMarshaller.java b/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ActiveMQBytesMessageMarshaller.java
deleted file mode 100755
index c45957c..0000000
--- a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ActiveMQBytesMessageMarshaller.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/**
- * 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.openwire.codec.v1;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.activemq.apollo.openwire.command.ActiveMQBytesMessage;
-import org.apache.activemq.apollo.openwire.command.DataStructure;
-import org.apache.activemq.apollo.openwire.codec.BooleanStream;
-import org.apache.activemq.apollo.openwire.codec.OpenWireFormat;
-
-
-
-/**
- * Marshalling code for Open Wire Format for ActiveMQBytesMessageMarshaller
- *
- *
- * NOTE!: This file is auto generated - do not modify!
- * if you need to make a change, please see the modify the groovy scripts in the
- * under src/gram/script and then use maven openwire:generate to regenerate
- * this file.
- *
- */
-public class ActiveMQBytesMessageMarshaller extends ActiveMQMessageMarshaller {
-
- /**
- * Return the type of Data Structure we marshal
- * @return short representation of the type data structure
- */
- public byte getDataStructureType() {
- return ActiveMQBytesMessage.DATA_STRUCTURE_TYPE;
- }
-
- /**
- * @return a new object instance
- */
- public DataStructure createObject() {
- return new ActiveMQBytesMessage();
- }
-
- /**
- * Un-marshal an object instance from the data input stream
- *
- * @param o the object to un-marshal
- * @param dataIn the data input stream to build the object from
- * @throws IOException
- */
- public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException {
- super.tightUnmarshal(wireFormat, o, dataIn, bs);
-
- }
-
-
- /**
- * Write the booleans that this object uses to a BooleanStream
- */
- public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
-
- int rc = super.tightMarshal1(wireFormat, o, bs);
-
- return rc + 0;
- }
-
- /**
- * Write a object instance to data output stream
- *
- * @param o the instance to be marshaled
- * @param dataOut the output stream
- * @throws IOException thrown if an error occurs
- */
- public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException {
- super.tightMarshal2(wireFormat, o, dataOut, bs);
-
- }
-
- /**
- * Un-marshal an object instance from the data input stream
- *
- * @param o the object to un-marshal
- * @param dataIn the data input stream to build the object from
- * @throws IOException
- */
- public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException {
- super.looseUnmarshal(wireFormat, o, dataIn);
-
- }
-
-
- /**
- * Write the booleans that this object uses to a BooleanStream
- */
- public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
-
- super.looseMarshal(wireFormat, o, dataOut);
-
- }
-}
diff --git a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ActiveMQDestinationMarshaller.java b/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ActiveMQDestinationMarshaller.java
deleted file mode 100755
index 3cb1d7e..0000000
--- a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ActiveMQDestinationMarshaller.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/**
- * 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.openwire.codec.v1;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.activemq.apollo.openwire.command.ActiveMQDestination;
-import org.apache.activemq.apollo.openwire.codec.BooleanStream;
-import org.apache.activemq.apollo.openwire.codec.OpenWireFormat;
-
-
-
-/**
- * Marshalling code for Open Wire Format for ActiveMQDestinationMarshaller
- *
- *
- * NOTE!: This file is auto generated - do not modify!
- * if you need to make a change, please see the modify the groovy scripts in the
- * under src/gram/script and then use maven openwire:generate to regenerate
- * this file.
- *
- */
-public abstract class ActiveMQDestinationMarshaller extends BaseDataStreamMarshaller {
-
- /**
- * Un-marshal an object instance from the data input stream
- *
- * @param o the object to un-marshal
- * @param dataIn the data input stream to build the object from
- * @throws IOException
- */
- public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException {
- super.tightUnmarshal(wireFormat, o, dataIn, bs);
-
- ActiveMQDestination info = (ActiveMQDestination)o;
- info.setPhysicalName(tightUnmarshalString(dataIn, bs));
-
- }
-
-
- /**
- * Write the booleans that this object uses to a BooleanStream
- */
- public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
-
- ActiveMQDestination info = (ActiveMQDestination)o;
-
- int rc = super.tightMarshal1(wireFormat, o, bs);
- rc += tightMarshalString1(info.getPhysicalName(), bs);
-
- return rc + 0;
- }
-
- /**
- * Write a object instance to data output stream
- *
- * @param o the instance to be marshaled
- * @param dataOut the output stream
- * @throws IOException thrown if an error occurs
- */
- public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException {
- super.tightMarshal2(wireFormat, o, dataOut, bs);
-
- ActiveMQDestination info = (ActiveMQDestination)o;
- tightMarshalString2(info.getPhysicalName(), dataOut, bs);
-
- }
-
- /**
- * Un-marshal an object instance from the data input stream
- *
- * @param o the object to un-marshal
- * @param dataIn the data input stream to build the object from
- * @throws IOException
- */
- public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException {
- super.looseUnmarshal(wireFormat, o, dataIn);
-
- ActiveMQDestination info = (ActiveMQDestination)o;
- info.setPhysicalName(looseUnmarshalString(dataIn));
-
- }
-
-
- /**
- * Write the booleans that this object uses to a BooleanStream
- */
- public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
-
- ActiveMQDestination info = (ActiveMQDestination)o;
-
- super.looseMarshal(wireFormat, o, dataOut);
- looseMarshalString(info.getPhysicalName(), dataOut);
-
- }
-}
diff --git a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ActiveMQMapMessageMarshaller.java b/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ActiveMQMapMessageMarshaller.java
deleted file mode 100755
index a9867f3..0000000
--- a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ActiveMQMapMessageMarshaller.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/**
- * 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.openwire.codec.v1;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.activemq.apollo.openwire.command.ActiveMQMapMessage;
-import org.apache.activemq.apollo.openwire.command.DataStructure;
-import org.apache.activemq.apollo.openwire.codec.BooleanStream;
-import org.apache.activemq.apollo.openwire.codec.OpenWireFormat;
-
-
-
-/**
- * Marshalling code for Open Wire Format for ActiveMQMapMessageMarshaller
- *
- *
- * NOTE!: This file is auto generated - do not modify!
- * if you need to make a change, please see the modify the groovy scripts in the
- * under src/gram/script and then use maven openwire:generate to regenerate
- * this file.
- *
- */
-public class ActiveMQMapMessageMarshaller extends ActiveMQMessageMarshaller {
-
- /**
- * Return the type of Data Structure we marshal
- * @return short representation of the type data structure
- */
- public byte getDataStructureType() {
- return ActiveMQMapMessage.DATA_STRUCTURE_TYPE;
- }
-
- /**
- * @return a new object instance
- */
- public DataStructure createObject() {
- return new ActiveMQMapMessage();
- }
-
- /**
- * Un-marshal an object instance from the data input stream
- *
- * @param o the object to un-marshal
- * @param dataIn the data input stream to build the object from
- * @throws IOException
- */
- public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException {
- super.tightUnmarshal(wireFormat, o, dataIn, bs);
-
- }
-
-
- /**
- * Write the booleans that this object uses to a BooleanStream
- */
- public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
-
- int rc = super.tightMarshal1(wireFormat, o, bs);
-
- return rc + 0;
- }
-
- /**
- * Write a object instance to data output stream
- *
- * @param o the instance to be marshaled
- * @param dataOut the output stream
- * @throws IOException thrown if an error occurs
- */
- public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException {
- super.tightMarshal2(wireFormat, o, dataOut, bs);
-
- }
-
- /**
- * Un-marshal an object instance from the data input stream
- *
- * @param o the object to un-marshal
- * @param dataIn the data input stream to build the object from
- * @throws IOException
- */
- public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException {
- super.looseUnmarshal(wireFormat, o, dataIn);
-
- }
-
-
- /**
- * Write the booleans that this object uses to a BooleanStream
- */
- public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
-
- super.looseMarshal(wireFormat, o, dataOut);
-
- }
-}
diff --git a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ActiveMQMessageMarshaller.java b/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ActiveMQMessageMarshaller.java
deleted file mode 100755
index 9131181..0000000
--- a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ActiveMQMessageMarshaller.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/**
- * 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.openwire.codec.v1;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.activemq.apollo.openwire.command.ActiveMQMessage;
-import org.apache.activemq.apollo.openwire.command.DataStructure;
-import org.apache.activemq.apollo.openwire.codec.BooleanStream;
-import org.apache.activemq.apollo.openwire.codec.OpenWireFormat;
-
-
-
-/**
- * Marshalling code for Open Wire Format for ActiveMQMessageMarshaller
- *
- *
- * NOTE!: This file is auto generated - do not modify!
- * if you need to make a change, please see the modify the groovy scripts in the
- * under src/gram/script and then use maven openwire:generate to regenerate
- * this file.
- *
- */
-public class ActiveMQMessageMarshaller extends MessageMarshaller {
-
- /**
- * Return the type of Data Structure we marshal
- * @return short representation of the type data structure
- */
- public byte getDataStructureType() {
- return ActiveMQMessage.DATA_STRUCTURE_TYPE;
- }
-
- /**
- * @return a new object instance
- */
- public DataStructure createObject() {
- return new ActiveMQMessage();
- }
-
- /**
- * Un-marshal an object instance from the data input stream
- *
- * @param o the object to un-marshal
- * @param dataIn the data input stream to build the object from
- * @throws IOException
- */
- public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException {
- super.tightUnmarshal(wireFormat, o, dataIn, bs);
-
- }
-
-
- /**
- * Write the booleans that this object uses to a BooleanStream
- */
- public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
-
- int rc = super.tightMarshal1(wireFormat, o, bs);
-
- return rc + 0;
- }
-
- /**
- * Write a object instance to data output stream
- *
- * @param o the instance to be marshaled
- * @param dataOut the output stream
- * @throws IOException thrown if an error occurs
- */
- public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException {
- super.tightMarshal2(wireFormat, o, dataOut, bs);
-
- }
-
- /**
- * Un-marshal an object instance from the data input stream
- *
- * @param o the object to un-marshal
- * @param dataIn the data input stream to build the object from
- * @throws IOException
- */
- public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException {
- super.looseUnmarshal(wireFormat, o, dataIn);
-
- }
-
-
- /**
- * Write the booleans that this object uses to a BooleanStream
- */
- public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
-
- super.looseMarshal(wireFormat, o, dataOut);
-
- }
-}
diff --git a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ActiveMQObjectMessageMarshaller.java b/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ActiveMQObjectMessageMarshaller.java
deleted file mode 100755
index 3015348..0000000
--- a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ActiveMQObjectMessageMarshaller.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/**
- * 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.openwire.codec.v1;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.activemq.apollo.openwire.command.ActiveMQObjectMessage;
-import org.apache.activemq.apollo.openwire.command.DataStructure;
-import org.apache.activemq.apollo.openwire.codec.BooleanStream;
-import org.apache.activemq.apollo.openwire.codec.OpenWireFormat;
-
-
-
-/**
- * Marshalling code for Open Wire Format for ActiveMQObjectMessageMarshaller
- *
- *
- * NOTE!: This file is auto generated - do not modify!
- * if you need to make a change, please see the modify the groovy scripts in the
- * under src/gram/script and then use maven openwire:generate to regenerate
- * this file.
- *
- */
-public class ActiveMQObjectMessageMarshaller extends ActiveMQMessageMarshaller {
-
- /**
- * Return the type of Data Structure we marshal
- * @return short representation of the type data structure
- */
- public byte getDataStructureType() {
- return ActiveMQObjectMessage.DATA_STRUCTURE_TYPE;
- }
-
- /**
- * @return a new object instance
- */
- public DataStructure createObject() {
- return new ActiveMQObjectMessage();
- }
-
- /**
- * Un-marshal an object instance from the data input stream
- *
- * @param o the object to un-marshal
- * @param dataIn the data input stream to build the object from
- * @throws IOException
- */
- public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException {
- super.tightUnmarshal(wireFormat, o, dataIn, bs);
-
- }
-
-
- /**
- * Write the booleans that this object uses to a BooleanStream
- */
- public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
-
- int rc = super.tightMarshal1(wireFormat, o, bs);
-
- return rc + 0;
- }
-
- /**
- * Write a object instance to data output stream
- *
- * @param o the instance to be marshaled
- * @param dataOut the output stream
- * @throws IOException thrown if an error occurs
- */
- public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException {
- super.tightMarshal2(wireFormat, o, dataOut, bs);
-
- }
-
- /**
- * Un-marshal an object instance from the data input stream
- *
- * @param o the object to un-marshal
- * @param dataIn the data input stream to build the object from
- * @throws IOException
- */
- public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException {
- super.looseUnmarshal(wireFormat, o, dataIn);
-
- }
-
-
- /**
- * Write the booleans that this object uses to a BooleanStream
- */
- public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
-
- super.looseMarshal(wireFormat, o, dataOut);
-
- }
-}
diff --git a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ActiveMQQueueMarshaller.java b/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ActiveMQQueueMarshaller.java
deleted file mode 100755
index 2499ab3..0000000
--- a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ActiveMQQueueMarshaller.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/**
- * 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.openwire.codec.v1;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.activemq.apollo.openwire.command.ActiveMQQueue;
-import org.apache.activemq.apollo.openwire.command.DataStructure;
-import org.apache.activemq.apollo.openwire.codec.BooleanStream;
-import org.apache.activemq.apollo.openwire.codec.OpenWireFormat;
-
-
-
-/**
- * Marshalling code for Open Wire Format for ActiveMQQueueMarshaller
- *
- *
- * NOTE!: This file is auto generated - do not modify!
- * if you need to make a change, please see the modify the groovy scripts in the
- * under src/gram/script and then use maven openwire:generate to regenerate
- * this file.
- *
- */
-public class ActiveMQQueueMarshaller extends ActiveMQDestinationMarshaller {
-
- /**
- * Return the type of Data Structure we marshal
- * @return short representation of the type data structure
- */
- public byte getDataStructureType() {
- return ActiveMQQueue.DATA_STRUCTURE_TYPE;
- }
-
- /**
- * @return a new object instance
- */
- public DataStructure createObject() {
- return new ActiveMQQueue();
- }
-
- /**
- * Un-marshal an object instance from the data input stream
- *
- * @param o the object to un-marshal
- * @param dataIn the data input stream to build the object from
- * @throws IOException
- */
- public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException {
- super.tightUnmarshal(wireFormat, o, dataIn, bs);
-
- }
-
-
- /**
- * Write the booleans that this object uses to a BooleanStream
- */
- public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
-
- int rc = super.tightMarshal1(wireFormat, o, bs);
-
- return rc + 0;
- }
-
- /**
- * Write a object instance to data output stream
- *
- * @param o the instance to be marshaled
- * @param dataOut the output stream
- * @throws IOException thrown if an error occurs
- */
- public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException {
- super.tightMarshal2(wireFormat, o, dataOut, bs);
-
- }
-
- /**
- * Un-marshal an object instance from the data input stream
- *
- * @param o the object to un-marshal
- * @param dataIn the data input stream to build the object from
- * @throws IOException
- */
- public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException {
- super.looseUnmarshal(wireFormat, o, dataIn);
-
- }
-
-
- /**
- * Write the booleans that this object uses to a BooleanStream
- */
- public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
-
- super.looseMarshal(wireFormat, o, dataOut);
-
- }
-}
diff --git a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ActiveMQStreamMessageMarshaller.java b/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ActiveMQStreamMessageMarshaller.java
deleted file mode 100755
index 4c1d201..0000000
--- a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ActiveMQStreamMessageMarshaller.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/**
- * 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.openwire.codec.v1;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.activemq.apollo.openwire.command.ActiveMQStreamMessage;
-import org.apache.activemq.apollo.openwire.command.DataStructure;
-import org.apache.activemq.apollo.openwire.codec.BooleanStream;
-import org.apache.activemq.apollo.openwire.codec.OpenWireFormat;
-
-
-
-/**
- * Marshalling code for Open Wire Format for ActiveMQStreamMessageMarshaller
- *
- *
- * NOTE!: This file is auto generated - do not modify!
- * if you need to make a change, please see the modify the groovy scripts in the
- * under src/gram/script and then use maven openwire:generate to regenerate
- * this file.
- *
- */
-public class ActiveMQStreamMessageMarshaller extends ActiveMQMessageMarshaller {
-
- /**
- * Return the type of Data Structure we marshal
- * @return short representation of the type data structure
- */
- public byte getDataStructureType() {
- return ActiveMQStreamMessage.DATA_STRUCTURE_TYPE;
- }
-
- /**
- * @return a new object instance
- */
- public DataStructure createObject() {
- return new ActiveMQStreamMessage();
- }
-
- /**
- * Un-marshal an object instance from the data input stream
- *
- * @param o the object to un-marshal
- * @param dataIn the data input stream to build the object from
- * @throws IOException
- */
- public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException {
- super.tightUnmarshal(wireFormat, o, dataIn, bs);
-
- }
-
-
- /**
- * Write the booleans that this object uses to a BooleanStream
- */
- public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
-
- int rc = super.tightMarshal1(wireFormat, o, bs);
-
- return rc + 0;
- }
-
- /**
- * Write a object instance to data output stream
- *
- * @param o the instance to be marshaled
- * @param dataOut the output stream
- * @throws IOException thrown if an error occurs
- */
- public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException {
- super.tightMarshal2(wireFormat, o, dataOut, bs);
-
- }
-
- /**
- * Un-marshal an object instance from the data input stream
- *
- * @param o the object to un-marshal
- * @param dataIn the data input stream to build the object from
- * @throws IOException
- */
- public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException {
- super.looseUnmarshal(wireFormat, o, dataIn);
-
- }
-
-
- /**
- * Write the booleans that this object uses to a BooleanStream
- */
- public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
-
- super.looseMarshal(wireFormat, o, dataOut);
-
- }
-}
diff --git a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ActiveMQTempDestinationMarshaller.java b/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ActiveMQTempDestinationMarshaller.java
deleted file mode 100755
index a2a4104..0000000
--- a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ActiveMQTempDestinationMarshaller.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/**
- * 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.openwire.codec.v1;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.activemq.apollo.openwire.codec.BooleanStream;
-import org.apache.activemq.apollo.openwire.codec.OpenWireFormat;
-
-
-
-/**
- * Marshalling code for Open Wire Format for ActiveMQTempDestinationMarshaller
- *
- *
- * NOTE!: This file is auto generated - do not modify!
- * if you need to make a change, please see the modify the groovy scripts in the
- * under src/gram/script and then use maven openwire:generate to regenerate
- * this file.
- *
- */
-public abstract class ActiveMQTempDestinationMarshaller extends ActiveMQDestinationMarshaller {
-
- /**
- * Un-marshal an object instance from the data input stream
- *
- * @param o the object to un-marshal
- * @param dataIn the data input stream to build the object from
- * @throws IOException
- */
- public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException {
- super.tightUnmarshal(wireFormat, o, dataIn, bs);
-
- }
-
-
- /**
- * Write the booleans that this object uses to a BooleanStream
- */
- public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
-
- int rc = super.tightMarshal1(wireFormat, o, bs);
-
- return rc + 0;
- }
-
- /**
- * Write a object instance to data output stream
- *
- * @param o the instance to be marshaled
- * @param dataOut the output stream
- * @throws IOException thrown if an error occurs
- */
- public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException {
- super.tightMarshal2(wireFormat, o, dataOut, bs);
-
- }
-
- /**
- * Un-marshal an object instance from the data input stream
- *
- * @param o the object to un-marshal
- * @param dataIn the data input stream to build the object from
- * @throws IOException
- */
- public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException {
- super.looseUnmarshal(wireFormat, o, dataIn);
-
- }
-
-
- /**
- * Write the booleans that this object uses to a BooleanStream
- */
- public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
-
- super.looseMarshal(wireFormat, o, dataOut);
-
- }
-}
diff --git a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ActiveMQTempQueueMarshaller.java b/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ActiveMQTempQueueMarshaller.java
deleted file mode 100755
index b498a68..0000000
--- a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ActiveMQTempQueueMarshaller.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/**
- * 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.openwire.codec.v1;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.activemq.apollo.openwire.command.ActiveMQTempQueue;
-import org.apache.activemq.apollo.openwire.command.DataStructure;
-import org.apache.activemq.apollo.openwire.codec.BooleanStream;
-import org.apache.activemq.apollo.openwire.codec.OpenWireFormat;
-
-
-
-/**
- * Marshalling code for Open Wire Format for ActiveMQTempQueueMarshaller
- *
- *
- * NOTE!: This file is auto generated - do not modify!
- * if you need to make a change, please see the modify the groovy scripts in the
- * under src/gram/script and then use maven openwire:generate to regenerate
- * this file.
- *
- */
-public class ActiveMQTempQueueMarshaller extends ActiveMQTempDestinationMarshaller {
-
- /**
- * Return the type of Data Structure we marshal
- * @return short representation of the type data structure
- */
- public byte getDataStructureType() {
- return ActiveMQTempQueue.DATA_STRUCTURE_TYPE;
- }
-
- /**
- * @return a new object instance
- */
- public DataStructure createObject() {
- return new ActiveMQTempQueue();
- }
-
- /**
- * Un-marshal an object instance from the data input stream
- *
- * @param o the object to un-marshal
- * @param dataIn the data input stream to build the object from
- * @throws IOException
- */
- public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException {
- super.tightUnmarshal(wireFormat, o, dataIn, bs);
-
- }
-
-
- /**
- * Write the booleans that this object uses to a BooleanStream
- */
- public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
-
- int rc = super.tightMarshal1(wireFormat, o, bs);
-
- return rc + 0;
- }
-
- /**
- * Write a object instance to data output stream
- *
- * @param o the instance to be marshaled
- * @param dataOut the output stream
- * @throws IOException thrown if an error occurs
- */
- public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException {
- super.tightMarshal2(wireFormat, o, dataOut, bs);
-
- }
-
- /**
- * Un-marshal an object instance from the data input stream
- *
- * @param o the object to un-marshal
- * @param dataIn the data input stream to build the object from
- * @throws IOException
- */
- public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException {
- super.looseUnmarshal(wireFormat, o, dataIn);
-
- }
-
-
- /**
- * Write the booleans that this object uses to a BooleanStream
- */
- public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
-
- super.looseMarshal(wireFormat, o, dataOut);
-
- }
-}
diff --git a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ActiveMQTempTopicMarshaller.java b/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ActiveMQTempTopicMarshaller.java
deleted file mode 100755
index b4d597a..0000000
--- a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ActiveMQTempTopicMarshaller.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/**
- * 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.openwire.codec.v1;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.activemq.apollo.openwire.command.ActiveMQTempTopic;
-import org.apache.activemq.apollo.openwire.command.DataStructure;
-import org.apache.activemq.apollo.openwire.codec.BooleanStream;
-import org.apache.activemq.apollo.openwire.codec.OpenWireFormat;
-
-
-
-/**
- * Marshalling code for Open Wire Format for ActiveMQTempTopicMarshaller
- *
- *
- * NOTE!: This file is auto generated - do not modify!
- * if you need to make a change, please see the modify the groovy scripts in the
- * under src/gram/script and then use maven openwire:generate to regenerate
- * this file.
- *
- */
-public class ActiveMQTempTopicMarshaller extends ActiveMQTempDestinationMarshaller {
-
- /**
- * Return the type of Data Structure we marshal
- * @return short representation of the type data structure
- */
- public byte getDataStructureType() {
- return ActiveMQTempTopic.DATA_STRUCTURE_TYPE;
- }
-
- /**
- * @return a new object instance
- */
- public DataStructure createObject() {
- return new ActiveMQTempTopic();
- }
-
- /**
- * Un-marshal an object instance from the data input stream
- *
- * @param o the object to un-marshal
- * @param dataIn the data input stream to build the object from
- * @throws IOException
- */
- public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException {
- super.tightUnmarshal(wireFormat, o, dataIn, bs);
-
- }
-
-
- /**
- * Write the booleans that this object uses to a BooleanStream
- */
- public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
-
- int rc = super.tightMarshal1(wireFormat, o, bs);
-
- return rc + 0;
- }
-
- /**
- * Write a object instance to data output stream
- *
- * @param o the instance to be marshaled
- * @param dataOut the output stream
- * @throws IOException thrown if an error occurs
- */
- public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException {
- super.tightMarshal2(wireFormat, o, dataOut, bs);
-
- }
-
- /**
- * Un-marshal an object instance from the data input stream
- *
- * @param o the object to un-marshal
- * @param dataIn the data input stream to build the object from
- * @throws IOException
- */
- public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException {
- super.looseUnmarshal(wireFormat, o, dataIn);
-
- }
-
-
- /**
- * Write the booleans that this object uses to a BooleanStream
- */
- public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
-
- super.looseMarshal(wireFormat, o, dataOut);
-
- }
-}
diff --git a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ActiveMQTextMessageMarshaller.java b/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ActiveMQTextMessageMarshaller.java
deleted file mode 100755
index 88f58db..0000000
--- a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ActiveMQTextMessageMarshaller.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/**
- * 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.openwire.codec.v1;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.activemq.apollo.openwire.command.ActiveMQTextMessage;
-import org.apache.activemq.apollo.openwire.command.DataStructure;
-import org.apache.activemq.apollo.openwire.codec.BooleanStream;
-import org.apache.activemq.apollo.openwire.codec.OpenWireFormat;
-
-
-
-/**
- * Marshalling code for Open Wire Format for ActiveMQTextMessageMarshaller
- *
- *
- * NOTE!: This file is auto generated - do not modify!
- * if you need to make a change, please see the modify the groovy scripts in the
- * under src/gram/script and then use maven openwire:generate to regenerate
- * this file.
- *
- */
-public class ActiveMQTextMessageMarshaller extends ActiveMQMessageMarshaller {
-
- /**
- * Return the type of Data Structure we marshal
- * @return short representation of the type data structure
- */
- public byte getDataStructureType() {
- return ActiveMQTextMessage.DATA_STRUCTURE_TYPE;
- }
-
- /**
- * @return a new object instance
- */
- public DataStructure createObject() {
- return new ActiveMQTextMessage();
- }
-
- /**
- * Un-marshal an object instance from the data input stream
- *
- * @param o the object to un-marshal
- * @param dataIn the data input stream to build the object from
- * @throws IOException
- */
- public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException {
- super.tightUnmarshal(wireFormat, o, dataIn, bs);
-
- }
-
-
- /**
- * Write the booleans that this object uses to a BooleanStream
- */
- public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
-
- int rc = super.tightMarshal1(wireFormat, o, bs);
-
- return rc + 0;
- }
-
- /**
- * Write a object instance to data output stream
- *
- * @param o the instance to be marshaled
- * @param dataOut the output stream
- * @throws IOException thrown if an error occurs
- */
- public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException {
- super.tightMarshal2(wireFormat, o, dataOut, bs);
-
- }
-
- /**
- * Un-marshal an object instance from the data input stream
- *
- * @param o the object to un-marshal
- * @param dataIn the data input stream to build the object from
- * @throws IOException
- */
- public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException {
- super.looseUnmarshal(wireFormat, o, dataIn);
-
- }
-
-
- /**
- * Write the booleans that this object uses to a BooleanStream
- */
- public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
-
- super.looseMarshal(wireFormat, o, dataOut);
-
- }
-}
diff --git a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ActiveMQTopicMarshaller.java b/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ActiveMQTopicMarshaller.java
deleted file mode 100755
index 012c997..0000000
--- a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ActiveMQTopicMarshaller.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/**
- * 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.openwire.codec.v1;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.activemq.apollo.openwire.command.ActiveMQTopic;
-import org.apache.activemq.apollo.openwire.command.DataStructure;
-import org.apache.activemq.apollo.openwire.codec.BooleanStream;
-import org.apache.activemq.apollo.openwire.codec.OpenWireFormat;
-
-
-
-/**
- * Marshalling code for Open Wire Format for ActiveMQTopicMarshaller
- *
- *
- * NOTE!: This file is auto generated - do not modify!
- * if you need to make a change, please see the modify the groovy scripts in the
- * under src/gram/script and then use maven openwire:generate to regenerate
- * this file.
- *
- */
-public class ActiveMQTopicMarshaller extends ActiveMQDestinationMarshaller {
-
- /**
- * Return the type of Data Structure we marshal
- * @return short representation of the type data structure
- */
- public byte getDataStructureType() {
- return ActiveMQTopic.DATA_STRUCTURE_TYPE;
- }
-
- /**
- * @return a new object instance
- */
- public DataStructure createObject() {
- return new ActiveMQTopic();
- }
-
- /**
- * Un-marshal an object instance from the data input stream
- *
- * @param o the object to un-marshal
- * @param dataIn the data input stream to build the object from
- * @throws IOException
- */
- public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException {
- super.tightUnmarshal(wireFormat, o, dataIn, bs);
-
- }
-
-
- /**
- * Write the booleans that this object uses to a BooleanStream
- */
- public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
-
- int rc = super.tightMarshal1(wireFormat, o, bs);
-
- return rc + 0;
- }
-
- /**
- * Write a object instance to data output stream
- *
- * @param o the instance to be marshaled
- * @param dataOut the output stream
- * @throws IOException thrown if an error occurs
- */
- public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException {
- super.tightMarshal2(wireFormat, o, dataOut, bs);
-
- }
-
- /**
- * Un-marshal an object instance from the data input stream
- *
- * @param o the object to un-marshal
- * @param dataIn the data input stream to build the object from
- * @throws IOException
- */
- public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException {
- super.looseUnmarshal(wireFormat, o, dataIn);
-
- }
-
-
- /**
- * Write the booleans that this object uses to a BooleanStream
- */
- public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
-
- super.looseMarshal(wireFormat, o, dataOut);
-
- }
-}
diff --git a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/BaseCommandMarshaller.java b/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/BaseCommandMarshaller.java
deleted file mode 100755
index 5ed0648..0000000
--- a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/BaseCommandMarshaller.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/**
- * 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.openwire.codec.v1;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.activemq.apollo.openwire.command.BaseCommand;
-import org.apache.activemq.apollo.openwire.codec.BooleanStream;
-import org.apache.activemq.apollo.openwire.codec.OpenWireFormat;
-
-
-
-/**
- * Marshalling code for Open Wire Format for BaseCommandMarshaller
- *
- *
- * NOTE!: This file is auto generated - do not modify!
- * if you need to make a change, please see the modify the groovy scripts in the
- * under src/gram/script and then use maven openwire:generate to regenerate
- * this file.
- *
- */
-public abstract class BaseCommandMarshaller extends BaseDataStreamMarshaller {
-
- /**
- * Un-marshal an object instance from the data input stream
- *
- * @param o the object to un-marshal
- * @param dataIn the data input stream to build the object from
- * @throws IOException
- */
- public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException {
- super.tightUnmarshal(wireFormat, o, dataIn, bs);
-
- BaseCommand info = (BaseCommand)o;
- info.setCommandId(dataIn.readInt());
- info.setResponseRequired(bs.readBoolean());
-
- }
-
-
- /**
- * Write the booleans that this object uses to a BooleanStream
- */
- public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
-
- BaseCommand info = (BaseCommand)o;
-
- int rc = super.tightMarshal1(wireFormat, o, bs);
- bs.writeBoolean(info.isResponseRequired());
-
- return rc + 4;
- }
-
- /**
- * Write a object instance to data output stream
- *
- * @param o the instance to be marshaled
- * @param dataOut the output stream
- * @throws IOException thrown if an error occurs
- */
- public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException {
- super.tightMarshal2(wireFormat, o, dataOut, bs);
-
- BaseCommand info = (BaseCommand)o;
- dataOut.writeInt(info.getCommandId());
- bs.readBoolean();
-
- }
-
- /**
- * Un-marshal an object instance from the data input stream
- *
- * @param o the object to un-marshal
- * @param dataIn the data input stream to build the object from
- * @throws IOException
- */
- public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException {
- super.looseUnmarshal(wireFormat, o, dataIn);
-
- BaseCommand info = (BaseCommand)o;
- info.setCommandId(dataIn.readInt());
- info.setResponseRequired(dataIn.readBoolean());
-
- }
-
-
- /**
- * Write the booleans that this object uses to a BooleanStream
- */
- public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
-
- BaseCommand info = (BaseCommand)o;
-
- super.looseMarshal(wireFormat, o, dataOut);
- dataOut.writeInt(info.getCommandId());
- dataOut.writeBoolean(info.isResponseRequired());
-
- }
-}
diff --git a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/BaseDataStreamMarshaller.java b/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/BaseDataStreamMarshaller.java
deleted file mode 100755
index 0291409..0000000
--- a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/BaseDataStreamMarshaller.java
+++ /dev/null
@@ -1,645 +0,0 @@
-/**
- * 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.openwire.codec.v1;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-import java.lang.reflect.Constructor;
-
-import org.apache.activemq.apollo.openwire.command.DataStructure;
-import org.apache.activemq.apollo.openwire.codec.BooleanStream;
-import org.apache.activemq.apollo.openwire.codec.DataStreamMarshaller;
-import org.apache.activemq.apollo.openwire.codec.OpenWireFormat;
-import org.fusesource.hawtbuf.Buffer;
-
-public abstract class BaseDataStreamMarshaller implements DataStreamMarshaller {
-
- public static final Constructor STACK_TRACE_ELEMENT_CONSTRUCTOR;
-
- static {
- Constructor constructor = null;
- try {
- constructor = StackTraceElement.class.getConstructor(new Class[] {String.class, String.class,
- String.class, int.class});
- } catch (Throwable e) {
- }
- STACK_TRACE_ELEMENT_CONSTRUCTOR = constructor;
- }
-
- public abstract byte getDataStructureType();
-
- public abstract DataStructure createObject();
-
- public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
- return 0;
- }
-
- public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs)
- throws IOException {
- }
-
- public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs)
- throws IOException {
- }
-
- public int tightMarshalLong1(OpenWireFormat wireFormat, long o, BooleanStream bs) throws IOException {
- if (o == 0) {
- bs.writeBoolean(false);
- bs.writeBoolean(false);
- return 0;
- } else if ((o & 0xFFFFFFFFFFFF0000L) == 0) {
- bs.writeBoolean(false);
- bs.writeBoolean(true);
- return 2;
- } else if ((o & 0xFFFFFFFF00000000L) == 0) {
- bs.writeBoolean(true);
- bs.writeBoolean(false);
- return 4;
- } else {
- bs.writeBoolean(true);
- bs.writeBoolean(true);
- return 8;
- }
- }
-
- public void tightMarshalLong2(OpenWireFormat wireFormat, long o, DataOutput dataOut, BooleanStream bs)
- throws IOException {
- if (bs.readBoolean()) {
- if (bs.readBoolean()) {
- dataOut.writeLong(o);
- } else {
- dataOut.writeInt((int)o);
- }
- } else {
- if (bs.readBoolean()) {
- dataOut.writeShort((int)o);
- }
- }
- }
-
- public long tightUnmarshalLong(OpenWireFormat wireFormat, DataInput dataIn, BooleanStream bs)
- throws IOException {
- if (bs.readBoolean()) {
- if (bs.readBoolean()) {
- return dataIn.readLong();
- } else {
- return toLong(dataIn.readInt());
- }
- } else {
- if (bs.readBoolean()) {
- return toLong(dataIn.readShort());
- } else {
- return 0;
- }
- }
- }
-
- protected long toLong(short value) {
- // lets handle negative values
- long answer = value;
- return answer & 0xffffL;
- }
-
- protected long toLong(int value) {
- // lets handle negative values
- long answer = value;
- return answer & 0xffffffffL;
- }
-
- protected DataStructure tightUnmarsalNestedObject(OpenWireFormat wireFormat, DataInput dataIn,
- BooleanStream bs) throws IOException {
- return wireFormat.tightUnmarshalNestedObject(dataIn, bs);
- }
-
- protected int tightMarshalNestedObject1(OpenWireFormat wireFormat, DataStructure o, BooleanStream bs)
- throws IOException {
- return wireFormat.tightMarshalNestedObject1(o, bs);
- }
-
- protected void tightMarshalNestedObject2(OpenWireFormat wireFormat, DataStructure o, DataOutput dataOut,
- BooleanStream bs) throws IOException {
- wireFormat.tightMarshalNestedObject2(o, dataOut, bs);
- }
-
- protected DataStructure tightUnmarsalCachedObject(OpenWireFormat wireFormat, DataInput dataIn,
- BooleanStream bs) throws IOException {
- if (wireFormat.isCacheEnabled()) {
- if (bs.readBoolean()) {
- short index = dataIn.readShort();
- DataStructure object = wireFormat.tightUnmarshalNestedObject(dataIn, bs);
- wireFormat.setInUnmarshallCache(index, object);
- return object;
- } else {
- short index = dataIn.readShort();
- return wireFormat.getFromUnmarshallCache(index);
- }
- } else {
- return wireFormat.tightUnmarshalNestedObject(dataIn, bs);
- }
- }
-
- protected int tightMarshalCachedObject1(OpenWireFormat wireFormat, DataStructure o, BooleanStream bs)
- throws IOException {
- if (wireFormat.isCacheEnabled()) {
- Short index = wireFormat.getMarshallCacheIndex(o);
- bs.writeBoolean(index == null);
- if (index == null) {
- int rc = wireFormat.tightMarshalNestedObject1(o, bs);
- wireFormat.addToMarshallCache(o);
- return 2 + rc;
- } else {
- return 2;
- }
- } else {
- return wireFormat.tightMarshalNestedObject1(o, bs);
- }
- }
-
- protected void tightMarshalCachedObject2(OpenWireFormat wireFormat, DataStructure o, DataOutput dataOut,
- BooleanStream bs) throws IOException {
- if (wireFormat.isCacheEnabled()) {
- Short index = wireFormat.getMarshallCacheIndex(o);
- if (bs.readBoolean()) {
- dataOut.writeShort(index.shortValue());
- wireFormat.tightMarshalNestedObject2(o, dataOut, bs);
- } else {
- dataOut.writeShort(index.shortValue());
- }
- } else {
- wireFormat.tightMarshalNestedObject2(o, dataOut, bs);
- }
- }
-
- protected Throwable tightUnmarsalThrowable(OpenWireFormat wireFormat, DataInput dataIn, BooleanStream bs)
- throws IOException {
- if (bs.readBoolean()) {
- String clazz = tightUnmarshalString(dataIn, bs);
- String message = tightUnmarshalString(dataIn, bs);
- Throwable o = createThrowable(clazz, message);
- if (wireFormat.isStackTraceEnabled()) {
- if (STACK_TRACE_ELEMENT_CONSTRUCTOR != null) {
- StackTraceElement ss[] = new StackTraceElement[dataIn.readShort()];
- for (int i = 0; i < ss.length; i++) {
- try {
- ss[i] = (StackTraceElement)STACK_TRACE_ELEMENT_CONSTRUCTOR
- .newInstance(new Object[] {tightUnmarshalString(dataIn, bs),
- tightUnmarshalString(dataIn, bs),
- tightUnmarshalString(dataIn, bs),
- new Integer(dataIn.readInt())});
- } catch (IOException e) {
- throw e;
- } catch (Throwable e) {
- }
- }
- o.setStackTrace(ss);
- } else {
- short size = dataIn.readShort();
- for (int i = 0; i < size; i++) {
- tightUnmarshalString(dataIn, bs);
- tightUnmarshalString(dataIn, bs);
- tightUnmarshalString(dataIn, bs);
- dataIn.readInt();
- }
- }
- o.initCause(tightUnmarsalThrowable(wireFormat, dataIn, bs));
-
- }
- return o;
- } else {
- return null;
- }
- }
-
- private Throwable createThrowable(String className, String message) {
- try {
- Class clazz = Class.forName(className, false, BaseDataStreamMarshaller.class.getClassLoader());
- Constructor constructor = clazz.getConstructor(new Class[] {String.class});
- return (Throwable)constructor.newInstance(new Object[] {message});
- } catch (Throwable e) {
- return new Throwable(className + ": " + message);
- }
- }
-
- protected int tightMarshalThrowable1(OpenWireFormat wireFormat, Throwable o, BooleanStream bs)
- throws IOException {
- if (o == null) {
- bs.writeBoolean(false);
- return 0;
- } else {
- int rc = 0;
- bs.writeBoolean(true);
- rc += tightMarshalString1(o.getClass().getName(), bs);
- rc += tightMarshalString1(o.getMessage(), bs);
- if (wireFormat.isStackTraceEnabled()) {
- rc += 2;
- StackTraceElement[] stackTrace = o.getStackTrace();
- for (int i = 0; i < stackTrace.length; i++) {
- StackTraceElement element = stackTrace[i];
- rc += tightMarshalString1(element.getClassName(), bs);
- rc += tightMarshalString1(element.getMethodName(), bs);
- rc += tightMarshalString1(element.getFileName(), bs);
- rc += 4;
- }
- rc += tightMarshalThrowable1(wireFormat, o.getCause(), bs);
- }
- return rc;
- }
- }
-
- protected void tightMarshalThrowable2(OpenWireFormat wireFormat, Throwable o, DataOutput dataOut,
- BooleanStream bs) throws IOException {
- if (bs.readBoolean()) {
- tightMarshalString2(o.getClass().getName(), dataOut, bs);
- tightMarshalString2(o.getMessage(), dataOut, bs);
- if (wireFormat.isStackTraceEnabled()) {
- StackTraceElement[] stackTrace = o.getStackTrace();
- dataOut.writeShort(stackTrace.length);
- for (int i = 0; i < stackTrace.length; i++) {
- StackTraceElement element = stackTrace[i];
- tightMarshalString2(element.getClassName(), dataOut, bs);
- tightMarshalString2(element.getMethodName(), dataOut, bs);
- tightMarshalString2(element.getFileName(), dataOut, bs);
- dataOut.writeInt(element.getLineNumber());
- }
- tightMarshalThrowable2(wireFormat, o.getCause(), dataOut, bs);
- }
- }
- }
-
- @SuppressWarnings("deprecation")
- protected String tightUnmarshalString(DataInput dataIn, BooleanStream bs) throws IOException {
- if (bs.readBoolean()) {
- if (bs.readBoolean()) {
- int size = dataIn.readShort();
- byte data[] = new byte[size];
- dataIn.readFully(data);
- // Yes deprecated, but we know what we are doing.
- // This allows us to create a String from a ASCII byte array. (no UTF-8 decoding)
- return new String(data, 0);
- } else {
- return dataIn.readUTF();
- }
- } else {
- return null;
- }
- }
-
- protected int tightMarshalString1(String value, BooleanStream bs) throws IOException {
- bs.writeBoolean(value != null);
- if (value != null) {
-
- int strlen = value.length();
- int utflen = 0;
- char[] charr = new char[strlen];
- int c = 0;
- boolean isOnlyAscii = true;
-
- value.getChars(0, strlen, charr, 0);
-
- for (int i = 0; i < strlen; i++) {
- c = charr[i];
- if ((c >= 0x0001) && (c <= 0x007F)) {
- utflen++;
- } else if (c > 0x07FF) {
- utflen += 3;
- isOnlyAscii = false;
- } else {
- isOnlyAscii = false;
- utflen += 2;
- }
- }
-
- if (utflen >= Short.MAX_VALUE) {
- throw new IOException("Encountered a String value that is too long to encode.");
- }
- bs.writeBoolean(isOnlyAscii);
- return utflen + 2;
-
- } else {
- return 0;
- }
- }
-
- protected void tightMarshalString2(String value, DataOutput dataOut, BooleanStream bs) throws IOException {
- if (bs.readBoolean()) {
- // If we verified it only holds ascii values
- if (bs.readBoolean()) {
- dataOut.writeShort(value.length());
- dataOut.writeBytes(value);
- } else {
- dataOut.writeUTF(value);
- }
- }
- }
-
- protected int tightMarshalObjectArray1(OpenWireFormat wireFormat, DataStructure[] objects,
- BooleanStream bs) throws IOException {
- if (objects != null) {
- int rc = 0;
- bs.writeBoolean(true);
- rc += 2;
- for (int i = 0; i < objects.length; i++) {
- rc += tightMarshalNestedObject1(wireFormat, objects[i], bs);
- }
- return rc;
- } else {
- bs.writeBoolean(false);
- return 0;
- }
- }
-
- protected void tightMarshalObjectArray2(OpenWireFormat wireFormat, DataStructure[] objects,
- DataOutput dataOut, BooleanStream bs) throws IOException {
- if (bs.readBoolean()) {
- dataOut.writeShort(objects.length);
- for (int i = 0; i < objects.length; i++) {
- tightMarshalNestedObject2(wireFormat, objects[i], dataOut, bs);
- }
- }
- }
-
- protected int tightMarshalConstByteArray1(byte[] data, BooleanStream bs, int i) throws IOException {
- return i;
- }
-
- protected void tightMarshalConstByteArray2(byte[] data, DataOutput dataOut, BooleanStream bs, int i)
- throws IOException {
- dataOut.write(data, 0, i);
- }
-
- protected byte[] tightUnmarshalConstByteArray(DataInput dataIn, BooleanStream bs, int i)
- throws IOException {
- byte data[] = new byte[i];
- dataIn.readFully(data);
- return data;
- }
-
- protected int tightMarshalByteArray1(byte[] data, BooleanStream bs) throws IOException {
- bs.writeBoolean(data != null);
- if (data != null) {
- return data.length + 4;
- } else {
- return 0;
- }
- }
-
- protected void tightMarshalByteArray2(byte[] data, DataOutput dataOut, BooleanStream bs)
- throws IOException {
- if (bs.readBoolean()) {
- dataOut.writeInt(data.length);
- dataOut.write(data);
- }
- }
-
- protected byte[] tightUnmarshalByteArray(DataInput dataIn, BooleanStream bs) throws IOException {
- byte rc[] = null;
- if (bs.readBoolean()) {
- int size = dataIn.readInt();
- rc = new byte[size];
- dataIn.readFully(rc);
- }
- return rc;
- }
-
- protected int tightMarshalByteSequence1(Buffer data, BooleanStream bs) throws IOException {
- bs.writeBoolean(data != null);
- if (data != null) {
- return data.getLength() + 4;
- } else {
- return 0;
- }
- }
-
- protected void tightMarshalByteSequence2(Buffer data, DataOutput dataOut, BooleanStream bs)
- throws IOException {
- if (bs.readBoolean()) {
- dataOut.writeInt(data.getLength());
- dataOut.write(data.getData(), data.getOffset(), data.getLength());
- }
- }
-
- protected Buffer tightUnmarshalByteSequence(DataInput dataIn, BooleanStream bs) throws IOException {
- Buffer rc = null;
- if (bs.readBoolean()) {
- int size = dataIn.readInt();
- byte[] t = new byte[size];
- dataIn.readFully(t);
- return new Buffer(t, 0, size);
- }
- return rc;
- }
-
- //
- // The loose marshaling logic
- //
-
- public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
- }
-
- public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException {
- }
-
- public void looseMarshalLong(OpenWireFormat wireFormat, long o, DataOutput dataOut) throws IOException {
- dataOut.writeLong(o);
- }
-
- public long looseUnmarshalLong(OpenWireFormat wireFormat, DataInput dataIn) throws IOException {
- return dataIn.readLong();
- }
-
- protected DataStructure looseUnmarsalNestedObject(OpenWireFormat wireFormat, DataInput dataIn)
- throws IOException {
- return wireFormat.looseUnmarshalNestedObject(dataIn);
- }
-
- protected void looseMarshalNestedObject(OpenWireFormat wireFormat, DataStructure o, DataOutput dataOut)
- throws IOException {
- wireFormat.looseMarshalNestedObject(o, dataOut);
- }
-
- protected DataStructure looseUnmarsalCachedObject(OpenWireFormat wireFormat, DataInput dataIn)
- throws IOException {
- if (wireFormat.isCacheEnabled()) {
- if (dataIn.readBoolean()) {
- short index = dataIn.readShort();
- DataStructure object = wireFormat.looseUnmarshalNestedObject(dataIn);
- wireFormat.setInUnmarshallCache(index, object);
- return object;
- } else {
- short index = dataIn.readShort();
- return wireFormat.getFromUnmarshallCache(index);
- }
- } else {
- return wireFormat.looseUnmarshalNestedObject(dataIn);
- }
- }
-
- protected void looseMarshalCachedObject(OpenWireFormat wireFormat, DataStructure o, DataOutput dataOut)
- throws IOException {
- if (wireFormat.isCacheEnabled()) {
- Short index = wireFormat.getMarshallCacheIndex(o);
- dataOut.writeBoolean(index == null);
- if (index == null) {
- index = wireFormat.addToMarshallCache(o);
- dataOut.writeShort(index.shortValue());
- wireFormat.looseMarshalNestedObject(o, dataOut);
- } else {
- dataOut.writeShort(index.shortValue());
- }
- } else {
- wireFormat.looseMarshalNestedObject(o, dataOut);
- }
- }
-
- protected Throwable looseUnmarsalThrowable(OpenWireFormat wireFormat, DataInput dataIn)
- throws IOException {
- if (dataIn.readBoolean()) {
- String clazz = looseUnmarshalString(dataIn);
- String message = looseUnmarshalString(dataIn);
- Throwable o = createThrowable(clazz, message);
- if (wireFormat.isStackTraceEnabled()) {
- if (STACK_TRACE_ELEMENT_CONSTRUCTOR != null) {
- StackTraceElement ss[] = new StackTraceElement[dataIn.readShort()];
- for (int i = 0; i < ss.length; i++) {
- try {
- ss[i] = (StackTraceElement)STACK_TRACE_ELEMENT_CONSTRUCTOR
- .newInstance(new Object[] {looseUnmarshalString(dataIn),
- looseUnmarshalString(dataIn),
- looseUnmarshalString(dataIn),
- new Integer(dataIn.readInt())});
- } catch (IOException e) {
- throw e;
- } catch (Throwable e) {
- }
- }
- o.setStackTrace(ss);
- } else {
- short size = dataIn.readShort();
- for (int i = 0; i < size; i++) {
- looseUnmarshalString(dataIn);
- looseUnmarshalString(dataIn);
- looseUnmarshalString(dataIn);
- dataIn.readInt();
- }
- }
- o.initCause(looseUnmarsalThrowable(wireFormat, dataIn));
-
- }
- return o;
- } else {
- return null;
- }
- }
-
- protected void looseMarshalThrowable(OpenWireFormat wireFormat, Throwable o, DataOutput dataOut)
- throws IOException {
- dataOut.writeBoolean(o != null);
- if (o != null) {
- looseMarshalString(o.getClass().getName(), dataOut);
- looseMarshalString(o.getMessage(), dataOut);
- if (wireFormat.isStackTraceEnabled()) {
- StackTraceElement[] stackTrace = o.getStackTrace();
- dataOut.writeShort(stackTrace.length);
- for (int i = 0; i < stackTrace.length; i++) {
- StackTraceElement element = stackTrace[i];
- looseMarshalString(element.getClassName(), dataOut);
- looseMarshalString(element.getMethodName(), dataOut);
- looseMarshalString(element.getFileName(), dataOut);
- dataOut.writeInt(element.getLineNumber());
- }
- looseMarshalThrowable(wireFormat, o.getCause(), dataOut);
- }
- }
- }
-
- protected String looseUnmarshalString(DataInput dataIn) throws IOException {
- if (dataIn.readBoolean()) {
- return dataIn.readUTF();
- } else {
- return null;
- }
- }
-
- protected void looseMarshalString(String value, DataOutput dataOut) throws IOException {
- dataOut.writeBoolean(value != null);
- if (value != null) {
- dataOut.writeUTF(value);
- }
- }
-
- protected void looseMarshalObjectArray(OpenWireFormat wireFormat, DataStructure[] objects,
- DataOutput dataOut) throws IOException {
- dataOut.writeBoolean(objects != null);
- if (objects != null) {
- dataOut.writeShort(objects.length);
- for (int i = 0; i < objects.length; i++) {
- looseMarshalNestedObject(wireFormat, objects[i], dataOut);
- }
- }
- }
-
- protected void looseMarshalConstByteArray(OpenWireFormat wireFormat, byte[] data, DataOutput dataOut,
- int i) throws IOException {
- dataOut.write(data, 0, i);
- }
-
- protected byte[] looseUnmarshalConstByteArray(DataInput dataIn, int i) throws IOException {
- byte data[] = new byte[i];
- dataIn.readFully(data);
- return data;
- }
-
- protected void looseMarshalByteArray(OpenWireFormat wireFormat, byte[] data, DataOutput dataOut)
- throws IOException {
- dataOut.writeBoolean(data != null);
- if (data != null) {
- dataOut.writeInt(data.length);
- dataOut.write(data);
- }
- }
-
- protected byte[] looseUnmarshalByteArray(DataInput dataIn) throws IOException {
- byte rc[] = null;
- if (dataIn.readBoolean()) {
- int size = dataIn.readInt();
- rc = new byte[size];
- dataIn.readFully(rc);
- }
- return rc;
- }
-
- protected void looseMarshalByteSequence(OpenWireFormat wireFormat, Buffer data, DataOutput dataOut)
- throws IOException {
- dataOut.writeBoolean(data != null);
- if (data != null) {
- dataOut.writeInt(data.getLength());
- dataOut.write(data.getData(), data.getOffset(), data.getLength());
- }
- }
-
- protected Buffer looseUnmarshalByteSequence(DataInput dataIn) throws IOException {
- Buffer rc = null;
- if (dataIn.readBoolean()) {
- int size = dataIn.readInt();
- byte[] t = new byte[size];
- dataIn.readFully(t);
- rc = new Buffer(t, 0, size);
- }
- return rc;
- }
-}
diff --git a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/BrokerIdMarshaller.java b/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/BrokerIdMarshaller.java
deleted file mode 100755
index 1261c35..0000000
--- a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/BrokerIdMarshaller.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/**
- * 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.openwire.codec.v1;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.activemq.apollo.openwire.command.BrokerId;
-import org.apache.activemq.apollo.openwire.command.DataStructure;
-import org.apache.activemq.apollo.openwire.codec.BooleanStream;
-import org.apache.activemq.apollo.openwire.codec.OpenWireFormat;
-
-
-
-/**
- * Marshalling code for Open Wire Format for BrokerIdMarshaller
- *
- *
- * NOTE!: This file is auto generated - do not modify!
- * if you need to make a change, please see the modify the groovy scripts in the
- * under src/gram/script and then use maven openwire:generate to regenerate
- * this file.
- *
- */
-public class BrokerIdMarshaller extends BaseDataStreamMarshaller {
-
- /**
- * Return the type of Data Structure we marshal
- * @return short representation of the type data structure
- */
- public byte getDataStructureType() {
- return BrokerId.DATA_STRUCTURE_TYPE;
- }
-
- /**
- * @return a new object instance
- */
- public DataStructure createObject() {
- return new BrokerId();
- }
-
- /**
- * Un-marshal an object instance from the data input stream
- *
- * @param o the object to un-marshal
- * @param dataIn the data input stream to build the object from
- * @throws IOException
- */
- public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException {
- super.tightUnmarshal(wireFormat, o, dataIn, bs);
-
- BrokerId info = (BrokerId)o;
- info.setValue(tightUnmarshalString(dataIn, bs));
-
- }
-
-
- /**
- * Write the booleans that this object uses to a BooleanStream
- */
- public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
-
- BrokerId info = (BrokerId)o;
-
- int rc = super.tightMarshal1(wireFormat, o, bs);
- rc += tightMarshalString1(info.getValue(), bs);
-
- return rc + 0;
- }
-
- /**
- * Write a object instance to data output stream
- *
- * @param o the instance to be marshaled
- * @param dataOut the output stream
- * @throws IOException thrown if an error occurs
- */
- public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException {
- super.tightMarshal2(wireFormat, o, dataOut, bs);
-
- BrokerId info = (BrokerId)o;
- tightMarshalString2(info.getValue(), dataOut, bs);
-
- }
-
- /**
- * Un-marshal an object instance from the data input stream
- *
- * @param o the object to un-marshal
- * @param dataIn the data input stream to build the object from
- * @throws IOException
- */
- public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException {
- super.looseUnmarshal(wireFormat, o, dataIn);
-
- BrokerId info = (BrokerId)o;
- info.setValue(looseUnmarshalString(dataIn));
-
- }
-
-
- /**
- * Write the booleans that this object uses to a BooleanStream
- */
- public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
-
- BrokerId info = (BrokerId)o;
-
- super.looseMarshal(wireFormat, o, dataOut);
- looseMarshalString(info.getValue(), dataOut);
-
- }
-}
diff --git a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/BrokerInfoMarshaller.java b/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/BrokerInfoMarshaller.java
deleted file mode 100755
index d52bd5a..0000000
--- a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/BrokerInfoMarshaller.java
+++ /dev/null
@@ -1,173 +0,0 @@
-/**
- * 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.openwire.codec.v1;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.activemq.apollo.openwire.command.BrokerInfo;
-import org.apache.activemq.apollo.openwire.command.DataStructure;
-import org.apache.activemq.apollo.openwire.codec.BooleanStream;
-import org.apache.activemq.apollo.openwire.codec.OpenWireFormat;
-
-/**
- * Marshalling code for Open Wire Format for BrokerInfoMarshaller NOTE!: This
- * file is auto generated - do not modify! if you need to make a change, please
- * see the modify the groovy scripts in the under src/gram/script and then use
- * maven openwire:generate to regenerate this file.
- *
- */
-public class BrokerInfoMarshaller extends BaseCommandMarshaller {
-
- /**
- * Return the type of Data Structure we marshal
- *
- * @return short representation of the type data structure
- */
- public byte getDataStructureType() {
- return BrokerInfo.DATA_STRUCTURE_TYPE;
- }
-
- /**
- * @return a new object instance
- */
- public DataStructure createObject() {
- return new BrokerInfo();
- }
-
- /**
- * Un-marshal an object instance from the data input stream
- *
- * @param o the object to un-marshal
- * @param dataIn the data input stream to build the object from
- * @throws IOException
- */
- public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException {
- super.tightUnmarshal(wireFormat, o, dataIn, bs);
-
- BrokerInfo info = (BrokerInfo)o;
- info.setBrokerId((org.apache.activemq.apollo.openwire.command.BrokerId)tightUnmarsalCachedObject(wireFormat, dataIn, bs));
- info.setBrokerURL(tightUnmarshalString(dataIn, bs));
-
- if (bs.readBoolean()) {
- short size = dataIn.readShort();
- org.apache.activemq.apollo.openwire.command.BrokerInfo value[] = new org.apache.activemq.apollo.openwire.command.BrokerInfo[size];
- for (int i = 0; i < size; i++) {
- value[i] = (org.apache.activemq.apollo.openwire.command.BrokerInfo)tightUnmarsalNestedObject(wireFormat, dataIn, bs);
- }
- info.setPeerBrokerInfos(value);
- } else {
- info.setPeerBrokerInfos(null);
- }
- info.setBrokerName(tightUnmarshalString(dataIn, bs));
- info.setSlaveBroker(bs.readBoolean());
- info.setMasterBroker(bs.readBoolean());
- info.setFaultTolerantConfiguration(bs.readBoolean());
-
- }
-
- /**
- * Write the booleans that this object uses to a BooleanStream
- */
- public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
-
- BrokerInfo info = (BrokerInfo)o;
-
- int rc = super.tightMarshal1(wireFormat, o, bs);
- rc += tightMarshalCachedObject1(wireFormat, (DataStructure)info.getBrokerId(), bs);
- rc += tightMarshalString1(info.getBrokerURL(), bs);
- rc += tightMarshalObjectArray1(wireFormat, info.getPeerBrokerInfos(), bs);
- rc += tightMarshalString1(info.getBrokerName(), bs);
- bs.writeBoolean(info.isSlaveBroker());
- bs.writeBoolean(info.isMasterBroker());
- bs.writeBoolean(info.isFaultTolerantConfiguration());
-
- return rc + 0;
- }
-
- /**
- * Write a object instance to data output stream
- *
- * @param o the instance to be marshaled
- * @param dataOut the output stream
- * @throws IOException thrown if an error occurs
- */
- public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException {
- super.tightMarshal2(wireFormat, o, dataOut, bs);
-
- BrokerInfo info = (BrokerInfo)o;
- tightMarshalCachedObject2(wireFormat, (DataStructure)info.getBrokerId(), dataOut, bs);
- tightMarshalString2(info.getBrokerURL(), dataOut, bs);
- tightMarshalObjectArray2(wireFormat, info.getPeerBrokerInfos(), dataOut, bs);
- tightMarshalString2(info.getBrokerName(), dataOut, bs);
- bs.readBoolean();
- bs.readBoolean();
- bs.readBoolean();
-
- }
-
- /**
- * Un-marshal an object instance from the data input stream
- *
- * @param o the object to un-marshal
- * @param dataIn the data input stream to build the object from
- * @throws IOException
- */
- public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException {
- super.looseUnmarshal(wireFormat, o, dataIn);
-
- BrokerInfo info = (BrokerInfo)o;
- info.setBrokerId((org.apache.activemq.apollo.openwire.command.BrokerId)looseUnmarsalCachedObject(wireFormat, dataIn));
- info.setBrokerURL(looseUnmarshalString(dataIn));
-
- if (dataIn.readBoolean()) {
- short size = dataIn.readShort();
- org.apache.activemq.apollo.openwire.command.BrokerInfo value[] = new org.apache.activemq.apollo.openwire.command.BrokerInfo[size];
- for (int i = 0; i < size; i++) {
- value[i] = (org.apache.activemq.apollo.openwire.command.BrokerInfo)looseUnmarsalNestedObject(wireFormat, dataIn);
- }
- info.setPeerBrokerInfos(value);
- } else {
- info.setPeerBrokerInfos(null);
- }
- info.setBrokerName(looseUnmarshalString(dataIn));
- info.setSlaveBroker(dataIn.readBoolean());
- info.setMasterBroker(dataIn.readBoolean());
- info.setFaultTolerantConfiguration(dataIn.readBoolean());
-
- }
-
- /**
- * Write the booleans that this object uses to a BooleanStream
- */
- public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
-
- BrokerInfo info = (BrokerInfo)o;
-
- super.looseMarshal(wireFormat, o, dataOut);
- looseMarshalCachedObject(wireFormat, (DataStructure)info.getBrokerId(), dataOut);
- looseMarshalString(info.getBrokerURL(), dataOut);
- looseMarshalObjectArray(wireFormat, info.getPeerBrokerInfos(), dataOut);
- looseMarshalString(info.getBrokerName(), dataOut);
- dataOut.writeBoolean(info.isSlaveBroker());
- dataOut.writeBoolean(info.isMasterBroker());
- dataOut.writeBoolean(info.isFaultTolerantConfiguration());
-
- }
-}
diff --git a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ConnectionControlMarshaller.java b/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ConnectionControlMarshaller.java
deleted file mode 100644
index 18eb610..0000000
--- a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ConnectionControlMarshaller.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/**
- * 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.openwire.codec.v1;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.activemq.apollo.openwire.command.ConnectionControl;
-import org.apache.activemq.apollo.openwire.command.DataStructure;
-import org.apache.activemq.apollo.openwire.codec.BooleanStream;
-import org.apache.activemq.apollo.openwire.codec.OpenWireFormat;
-
-
-
-/**
- * Marshalling code for Open Wire Format for ConnectionControlMarshaller
- *
- *
- * NOTE!: This file is auto generated - do not modify!
- * if you need to make a change, please see the modify the groovy scripts in the
- * under src/gram/script and then use maven openwire:generate to regenerate
- * this file.
- *
- */
-public class ConnectionControlMarshaller extends BaseCommandMarshaller {
-
- /**
- * Return the type of Data Structure we marshal
- * @return short representation of the type data structure
- */
- public byte getDataStructureType() {
- return ConnectionControl.DATA_STRUCTURE_TYPE;
- }
-
- /**
- * @return a new object instance
- */
- public DataStructure createObject() {
- return new ConnectionControl();
- }
-
- /**
- * Un-marshal an object instance from the data input stream
- *
- * @param o the object to un-marshal
- * @param dataIn the data input stream to build the object from
- * @throws IOException
- */
- public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException {
- super.tightUnmarshal(wireFormat, o, dataIn, bs);
-
- ConnectionControl info = (ConnectionControl)o;
- info.setClose(bs.readBoolean());
- info.setExit(bs.readBoolean());
- info.setFaultTolerant(bs.readBoolean());
- info.setResume(bs.readBoolean());
- info.setSuspend(bs.readBoolean());
-
- }
-
-
- /**
- * Write the booleans that this object uses to a BooleanStream
- */
- public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
-
- ConnectionControl info = (ConnectionControl)o;
-
- int rc = super.tightMarshal1(wireFormat, o, bs);
- bs.writeBoolean(info.isClose());
- bs.writeBoolean(info.isExit());
- bs.writeBoolean(info.isFaultTolerant());
- bs.writeBoolean(info.isResume());
- bs.writeBoolean(info.isSuspend());
-
- return rc + 0;
- }
-
- /**
- * Write a object instance to data output stream
- *
- * @param o the instance to be marshaled
- * @param dataOut the output stream
- * @throws IOException thrown if an error occurs
- */
- public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException {
- super.tightMarshal2(wireFormat, o, dataOut, bs);
-
- ConnectionControl info = (ConnectionControl)o;
- bs.readBoolean();
- bs.readBoolean();
- bs.readBoolean();
- bs.readBoolean();
- bs.readBoolean();
-
- }
-
- /**
- * Un-marshal an object instance from the data input stream
- *
- * @param o the object to un-marshal
- * @param dataIn the data input stream to build the object from
- * @throws IOException
- */
- public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException {
- super.looseUnmarshal(wireFormat, o, dataIn);
-
- ConnectionControl info = (ConnectionControl)o;
- info.setClose(dataIn.readBoolean());
- info.setExit(dataIn.readBoolean());
- info.setFaultTolerant(dataIn.readBoolean());
- info.setResume(dataIn.readBoolean());
- info.setSuspend(dataIn.readBoolean());
-
- }
-
-
- /**
- * Write the booleans that this object uses to a BooleanStream
- */
- public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
-
- ConnectionControl info = (ConnectionControl)o;
-
- super.looseMarshal(wireFormat, o, dataOut);
- dataOut.writeBoolean(info.isClose());
- dataOut.writeBoolean(info.isExit());
- dataOut.writeBoolean(info.isFaultTolerant());
- dataOut.writeBoolean(info.isResume());
- dataOut.writeBoolean(info.isSuspend());
-
- }
-}
diff --git a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ConnectionErrorMarshaller.java b/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ConnectionErrorMarshaller.java
deleted file mode 100644
index 58eed56..0000000
--- a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ConnectionErrorMarshaller.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/**
- * 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.openwire.codec.v1;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.activemq.apollo.openwire.command.ConnectionError;
-import org.apache.activemq.apollo.openwire.command.DataStructure;
-import org.apache.activemq.apollo.openwire.codec.BooleanStream;
-import org.apache.activemq.apollo.openwire.codec.OpenWireFormat;
-
-
-
-/**
- * Marshalling code for Open Wire Format for ConnectionErrorMarshaller
- *
- *
- * NOTE!: This file is auto generated - do not modify!
- * if you need to make a change, please see the modify the groovy scripts in the
- * under src/gram/script and then use maven openwire:generate to regenerate
- * this file.
- *
- */
-public class ConnectionErrorMarshaller extends BaseCommandMarshaller {
-
- /**
- * Return the type of Data Structure we marshal
- * @return short representation of the type data structure
- */
- public byte getDataStructureType() {
- return ConnectionError.DATA_STRUCTURE_TYPE;
- }
-
- /**
- * @return a new object instance
- */
- public DataStructure createObject() {
- return new ConnectionError();
- }
-
- /**
- * Un-marshal an object instance from the data input stream
- *
- * @param o the object to un-marshal
- * @param dataIn the data input stream to build the object from
- * @throws IOException
- */
- public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException {
- super.tightUnmarshal(wireFormat, o, dataIn, bs);
-
- ConnectionError info = (ConnectionError)o;
- info.setException((java.lang.Throwable) tightUnmarsalThrowable(wireFormat, dataIn, bs));
- info.setConnectionId((org.apache.activemq.apollo.openwire.command.ConnectionId) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
-
- }
-
-
- /**
- * Write the booleans that this object uses to a BooleanStream
- */
- public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
-
- ConnectionError info = (ConnectionError)o;
-
- int rc = super.tightMarshal1(wireFormat, o, bs);
- rc += tightMarshalThrowable1(wireFormat, info.getException(), bs);
- rc += tightMarshalNestedObject1(wireFormat, (DataStructure)info.getConnectionId(), bs);
-
- return rc + 0;
- }
-
- /**
- * Write a object instance to data output stream
- *
- * @param o the instance to be marshaled
- * @param dataOut the output stream
- * @throws IOException thrown if an error occurs
- */
- public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException {
- super.tightMarshal2(wireFormat, o, dataOut, bs);
-
- ConnectionError info = (ConnectionError)o;
- tightMarshalThrowable2(wireFormat, info.getException(), dataOut, bs);
- tightMarshalNestedObject2(wireFormat, (DataStructure)info.getConnectionId(), dataOut, bs);
-
- }
-
- /**
- * Un-marshal an object instance from the data input stream
- *
- * @param o the object to un-marshal
- * @param dataIn the data input stream to build the object from
- * @throws IOException
- */
- public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException {
- super.looseUnmarshal(wireFormat, o, dataIn);
-
- ConnectionError info = (ConnectionError)o;
- info.setException((java.lang.Throwable) looseUnmarsalThrowable(wireFormat, dataIn));
- info.setConnectionId((org.apache.activemq.apollo.openwire.command.ConnectionId) looseUnmarsalNestedObject(wireFormat, dataIn));
-
- }
-
-
- /**
- * Write the booleans that this object uses to a BooleanStream
- */
- public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
-
- ConnectionError info = (ConnectionError)o;
-
- super.looseMarshal(wireFormat, o, dataOut);
- looseMarshalThrowable(wireFormat, info.getException(), dataOut);
- looseMarshalNestedObject(wireFormat, (DataStructure)info.getConnectionId(), dataOut);
-
- }
-}
diff --git a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ConnectionIdMarshaller.java b/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ConnectionIdMarshaller.java
deleted file mode 100755
index 7a1e19c..0000000
--- a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ConnectionIdMarshaller.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/**
- * 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.openwire.codec.v1;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.activemq.apollo.openwire.command.ConnectionId;
-import org.apache.activemq.apollo.openwire.command.DataStructure;
-import org.apache.activemq.apollo.openwire.codec.BooleanStream;
-import org.apache.activemq.apollo.openwire.codec.OpenWireFormat;
-
-
-
-/**
- * Marshalling code for Open Wire Format for ConnectionIdMarshaller
- *
- *
- * NOTE!: This file is auto generated - do not modify!
- * if you need to make a change, please see the modify the groovy scripts in the
- * under src/gram/script and then use maven openwire:generate to regenerate
- * this file.
- *
- */
-public class ConnectionIdMarshaller extends BaseDataStreamMarshaller {
-
- /**
- * Return the type of Data Structure we marshal
- * @return short representation of the type data structure
- */
- public byte getDataStructureType() {
- return ConnectionId.DATA_STRUCTURE_TYPE;
- }
-
- /**
- * @return a new object instance
- */
- public DataStructure createObject() {
- return new ConnectionId();
- }
-
- /**
- * Un-marshal an object instance from the data input stream
- *
- * @param o the object to un-marshal
- * @param dataIn the data input stream to build the object from
- * @throws IOException
- */
- public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException {
- super.tightUnmarshal(wireFormat, o, dataIn, bs);
-
- ConnectionId info = (ConnectionId)o;
- info.setValue(tightUnmarshalString(dataIn, bs));
-
- }
-
-
- /**
- * Write the booleans that this object uses to a BooleanStream
- */
- public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
-
- ConnectionId info = (ConnectionId)o;
-
- int rc = super.tightMarshal1(wireFormat, o, bs);
- rc += tightMarshalString1(info.getValue(), bs);
-
- return rc + 0;
- }
-
- /**
- * Write a object instance to data output stream
- *
- * @param o the instance to be marshaled
- * @param dataOut the output stream
- * @throws IOException thrown if an error occurs
- */
- public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException {
- super.tightMarshal2(wireFormat, o, dataOut, bs);
-
- ConnectionId info = (ConnectionId)o;
- tightMarshalString2(info.getValue(), dataOut, bs);
-
- }
-
- /**
- * Un-marshal an object instance from the data input stream
- *
- * @param o the object to un-marshal
- * @param dataIn the data input stream to build the object from
- * @throws IOException
- */
- public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException {
- super.looseUnmarshal(wireFormat, o, dataIn);
-
- ConnectionId info = (ConnectionId)o;
- info.setValue(looseUnmarshalString(dataIn));
-
- }
-
-
- /**
- * Write the booleans that this object uses to a BooleanStream
- */
- public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
-
- ConnectionId info = (ConnectionId)o;
-
- super.looseMarshal(wireFormat, o, dataOut);
- looseMarshalString(info.getValue(), dataOut);
-
- }
-}
diff --git a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ConnectionInfoMarshaller.java b/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ConnectionInfoMarshaller.java
deleted file mode 100755
index e0aacb8..0000000
--- a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ConnectionInfoMarshaller.java
+++ /dev/null
@@ -1,180 +0,0 @@
-/**
- * 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.openwire.codec.v1;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.activemq.apollo.openwire.command.ConnectionInfo;
-import org.apache.activemq.apollo.openwire.command.DataStructure;
-import org.apache.activemq.apollo.openwire.codec.BooleanStream;
-import org.apache.activemq.apollo.openwire.codec.OpenWireFormat;
-
-/**
- * Marshalling code for Open Wire Format for ConnectionInfoMarshaller
- *
- *
- * NOTE!: This file is auto generated - do not modify! if you need to make a
- * change, please see the modify the groovy scripts in the under src/gram/script
- * and then use maven openwire:generate to regenerate this file.
- *
- */
-public class ConnectionInfoMarshaller extends BaseCommandMarshaller {
-
- /**
- * Return the type of Data Structure we marshal
- *
- * @return short representation of the type data structure
- */
- public byte getDataStructureType() {
- return ConnectionInfo.DATA_STRUCTURE_TYPE;
- }
-
- /**
- * @return a new object instance
- */
- public DataStructure createObject() {
- return new ConnectionInfo();
- }
-
- /**
- * Un-marshal an object instance from the data input stream
- *
- * @param o the object to un-marshal
- * @param dataIn the data input stream to build the object from
- * @throws IOException
- */
- public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs)
- throws IOException {
- super.tightUnmarshal(wireFormat, o, dataIn, bs);
-
- ConnectionInfo info = (ConnectionInfo)o;
- info.setConnectionId((org.apache.activemq.apollo.openwire.command.ConnectionId)tightUnmarsalCachedObject(wireFormat,
- dataIn, bs));
- info.setClientId(tightUnmarshalString(dataIn, bs));
- info.setPassword(tightUnmarshalString(dataIn, bs));
- info.setUserName(tightUnmarshalString(dataIn, bs));
-
- if (bs.readBoolean()) {
- short size = dataIn.readShort();
- org.apache.activemq.apollo.openwire.command.BrokerId value[] = new org.apache.activemq.apollo.openwire.command.BrokerId[size];
- for (int i = 0; i < size; i++) {
- value[i] = (org.apache.activemq.apollo.openwire.command.BrokerId)tightUnmarsalNestedObject(wireFormat,
- dataIn, bs);
- }
- info.setBrokerPath(value);
- } else {
- info.setBrokerPath(null);
- }
- info.setBrokerMasterConnector(bs.readBoolean());
- info.setManageable(bs.readBoolean());
-
- }
-
- /**
- * Write the booleans that this object uses to a BooleanStream
- */
- public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
-
- ConnectionInfo info = (ConnectionInfo)o;
-
- int rc = super.tightMarshal1(wireFormat, o, bs);
- rc += tightMarshalCachedObject1(wireFormat, (DataStructure)info.getConnectionId(), bs);
- rc += tightMarshalString1(info.getClientId(), bs);
- rc += tightMarshalString1(info.getPassword(), bs);
- rc += tightMarshalString1(info.getUserName(), bs);
- rc += tightMarshalObjectArray1(wireFormat, info.getBrokerPath(), bs);
- bs.writeBoolean(info.isBrokerMasterConnector());
- bs.writeBoolean(info.isManageable());
-
- return rc + 0;
- }
-
- /**
- * Write a object instance to data output stream
- *
- * @param o the instance to be marshaled
- * @param dataOut the output stream
- * @throws IOException thrown if an error occurs
- */
- public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs)
- throws IOException {
- super.tightMarshal2(wireFormat, o, dataOut, bs);
-
- ConnectionInfo info = (ConnectionInfo)o;
- tightMarshalCachedObject2(wireFormat, (DataStructure)info.getConnectionId(), dataOut, bs);
- tightMarshalString2(info.getClientId(), dataOut, bs);
- tightMarshalString2(info.getPassword(), dataOut, bs);
- tightMarshalString2(info.getUserName(), dataOut, bs);
- tightMarshalObjectArray2(wireFormat, info.getBrokerPath(), dataOut, bs);
- bs.readBoolean();
- bs.readBoolean();
-
- }
-
- /**
- * Un-marshal an object instance from the data input stream
- *
- * @param o the object to un-marshal
- * @param dataIn the data input stream to build the object from
- * @throws IOException
- */
- public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException {
- super.looseUnmarshal(wireFormat, o, dataIn);
-
- ConnectionInfo info = (ConnectionInfo)o;
- info.setConnectionId((org.apache.activemq.apollo.openwire.command.ConnectionId)looseUnmarsalCachedObject(wireFormat,
- dataIn));
- info.setClientId(looseUnmarshalString(dataIn));
- info.setPassword(looseUnmarshalString(dataIn));
- info.setUserName(looseUnmarshalString(dataIn));
-
- if (dataIn.readBoolean()) {
- short size = dataIn.readShort();
- org.apache.activemq.apollo.openwire.command.BrokerId value[] = new org.apache.activemq.apollo.openwire.command.BrokerId[size];
- for (int i = 0; i < size; i++) {
- value[i] = (org.apache.activemq.apollo.openwire.command.BrokerId)looseUnmarsalNestedObject(wireFormat, dataIn);
- }
- info.setBrokerPath(value);
- } else {
- info.setBrokerPath(null);
- }
- info.setBrokerMasterConnector(dataIn.readBoolean());
- info.setManageable(dataIn.readBoolean());
-
- }
-
- /**
- * Write the booleans that this object uses to a BooleanStream
- */
- public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
-
- ConnectionInfo info = (ConnectionInfo)o;
-
- super.looseMarshal(wireFormat, o, dataOut);
- looseMarshalCachedObject(wireFormat, (DataStructure)info.getConnectionId(), dataOut);
- looseMarshalString(info.getClientId(), dataOut);
- looseMarshalString(info.getPassword(), dataOut);
- looseMarshalString(info.getUserName(), dataOut);
- looseMarshalObjectArray(wireFormat, info.getBrokerPath(), dataOut);
- dataOut.writeBoolean(info.isBrokerMasterConnector());
- dataOut.writeBoolean(info.isManageable());
-
- }
-}
diff --git a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ConsumerControlMarshaller.java b/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ConsumerControlMarshaller.java
deleted file mode 100644
index 8152d0f..0000000
--- a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ConsumerControlMarshaller.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/**
- * 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.openwire.codec.v1;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.activemq.apollo.openwire.command.ConsumerControl;
-import org.apache.activemq.apollo.openwire.command.DataStructure;
-import org.apache.activemq.apollo.openwire.codec.BooleanStream;
-import org.apache.activemq.apollo.openwire.codec.OpenWireFormat;
-
-
-
-/**
- * Marshalling code for Open Wire Format for ConsumerControlMarshaller
- *
- *
- * NOTE!: This file is auto generated - do not modify!
- * if you need to make a change, please see the modify the groovy scripts in the
- * under src/gram/script and then use maven openwire:generate to regenerate
- * this file.
- *
- */
-public class ConsumerControlMarshaller extends BaseCommandMarshaller {
-
- /**
- * Return the type of Data Structure we marshal
- * @return short representation of the type data structure
- */
- public byte getDataStructureType() {
- return ConsumerControl.DATA_STRUCTURE_TYPE;
- }
-
- /**
- * @return a new object instance
- */
- public DataStructure createObject() {
- return new ConsumerControl();
- }
-
- /**
- * Un-marshal an object instance from the data input stream
- *
- * @param o the object to un-marshal
- * @param dataIn the data input stream to build the object from
- * @throws IOException
- */
- public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException {
- super.tightUnmarshal(wireFormat, o, dataIn, bs);
-
- ConsumerControl info = (ConsumerControl)o;
- info.setClose(bs.readBoolean());
- info.setConsumerId((org.apache.activemq.apollo.openwire.command.ConsumerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
- info.setPrefetch(dataIn.readInt());
-
- }
-
-
- /**
- * Write the booleans that this object uses to a BooleanStream
- */
- public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
-
- ConsumerControl info = (ConsumerControl)o;
-
- int rc = super.tightMarshal1(wireFormat, o, bs);
- bs.writeBoolean(info.isClose());
- rc += tightMarshalNestedObject1(wireFormat, (DataStructure)info.getConsumerId(), bs);
-
- return rc + 4;
- }
-
- /**
- * Write a object instance to data output stream
- *
- * @param o the instance to be marshaled
- * @param dataOut the output stream
- * @throws IOException thrown if an error occurs
- */
- public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException {
- super.tightMarshal2(wireFormat, o, dataOut, bs);
-
- ConsumerControl info = (ConsumerControl)o;
- bs.readBoolean();
- tightMarshalNestedObject2(wireFormat, (DataStructure)info.getConsumerId(), dataOut, bs);
- dataOut.writeInt(info.getPrefetch());
-
- }
-
- /**
- * Un-marshal an object instance from the data input stream
- *
- * @param o the object to un-marshal
- * @param dataIn the data input stream to build the object from
- * @throws IOException
- */
- public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException {
- super.looseUnmarshal(wireFormat, o, dataIn);
-
- ConsumerControl info = (ConsumerControl)o;
- info.setClose(dataIn.readBoolean());
- info.setConsumerId((org.apache.activemq.apollo.openwire.command.ConsumerId) looseUnmarsalNestedObject(wireFormat, dataIn));
- info.setPrefetch(dataIn.readInt());
-
- }
-
-
- /**
- * Write the booleans that this object uses to a BooleanStream
- */
- public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
-
- ConsumerControl info = (ConsumerControl)o;
-
- super.looseMarshal(wireFormat, o, dataOut);
- dataOut.writeBoolean(info.isClose());
- looseMarshalNestedObject(wireFormat, (DataStructure)info.getConsumerId(), dataOut);
- dataOut.writeInt(info.getPrefetch());
-
- }
-}
diff --git a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ConsumerIdMarshaller.java b/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ConsumerIdMarshaller.java
deleted file mode 100755
index 94a6434..0000000
--- a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ConsumerIdMarshaller.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/**
- * 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.openwire.codec.v1;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.activemq.apollo.openwire.command.ConsumerId;
-import org.apache.activemq.apollo.openwire.command.DataStructure;
-import org.apache.activemq.apollo.openwire.codec.BooleanStream;
-import org.apache.activemq.apollo.openwire.codec.OpenWireFormat;
-
-/**
- * Marshalling code for Open Wire Format for ConsumerIdMarshaller
- *
- *
- * NOTE!: This file is auto generated - do not modify! if you need to make a
- * change, please see the modify the groovy scripts in the under src/gram/script
- * and then use maven openwire:generate to regenerate this file.
- *
- */
-public class ConsumerIdMarshaller extends BaseDataStreamMarshaller {
-
- /**
- * Return the type of Data Structure we marshal
- *
- * @return short representation of the type data structure
- */
- public byte getDataStructureType() {
- return ConsumerId.DATA_STRUCTURE_TYPE;
- }
-
- /**
- * @return a new object instance
- */
- public DataStructure createObject() {
- return new ConsumerId();
- }
-
- /**
- * Un-marshal an object instance from the data input stream
- *
- * @param o the object to un-marshal
- * @param dataIn the data input stream to build the object from
- * @throws IOException
- */
- public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs)
- throws IOException {
- super.tightUnmarshal(wireFormat, o, dataIn, bs);
-
- ConsumerId info = (ConsumerId)o;
- info.setConnectionId(tightUnmarshalString(dataIn, bs));
- info.setSessionId(tightUnmarshalLong(wireFormat, dataIn, bs));
- info.setValue(tightUnmarshalLong(wireFormat, dataIn, bs));
-
- }
-
- /**
- * Write the booleans that this object uses to a BooleanStream
- */
- public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
-
- ConsumerId info = (ConsumerId)o;
-
- int rc = super.tightMarshal1(wireFormat, o, bs);
- rc += tightMarshalString1(info.getConnectionId(), bs);
- rc += tightMarshalLong1(wireFormat, info.getSessionId(), bs);
- rc += tightMarshalLong1(wireFormat, info.getValue(), bs);
-
- return rc + 0;
- }
-
- /**
- * Write a object instance to data output stream
- *
- * @param o the instance to be marshaled
- * @param dataOut the output stream
- * @throws IOException thrown if an error occurs
- */
- public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs)
- throws IOException {
- super.tightMarshal2(wireFormat, o, dataOut, bs);
-
- ConsumerId info = (ConsumerId)o;
- tightMarshalString2(info.getConnectionId(), dataOut, bs);
- tightMarshalLong2(wireFormat, info.getSessionId(), dataOut, bs);
- tightMarshalLong2(wireFormat, info.getValue(), dataOut, bs);
-
- }
-
- /**
- * Un-marshal an object instance from the data input stream
- *
- * @param o the object to un-marshal
- * @param dataIn the data input stream to build the object from
- * @throws IOException
- */
- public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException {
- super.looseUnmarshal(wireFormat, o, dataIn);
-
- ConsumerId info = (ConsumerId)o;
- info.setConnectionId(looseUnmarshalString(dataIn));
- info.setSessionId(looseUnmarshalLong(wireFormat, dataIn));
- info.setValue(looseUnmarshalLong(wireFormat, dataIn));
-
- }
-
- /**
- * Write the booleans that this object uses to a BooleanStream
- */
- public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
-
- ConsumerId info = (ConsumerId)o;
-
- super.looseMarshal(wireFormat, o, dataOut);
- looseMarshalString(info.getConnectionId(), dataOut);
- looseMarshalLong(wireFormat, info.getSessionId(), dataOut);
- looseMarshalLong(wireFormat, info.getValue(), dataOut);
-
- }
-}
diff --git a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ConsumerInfoMarshaller.java b/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ConsumerInfoMarshaller.java
deleted file mode 100755
index 8f822a3..0000000
--- a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ConsumerInfoMarshaller.java
+++ /dev/null
@@ -1,242 +0,0 @@
-/**
- * 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.openwire.codec.v1;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.activemq.apollo.filter.BooleanExpression;
-import org.apache.activemq.apollo.openwire.command.ConsumerInfo;
-import org.apache.activemq.apollo.openwire.command.DataStructure;
-import org.apache.activemq.apollo.openwire.codec.BooleanStream;
-import org.apache.activemq.apollo.openwire.codec.OpenWireFormat;
-
-/**
- * Marshalling code for Open Wire Format for ConsumerInfoMarshaller
- *
- *
- * NOTE!: This file is auto generated - do not modify! if you need to make a
- * change, please see the modify the groovy scripts in the under src/gram/script
- * and then use maven openwire:generate to regenerate this file.
- *
- */
-public class ConsumerInfoMarshaller extends BaseCommandMarshaller {
-
- /**
- * Return the type of Data Structure we marshal
- *
- * @return short representation of the type data structure
- */
- public byte getDataStructureType() {
- return ConsumerInfo.DATA_STRUCTURE_TYPE;
- }
-
- /**
- * @return a new object instance
- */
- public DataStructure createObject() {
- return new ConsumerInfo();
- }
-
- /**
- * Un-marshal an object instance from the data input stream
- *
- * @param o the object to un-marshal
- * @param dataIn the data input stream to build the object from
- * @throws IOException
- */
- public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs)
- throws IOException {
- super.tightUnmarshal(wireFormat, o, dataIn, bs);
-
- ConsumerInfo info = (ConsumerInfo)o;
- info.setConsumerId((org.apache.activemq.apollo.openwire.command.ConsumerId)tightUnmarsalCachedObject(wireFormat,
- dataIn, bs));
- info.setBrowser(bs.readBoolean());
- info
- .setDestination((org.apache.activemq.apollo.openwire.command.ActiveMQDestination)tightUnmarsalCachedObject(
- wireFormat,
- dataIn,
- bs));
- info.setPrefetchSize(dataIn.readInt());
- info.setMaximumPendingMessageLimit(dataIn.readInt());
- info.setDispatchAsync(bs.readBoolean());
- info.setSelector(tightUnmarshalString(dataIn, bs));
- info.setSubscriptionName(tightUnmarshalString(dataIn, bs));
- info.setNoLocal(bs.readBoolean());
- info.setExclusive(bs.readBoolean());
- info.setRetroactive(bs.readBoolean());
- info.setPriority(dataIn.readByte());
-
- if (bs.readBoolean()) {
- short size = dataIn.readShort();
- org.apache.activemq.apollo.openwire.command.BrokerId value[] = new org.apache.activemq.apollo.openwire.command.BrokerId[size];
- for (int i = 0; i < size; i++) {
- value[i] = (org.apache.activemq.apollo.openwire.command.BrokerId)tightUnmarsalNestedObject(wireFormat,
- dataIn, bs);
- }
- info.setBrokerPath(value);
- } else {
- info.setBrokerPath(null);
- }
- info
- .setAdditionalPredicate((BooleanExpression)tightUnmarsalNestedObject(
- wireFormat,
- dataIn,
- bs));
- info.setNetworkSubscription(bs.readBoolean());
- info.setOptimizedAcknowledge(bs.readBoolean());
- info.setNoRangeAcks(bs.readBoolean());
-
- }
-
- /**
- * Write the booleans that this object uses to a BooleanStream
- */
- public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
-
- ConsumerInfo info = (ConsumerInfo)o;
-
- int rc = super.tightMarshal1(wireFormat, o, bs);
- rc += tightMarshalCachedObject1(wireFormat, (DataStructure)info.getConsumerId(), bs);
- bs.writeBoolean(info.isBrowser());
- rc += tightMarshalCachedObject1(wireFormat, (DataStructure)info.getDestination(), bs);
- bs.writeBoolean(info.isDispatchAsync());
- rc += tightMarshalString1(info.getSelector(), bs);
- rc += tightMarshalString1(info.getSubscriptionName(), bs);
- bs.writeBoolean(info.isNoLocal());
- bs.writeBoolean(info.isExclusive());
- bs.writeBoolean(info.isRetroactive());
- rc += tightMarshalObjectArray1(wireFormat, info.getBrokerPath(), bs);
- rc += tightMarshalNestedObject1(wireFormat, (DataStructure)info.getAdditionalPredicate(), bs);
- bs.writeBoolean(info.isNetworkSubscription());
- bs.writeBoolean(info.isOptimizedAcknowledge());
- bs.writeBoolean(info.isNoRangeAcks());
-
- return rc + 9;
- }
-
- /**
- * Write a object instance to data output stream
- *
- * @param o the instance to be marshaled
- * @param dataOut the output stream
- * @throws IOException thrown if an error occurs
- */
- public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs)
- throws IOException {
- super.tightMarshal2(wireFormat, o, dataOut, bs);
-
- ConsumerInfo info = (ConsumerInfo)o;
- tightMarshalCachedObject2(wireFormat, (DataStructure)info.getConsumerId(), dataOut, bs);
- bs.readBoolean();
- tightMarshalCachedObject2(wireFormat, (DataStructure)info.getDestination(), dataOut, bs);
- dataOut.writeInt(info.getPrefetchSize());
- dataOut.writeInt(info.getMaximumPendingMessageLimit());
- bs.readBoolean();
- tightMarshalString2(info.getSelector(), dataOut, bs);
- tightMarshalString2(info.getSubscriptionName(), dataOut, bs);
- bs.readBoolean();
- bs.readBoolean();
- bs.readBoolean();
- dataOut.writeByte(info.getPriority());
- tightMarshalObjectArray2(wireFormat, info.getBrokerPath(), dataOut, bs);
- tightMarshalNestedObject2(wireFormat, (DataStructure)info.getAdditionalPredicate(), dataOut, bs);
- bs.readBoolean();
- bs.readBoolean();
- bs.readBoolean();
-
- }
-
- /**
- * Un-marshal an object instance from the data input stream
- *
- * @param o the object to un-marshal
- * @param dataIn the data input stream to build the object from
- * @throws IOException
- */
- public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException {
- super.looseUnmarshal(wireFormat, o, dataIn);
-
- ConsumerInfo info = (ConsumerInfo)o;
- info.setConsumerId((org.apache.activemq.apollo.openwire.command.ConsumerId)looseUnmarsalCachedObject(wireFormat,
- dataIn));
- info.setBrowser(dataIn.readBoolean());
- info
- .setDestination((org.apache.activemq.apollo.openwire.command.ActiveMQDestination)looseUnmarsalCachedObject(
- wireFormat,
- dataIn));
- info.setPrefetchSize(dataIn.readInt());
- info.setMaximumPendingMessageLimit(dataIn.readInt());
- info.setDispatchAsync(dataIn.readBoolean());
- info.setSelector(looseUnmarshalString(dataIn));
- info.setSubscriptionName(looseUnmarshalString(dataIn));
- info.setNoLocal(dataIn.readBoolean());
- info.setExclusive(dataIn.readBoolean());
- info.setRetroactive(dataIn.readBoolean());
- info.setPriority(dataIn.readByte());
-
- if (dataIn.readBoolean()) {
- short size = dataIn.readShort();
- org.apache.activemq.apollo.openwire.command.BrokerId value[] = new org.apache.activemq.apollo.openwire.command.BrokerId[size];
- for (int i = 0; i < size; i++) {
- value[i] = (org.apache.activemq.apollo.openwire.command.BrokerId)looseUnmarsalNestedObject(wireFormat, dataIn);
- }
- info.setBrokerPath(value);
- } else {
- info.setBrokerPath(null);
- }
- info
- .setAdditionalPredicate((BooleanExpression)looseUnmarsalNestedObject(
- wireFormat,
- dataIn));
- info.setNetworkSubscription(dataIn.readBoolean());
- info.setOptimizedAcknowledge(dataIn.readBoolean());
- info.setNoRangeAcks(dataIn.readBoolean());
-
- }
-
- /**
- * Write the booleans that this object uses to a BooleanStream
- */
- public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
-
- ConsumerInfo info = (ConsumerInfo)o;
-
- super.looseMarshal(wireFormat, o, dataOut);
- looseMarshalCachedObject(wireFormat, (DataStructure)info.getConsumerId(), dataOut);
- dataOut.writeBoolean(info.isBrowser());
- looseMarshalCachedObject(wireFormat, (DataStructure)info.getDestination(), dataOut);
- dataOut.writeInt(info.getPrefetchSize());
- dataOut.writeInt(info.getMaximumPendingMessageLimit());
- dataOut.writeBoolean(info.isDispatchAsync());
- looseMarshalString(info.getSelector(), dataOut);
- looseMarshalString(info.getSubscriptionName(), dataOut);
- dataOut.writeBoolean(info.isNoLocal());
- dataOut.writeBoolean(info.isExclusive());
- dataOut.writeBoolean(info.isRetroactive());
- dataOut.writeByte(info.getPriority());
- looseMarshalObjectArray(wireFormat, info.getBrokerPath(), dataOut);
- looseMarshalNestedObject(wireFormat, (DataStructure)info.getAdditionalPredicate(), dataOut);
- dataOut.writeBoolean(info.isNetworkSubscription());
- dataOut.writeBoolean(info.isOptimizedAcknowledge());
- dataOut.writeBoolean(info.isNoRangeAcks());
-
- }
-}
diff --git a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ControlCommandMarshaller.java b/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ControlCommandMarshaller.java
deleted file mode 100644
index 9d1a28e..0000000
--- a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ControlCommandMarshaller.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/**
- * 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.openwire.codec.v1;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.activemq.apollo.openwire.command.ControlCommand;
-import org.apache.activemq.apollo.openwire.command.DataStructure;
-import org.apache.activemq.apollo.openwire.codec.BooleanStream;
-import org.apache.activemq.apollo.openwire.codec.OpenWireFormat;
-
-
-
-/**
- * Marshalling code for Open Wire Format for ControlCommandMarshaller
- *
- *
- * NOTE!: This file is auto generated - do not modify!
- * if you need to make a change, please see the modify the groovy scripts in the
- * under src/gram/script and then use maven openwire:generate to regenerate
- * this file.
- *
- */
-public class ControlCommandMarshaller extends BaseCommandMarshaller {
-
- /**
- * Return the type of Data Structure we marshal
- * @return short representation of the type data structure
- */
- public byte getDataStructureType() {
- return ControlCommand.DATA_STRUCTURE_TYPE;
- }
-
- /**
- * @return a new object instance
- */
- public DataStructure createObject() {
- return new ControlCommand();
- }
-
- /**
- * Un-marshal an object instance from the data input stream
- *
- * @param o the object to un-marshal
- * @param dataIn the data input stream to build the object from
- * @throws IOException
- */
- public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException {
- super.tightUnmarshal(wireFormat, o, dataIn, bs);
-
- ControlCommand info = (ControlCommand)o;
- info.setCommand(tightUnmarshalString(dataIn, bs));
-
- }
-
-
- /**
- * Write the booleans that this object uses to a BooleanStream
- */
- public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
-
- ControlCommand info = (ControlCommand)o;
-
- int rc = super.tightMarshal1(wireFormat, o, bs);
- rc += tightMarshalString1(info.getCommand(), bs);
-
- return rc + 0;
- }
-
- /**
- * Write a object instance to data output stream
- *
- * @param o the instance to be marshaled
- * @param dataOut the output stream
- * @throws IOException thrown if an error occurs
- */
- public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException {
- super.tightMarshal2(wireFormat, o, dataOut, bs);
-
- ControlCommand info = (ControlCommand)o;
- tightMarshalString2(info.getCommand(), dataOut, bs);
-
- }
-
- /**
- * Un-marshal an object instance from the data input stream
- *
- * @param o the object to un-marshal
- * @param dataIn the data input stream to build the object from
- * @throws IOException
- */
- public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException {
- super.looseUnmarshal(wireFormat, o, dataIn);
-
- ControlCommand info = (ControlCommand)o;
- info.setCommand(looseUnmarshalString(dataIn));
-
- }
-
-
- /**
- * Write the booleans that this object uses to a BooleanStream
- */
- public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
-
- ControlCommand info = (ControlCommand)o;
-
- super.looseMarshal(wireFormat, o, dataOut);
- looseMarshalString(info.getCommand(), dataOut);
-
- }
-}
diff --git a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/DataArrayResponseMarshaller.java b/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/DataArrayResponseMarshaller.java
deleted file mode 100755
index 161b0d8..0000000
--- a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/DataArrayResponseMarshaller.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/**
- * 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.openwire.codec.v1;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.activemq.apollo.openwire.command.DataArrayResponse;
-import org.apache.activemq.apollo.openwire.command.DataStructure;
-import org.apache.activemq.apollo.openwire.codec.BooleanStream;
-import org.apache.activemq.apollo.openwire.codec.OpenWireFormat;
-
-/**
- * Marshalling code for Open Wire Format for DataArrayResponseMarshaller
- *
- *
- * NOTE!: This file is auto generated - do not modify! if you need to make a
- * change, please see the modify the groovy scripts in the under src/gram/script
- * and then use maven openwire:generate to regenerate this file.
- *
- */
-public class DataArrayResponseMarshaller extends ResponseMarshaller {
-
- /**
- * Return the type of Data Structure we marshal
- *
- * @return short representation of the type data structure
- */
- public byte getDataStructureType() {
- return DataArrayResponse.DATA_STRUCTURE_TYPE;
- }
-
- /**
- * @return a new object instance
- */
- public DataStructure createObject() {
- return new DataArrayResponse();
- }
-
- /**
- * Un-marshal an object instance from the data input stream
- *
- * @param o the object to un-marshal
- * @param dataIn the data input stream to build the object from
- * @throws IOException
- */
- public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs)
- throws IOException {
- super.tightUnmarshal(wireFormat, o, dataIn, bs);
-
- DataArrayResponse info = (DataArrayResponse)o;
-
- if (bs.readBoolean()) {
- short size = dataIn.readShort();
- org.apache.activemq.apollo.openwire.command.DataStructure value[] = new org.apache.activemq.apollo.openwire.command.DataStructure[size];
- for (int i = 0; i < size; i++) {
- value[i] = (org.apache.activemq.apollo.openwire.command.DataStructure)tightUnmarsalNestedObject(wireFormat,
- dataIn, bs);
- }
- info.setData(value);
- } else {
- info.setData(null);
- }
-
- }
-
- /**
- * Write the booleans that this object uses to a BooleanStream
- */
- public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
-
- DataArrayResponse info = (DataArrayResponse)o;
-
- int rc = super.tightMarshal1(wireFormat, o, bs);
- rc += tightMarshalObjectArray1(wireFormat, info.getData(), bs);
-
- return rc + 0;
- }
-
- /**
- * Write a object instance to data output stream
- *
- * @param o the instance to be marshaled
- * @param dataOut the output stream
- * @throws IOException thrown if an error occurs
- */
- public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs)
- throws IOException {
- super.tightMarshal2(wireFormat, o, dataOut, bs);
-
- DataArrayResponse info = (DataArrayResponse)o;
- tightMarshalObjectArray2(wireFormat, info.getData(), dataOut, bs);
-
- }
-
- /**
- * Un-marshal an object instance from the data input stream
- *
- * @param o the object to un-marshal
- * @param dataIn the data input stream to build the object from
- * @throws IOException
- */
- public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException {
- super.looseUnmarshal(wireFormat, o, dataIn);
-
- DataArrayResponse info = (DataArrayResponse)o;
-
- if (dataIn.readBoolean()) {
- short size = dataIn.readShort();
- org.apache.activemq.apollo.openwire.command.DataStructure value[] = new org.apache.activemq.apollo.openwire.command.DataStructure[size];
- for (int i = 0; i < size; i++) {
- value[i] = (org.apache.activemq.apollo.openwire.command.DataStructure)looseUnmarsalNestedObject(wireFormat,
- dataIn);
- }
- info.setData(value);
- } else {
- info.setData(null);
- }
-
- }
-
- /**
- * Write the booleans that this object uses to a BooleanStream
- */
- public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
-
- DataArrayResponse info = (DataArrayResponse)o;
-
- super.looseMarshal(wireFormat, o, dataOut);
- looseMarshalObjectArray(wireFormat, info.getData(), dataOut);
-
- }
-}
diff --git a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/DataResponseMarshaller.java b/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/DataResponseMarshaller.java
deleted file mode 100755
index f6c6833..0000000
--- a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/DataResponseMarshaller.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/**
- * 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.openwire.codec.v1;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.activemq.apollo.openwire.command.DataResponse;
-import org.apache.activemq.apollo.openwire.command.DataStructure;
-import org.apache.activemq.apollo.openwire.codec.BooleanStream;
-import org.apache.activemq.apollo.openwire.codec.OpenWireFormat;
-
-
-
-/**
- * Marshalling code for Open Wire Format for DataResponseMarshaller
- *
- *
- * NOTE!: This file is auto generated - do not modify!
- * if you need to make a change, please see the modify the groovy scripts in the
- * under src/gram/script and then use maven openwire:generate to regenerate
- * this file.
- *
- */
-public class DataResponseMarshaller extends ResponseMarshaller {
-
- /**
- * Return the type of Data Structure we marshal
- * @return short representation of the type data structure
- */
- public byte getDataStructureType() {
- return DataResponse.DATA_STRUCTURE_TYPE;
- }
-
- /**
- * @return a new object instance
- */
- public DataStructure createObject() {
- return new DataResponse();
- }
-
- /**
- * Un-marshal an object instance from the data input stream
- *
- * @param o the object to un-marshal
- * @param dataIn the data input stream to build the object from
- * @throws IOException
- */
- public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException {
- super.tightUnmarshal(wireFormat, o, dataIn, bs);
-
- DataResponse info = (DataResponse)o;
- info.setData((org.apache.activemq.apollo.openwire.command.DataStructure) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
-
- }
-
-
- /**
- * Write the booleans that this object uses to a BooleanStream
- */
- public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
-
- DataResponse info = (DataResponse)o;
-
- int rc = super.tightMarshal1(wireFormat, o, bs);
- rc += tightMarshalNestedObject1(wireFormat, (DataStructure)info.getData(), bs);
-
- return rc + 0;
- }
-
- /**
- * Write a object instance to data output stream
- *
- * @param o the instance to be marshaled
- * @param dataOut the output stream
- * @throws IOException thrown if an error occurs
- */
- public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException {
- super.tightMarshal2(wireFormat, o, dataOut, bs);
-
- DataResponse info = (DataResponse)o;
- tightMarshalNestedObject2(wireFormat, (DataStructure)info.getData(), dataOut, bs);
-
- }
-
- /**
- * Un-marshal an object instance from the data input stream
- *
- * @param o the object to un-marshal
- * @param dataIn the data input stream to build the object from
- * @throws IOException
- */
- public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException {
- super.looseUnmarshal(wireFormat, o, dataIn);
-
- DataResponse info = (DataResponse)o;
- info.setData((org.apache.activemq.apollo.openwire.command.DataStructure) looseUnmarsalNestedObject(wireFormat, dataIn));
-
- }
-
-
- /**
- * Write the booleans that this object uses to a BooleanStream
- */
- public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
-
- DataResponse info = (DataResponse)o;
-
- super.looseMarshal(wireFormat, o, dataOut);
- looseMarshalNestedObject(wireFormat, (DataStructure)info.getData(), dataOut);
-
- }
-}
diff --git a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/DataStructureSupportMarshaller.java b/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/DataStructureSupportMarshaller.java
deleted file mode 100644
index 516958f..0000000
--- a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/DataStructureSupportMarshaller.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/**
- * 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.openwire.codec.v1;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.activemq.apollo.openwire.codec.BooleanStream;
-import org.apache.activemq.apollo.openwire.codec.OpenWireFormat;
-
-
-/**
- * Marshalling code for Open Wire Format for DataStructureSupportMarshaller
- *
- *
- * NOTE!: This file is auto generated - do not modify!
- * if you need to make a change, please see the modify the groovy scripts in the
- * under src/gram/script and then use maven openwire:generate to regenerate
- * this file.
- *
- */
-public abstract class DataStructureSupportMarshaller extends BaseDataStreamMarshaller {
-
- /**
- * Un-marshal an object instance from the data input stream
- *
- * @param o the object to un-marshal
- * @param dataIn the data input stream to build the object from
- * @throws IOException
- */
- public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException {
- super.tightUnmarshal(wireFormat, o, dataIn, bs);
-
- }
-
-
- /**
- * Write the booleans that this object uses to a BooleanStream
- */
- public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
-
- int rc = super.tightMarshal1(wireFormat, o, bs);
-
- return rc + 0;
- }
-
- /**
- * Write a object instance to data output stream
- *
- * @param o the instance to be marshaled
- * @param dataOut the output stream
- * @throws IOException thrown if an error occurs
- */
- public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException {
- super.tightMarshal2(wireFormat, o, dataOut, bs);
-
- }
-
- /**
- * Un-marshal an object instance from the data input stream
- *
- * @param o the object to un-marshal
- * @param dataIn the data input stream to build the object from
- * @throws IOException
- */
- public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException {
- super.looseUnmarshal(wireFormat, o, dataIn);
-
- }
-
-
- /**
- * Write the booleans that this object uses to a BooleanStream
- */
- public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
-
- super.looseMarshal(wireFormat, o, dataOut);
-
- }
-}
diff --git a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/DestinationInfoMarshaller.java b/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/DestinationInfoMarshaller.java
deleted file mode 100755
index aa0d337..0000000
--- a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/DestinationInfoMarshaller.java
+++ /dev/null
@@ -1,176 +0,0 @@
-/**
- * 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.openwire.codec.v1;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.activemq.apollo.openwire.command.DataStructure;
-import org.apache.activemq.apollo.openwire.command.DestinationInfo;
-import org.apache.activemq.apollo.openwire.codec.BooleanStream;
-import org.apache.activemq.apollo.openwire.codec.OpenWireFormat;
-
-/**
- * Marshalling code for Open Wire Format for DestinationInfoMarshaller
- *
- *
- * NOTE!: This file is auto generated - do not modify! if you need to make a
- * change, please see the modify the groovy scripts in the under src/gram/script
- * and then use maven openwire:generate to regenerate this file.
- *
- */
-public class DestinationInfoMarshaller extends BaseCommandMarshaller {
-
- /**
- * Return the type of Data Structure we marshal
- *
- * @return short representation of the type data structure
- */
- public byte getDataStructureType() {
- return DestinationInfo.DATA_STRUCTURE_TYPE;
- }
-
- /**
- * @return a new object instance
- */
- public DataStructure createObject() {
- return new DestinationInfo();
- }
-
- /**
- * Un-marshal an object instance from the data input stream
- *
- * @param o the object to un-marshal
- * @param dataIn the data input stream to build the object from
- * @throws IOException
- */
- public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs)
- throws IOException {
- super.tightUnmarshal(wireFormat, o, dataIn, bs);
-
- DestinationInfo info = (DestinationInfo)o;
- info.setConnectionId((org.apache.activemq.apollo.openwire.command.ConnectionId)tightUnmarsalCachedObject(wireFormat,
- dataIn, bs));
- info
- .setDestination((org.apache.activemq.apollo.openwire.command.ActiveMQDestination)tightUnmarsalCachedObject(
- wireFormat,
- dataIn,
- bs));
- info.setOperationType(dataIn.readByte());
- info.setTimeout(tightUnmarshalLong(wireFormat, dataIn, bs));
-
- if (bs.readBoolean()) {
- short size = dataIn.readShort();
- org.apache.activemq.apollo.openwire.command.BrokerId value[] = new org.apache.activemq.apollo.openwire.command.BrokerId[size];
- for (int i = 0; i < size; i++) {
- value[i] = (org.apache.activemq.apollo.openwire.command.BrokerId)tightUnmarsalNestedObject(wireFormat,
- dataIn, bs);
- }
- info.setBrokerPath(value);
- } else {
- info.setBrokerPath(null);
- }
-
- }
-
- /**
- * Write the booleans that this object uses to a BooleanStream
- */
- public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
-
- DestinationInfo info = (DestinationInfo)o;
-
- int rc = super.tightMarshal1(wireFormat, o, bs);
- rc += tightMarshalCachedObject1(wireFormat, (DataStructure)info.getConnectionId(), bs);
- rc += tightMarshalCachedObject1(wireFormat, (DataStructure)info.getDestination(), bs);
- rc += tightMarshalLong1(wireFormat, info.getTimeout(), bs);
- rc += tightMarshalObjectArray1(wireFormat, info.getBrokerPath(), bs);
-
- return rc + 1;
- }
-
- /**
- * Write a object instance to data output stream
- *
- * @param o the instance to be marshaled
- * @param dataOut the output stream
- * @throws IOException thrown if an error occurs
- */
- public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs)
- throws IOException {
- super.tightMarshal2(wireFormat, o, dataOut, bs);
-
- DestinationInfo info = (DestinationInfo)o;
- tightMarshalCachedObject2(wireFormat, (DataStructure)info.getConnectionId(), dataOut, bs);
- tightMarshalCachedObject2(wireFormat, (DataStructure)info.getDestination(), dataOut, bs);
- dataOut.writeByte(info.getOperationType());
- tightMarshalLong2(wireFormat, info.getTimeout(), dataOut, bs);
- tightMarshalObjectArray2(wireFormat, info.getBrokerPath(), dataOut, bs);
-
- }
-
- /**
- * Un-marshal an object instance from the data input stream
- *
- * @param o the object to un-marshal
- * @param dataIn the data input stream to build the object from
- * @throws IOException
- */
- public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException {
- super.looseUnmarshal(wireFormat, o, dataIn);
-
- DestinationInfo info = (DestinationInfo)o;
- info.setConnectionId((org.apache.activemq.apollo.openwire.command.ConnectionId)looseUnmarsalCachedObject(wireFormat,
- dataIn));
- info
- .setDestination((org.apache.activemq.apollo.openwire.command.ActiveMQDestination)looseUnmarsalCachedObject(
- wireFormat,
- dataIn));
- info.setOperationType(dataIn.readByte());
- info.setTimeout(looseUnmarshalLong(wireFormat, dataIn));
-
- if (dataIn.readBoolean()) {
- short size = dataIn.readShort();
- org.apache.activemq.apollo.openwire.command.BrokerId value[] = new org.apache.activemq.apollo.openwire.command.BrokerId[size];
- for (int i = 0; i < size; i++) {
- value[i] = (org.apache.activemq.apollo.openwire.command.BrokerId)looseUnmarsalNestedObject(wireFormat, dataIn);
- }
- info.setBrokerPath(value);
- } else {
- info.setBrokerPath(null);
- }
-
- }
-
- /**
- * Write the booleans that this object uses to a BooleanStream
- */
- public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
-
- DestinationInfo info = (DestinationInfo)o;
-
- super.looseMarshal(wireFormat, o, dataOut);
- looseMarshalCachedObject(wireFormat, (DataStructure)info.getConnectionId(), dataOut);
- looseMarshalCachedObject(wireFormat, (DataStructure)info.getDestination(), dataOut);
- dataOut.writeByte(info.getOperationType());
- looseMarshalLong(wireFormat, info.getTimeout(), dataOut);
- looseMarshalObjectArray(wireFormat, info.getBrokerPath(), dataOut);
-
- }
-}
diff --git a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/DiscoveryEventMarshaller.java b/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/DiscoveryEventMarshaller.java
deleted file mode 100644
index dda4785..0000000
--- a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/DiscoveryEventMarshaller.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/**
- * 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.openwire.codec.v1;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.activemq.apollo.openwire.command.DataStructure;
-import org.apache.activemq.apollo.openwire.command.DiscoveryEvent;
-import org.apache.activemq.apollo.openwire.codec.BooleanStream;
-import org.apache.activemq.apollo.openwire.codec.OpenWireFormat;
-
-
-
-/**
- * Marshalling code for Open Wire Format for DiscoveryEventMarshaller
- *
- *
- * NOTE!: This file is auto generated - do not modify!
- * if you need to make a change, please see the modify the groovy scripts in the
- * under src/gram/script and then use maven openwire:generate to regenerate
- * this file.
- *
- */
-public class DiscoveryEventMarshaller extends BaseDataStreamMarshaller {
-
- /**
- * Return the type of Data Structure we marshal
- * @return short representation of the type data structure
- */
- public byte getDataStructureType() {
- return DiscoveryEvent.DATA_STRUCTURE_TYPE;
- }
-
- /**
- * @return a new object instance
- */
- public DataStructure createObject() {
- return new DiscoveryEvent();
- }
-
- /**
- * Un-marshal an object instance from the data input stream
- *
- * @param o the object to un-marshal
- * @param dataIn the data input stream to build the object from
- * @throws IOException
- */
- public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException {
- super.tightUnmarshal(wireFormat, o, dataIn, bs);
-
- DiscoveryEvent info = (DiscoveryEvent)o;
- info.setServiceName(tightUnmarshalString(dataIn, bs));
- info.setBrokerName(tightUnmarshalString(dataIn, bs));
-
- }
-
-
- /**
- * Write the booleans that this object uses to a BooleanStream
- */
- public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
-
- DiscoveryEvent info = (DiscoveryEvent)o;
-
- int rc = super.tightMarshal1(wireFormat, o, bs);
- rc += tightMarshalString1(info.getServiceName(), bs);
- rc += tightMarshalString1(info.getBrokerName(), bs);
-
- return rc + 0;
- }
-
- /**
- * Write a object instance to data output stream
- *
- * @param o the instance to be marshaled
- * @param dataOut the output stream
- * @throws IOException thrown if an error occurs
- */
- public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException {
- super.tightMarshal2(wireFormat, o, dataOut, bs);
-
- DiscoveryEvent info = (DiscoveryEvent)o;
- tightMarshalString2(info.getServiceName(), dataOut, bs);
- tightMarshalString2(info.getBrokerName(), dataOut, bs);
-
- }
-
- /**
- * Un-marshal an object instance from the data input stream
- *
- * @param o the object to un-marshal
- * @param dataIn the data input stream to build the object from
- * @throws IOException
- */
- public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException {
- super.looseUnmarshal(wireFormat, o, dataIn);
-
- DiscoveryEvent info = (DiscoveryEvent)o;
- info.setServiceName(looseUnmarshalString(dataIn));
- info.setBrokerName(looseUnmarshalString(dataIn));
-
- }
-
-
- /**
- * Write the booleans that this object uses to a BooleanStream
- */
- public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
-
- DiscoveryEvent info = (DiscoveryEvent)o;
-
- super.looseMarshal(wireFormat, o, dataOut);
- looseMarshalString(info.getServiceName(), dataOut);
- looseMarshalString(info.getBrokerName(), dataOut);
-
- }
-}
diff --git a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ExceptionResponseMarshaller.java b/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ExceptionResponseMarshaller.java
deleted file mode 100755
index 8d4e26f..0000000
--- a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/ExceptionResponseMarshaller.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/**
- * 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.openwire.codec.v1;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.activemq.apollo.openwire.command.DataStructure;
-import org.apache.activemq.apollo.openwire.command.ExceptionResponse;
-import org.apache.activemq.apollo.openwire.codec.BooleanStream;
-import org.apache.activemq.apollo.openwire.codec.OpenWireFormat;
-
-
-
-/**
- * Marshalling code for Open Wire Format for ExceptionResponseMarshaller
- *
- *
- * NOTE!: This file is auto generated - do not modify!
- * if you need to make a change, please see the modify the groovy scripts in the
- * under src/gram/script and then use maven openwire:generate to regenerate
- * this file.
- *
- */
-public class ExceptionResponseMarshaller extends ResponseMarshaller {
-
- /**
- * Return the type of Data Structure we marshal
- * @return short representation of the type data structure
- */
- public byte getDataStructureType() {
- return ExceptionResponse.DATA_STRUCTURE_TYPE;
- }
-
- /**
- * @return a new object instance
- */
- public DataStructure createObject() {
- return new ExceptionResponse();
- }
-
- /**
- * Un-marshal an object instance from the data input stream
- *
- * @param o the object to un-marshal
- * @param dataIn the data input stream to build the object from
- * @throws IOException
- */
- public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException {
- super.tightUnmarshal(wireFormat, o, dataIn, bs);
-
- ExceptionResponse info = (ExceptionResponse)o;
- info.setException((java.lang.Throwable) tightUnmarsalThrowable(wireFormat, dataIn, bs));
-
- }
-
-
- /**
- * Write the booleans that this object uses to a BooleanStream
- */
- public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
-
- ExceptionResponse info = (ExceptionResponse)o;
-
- int rc = super.tightMarshal1(wireFormat, o, bs);
- rc += tightMarshalThrowable1(wireFormat, info.getException(), bs);
-
- return rc + 0;
- }
-
- /**
- * Write a object instance to data output stream
- *
- * @param o the instance to be marshaled
- * @param dataOut the output stream
- * @throws IOException thrown if an error occurs
- */
- public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException {
- super.tightMarshal2(wireFormat, o, dataOut, bs);
-
- ExceptionResponse info = (ExceptionResponse)o;
- tightMarshalThrowable2(wireFormat, info.getException(), dataOut, bs);
-
- }
-
- /**
- * Un-marshal an object instance from the data input stream
- *
- * @param o the object to un-marshal
- * @param dataIn the data input stream to build the object from
- * @throws IOException
- */
- public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException {
- super.looseUnmarshal(wireFormat, o, dataIn);
-
- ExceptionResponse info = (ExceptionResponse)o;
- info.setException((java.lang.Throwable) looseUnmarsalThrowable(wireFormat, dataIn));
-
- }
-
-
- /**
- * Write the booleans that this object uses to a BooleanStream
- */
- public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
-
- ExceptionResponse info = (ExceptionResponse)o;
-
- super.looseMarshal(wireFormat, o, dataOut);
- looseMarshalThrowable(wireFormat, info.getException(), dataOut);
-
- }
-}
diff --git a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/FlushCommandMarshaller.java b/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/FlushCommandMarshaller.java
deleted file mode 100644
index 7a28223..0000000
--- a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/FlushCommandMarshaller.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/**
- * 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.openwire.codec.v1;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.activemq.apollo.openwire.command.DataStructure;
-import org.apache.activemq.apollo.openwire.command.FlushCommand;
-import org.apache.activemq.apollo.openwire.codec.BooleanStream;
-import org.apache.activemq.apollo.openwire.codec.OpenWireFormat;
-
-
-
-/**
- * Marshalling code for Open Wire Format for FlushCommandMarshaller
- *
- *
- * NOTE!: This file is auto generated - do not modify!
- * if you need to make a change, please see the modify the groovy scripts in the
- * under src/gram/script and then use maven openwire:generate to regenerate
- * this file.
- *
- */
-public class FlushCommandMarshaller extends BaseCommandMarshaller {
-
- /**
- * Return the type of Data Structure we marshal
- * @return short representation of the type data structure
- */
- public byte getDataStructureType() {
- return FlushCommand.DATA_STRUCTURE_TYPE;
- }
-
- /**
- * @return a new object instance
- */
- public DataStructure createObject() {
- return new FlushCommand();
- }
-
- /**
- * Un-marshal an object instance from the data input stream
- *
- * @param o the object to un-marshal
- * @param dataIn the data input stream to build the object from
- * @throws IOException
- */
- public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException {
- super.tightUnmarshal(wireFormat, o, dataIn, bs);
-
- }
-
-
- /**
- * Write the booleans that this object uses to a BooleanStream
- */
- public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
-
- int rc = super.tightMarshal1(wireFormat, o, bs);
-
- return rc + 0;
- }
-
- /**
- * Write a object instance to data output stream
- *
- * @param o the instance to be marshaled
- * @param dataOut the output stream
- * @throws IOException thrown if an error occurs
- */
- public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException {
- super.tightMarshal2(wireFormat, o, dataOut, bs);
-
- }
-
- /**
- * Un-marshal an object instance from the data input stream
- *
- * @param o the object to un-marshal
- * @param dataIn the data input stream to build the object from
- * @throws IOException
- */
- public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException {
- super.looseUnmarshal(wireFormat, o, dataIn);
-
- }
-
-
- /**
- * Write the booleans that this object uses to a BooleanStream
- */
- public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
-
- super.looseMarshal(wireFormat, o, dataOut);
-
- }
-}
diff --git a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/IntegerResponseMarshaller.java b/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/IntegerResponseMarshaller.java
deleted file mode 100755
index ff1129e..0000000
--- a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/IntegerResponseMarshaller.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/**
- * 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.openwire.codec.v1;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.activemq.apollo.openwire.command.DataStructure;
-import org.apache.activemq.apollo.openwire.command.IntegerResponse;
-import org.apache.activemq.apollo.openwire.codec.BooleanStream;
-import org.apache.activemq.apollo.openwire.codec.OpenWireFormat;
-
-
-
-/**
- * Marshalling code for Open Wire Format for IntegerResponseMarshaller
- *
- *
- * NOTE!: This file is auto generated - do not modify!
- * if you need to make a change, please see the modify the groovy scripts in the
- * under src/gram/script and then use maven openwire:generate to regenerate
- * this file.
- *
- */
-public class IntegerResponseMarshaller extends ResponseMarshaller {
-
- /**
- * Return the type of Data Structure we marshal
- * @return short representation of the type data structure
- */
- public byte getDataStructureType() {
- return IntegerResponse.DATA_STRUCTURE_TYPE;
- }
-
- /**
- * @return a new object instance
- */
- public DataStructure createObject() {
- return new IntegerResponse();
- }
-
- /**
- * Un-marshal an object instance from the data input stream
- *
- * @param o the object to un-marshal
- * @param dataIn the data input stream to build the object from
- * @throws IOException
- */
- public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException {
- super.tightUnmarshal(wireFormat, o, dataIn, bs);
-
- IntegerResponse info = (IntegerResponse)o;
- info.setResult(dataIn.readInt());
-
- }
-
-
- /**
- * Write the booleans that this object uses to a BooleanStream
- */
- public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
-
- IntegerResponse info = (IntegerResponse)o;
-
- int rc = super.tightMarshal1(wireFormat, o, bs);
-
- return rc + 4;
- }
-
- /**
- * Write a object instance to data output stream
- *
- * @param o the instance to be marshaled
- * @param dataOut the output stream
- * @throws IOException thrown if an error occurs
- */
- public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException {
- super.tightMarshal2(wireFormat, o, dataOut, bs);
-
- IntegerResponse info = (IntegerResponse)o;
- dataOut.writeInt(info.getResult());
-
- }
-
- /**
- * Un-marshal an object instance from the data input stream
- *
- * @param o the object to un-marshal
- * @param dataIn the data input stream to build the object from
- * @throws IOException
- */
- public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException {
- super.looseUnmarshal(wireFormat, o, dataIn);
-
- IntegerResponse info = (IntegerResponse)o;
- info.setResult(dataIn.readInt());
-
- }
-
-
- /**
- * Write the booleans that this object uses to a BooleanStream
- */
- public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
-
- IntegerResponse info = (IntegerResponse)o;
-
- super.looseMarshal(wireFormat, o, dataOut);
- dataOut.writeInt(info.getResult());
-
- }
-}
diff --git a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/JournalQueueAckMarshaller.java b/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/JournalQueueAckMarshaller.java
deleted file mode 100755
index d72b8e9..0000000
--- a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/JournalQueueAckMarshaller.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/**
- * 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.openwire.codec.v1;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.activemq.apollo.openwire.command.DataStructure;
-import org.apache.activemq.apollo.openwire.command.JournalQueueAck;
-import org.apache.activemq.apollo.openwire.codec.BooleanStream;
-import org.apache.activemq.apollo.openwire.codec.OpenWireFormat;
-
-
-
-/**
- * Marshalling code for Open Wire Format for JournalQueueAckMarshaller
- *
- *
- * NOTE!: This file is auto generated - do not modify!
- * if you need to make a change, please see the modify the groovy scripts in the
- * under src/gram/script and then use maven openwire:generate to regenerate
- * this file.
- *
- */
-public class JournalQueueAckMarshaller extends BaseDataStreamMarshaller {
-
- /**
- * Return the type of Data Structure we marshal
- * @return short representation of the type data structure
- */
- public byte getDataStructureType() {
- return JournalQueueAck.DATA_STRUCTURE_TYPE;
- }
-
- /**
- * @return a new object instance
- */
- public DataStructure createObject() {
- return new JournalQueueAck();
- }
-
- /**
- * Un-marshal an object instance from the data input stream
- *
- * @param o the object to un-marshal
- * @param dataIn the data input stream to build the object from
- * @throws IOException
- */
- public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException {
- super.tightUnmarshal(wireFormat, o, dataIn, bs);
-
- JournalQueueAck info = (JournalQueueAck)o;
- info.setDestination((org.apache.activemq.apollo.openwire.command.ActiveMQDestination) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
- info.setMessageAck((org.apache.activemq.apollo.openwire.command.MessageAck) tightUnmarsalNestedObject(wireFormat, dataIn, bs));
-
- }
-
-
- /**
- * Write the booleans that this object uses to a BooleanStream
- */
- public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
-
- JournalQueueAck info = (JournalQueueAck)o;
-
- int rc = super.tightMarshal1(wireFormat, o, bs);
- rc += tightMarshalNestedObject1(wireFormat, (DataStructure)info.getDestination(), bs);
- rc += tightMarshalNestedObject1(wireFormat, (DataStructure)info.getMessageAck(), bs);
-
- return rc + 0;
- }
-
- /**
- * Write a object instance to data output stream
- *
- * @param o the instance to be marshaled
- * @param dataOut the output stream
- * @throws IOException thrown if an error occurs
- */
- public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException {
- super.tightMarshal2(wireFormat, o, dataOut, bs);
-
- JournalQueueAck info = (JournalQueueAck)o;
- tightMarshalNestedObject2(wireFormat, (DataStructure)info.getDestination(), dataOut, bs);
- tightMarshalNestedObject2(wireFormat, (DataStructure)info.getMessageAck(), dataOut, bs);
-
- }
-
- /**
- * Un-marshal an object instance from the data input stream
- *
- * @param o the object to un-marshal
- * @param dataIn the data input stream to build the object from
- * @throws IOException
- */
- public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException {
- super.looseUnmarshal(wireFormat, o, dataIn);
-
- JournalQueueAck info = (JournalQueueAck)o;
- info.setDestination((org.apache.activemq.apollo.openwire.command.ActiveMQDestination) looseUnmarsalNestedObject(wireFormat, dataIn));
- info.setMessageAck((org.apache.activemq.apollo.openwire.command.MessageAck) looseUnmarsalNestedObject(wireFormat, dataIn));
-
- }
-
-
- /**
- * Write the booleans that this object uses to a BooleanStream
- */
- public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
-
- JournalQueueAck info = (JournalQueueAck)o;
-
- super.looseMarshal(wireFormat, o, dataOut);
- looseMarshalNestedObject(wireFormat, (DataStructure)info.getDestination(), dataOut);
- looseMarshalNestedObject(wireFormat, (DataStructure)info.getMessageAck(), dataOut);
-
- }
-}
diff --git a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/JournalTopicAckMarshaller.java b/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/JournalTopicAckMarshaller.java
deleted file mode 100755
index a653ca1..0000000
--- a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/JournalTopicAckMarshaller.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/**
- * 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.openwire.codec.v1;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.activemq.apollo.openwire.command.DataStructure;
-import org.apache.activemq.apollo.openwire.command.JournalTopicAck;
-import org.apache.activemq.apollo.openwire.codec.BooleanStream;
-import org.apache.activemq.apollo.openwire.codec.OpenWireFormat;
-
-/**
- * Marshalling code for Open Wire Format for JournalTopicAckMarshaller NOTE!:
- * This file is auto generated - do not modify! if you need to make a change,
- * please see the modify the groovy scripts in the under src/gram/script and
- * then use maven openwire:generate to regenerate this file.
- *
- */
-public class JournalTopicAckMarshaller extends BaseDataStreamMarshaller {
-
- /**
- * Return the type of Data Structure we marshal
- *
- * @return short representation of the type data structure
- */
- public byte getDataStructureType() {
- return JournalTopicAck.DATA_STRUCTURE_TYPE;
- }
-
- /**
- * @return a new object instance
- */
- public DataStructure createObject() {
- return new JournalTopicAck();
- }
-
- /**
- * Un-marshal an object instance from the data input stream
- *
- * @param o the object to un-marshal
- * @param dataIn the data input stream to build the object from
- * @throws IOException
- */
- public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException {
- super.tightUnmarshal(wireFormat, o, dataIn, bs);
-
- JournalTopicAck info = (JournalTopicAck)o;
- info.setDestination((org.apache.activemq.apollo.openwire.command.ActiveMQDestination)tightUnmarsalNestedObject(wireFormat, dataIn, bs));
- info.setMessageId((org.apache.activemq.apollo.openwire.command.MessageId)tightUnmarsalNestedObject(wireFormat, dataIn, bs));
- info.setMessageSequenceId(tightUnmarshalLong(wireFormat, dataIn, bs));
- info.setSubscritionName(tightUnmarshalString(dataIn, bs));
- info.setClientId(tightUnmarshalString(dataIn, bs));
- info.setTransactionId((org.apache.activemq.apollo.openwire.command.TransactionId)tightUnmarsalNestedObject(wireFormat, dataIn, bs));
-
- }
-
- /**
- * Write the booleans that this object uses to a BooleanStream
- */
- public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException {
-
- JournalTopicAck info = (JournalTopicAck)o;
-
- int rc = super.tightMarshal1(wireFormat, o, bs);
- rc += tightMarshalNestedObject1(wireFormat, (DataStructure)info.getDestination(), bs);
- rc += tightMarshalNestedObject1(wireFormat, (DataStructure)info.getMessageId(), bs);
- rc += tightMarshalLong1(wireFormat, info.getMessageSequenceId(), bs);
- rc += tightMarshalString1(info.getSubscritionName(), bs);
- rc += tightMarshalString1(info.getClientId(), bs);
- rc += tightMarshalNestedObject1(wireFormat, (DataStructure)info.getTransactionId(), bs);
-
- return rc + 0;
- }
-
- /**
- * Write a object instance to data output stream
- *
- * @param o the instance to be marshaled
- * @param dataOut the output stream
- * @throws IOException thrown if an error occurs
- */
- public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException {
- super.tightMarshal2(wireFormat, o, dataOut, bs);
-
- JournalTopicAck info = (JournalTopicAck)o;
- tightMarshalNestedObject2(wireFormat, (DataStructure)info.getDestination(), dataOut, bs);
- tightMarshalNestedObject2(wireFormat, (DataStructure)info.getMessageId(), dataOut, bs);
- tightMarshalLong2(wireFormat, info.getMessageSequenceId(), dataOut, bs);
- tightMarshalString2(info.getSubscritionName(), dataOut, bs);
- tightMarshalString2(info.getClientId(), dataOut, bs);
- tightMarshalNestedObject2(wireFormat, (DataStructure)info.getTransactionId(), dataOut, bs);
-
- }
-
- /**
- * Un-marshal an object instance from the data input stream
- *
- * @param o the object to un-marshal
- * @param dataIn the data input stream to build the object from
- * @throws IOException
- */
- public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException {
- super.looseUnmarshal(wireFormat, o, dataIn);
-
- JournalTopicAck info = (JournalTopicAck)o;
- info.setDestination((org.apache.activemq.apollo.openwire.command.ActiveMQDestination)looseUnmarsalNestedObject(wireFormat, dataIn));
- info.setMessageId((org.apache.activemq.apollo.openwire.command.MessageId)looseUnmarsalNestedObject(wireFormat, dataIn));
- info.setMessageSequenceId(looseUnmarshalLong(wireFormat, dataIn));
- info.setSubscritionName(looseUnmarshalString(dataIn));
- info.setClientId(looseUnmarshalString(dataIn));
- info.setTransactionId((org.apache.activemq.apollo.openwire.command.TransactionId)looseUnmarsalNestedObject(wireFormat, dataIn));
-
- }
-
- /**
- * Write the booleans that this object uses to a BooleanStream
- */
- public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
-
- JournalTopicAck info = (JournalTopicAck)o;
-
- super.looseMarshal(wireFormat, o, dataOut);
- looseMarshalNestedObject(wireFormat, (DataStructure)info.getDestination(), dataOut);
- looseMarshalNestedObject(wireFormat, (DataStructure)info.getMessageId(), dataOut);
- looseMarshalLong(wireFormat, info.getMessageSequenceId(), dataOut);
- looseMarshalString(info.getSubscritionName(), dataOut);
- looseMarshalString(info.getClientId(), dataOut);
- looseMarshalNestedObject(wireFormat, (DataStructure)info.getTransactionId(), dataOut);
-
- }
-}
diff --git a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/JournalTraceMarshaller.java b/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/JournalTraceMarshaller.java
deleted file mode 100755
index b32c040..0000000
--- a/apollo-openwire/src/main/scala/org/apache/activemq/apollo/openwire/codec/v1/JournalTraceMarshaller.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/**
- * 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.openwire.codec.v1;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-
-import org.apache.activemq.apollo.openwire.command.DataStructure;
-import org.apache.activemq.apollo.openwire.command.JournalTrace;
-import org.apache.activemq.apollo.openwire.codec.BooleanStream;
-import org.apache.activemq.apollo.openwire.codec.OpenWireFormat;
-
-
-
-/**
- * Marshalling code for Open Wire Format for JournalTraceMarshaller
- *
- *
- * NOTE!: This file is auto generated - do not modify!
- * if you need to make a change, please see the modify the groovy scripts in the
- * under src/gram/script and then use maven openwire:generate to regenerate
- * this file.
- *
- */
-public class JournalTraceMarshaller extends BaseDataStreamMarshaller {
-
- /**
- * Return the type of Data Structure we marshal
- * @return short representation of the type data structure
- */
- public byte getDataStructureType() {
- return JournalTrace.DATA_STRUCTURE_TYPE;
- }
-
- /**
- * @return a new object inst