mirror of https://github.com/apache/activemq.git
did a few svn propset svn:eol-styl native
git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/branches/activemq-4.0@426431 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
3372966d20
commit
a23f329fb7
|
@ -1,276 +1,276 @@
|
|||
/**
|
||||
*
|
||||
* Copyright 2005-2006 The Apache Software Foundation
|
||||
*
|
||||
* Licensed 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.kaha.impl;
|
||||
|
||||
/**
|
||||
* A linked list used by IndexItems
|
||||
*
|
||||
* @version $Revision: 1.2 $
|
||||
*/
|
||||
final class IndexLinkedList implements Cloneable{
|
||||
private transient IndexItem root;
|
||||
private transient int size=0;
|
||||
|
||||
|
||||
/**
|
||||
* Constructs an empty list.
|
||||
*/
|
||||
IndexLinkedList(IndexItem header){
|
||||
this.root = header;
|
||||
this.root.next=root.prev=root;
|
||||
}
|
||||
|
||||
IndexItem getRoot(){
|
||||
return root;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the first element in this list.
|
||||
*
|
||||
* @return the first element in this list.
|
||||
*/
|
||||
IndexItem getFirst(){
|
||||
if(size==0)
|
||||
return null;
|
||||
return root.next;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the last element in this list.
|
||||
*
|
||||
* @return the last element in this list.
|
||||
*/
|
||||
IndexItem getLast(){
|
||||
if(size==0)
|
||||
return null;
|
||||
return root.prev;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes and returns the first element from this list.
|
||||
*
|
||||
* @return the first element from this list.
|
||||
*/
|
||||
IndexItem removeFirst(){
|
||||
if(size==0){
|
||||
return null;
|
||||
}
|
||||
IndexItem result=root.next;
|
||||
remove(root.next);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes and returns the last element from this list.
|
||||
*
|
||||
* @return the last element from this list.
|
||||
*/
|
||||
Object removeLast(){
|
||||
if(size==0)
|
||||
return null;
|
||||
IndexItem result=root.prev;
|
||||
remove(root.prev);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Inserts the given element at the beginning of this list.
|
||||
*
|
||||
* @param o the element to be inserted at the beginning of this list.
|
||||
*/
|
||||
void addFirst(IndexItem item){
|
||||
addBefore(item,root.next);
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends the given element to the end of this list. (Identical in function to the <tt>add</tt> method; included
|
||||
* only for consistency.)
|
||||
*
|
||||
* @param o the element to be inserted at the end of this list.
|
||||
*/
|
||||
void addLast(IndexItem item){
|
||||
addBefore(item,root);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of elements in this list.
|
||||
*
|
||||
* @return the number of elements in this list.
|
||||
*/
|
||||
int size(){
|
||||
return size;
|
||||
}
|
||||
|
||||
/**
|
||||
* is the list empty?
|
||||
*
|
||||
* @return true if there are no elements in the list
|
||||
*/
|
||||
boolean isEmpty(){
|
||||
return size==0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends the specified element to the end of this list.
|
||||
*
|
||||
* @param o element to be appended to this list.
|
||||
* @return <tt>true</tt> (as per the general contract of <tt>Collection.add</tt>).
|
||||
*/
|
||||
boolean add(IndexItem item){
|
||||
addBefore(item,root);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes all of the elements from this list.
|
||||
*/
|
||||
void clear(){
|
||||
root.next=root.prev=root;
|
||||
size=0;
|
||||
}
|
||||
|
||||
// Positional Access Operations
|
||||
/**
|
||||
* Returns the element at the specified position in this list.
|
||||
*
|
||||
* @param index index of element to return.
|
||||
* @return the element at the specified position in this list.
|
||||
*
|
||||
* @throws IndexOutOfBoundsException if the specified index is is out of range (<tt>index < 0 || index >= size()</tt>).
|
||||
*/
|
||||
IndexItem get(int index){
|
||||
return entry(index);
|
||||
}
|
||||
|
||||
/**
|
||||
* Inserts the specified element at the specified position in this list. Shifts the element currently at that
|
||||
* position (if any) and any subsequent elements to the right (adds one to their indices).
|
||||
*
|
||||
* @param index index at which the specified element is to be inserted.
|
||||
* @param element element to be inserted.
|
||||
*
|
||||
* @throws IndexOutOfBoundsException if the specified index is out of range (<tt>index < 0 || index > size()</tt>).
|
||||
*/
|
||||
void add(int index,IndexItem element){
|
||||
addBefore(element,(index==size?root:entry(index)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the element at the specified position in this list. Shifts any subsequent elements to the left (subtracts
|
||||
* one from their indices). Returns the element that was removed from the list.
|
||||
*
|
||||
* @param index the index of the element to removed.
|
||||
* @return the element previously at the specified position.
|
||||
*
|
||||
* @throws IndexOutOfBoundsException if the specified index is out of range (<tt>index < 0 || index >= size()</tt>).
|
||||
*/
|
||||
Object remove(int index){
|
||||
IndexItem e=entry(index);
|
||||
remove(e);
|
||||
return e;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the indexed entry.
|
||||
*/
|
||||
private IndexItem entry(int index){
|
||||
if(index<0||index>=size)
|
||||
throw new IndexOutOfBoundsException("Index: "+index+", Size: "+size);
|
||||
IndexItem e=root;
|
||||
if(index<size/2){
|
||||
for(int i=0;i<=index;i++)
|
||||
e=e.next;
|
||||
}else{
|
||||
for(int i=size;i>index;i--)
|
||||
e=e.prev;
|
||||
}
|
||||
return e;
|
||||
}
|
||||
|
||||
// Search Operations
|
||||
/**
|
||||
* Returns the index in this list of the first occurrence of the specified element, or -1 if the List does not
|
||||
* contain this element. More formally, returns the lowest index i such that
|
||||
* <tt>(o==null ? get(i)==null : o.equals(get(i)))</tt>, or -1 if there is no such index.
|
||||
*
|
||||
* @param o element to search for.
|
||||
* @return the index in this list of the first occurrence of the specified element, or -1 if the list does not
|
||||
* contain this element.
|
||||
*/
|
||||
int indexOf(IndexItem o){
|
||||
int index=0;
|
||||
for(IndexItem e=root.next;e!=root;e=e.next){
|
||||
if(o==e){
|
||||
return index;
|
||||
}
|
||||
index++;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the next entry after this entry
|
||||
*
|
||||
* @param entry
|
||||
* @return next entry
|
||||
*/
|
||||
IndexItem getNextEntry(IndexItem entry){
|
||||
return entry.next != root ? entry.next : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrive the prev entry after this entry
|
||||
*
|
||||
* @param entry
|
||||
* @return prev entry
|
||||
*/
|
||||
IndexItem getPrevEntry(IndexItem entry){
|
||||
return entry.prev != root ? entry.prev : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Insert an Entry before this entry
|
||||
*
|
||||
* @param o the elment to insert
|
||||
* @param e the Entry to insert the object before
|
||||
*
|
||||
*/
|
||||
void addBefore(IndexItem insert,IndexItem e){
|
||||
insert.next=e;
|
||||
insert.prev=e.prev;
|
||||
insert.prev.next=insert;
|
||||
insert.next.prev=insert;
|
||||
size++;
|
||||
}
|
||||
|
||||
void remove(IndexItem e){
|
||||
if(e==root)
|
||||
return;
|
||||
e.prev.next=e.next;
|
||||
e.next.prev=e.prev;
|
||||
size--;
|
||||
}
|
||||
|
||||
/**
|
||||
*@return clone
|
||||
*/
|
||||
public Object clone(){
|
||||
IndexLinkedList clone=new IndexLinkedList(this.root);
|
||||
for(IndexItem e=root.next;e!=root;e=e.next)
|
||||
clone.add(e);
|
||||
return clone;
|
||||
}
|
||||
}
|
||||
/**
|
||||
*
|
||||
* Copyright 2005-2006 The Apache Software Foundation
|
||||
*
|
||||
* Licensed 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.kaha.impl;
|
||||
|
||||
/**
|
||||
* A linked list used by IndexItems
|
||||
*
|
||||
* @version $Revision: 1.2 $
|
||||
*/
|
||||
final class IndexLinkedList implements Cloneable{
|
||||
private transient IndexItem root;
|
||||
private transient int size=0;
|
||||
|
||||
|
||||
/**
|
||||
* Constructs an empty list.
|
||||
*/
|
||||
IndexLinkedList(IndexItem header){
|
||||
this.root = header;
|
||||
this.root.next=root.prev=root;
|
||||
}
|
||||
|
||||
IndexItem getRoot(){
|
||||
return root;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the first element in this list.
|
||||
*
|
||||
* @return the first element in this list.
|
||||
*/
|
||||
IndexItem getFirst(){
|
||||
if(size==0)
|
||||
return null;
|
||||
return root.next;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the last element in this list.
|
||||
*
|
||||
* @return the last element in this list.
|
||||
*/
|
||||
IndexItem getLast(){
|
||||
if(size==0)
|
||||
return null;
|
||||
return root.prev;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes and returns the first element from this list.
|
||||
*
|
||||
* @return the first element from this list.
|
||||
*/
|
||||
IndexItem removeFirst(){
|
||||
if(size==0){
|
||||
return null;
|
||||
}
|
||||
IndexItem result=root.next;
|
||||
remove(root.next);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes and returns the last element from this list.
|
||||
*
|
||||
* @return the last element from this list.
|
||||
*/
|
||||
Object removeLast(){
|
||||
if(size==0)
|
||||
return null;
|
||||
IndexItem result=root.prev;
|
||||
remove(root.prev);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Inserts the given element at the beginning of this list.
|
||||
*
|
||||
* @param o the element to be inserted at the beginning of this list.
|
||||
*/
|
||||
void addFirst(IndexItem item){
|
||||
addBefore(item,root.next);
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends the given element to the end of this list. (Identical in function to the <tt>add</tt> method; included
|
||||
* only for consistency.)
|
||||
*
|
||||
* @param o the element to be inserted at the end of this list.
|
||||
*/
|
||||
void addLast(IndexItem item){
|
||||
addBefore(item,root);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of elements in this list.
|
||||
*
|
||||
* @return the number of elements in this list.
|
||||
*/
|
||||
int size(){
|
||||
return size;
|
||||
}
|
||||
|
||||
/**
|
||||
* is the list empty?
|
||||
*
|
||||
* @return true if there are no elements in the list
|
||||
*/
|
||||
boolean isEmpty(){
|
||||
return size==0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends the specified element to the end of this list.
|
||||
*
|
||||
* @param o element to be appended to this list.
|
||||
* @return <tt>true</tt> (as per the general contract of <tt>Collection.add</tt>).
|
||||
*/
|
||||
boolean add(IndexItem item){
|
||||
addBefore(item,root);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes all of the elements from this list.
|
||||
*/
|
||||
void clear(){
|
||||
root.next=root.prev=root;
|
||||
size=0;
|
||||
}
|
||||
|
||||
// Positional Access Operations
|
||||
/**
|
||||
* Returns the element at the specified position in this list.
|
||||
*
|
||||
* @param index index of element to return.
|
||||
* @return the element at the specified position in this list.
|
||||
*
|
||||
* @throws IndexOutOfBoundsException if the specified index is is out of range (<tt>index < 0 || index >= size()</tt>).
|
||||
*/
|
||||
IndexItem get(int index){
|
||||
return entry(index);
|
||||
}
|
||||
|
||||
/**
|
||||
* Inserts the specified element at the specified position in this list. Shifts the element currently at that
|
||||
* position (if any) and any subsequent elements to the right (adds one to their indices).
|
||||
*
|
||||
* @param index index at which the specified element is to be inserted.
|
||||
* @param element element to be inserted.
|
||||
*
|
||||
* @throws IndexOutOfBoundsException if the specified index is out of range (<tt>index < 0 || index > size()</tt>).
|
||||
*/
|
||||
void add(int index,IndexItem element){
|
||||
addBefore(element,(index==size?root:entry(index)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the element at the specified position in this list. Shifts any subsequent elements to the left (subtracts
|
||||
* one from their indices). Returns the element that was removed from the list.
|
||||
*
|
||||
* @param index the index of the element to removed.
|
||||
* @return the element previously at the specified position.
|
||||
*
|
||||
* @throws IndexOutOfBoundsException if the specified index is out of range (<tt>index < 0 || index >= size()</tt>).
|
||||
*/
|
||||
Object remove(int index){
|
||||
IndexItem e=entry(index);
|
||||
remove(e);
|
||||
return e;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the indexed entry.
|
||||
*/
|
||||
private IndexItem entry(int index){
|
||||
if(index<0||index>=size)
|
||||
throw new IndexOutOfBoundsException("Index: "+index+", Size: "+size);
|
||||
IndexItem e=root;
|
||||
if(index<size/2){
|
||||
for(int i=0;i<=index;i++)
|
||||
e=e.next;
|
||||
}else{
|
||||
for(int i=size;i>index;i--)
|
||||
e=e.prev;
|
||||
}
|
||||
return e;
|
||||
}
|
||||
|
||||
// Search Operations
|
||||
/**
|
||||
* Returns the index in this list of the first occurrence of the specified element, or -1 if the List does not
|
||||
* contain this element. More formally, returns the lowest index i such that
|
||||
* <tt>(o==null ? get(i)==null : o.equals(get(i)))</tt>, or -1 if there is no such index.
|
||||
*
|
||||
* @param o element to search for.
|
||||
* @return the index in this list of the first occurrence of the specified element, or -1 if the list does not
|
||||
* contain this element.
|
||||
*/
|
||||
int indexOf(IndexItem o){
|
||||
int index=0;
|
||||
for(IndexItem e=root.next;e!=root;e=e.next){
|
||||
if(o==e){
|
||||
return index;
|
||||
}
|
||||
index++;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the next entry after this entry
|
||||
*
|
||||
* @param entry
|
||||
* @return next entry
|
||||
*/
|
||||
IndexItem getNextEntry(IndexItem entry){
|
||||
return entry.next != root ? entry.next : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrive the prev entry after this entry
|
||||
*
|
||||
* @param entry
|
||||
* @return prev entry
|
||||
*/
|
||||
IndexItem getPrevEntry(IndexItem entry){
|
||||
return entry.prev != root ? entry.prev : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Insert an Entry before this entry
|
||||
*
|
||||
* @param o the elment to insert
|
||||
* @param e the Entry to insert the object before
|
||||
*
|
||||
*/
|
||||
void addBefore(IndexItem insert,IndexItem e){
|
||||
insert.next=e;
|
||||
insert.prev=e.prev;
|
||||
insert.prev.next=insert;
|
||||
insert.next.prev=insert;
|
||||
size++;
|
||||
}
|
||||
|
||||
void remove(IndexItem e){
|
||||
if(e==root)
|
||||
return;
|
||||
e.prev.next=e.next;
|
||||
e.next.prev=e.prev;
|
||||
size--;
|
||||
}
|
||||
|
||||
/**
|
||||
*@return clone
|
||||
*/
|
||||
public Object clone(){
|
||||
IndexLinkedList clone=new IndexLinkedList(this.root);
|
||||
for(IndexItem e=root.next;e!=root;e=e.next)
|
||||
clone.add(e);
|
||||
return clone;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1 +1,148 @@
|
|||
/**
*
* Copyright 2005-2006 The Apache Software Foundation
*
* Licensed 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.openwire.v1;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import org.apache.activemq.openwire.*;
import org.apache.activemq.command.*;
/**
* 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.
*
* @version $Revision$
*/
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, DataInputStream 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, DataOutputStream 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, DataInputStream 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, DataOutputStream 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());
}
}
|
||||
/**
|
||||
*
|
||||
* Copyright 2005-2006 The Apache Software Foundation
|
||||
*
|
||||
* Licensed 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.openwire.v1;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.activemq.openwire.*;
|
||||
import org.apache.activemq.command.*;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @version $Revision$
|
||||
*/
|
||||
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, DataInputStream 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, DataOutputStream 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, DataInputStream 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, DataOutputStream 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());
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1 +1,137 @@
|
|||
/**
*
* Copyright 2005-2006 The Apache Software Foundation
*
* Licensed 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.openwire.v1;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import org.apache.activemq.openwire.*;
import org.apache.activemq.command.*;
/**
* 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.
*
* @version $Revision$
*/
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, DataInputStream dataIn, BooleanStream bs) throws IOException {
super.tightUnmarshal(wireFormat, o, dataIn, bs);
ConsumerControl info = (ConsumerControl)o;
info.setClose(bs.readBoolean());
info.setConsumerId((org.apache.activemq.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, DataOutputStream 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, DataInputStream dataIn) throws IOException {
super.looseUnmarshal(wireFormat, o, dataIn);
ConsumerControl info = (ConsumerControl)o;
info.setClose(dataIn.readBoolean());
info.setConsumerId((org.apache.activemq.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, DataOutputStream 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());
}
}
|
||||
/**
|
||||
*
|
||||
* Copyright 2005-2006 The Apache Software Foundation
|
||||
*
|
||||
* Licensed 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.openwire.v1;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.activemq.openwire.*;
|
||||
import org.apache.activemq.command.*;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @version $Revision$
|
||||
*/
|
||||
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, DataInputStream dataIn, BooleanStream bs) throws IOException {
|
||||
super.tightUnmarshal(wireFormat, o, dataIn, bs);
|
||||
|
||||
ConsumerControl info = (ConsumerControl)o;
|
||||
info.setClose(bs.readBoolean());
|
||||
info.setConsumerId((org.apache.activemq.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, DataOutputStream 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, DataInputStream dataIn) throws IOException {
|
||||
super.looseUnmarshal(wireFormat, o, dataIn);
|
||||
|
||||
ConsumerControl info = (ConsumerControl)o;
|
||||
info.setClose(dataIn.readBoolean());
|
||||
info.setConsumerId((org.apache.activemq.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, DataOutputStream 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());
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1 +1,60 @@
|
|||
/**
*
* Copyright 2005-2006 The Apache Software Foundation
*
* Licensed 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.openwire.v1;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import org.apache.activemq.openwire.*;
import org.apache.activemq.command.*;
/**
* Test case for the OpenWire marshalling for ConnectionControl
*
*
* 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.
*
* @version $Revision: $
*/
public class ConnectionControlTest extends BaseCommandTestSupport {
public static ConnectionControlTest SINGLETON = new ConnectionControlTest();
public Object createObject() throws Exception {
ConnectionControl info = new ConnectionControl();
populateObject(info);
return info;
}
protected void populateObject(Object object) throws Exception {
super.populateObject(object);
ConnectionControl info = (ConnectionControl) object;
info.setClose(true);
info.setExit(false);
info.setFaultTolerant(true);
info.setResume(false);
info.setSuspend(true);
}
}
|
||||
/**
|
||||
*
|
||||
* Copyright 2005-2006 The Apache Software Foundation
|
||||
*
|
||||
* Licensed 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.openwire.v1;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.activemq.openwire.*;
|
||||
import org.apache.activemq.command.*;
|
||||
|
||||
|
||||
/**
|
||||
* Test case for the OpenWire marshalling for ConnectionControl
|
||||
*
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* @version $Revision: $
|
||||
*/
|
||||
public class ConnectionControlTest extends BaseCommandTestSupport {
|
||||
|
||||
|
||||
public static ConnectionControlTest SINGLETON = new ConnectionControlTest();
|
||||
|
||||
public Object createObject() throws Exception {
|
||||
ConnectionControl info = new ConnectionControl();
|
||||
populateObject(info);
|
||||
return info;
|
||||
}
|
||||
|
||||
|
||||
protected void populateObject(Object object) throws Exception {
|
||||
super.populateObject(object);
|
||||
ConnectionControl info = (ConnectionControl) object;
|
||||
info.setClose(true);
|
||||
info.setExit(false);
|
||||
info.setFaultTolerant(true);
|
||||
info.setResume(false);
|
||||
info.setSuspend(true);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1 +1,58 @@
|
|||
/**
*
* Copyright 2005-2006 The Apache Software Foundation
*
* Licensed 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.openwire.v1;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import org.apache.activemq.openwire.*;
import org.apache.activemq.command.*;
/**
* Test case for the OpenWire marshalling for ConsumerControl
*
*
* 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.
*
* @version $Revision: $
*/
public class ConsumerControlTest extends BaseCommandTestSupport {
public static ConsumerControlTest SINGLETON = new ConsumerControlTest();
public Object createObject() throws Exception {
ConsumerControl info = new ConsumerControl();
populateObject(info);
return info;
}
protected void populateObject(Object object) throws Exception {
super.populateObject(object);
ConsumerControl info = (ConsumerControl) object;
info.setClose(true);
info.setConsumerId(createConsumerId("ConsumerId:1"));
info.setPrefetch(1);
}
}
|
||||
/**
|
||||
*
|
||||
* Copyright 2005-2006 The Apache Software Foundation
|
||||
*
|
||||
* Licensed 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.openwire.v1;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.activemq.openwire.*;
|
||||
import org.apache.activemq.command.*;
|
||||
|
||||
|
||||
/**
|
||||
* Test case for the OpenWire marshalling for ConsumerControl
|
||||
*
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* @version $Revision: $
|
||||
*/
|
||||
public class ConsumerControlTest extends BaseCommandTestSupport {
|
||||
|
||||
|
||||
public static ConsumerControlTest SINGLETON = new ConsumerControlTest();
|
||||
|
||||
public Object createObject() throws Exception {
|
||||
ConsumerControl info = new ConsumerControl();
|
||||
populateObject(info);
|
||||
return info;
|
||||
}
|
||||
|
||||
|
||||
protected void populateObject(Object object) throws Exception {
|
||||
super.populateObject(object);
|
||||
ConsumerControl info = (ConsumerControl) object;
|
||||
info.setClose(true);
|
||||
info.setConsumerId(createConsumerId("ConsumerId:1"));
|
||||
info.setPrefetch(1);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1 +1,96 @@
|
|||
/*
* Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed 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.
*/
//
// NOTE!: This file is autogenerated - do not modify!
// if you need to make a change, please see the Groovy scripts in the
// activemq-core module
//
using System;
using System.Collections;
using ActiveMQ.OpenWire;
using ActiveMQ.Commands;
namespace ActiveMQ.Commands
{
/// <summary>
/// The ActiveMQ ConnectionControl Command
/// </summary>
public class ConnectionControl : BaseCommand
{
public const byte ID_ConnectionControl = 18;
bool close;
bool exit;
bool faultTolerant;
bool resume;
bool suspend;
public override string ToString() {
return GetType().Name + "["
+ " Close=" + Close
+ " Exit=" + Exit
+ " FaultTolerant=" + FaultTolerant
+ " Resume=" + Resume
+ " Suspend=" + Suspend
+ " ]";
}
public override byte GetDataStructureType() {
return ID_ConnectionControl;
}
// Properties
public bool Close
{
get { return close; }
set { this.close = value; }
}
public bool Exit
{
get { return exit; }
set { this.exit = value; }
}
public bool FaultTolerant
{
get { return faultTolerant; }
set { this.faultTolerant = value; }
}
public bool Resume
{
get { return resume; }
set { this.resume = value; }
}
public bool Suspend
{
get { return suspend; }
set { this.suspend = value; }
}
}
}
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
|
||||
//
|
||||
// NOTE!: This file is autogenerated - do not modify!
|
||||
// if you need to make a change, please see the Groovy scripts in the
|
||||
// activemq-core module
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
|
||||
using ActiveMQ.OpenWire;
|
||||
using ActiveMQ.Commands;
|
||||
|
||||
namespace ActiveMQ.Commands
|
||||
{
|
||||
/// <summary>
|
||||
/// The ActiveMQ ConnectionControl Command
|
||||
/// </summary>
|
||||
public class ConnectionControl : BaseCommand
|
||||
{
|
||||
public const byte ID_ConnectionControl = 18;
|
||||
|
||||
bool close;
|
||||
bool exit;
|
||||
bool faultTolerant;
|
||||
bool resume;
|
||||
bool suspend;
|
||||
|
||||
public override string ToString() {
|
||||
return GetType().Name + "["
|
||||
+ " Close=" + Close
|
||||
+ " Exit=" + Exit
|
||||
+ " FaultTolerant=" + FaultTolerant
|
||||
+ " Resume=" + Resume
|
||||
+ " Suspend=" + Suspend
|
||||
+ " ]";
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public override byte GetDataStructureType() {
|
||||
return ID_ConnectionControl;
|
||||
}
|
||||
|
||||
|
||||
// Properties
|
||||
|
||||
public bool Close
|
||||
{
|
||||
get { return close; }
|
||||
set { this.close = value; }
|
||||
}
|
||||
|
||||
public bool Exit
|
||||
{
|
||||
get { return exit; }
|
||||
set { this.exit = value; }
|
||||
}
|
||||
|
||||
public bool FaultTolerant
|
||||
{
|
||||
get { return faultTolerant; }
|
||||
set { this.faultTolerant = value; }
|
||||
}
|
||||
|
||||
public bool Resume
|
||||
{
|
||||
get { return resume; }
|
||||
set { this.resume = value; }
|
||||
}
|
||||
|
||||
public bool Suspend
|
||||
{
|
||||
get { return suspend; }
|
||||
set { this.suspend = value; }
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1 +1,80 @@
|
|||
/*
* Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed 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.
*/
//
// NOTE!: This file is autogenerated - do not modify!
// if you need to make a change, please see the Groovy scripts in the
// activemq-core module
//
using System;
using System.Collections;
using ActiveMQ.OpenWire;
using ActiveMQ.Commands;
namespace ActiveMQ.Commands
{
/// <summary>
/// The ActiveMQ ConsumerControl Command
/// </summary>
public class ConsumerControl : BaseCommand
{
public const byte ID_ConsumerControl = 17;
bool close;
ConsumerId consumerId;
int prefetch;
public override string ToString() {
return GetType().Name + "["
+ " Close=" + Close
+ " ConsumerId=" + ConsumerId
+ " Prefetch=" + Prefetch
+ " ]";
}
public override byte GetDataStructureType() {
return ID_ConsumerControl;
}
// Properties
public bool Close
{
get { return close; }
set { this.close = value; }
}
public ConsumerId ConsumerId
{
get { return consumerId; }
set { this.consumerId = value; }
}
public int Prefetch
{
get { return prefetch; }
set { this.prefetch = value; }
}
}
}
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
|
||||
//
|
||||
// NOTE!: This file is autogenerated - do not modify!
|
||||
// if you need to make a change, please see the Groovy scripts in the
|
||||
// activemq-core module
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
|
||||
using ActiveMQ.OpenWire;
|
||||
using ActiveMQ.Commands;
|
||||
|
||||
namespace ActiveMQ.Commands
|
||||
{
|
||||
/// <summary>
|
||||
/// The ActiveMQ ConsumerControl Command
|
||||
/// </summary>
|
||||
public class ConsumerControl : BaseCommand
|
||||
{
|
||||
public const byte ID_ConsumerControl = 17;
|
||||
|
||||
bool close;
|
||||
ConsumerId consumerId;
|
||||
int prefetch;
|
||||
|
||||
public override string ToString() {
|
||||
return GetType().Name + "["
|
||||
+ " Close=" + Close
|
||||
+ " ConsumerId=" + ConsumerId
|
||||
+ " Prefetch=" + Prefetch
|
||||
+ " ]";
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public override byte GetDataStructureType() {
|
||||
return ID_ConsumerControl;
|
||||
}
|
||||
|
||||
|
||||
// Properties
|
||||
|
||||
public bool Close
|
||||
{
|
||||
get { return close; }
|
||||
set { this.close = value; }
|
||||
}
|
||||
|
||||
public ConsumerId ConsumerId
|
||||
{
|
||||
get { return consumerId; }
|
||||
set { this.consumerId = value; }
|
||||
}
|
||||
|
||||
public int Prefetch
|
||||
{
|
||||
get { return prefetch; }
|
||||
set { this.prefetch = value; }
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1 +1,131 @@
|
|||
/*
* Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed 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.
*/
//
// NOTE!: This file is autogenerated - do not modify!
// if you need to make a change, please see the Groovy scripts in the
// activemq-core module
//
using System;
using System.Collections;
using System.IO;
using ActiveMQ.Commands;
using ActiveMQ.OpenWire;
using ActiveMQ.OpenWire.V1;
namespace ActiveMQ.OpenWire.V1
{
/// <summary>
/// Marshalling code for Open Wire Format for ConnectionControl
/// </summary>
class ConnectionControlMarshaller : BaseCommandMarshaller
{
public override DataStructure CreateObject()
{
return new ConnectionControl();
}
public override byte GetDataStructureType()
{
return ConnectionControl.ID_ConnectionControl;
}
//
// Un-marshal an object instance from the data input stream
//
public override void TightUnmarshal(OpenWireFormat wireFormat, Object o, BinaryReader dataIn, BooleanStream bs)
{
base.TightUnmarshal(wireFormat, o, dataIn, bs);
ConnectionControl info = (ConnectionControl)o;
info.Close = bs.ReadBoolean();
info.Exit = bs.ReadBoolean();
info.FaultTolerant = bs.ReadBoolean();
info.Resume = bs.ReadBoolean();
info.Suspend = bs.ReadBoolean();
}
//
// Write the booleans that this object uses to a BooleanStream
//
public override int TightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) {
ConnectionControl info = (ConnectionControl)o;
int rc = base.TightMarshal1(wireFormat, info, bs);
bs.WriteBoolean(info.Close);
bs.WriteBoolean(info.Exit);
bs.WriteBoolean(info.FaultTolerant);
bs.WriteBoolean(info.Resume);
bs.WriteBoolean(info.Suspend);
return rc + 0;
}
//
// Write a object instance to data output stream
//
public override void TightMarshal2(OpenWireFormat wireFormat, Object o, BinaryWriter dataOut, BooleanStream bs) {
base.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
//
public override void LooseUnmarshal(OpenWireFormat wireFormat, Object o, BinaryReader dataIn)
{
base.LooseUnmarshal(wireFormat, o, dataIn);
ConnectionControl info = (ConnectionControl)o;
info.Close = dataIn.ReadBoolean();
info.Exit = dataIn.ReadBoolean();
info.FaultTolerant = dataIn.ReadBoolean();
info.Resume = dataIn.ReadBoolean();
info.Suspend = dataIn.ReadBoolean();
}
//
// Write a object instance to data output stream
//
public override void LooseMarshal(OpenWireFormat wireFormat, Object o, BinaryWriter dataOut) {
ConnectionControl info = (ConnectionControl)o;
base.LooseMarshal(wireFormat, o, dataOut);
dataOut.Write(info.Close);
dataOut.Write(info.Exit);
dataOut.Write(info.FaultTolerant);
dataOut.Write(info.Resume);
dataOut.Write(info.Suspend);
}
}
}
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
|
||||
//
|
||||
// NOTE!: This file is autogenerated - do not modify!
|
||||
// if you need to make a change, please see the Groovy scripts in the
|
||||
// activemq-core module
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.IO;
|
||||
|
||||
using ActiveMQ.Commands;
|
||||
using ActiveMQ.OpenWire;
|
||||
using ActiveMQ.OpenWire.V1;
|
||||
|
||||
namespace ActiveMQ.OpenWire.V1
|
||||
{
|
||||
/// <summary>
|
||||
/// Marshalling code for Open Wire Format for ConnectionControl
|
||||
/// </summary>
|
||||
class ConnectionControlMarshaller : BaseCommandMarshaller
|
||||
{
|
||||
|
||||
|
||||
public override DataStructure CreateObject()
|
||||
{
|
||||
return new ConnectionControl();
|
||||
}
|
||||
|
||||
public override byte GetDataStructureType()
|
||||
{
|
||||
return ConnectionControl.ID_ConnectionControl;
|
||||
}
|
||||
|
||||
//
|
||||
// Un-marshal an object instance from the data input stream
|
||||
//
|
||||
public override void TightUnmarshal(OpenWireFormat wireFormat, Object o, BinaryReader dataIn, BooleanStream bs)
|
||||
{
|
||||
base.TightUnmarshal(wireFormat, o, dataIn, bs);
|
||||
|
||||
ConnectionControl info = (ConnectionControl)o;
|
||||
info.Close = bs.ReadBoolean();
|
||||
info.Exit = bs.ReadBoolean();
|
||||
info.FaultTolerant = bs.ReadBoolean();
|
||||
info.Resume = bs.ReadBoolean();
|
||||
info.Suspend = bs.ReadBoolean();
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// Write the booleans that this object uses to a BooleanStream
|
||||
//
|
||||
public override int TightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) {
|
||||
ConnectionControl info = (ConnectionControl)o;
|
||||
|
||||
int rc = base.TightMarshal1(wireFormat, info, bs);
|
||||
bs.WriteBoolean(info.Close);
|
||||
bs.WriteBoolean(info.Exit);
|
||||
bs.WriteBoolean(info.FaultTolerant);
|
||||
bs.WriteBoolean(info.Resume);
|
||||
bs.WriteBoolean(info.Suspend);
|
||||
|
||||
return rc + 0;
|
||||
}
|
||||
|
||||
//
|
||||
// Write a object instance to data output stream
|
||||
//
|
||||
public override void TightMarshal2(OpenWireFormat wireFormat, Object o, BinaryWriter dataOut, BooleanStream bs) {
|
||||
base.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
|
||||
//
|
||||
public override void LooseUnmarshal(OpenWireFormat wireFormat, Object o, BinaryReader dataIn)
|
||||
{
|
||||
base.LooseUnmarshal(wireFormat, o, dataIn);
|
||||
|
||||
ConnectionControl info = (ConnectionControl)o;
|
||||
info.Close = dataIn.ReadBoolean();
|
||||
info.Exit = dataIn.ReadBoolean();
|
||||
info.FaultTolerant = dataIn.ReadBoolean();
|
||||
info.Resume = dataIn.ReadBoolean();
|
||||
info.Suspend = dataIn.ReadBoolean();
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// Write a object instance to data output stream
|
||||
//
|
||||
public override void LooseMarshal(OpenWireFormat wireFormat, Object o, BinaryWriter dataOut) {
|
||||
|
||||
ConnectionControl info = (ConnectionControl)o;
|
||||
|
||||
base.LooseMarshal(wireFormat, o, dataOut);
|
||||
dataOut.Write(info.Close);
|
||||
dataOut.Write(info.Exit);
|
||||
dataOut.Write(info.FaultTolerant);
|
||||
dataOut.Write(info.Resume);
|
||||
dataOut.Write(info.Suspend);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1 +1,120 @@
|
|||
/*
* Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable.
*
* Licensed 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.
*/
//
// NOTE!: This file is autogenerated - do not modify!
// if you need to make a change, please see the Groovy scripts in the
// activemq-core module
//
using System;
using System.Collections;
using System.IO;
using ActiveMQ.Commands;
using ActiveMQ.OpenWire;
using ActiveMQ.OpenWire.V1;
namespace ActiveMQ.OpenWire.V1
{
/// <summary>
/// Marshalling code for Open Wire Format for ConsumerControl
/// </summary>
class ConsumerControlMarshaller : BaseCommandMarshaller
{
public override DataStructure CreateObject()
{
return new ConsumerControl();
}
public override byte GetDataStructureType()
{
return ConsumerControl.ID_ConsumerControl;
}
//
// Un-marshal an object instance from the data input stream
//
public override void TightUnmarshal(OpenWireFormat wireFormat, Object o, BinaryReader dataIn, BooleanStream bs)
{
base.TightUnmarshal(wireFormat, o, dataIn, bs);
ConsumerControl info = (ConsumerControl)o;
info.Close = bs.ReadBoolean();
info.ConsumerId = (ConsumerId) TightUnmarshalNestedObject(wireFormat, dataIn, bs);
info.Prefetch = dataIn.ReadInt32();
}
//
// Write the booleans that this object uses to a BooleanStream
//
public override int TightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) {
ConsumerControl info = (ConsumerControl)o;
int rc = base.TightMarshal1(wireFormat, info, bs);
bs.WriteBoolean(info.Close);
rc += TightMarshalNestedObject1(wireFormat, (DataStructure)info.ConsumerId, bs);
return rc + 4;
}
//
// Write a object instance to data output stream
//
public override void TightMarshal2(OpenWireFormat wireFormat, Object o, BinaryWriter dataOut, BooleanStream bs) {
base.TightMarshal2(wireFormat, o, dataOut, bs);
ConsumerControl info = (ConsumerControl)o;
bs.ReadBoolean();
TightMarshalNestedObject2(wireFormat, (DataStructure)info.ConsumerId, dataOut, bs);
dataOut.Write(info.Prefetch);
}
//
// Un-marshal an object instance from the data input stream
//
public override void LooseUnmarshal(OpenWireFormat wireFormat, Object o, BinaryReader dataIn)
{
base.LooseUnmarshal(wireFormat, o, dataIn);
ConsumerControl info = (ConsumerControl)o;
info.Close = dataIn.ReadBoolean();
info.ConsumerId = (ConsumerId) LooseUnmarshalNestedObject(wireFormat, dataIn);
info.Prefetch = dataIn.ReadInt32();
}
//
// Write a object instance to data output stream
//
public override void LooseMarshal(OpenWireFormat wireFormat, Object o, BinaryWriter dataOut) {
ConsumerControl info = (ConsumerControl)o;
base.LooseMarshal(wireFormat, o, dataOut);
dataOut.Write(info.Close);
LooseMarshalNestedObject(wireFormat, (DataStructure)info.ConsumerId, dataOut);
dataOut.Write(info.Prefetch);
}
}
}
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
|
||||
//
|
||||
// NOTE!: This file is autogenerated - do not modify!
|
||||
// if you need to make a change, please see the Groovy scripts in the
|
||||
// activemq-core module
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.IO;
|
||||
|
||||
using ActiveMQ.Commands;
|
||||
using ActiveMQ.OpenWire;
|
||||
using ActiveMQ.OpenWire.V1;
|
||||
|
||||
namespace ActiveMQ.OpenWire.V1
|
||||
{
|
||||
/// <summary>
|
||||
/// Marshalling code for Open Wire Format for ConsumerControl
|
||||
/// </summary>
|
||||
class ConsumerControlMarshaller : BaseCommandMarshaller
|
||||
{
|
||||
|
||||
|
||||
public override DataStructure CreateObject()
|
||||
{
|
||||
return new ConsumerControl();
|
||||
}
|
||||
|
||||
public override byte GetDataStructureType()
|
||||
{
|
||||
return ConsumerControl.ID_ConsumerControl;
|
||||
}
|
||||
|
||||
//
|
||||
// Un-marshal an object instance from the data input stream
|
||||
//
|
||||
public override void TightUnmarshal(OpenWireFormat wireFormat, Object o, BinaryReader dataIn, BooleanStream bs)
|
||||
{
|
||||
base.TightUnmarshal(wireFormat, o, dataIn, bs);
|
||||
|
||||
ConsumerControl info = (ConsumerControl)o;
|
||||
info.Close = bs.ReadBoolean();
|
||||
info.ConsumerId = (ConsumerId) TightUnmarshalNestedObject(wireFormat, dataIn, bs);
|
||||
info.Prefetch = dataIn.ReadInt32();
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// Write the booleans that this object uses to a BooleanStream
|
||||
//
|
||||
public override int TightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) {
|
||||
ConsumerControl info = (ConsumerControl)o;
|
||||
|
||||
int rc = base.TightMarshal1(wireFormat, info, bs);
|
||||
bs.WriteBoolean(info.Close);
|
||||
rc += TightMarshalNestedObject1(wireFormat, (DataStructure)info.ConsumerId, bs);
|
||||
|
||||
return rc + 4;
|
||||
}
|
||||
|
||||
//
|
||||
// Write a object instance to data output stream
|
||||
//
|
||||
public override void TightMarshal2(OpenWireFormat wireFormat, Object o, BinaryWriter dataOut, BooleanStream bs) {
|
||||
base.TightMarshal2(wireFormat, o, dataOut, bs);
|
||||
|
||||
ConsumerControl info = (ConsumerControl)o;
|
||||
bs.ReadBoolean();
|
||||
TightMarshalNestedObject2(wireFormat, (DataStructure)info.ConsumerId, dataOut, bs);
|
||||
dataOut.Write(info.Prefetch);
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// Un-marshal an object instance from the data input stream
|
||||
//
|
||||
public override void LooseUnmarshal(OpenWireFormat wireFormat, Object o, BinaryReader dataIn)
|
||||
{
|
||||
base.LooseUnmarshal(wireFormat, o, dataIn);
|
||||
|
||||
ConsumerControl info = (ConsumerControl)o;
|
||||
info.Close = dataIn.ReadBoolean();
|
||||
info.ConsumerId = (ConsumerId) LooseUnmarshalNestedObject(wireFormat, dataIn);
|
||||
info.Prefetch = dataIn.ReadInt32();
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// Write a object instance to data output stream
|
||||
//
|
||||
public override void LooseMarshal(OpenWireFormat wireFormat, Object o, BinaryWriter dataOut) {
|
||||
|
||||
ConsumerControl info = (ConsumerControl)o;
|
||||
|
||||
base.LooseMarshal(wireFormat, o, dataOut);
|
||||
dataOut.Write(info.Close);
|
||||
LooseMarshalNestedObject(wireFormat, (DataStructure)info.ConsumerId, dataOut);
|
||||
dataOut.Write(info.Prefetch);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,201 +1,201 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
Copyright 2005-2006 The Apache Software Foundation
|
||||
|
||||
Licensed 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
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0">
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>incubator-activemq</groupId>
|
||||
<artifactId>activemq-parent</artifactId>
|
||||
<version>4.0.2-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>activemq-rar</artifactId>
|
||||
<packaging>rar</packaging>
|
||||
<name>ActiveMQ :: RAR</name>
|
||||
<description>A JCA Resource Adapter used to integrate ActiveMQ with transactional enterprise containers</description>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!-- activemq -->
|
||||
<dependency>
|
||||
<groupId>${pom.groupId}</groupId>
|
||||
<artifactId>activemq-ra</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.apache.geronimo.specs</groupId>
|
||||
<artifactId>geronimo-jms_1.1_spec</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.apache.geronimo.specs</groupId>
|
||||
<artifactId>geronimo-j2ee-connector_1.5_spec</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.apache.geronimo.specs</groupId>
|
||||
<artifactId>geronimo-ejb_2.1_spec</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.apache.geronimo.specs</groupId>
|
||||
<artifactId>geronimo-j2ee-jacc_1.0_spec</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.apache.geronimo.specs</groupId>
|
||||
<artifactId>geronimo-jta_1.0.1B_spec</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.apache.geronimo.specs</groupId>
|
||||
<artifactId>geronimo-servlet_2.4_spec</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.apache.geronimo.specs</groupId>
|
||||
<artifactId>geronimo-j2ee-management_1.0_spec</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>mx4j</groupId>
|
||||
<artifactId>mx4j</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>geronimo</groupId>
|
||||
<artifactId>geronimo-kernel</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>geronimo</groupId>
|
||||
<artifactId>geronimo-j2ee</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>axion</groupId>
|
||||
<artifactId>axion</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>${pom.groupId}</groupId>
|
||||
<artifactId>activemq-jaas</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>howl</groupId>
|
||||
<artifactId>howl-logger</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>activemq</groupId>
|
||||
<artifactId>smackx</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>activemq</groupId>
|
||||
<artifactId>smack</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>mx4j</groupId>
|
||||
<artifactId>mx4j-jmx</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>mx4j</groupId>
|
||||
<artifactId>mx4j-impl</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>mx4j</groupId>
|
||||
<artifactId>mx4j-remote</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>mx4j</groupId>
|
||||
<artifactId>mx4j-tools</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>qdox</groupId>
|
||||
<artifactId>qdox</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>stax</groupId>
|
||||
<artifactId>stax-api</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>stax</groupId>
|
||||
<artifactId>stax</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>regexp</groupId>
|
||||
<artifactId>regexp</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>activemq</groupId>
|
||||
<artifactId>jmdns</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>xalan</groupId>
|
||||
<artifactId>xalan</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>xmlbeans</groupId>
|
||||
<artifactId>xbean</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>xmlbeans</groupId>
|
||||
<artifactId>xmlpublic</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>xmlbeans</groupId>
|
||||
<artifactId>xbean_xpath</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>xerces</groupId>
|
||||
<artifactId>xercesImpl</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>xml-apis</groupId>
|
||||
<artifactId>xml-apis</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>ant</groupId>
|
||||
<artifactId>ant</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>commons-collections</groupId>
|
||||
<artifactId>commons-collections</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>commons-primitives</groupId>
|
||||
<artifactId>commons-primitives</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>commons-pool</groupId>
|
||||
<artifactId>commons-pool</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.xbean</groupId>
|
||||
<artifactId>xbean-spring</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.derby</groupId>
|
||||
<artifactId>derby</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
Copyright 2005-2006 The Apache Software Foundation
|
||||
|
||||
Licensed 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
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0">
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>incubator-activemq</groupId>
|
||||
<artifactId>activemq-parent</artifactId>
|
||||
<version>4.0.2-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>activemq-rar</artifactId>
|
||||
<packaging>rar</packaging>
|
||||
<name>ActiveMQ :: RAR</name>
|
||||
<description>A JCA Resource Adapter used to integrate ActiveMQ with transactional enterprise containers</description>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!-- activemq -->
|
||||
<dependency>
|
||||
<groupId>${pom.groupId}</groupId>
|
||||
<artifactId>activemq-ra</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.apache.geronimo.specs</groupId>
|
||||
<artifactId>geronimo-jms_1.1_spec</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.apache.geronimo.specs</groupId>
|
||||
<artifactId>geronimo-j2ee-connector_1.5_spec</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.apache.geronimo.specs</groupId>
|
||||
<artifactId>geronimo-ejb_2.1_spec</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.apache.geronimo.specs</groupId>
|
||||
<artifactId>geronimo-j2ee-jacc_1.0_spec</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.apache.geronimo.specs</groupId>
|
||||
<artifactId>geronimo-jta_1.0.1B_spec</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.apache.geronimo.specs</groupId>
|
||||
<artifactId>geronimo-servlet_2.4_spec</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.apache.geronimo.specs</groupId>
|
||||
<artifactId>geronimo-j2ee-management_1.0_spec</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>mx4j</groupId>
|
||||
<artifactId>mx4j</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>geronimo</groupId>
|
||||
<artifactId>geronimo-kernel</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>geronimo</groupId>
|
||||
<artifactId>geronimo-j2ee</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>axion</groupId>
|
||||
<artifactId>axion</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>${pom.groupId}</groupId>
|
||||
<artifactId>activemq-jaas</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>howl</groupId>
|
||||
<artifactId>howl-logger</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>activemq</groupId>
|
||||
<artifactId>smackx</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>activemq</groupId>
|
||||
<artifactId>smack</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>mx4j</groupId>
|
||||
<artifactId>mx4j-jmx</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>mx4j</groupId>
|
||||
<artifactId>mx4j-impl</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>mx4j</groupId>
|
||||
<artifactId>mx4j-remote</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>mx4j</groupId>
|
||||
<artifactId>mx4j-tools</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>qdox</groupId>
|
||||
<artifactId>qdox</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>stax</groupId>
|
||||
<artifactId>stax-api</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>stax</groupId>
|
||||
<artifactId>stax</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>regexp</groupId>
|
||||
<artifactId>regexp</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>activemq</groupId>
|
||||
<artifactId>jmdns</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>xalan</groupId>
|
||||
<artifactId>xalan</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>xmlbeans</groupId>
|
||||
<artifactId>xbean</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>xmlbeans</groupId>
|
||||
<artifactId>xmlpublic</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>xmlbeans</groupId>
|
||||
<artifactId>xbean_xpath</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>xerces</groupId>
|
||||
<artifactId>xercesImpl</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>xml-apis</groupId>
|
||||
<artifactId>xml-apis</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>ant</groupId>
|
||||
<artifactId>ant</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>commons-collections</groupId>
|
||||
<artifactId>commons-collections</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>commons-primitives</groupId>
|
||||
<artifactId>commons-primitives</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>commons-pool</groupId>
|
||||
<artifactId>commons-pool</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.xbean</groupId>
|
||||
<artifactId>xbean-spring</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.derby</groupId>
|
||||
<artifactId>derby</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
|
|
@ -1,167 +1,167 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright 2005-2006 The Apache Software Foundation
|
||||
|
||||
Licensed 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.
|
||||
-->
|
||||
|
||||
<connector xmlns="http://java.sun.com/xml/ns/j2ee"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
|
||||
http://java.sun.com/xml/ns/j2ee/connector_1_5.xsd"
|
||||
version="1.5">
|
||||
<description>ActiveMQ inbound and outbound JMS ResourceAdapter</description>
|
||||
<display-name>ActiveMQ JMS Resource Adapter</display-name>
|
||||
<vendor-name>activemq.org</vendor-name>
|
||||
<eis-type>JMS 1.1</eis-type>
|
||||
<resourceadapter-version>1.0</resourceadapter-version>
|
||||
<license>
|
||||
<description>
|
||||
|
||||
Copyright 2005-2006 The Apache Software Foundation
|
||||
|
||||
Licensed 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.
|
||||
|
||||
</description>
|
||||
<license-required>true</license-required>
|
||||
</license>
|
||||
<resourceadapter>
|
||||
<resourceadapter-class>org.apache.activemq.ra.ActiveMQResourceAdapter</resourceadapter-class>
|
||||
<config-property>
|
||||
<description>
|
||||
The URL to the ActiveMQ server that you want this connection to connect to. If using
|
||||
an embedded broker, this value should be 'vm://localhost'.
|
||||
</description>
|
||||
<config-property-name>ServerUrl</config-property-name>
|
||||
<config-property-type>java.lang.String</config-property-type>
|
||||
<config-property-value>tcp://localhost:61616</config-property-value>
|
||||
<!-- <config-property-value>vm://localhost</config-property-value> -->
|
||||
</config-property>
|
||||
<config-property>
|
||||
<description>The default user name that will be used to establish connections to the ActiveMQ server.</description>
|
||||
<config-property-name>UserName</config-property-name>
|
||||
<config-property-type>java.lang.String</config-property-type>
|
||||
<config-property-value>defaultUser</config-property-value>
|
||||
</config-property>
|
||||
<config-property>
|
||||
<description>The default password that will be used to log the default user into the ActiveMQ server.</description>
|
||||
<config-property-name>Password</config-property-name>
|
||||
<config-property-type>java.lang.String</config-property-type>
|
||||
<config-property-value>defaultPassword</config-property-value>
|
||||
</config-property>
|
||||
<config-property>
|
||||
<description>The client id that will be set on the connection that is established to the ActiveMQ server.</description>
|
||||
<config-property-name>Clientid</config-property-name>
|
||||
<config-property-type>java.lang.String</config-property-type>
|
||||
</config-property>
|
||||
<config-property>
|
||||
<description>Boolean to configure if outbound connections should reuse the inbound connection's session for sending messages.</description>
|
||||
<config-property-name>UseInboundSession</config-property-name>
|
||||
<config-property-type>java.lang.Boolean</config-property-type>
|
||||
<config-property-value>false</config-property-value>
|
||||
</config-property>
|
||||
|
||||
<!-- NOTE disable the following property if you do not wish to deploy an embedded broker -->
|
||||
<config-property>
|
||||
<description>
|
||||
Sets the XML configuration file used to configure the embedded ActiveMQ broker via
|
||||
Spring if using embedded mode.
|
||||
|
||||
BrokerXmlConfig is the filename which is assumed to be on the classpath unless
|
||||
a URL is specified. So a value of foo/bar.xml would be assumed to be on the
|
||||
classpath whereas file:dir/file.xml would use the file system.
|
||||
Any valid URL string is supported.
|
||||
</description>
|
||||
<config-property-name>BrokerXmlConfig</config-property-name>
|
||||
<config-property-type>java.lang.String</config-property-type>
|
||||
<config-property-value></config-property-value>
|
||||
<!--
|
||||
<config-property-value>xbean:broker-config.xml</config-property-value>
|
||||
-->
|
||||
</config-property>
|
||||
|
||||
<outbound-resourceadapter>
|
||||
<connection-definition>
|
||||
<managedconnectionfactory-class>org.apache.activemq.ra.ActiveMQManagedConnectionFactory</managedconnectionfactory-class>
|
||||
<connectionfactory-interface>javax.jms.ConnectionFactory</connectionfactory-interface>
|
||||
<connectionfactory-impl-class>org.apache.activemq.ra.ActiveMQConnectionFactory</connectionfactory-impl-class>
|
||||
<connection-interface>javax.jms.Connection</connection-interface>
|
||||
<connection-impl-class>org.apache.activemq.ra.ManagedConnectionProxy</connection-impl-class>
|
||||
</connection-definition>
|
||||
<connection-definition>
|
||||
<managedconnectionfactory-class>org.apache.activemq.ra.ActiveMQManagedConnectionFactory</managedconnectionfactory-class>
|
||||
<connectionfactory-interface>javax.jms.QueueConnectionFactory</connectionfactory-interface>
|
||||
<connectionfactory-impl-class>org.apache.activemq.ra.ActiveMQConnectionFactory</connectionfactory-impl-class>
|
||||
<connection-interface>javax.jms.QueueConnection</connection-interface>
|
||||
<connection-impl-class>org.apache.activemq.ra.ManagedConnectionProxy</connection-impl-class>
|
||||
</connection-definition>
|
||||
<connection-definition>
|
||||
<managedconnectionfactory-class>org.apache.activemq.ra.ActiveMQManagedConnectionFactory</managedconnectionfactory-class>
|
||||
<connectionfactory-interface>javax.jms.TopicConnectionFactory</connectionfactory-interface>
|
||||
<connectionfactory-impl-class>org.apache.activemq.ra.ActiveMQConnectionFactory</connectionfactory-impl-class>
|
||||
<connection-interface>javax.jms.TopicConnection</connection-interface>
|
||||
<connection-impl-class>org.apache.activemq.ra.ManagedConnectionProxy</connection-impl-class>
|
||||
</connection-definition>
|
||||
<transaction-support>XATransaction</transaction-support>
|
||||
<authentication-mechanism>
|
||||
<authentication-mechanism-type>BasicPassword</authentication-mechanism-type>
|
||||
<credential-interface>javax.resource.spi.security.PasswordCredential</credential-interface>
|
||||
</authentication-mechanism>
|
||||
<reauthentication-support>false</reauthentication-support>
|
||||
</outbound-resourceadapter>
|
||||
<inbound-resourceadapter>
|
||||
<messageadapter>
|
||||
<messagelistener>
|
||||
<messagelistener-type>javax.jms.MessageListener</messagelistener-type>
|
||||
<activationspec>
|
||||
<activationspec-class>org.apache.activemq.ra.ActiveMQActivationSpec</activationspec-class>
|
||||
|
||||
<required-config-property>
|
||||
<config-property-name>destination</config-property-name>
|
||||
</required-config-property>
|
||||
<required-config-property>
|
||||
<config-property-name>destinationType</config-property-name>
|
||||
</required-config-property>
|
||||
|
||||
</activationspec>
|
||||
</messagelistener>
|
||||
</messageadapter>
|
||||
</inbound-resourceadapter>
|
||||
<adminobject>
|
||||
<adminobject-interface>javax.jms.Queue</adminobject-interface>
|
||||
<adminobject-class>org.apache.activemq.command.ActiveMQQueue</adminobject-class>
|
||||
<config-property>
|
||||
<config-property-name>PhysicalName</config-property-name>
|
||||
<config-property-type>java.lang.String</config-property-type>
|
||||
</config-property>
|
||||
</adminobject>
|
||||
<adminobject>
|
||||
<adminobject-interface>javax.jms.Topic</adminobject-interface>
|
||||
<adminobject-class>org.apache.activemq.command.ActiveMQTopic</adminobject-class>
|
||||
<config-property>
|
||||
<config-property-name>PhysicalName</config-property-name>
|
||||
<config-property-type>java.lang.String</config-property-type>
|
||||
</config-property>
|
||||
</adminobject>
|
||||
</resourceadapter>
|
||||
</connector>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright 2005-2006 The Apache Software Foundation
|
||||
|
||||
Licensed 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.
|
||||
-->
|
||||
|
||||
<connector xmlns="http://java.sun.com/xml/ns/j2ee"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
|
||||
http://java.sun.com/xml/ns/j2ee/connector_1_5.xsd"
|
||||
version="1.5">
|
||||
<description>ActiveMQ inbound and outbound JMS ResourceAdapter</description>
|
||||
<display-name>ActiveMQ JMS Resource Adapter</display-name>
|
||||
<vendor-name>activemq.org</vendor-name>
|
||||
<eis-type>JMS 1.1</eis-type>
|
||||
<resourceadapter-version>1.0</resourceadapter-version>
|
||||
<license>
|
||||
<description>
|
||||
|
||||
Copyright 2005-2006 The Apache Software Foundation
|
||||
|
||||
Licensed 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.
|
||||
|
||||
</description>
|
||||
<license-required>true</license-required>
|
||||
</license>
|
||||
<resourceadapter>
|
||||
<resourceadapter-class>org.apache.activemq.ra.ActiveMQResourceAdapter</resourceadapter-class>
|
||||
<config-property>
|
||||
<description>
|
||||
The URL to the ActiveMQ server that you want this connection to connect to. If using
|
||||
an embedded broker, this value should be 'vm://localhost'.
|
||||
</description>
|
||||
<config-property-name>ServerUrl</config-property-name>
|
||||
<config-property-type>java.lang.String</config-property-type>
|
||||
<config-property-value>tcp://localhost:61616</config-property-value>
|
||||
<!-- <config-property-value>vm://localhost</config-property-value> -->
|
||||
</config-property>
|
||||
<config-property>
|
||||
<description>The default user name that will be used to establish connections to the ActiveMQ server.</description>
|
||||
<config-property-name>UserName</config-property-name>
|
||||
<config-property-type>java.lang.String</config-property-type>
|
||||
<config-property-value>defaultUser</config-property-value>
|
||||
</config-property>
|
||||
<config-property>
|
||||
<description>The default password that will be used to log the default user into the ActiveMQ server.</description>
|
||||
<config-property-name>Password</config-property-name>
|
||||
<config-property-type>java.lang.String</config-property-type>
|
||||
<config-property-value>defaultPassword</config-property-value>
|
||||
</config-property>
|
||||
<config-property>
|
||||
<description>The client id that will be set on the connection that is established to the ActiveMQ server.</description>
|
||||
<config-property-name>Clientid</config-property-name>
|
||||
<config-property-type>java.lang.String</config-property-type>
|
||||
</config-property>
|
||||
<config-property>
|
||||
<description>Boolean to configure if outbound connections should reuse the inbound connection's session for sending messages.</description>
|
||||
<config-property-name>UseInboundSession</config-property-name>
|
||||
<config-property-type>java.lang.Boolean</config-property-type>
|
||||
<config-property-value>false</config-property-value>
|
||||
</config-property>
|
||||
|
||||
<!-- NOTE disable the following property if you do not wish to deploy an embedded broker -->
|
||||
<config-property>
|
||||
<description>
|
||||
Sets the XML configuration file used to configure the embedded ActiveMQ broker via
|
||||
Spring if using embedded mode.
|
||||
|
||||
BrokerXmlConfig is the filename which is assumed to be on the classpath unless
|
||||
a URL is specified. So a value of foo/bar.xml would be assumed to be on the
|
||||
classpath whereas file:dir/file.xml would use the file system.
|
||||
Any valid URL string is supported.
|
||||
</description>
|
||||
<config-property-name>BrokerXmlConfig</config-property-name>
|
||||
<config-property-type>java.lang.String</config-property-type>
|
||||
<config-property-value></config-property-value>
|
||||
<!--
|
||||
<config-property-value>xbean:broker-config.xml</config-property-value>
|
||||
-->
|
||||
</config-property>
|
||||
|
||||
<outbound-resourceadapter>
|
||||
<connection-definition>
|
||||
<managedconnectionfactory-class>org.apache.activemq.ra.ActiveMQManagedConnectionFactory</managedconnectionfactory-class>
|
||||
<connectionfactory-interface>javax.jms.ConnectionFactory</connectionfactory-interface>
|
||||
<connectionfactory-impl-class>org.apache.activemq.ra.ActiveMQConnectionFactory</connectionfactory-impl-class>
|
||||
<connection-interface>javax.jms.Connection</connection-interface>
|
||||
<connection-impl-class>org.apache.activemq.ra.ManagedConnectionProxy</connection-impl-class>
|
||||
</connection-definition>
|
||||
<connection-definition>
|
||||
<managedconnectionfactory-class>org.apache.activemq.ra.ActiveMQManagedConnectionFactory</managedconnectionfactory-class>
|
||||
<connectionfactory-interface>javax.jms.QueueConnectionFactory</connectionfactory-interface>
|
||||
<connectionfactory-impl-class>org.apache.activemq.ra.ActiveMQConnectionFactory</connectionfactory-impl-class>
|
||||
<connection-interface>javax.jms.QueueConnection</connection-interface>
|
||||
<connection-impl-class>org.apache.activemq.ra.ManagedConnectionProxy</connection-impl-class>
|
||||
</connection-definition>
|
||||
<connection-definition>
|
||||
<managedconnectionfactory-class>org.apache.activemq.ra.ActiveMQManagedConnectionFactory</managedconnectionfactory-class>
|
||||
<connectionfactory-interface>javax.jms.TopicConnectionFactory</connectionfactory-interface>
|
||||
<connectionfactory-impl-class>org.apache.activemq.ra.ActiveMQConnectionFactory</connectionfactory-impl-class>
|
||||
<connection-interface>javax.jms.TopicConnection</connection-interface>
|
||||
<connection-impl-class>org.apache.activemq.ra.ManagedConnectionProxy</connection-impl-class>
|
||||
</connection-definition>
|
||||
<transaction-support>XATransaction</transaction-support>
|
||||
<authentication-mechanism>
|
||||
<authentication-mechanism-type>BasicPassword</authentication-mechanism-type>
|
||||
<credential-interface>javax.resource.spi.security.PasswordCredential</credential-interface>
|
||||
</authentication-mechanism>
|
||||
<reauthentication-support>false</reauthentication-support>
|
||||
</outbound-resourceadapter>
|
||||
<inbound-resourceadapter>
|
||||
<messageadapter>
|
||||
<messagelistener>
|
||||
<messagelistener-type>javax.jms.MessageListener</messagelistener-type>
|
||||
<activationspec>
|
||||
<activationspec-class>org.apache.activemq.ra.ActiveMQActivationSpec</activationspec-class>
|
||||
|
||||
<required-config-property>
|
||||
<config-property-name>destination</config-property-name>
|
||||
</required-config-property>
|
||||
<required-config-property>
|
||||
<config-property-name>destinationType</config-property-name>
|
||||
</required-config-property>
|
||||
|
||||
</activationspec>
|
||||
</messagelistener>
|
||||
</messageadapter>
|
||||
</inbound-resourceadapter>
|
||||
<adminobject>
|
||||
<adminobject-interface>javax.jms.Queue</adminobject-interface>
|
||||
<adminobject-class>org.apache.activemq.command.ActiveMQQueue</adminobject-class>
|
||||
<config-property>
|
||||
<config-property-name>PhysicalName</config-property-name>
|
||||
<config-property-type>java.lang.String</config-property-type>
|
||||
</config-property>
|
||||
</adminobject>
|
||||
<adminobject>
|
||||
<adminobject-interface>javax.jms.Topic</adminobject-interface>
|
||||
<adminobject-class>org.apache.activemq.command.ActiveMQTopic</adminobject-class>
|
||||
<config-property>
|
||||
<config-property-name>PhysicalName</config-property-name>
|
||||
<config-property-type>java.lang.String</config-property-type>
|
||||
</config-property>
|
||||
</adminobject>
|
||||
</resourceadapter>
|
||||
</connector>
|
||||
|
|
|
@ -1,63 +1,63 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright 2005-2006 The Apache Software Foundation
|
||||
|
||||
Licensed 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.
|
||||
-->
|
||||
<!-- START SNIPPET: xbean -->
|
||||
<beans xmlns="http://activemq.org/config/1.0">
|
||||
|
||||
<broker useJmx="true">
|
||||
|
||||
<!-- In ActiveMQ 4, you can setup destination policies. note: this xml format may still change a bit -->
|
||||
<destinationPolicy>
|
||||
<policyMap><policyEntries>
|
||||
|
||||
<policyEntry topic="FOO.>">
|
||||
<dispatchPolicy>
|
||||
<strictOrderDispatchPolicy />
|
||||
</dispatchPolicy>
|
||||
<subscriptionRecoveryPolicy>
|
||||
<lastImageSubscriptionRecoveryPolicy />
|
||||
</subscriptionRecoveryPolicy>
|
||||
</policyEntry>
|
||||
|
||||
</policyEntries></policyMap>
|
||||
</destinationPolicy>
|
||||
|
||||
|
||||
<persistenceAdapter>
|
||||
<journaledJDBC journalLogFiles="5" dataDirectory="../data"/>
|
||||
<!-- To use a different datasource, use th following syntax : -->
|
||||
<!--
|
||||
<journaledJDBC journalLogFiles="5" dataDirectory="../data" dataSource="#postgres-ds"/>
|
||||
-->
|
||||
</persistenceAdapter>
|
||||
|
||||
<transportConnectors>
|
||||
<!-- prefixing a connector with discovery: causes the connector to be advertiesed over rendezvous -->
|
||||
<transportConnector uri="tcp://localhost:61616" discoveryUri="multicast://default"/>
|
||||
</transportConnectors>
|
||||
|
||||
<networkConnectors>
|
||||
<!-- by default just auto discover the other brokers -->
|
||||
<networkConnector uri="multicast://default"/>
|
||||
<!--
|
||||
<networkConnector uri="static://(tcp://host1:61616,tcp://host2:61616)"/>
|
||||
-->
|
||||
</networkConnectors>
|
||||
|
||||
</broker>
|
||||
|
||||
|
||||
</beans>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright 2005-2006 The Apache Software Foundation
|
||||
|
||||
Licensed 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.
|
||||
-->
|
||||
<!-- START SNIPPET: xbean -->
|
||||
<beans xmlns="http://activemq.org/config/1.0">
|
||||
|
||||
<broker useJmx="true">
|
||||
|
||||
<!-- In ActiveMQ 4, you can setup destination policies. note: this xml format may still change a bit -->
|
||||
<destinationPolicy>
|
||||
<policyMap><policyEntries>
|
||||
|
||||
<policyEntry topic="FOO.>">
|
||||
<dispatchPolicy>
|
||||
<strictOrderDispatchPolicy />
|
||||
</dispatchPolicy>
|
||||
<subscriptionRecoveryPolicy>
|
||||
<lastImageSubscriptionRecoveryPolicy />
|
||||
</subscriptionRecoveryPolicy>
|
||||
</policyEntry>
|
||||
|
||||
</policyEntries></policyMap>
|
||||
</destinationPolicy>
|
||||
|
||||
|
||||
<persistenceAdapter>
|
||||
<journaledJDBC journalLogFiles="5" dataDirectory="../data"/>
|
||||
<!-- To use a different datasource, use th following syntax : -->
|
||||
<!--
|
||||
<journaledJDBC journalLogFiles="5" dataDirectory="../data" dataSource="#postgres-ds"/>
|
||||
-->
|
||||
</persistenceAdapter>
|
||||
|
||||
<transportConnectors>
|
||||
<!-- prefixing a connector with discovery: causes the connector to be advertiesed over rendezvous -->
|
||||
<transportConnector uri="tcp://localhost:61616" discoveryUri="multicast://default"/>
|
||||
</transportConnectors>
|
||||
|
||||
<networkConnectors>
|
||||
<!-- by default just auto discover the other brokers -->
|
||||
<networkConnector uri="multicast://default"/>
|
||||
<!--
|
||||
<networkConnector uri="static://(tcp://host1:61616,tcp://host2:61616)"/>
|
||||
-->
|
||||
</networkConnectors>
|
||||
|
||||
</broker>
|
||||
|
||||
|
||||
</beans>
|
||||
|
|
|
@ -1,31 +1,31 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright 2005-2006 The Apache Software Foundation
|
||||
|
||||
Licensed 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 default="default"
|
||||
xmlns:j="jelly:core"
|
||||
xmlns:u="jelly:util"
|
||||
xmlns:ant="jelly:ant"
|
||||
xmlns:util="jelly:util"
|
||||
xmlns:artifact="artifact"
|
||||
>
|
||||
|
||||
|
||||
<goal name="default" prereqs="jar:install"/>
|
||||
|
||||
<postGoal name="clean">
|
||||
<delete dir="${basedir}/activemq-data" />
|
||||
</postGoal>
|
||||
</project>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright 2005-2006 The Apache Software Foundation
|
||||
|
||||
Licensed 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 default="default"
|
||||
xmlns:j="jelly:core"
|
||||
xmlns:u="jelly:util"
|
||||
xmlns:ant="jelly:ant"
|
||||
xmlns:util="jelly:util"
|
||||
xmlns:artifact="artifact"
|
||||
>
|
||||
|
||||
|
||||
<goal name="default" prereqs="jar:install"/>
|
||||
|
||||
<postGoal name="clean">
|
||||
<delete dir="${basedir}/activemq-data" />
|
||||
</postGoal>
|
||||
</project>
|
||||
|
|
|
@ -1,117 +1,117 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE project>
|
||||
<!--
|
||||
Copyright 2005-2006 The Apache Software Foundation
|
||||
|
||||
Licensed 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>
|
||||
<pomVersion>3</pomVersion>
|
||||
<extend>${basedir}/../etc/project.xml</extend>
|
||||
<name>ActiveMQ :: SoakTest</name>
|
||||
<id>activemq</id>
|
||||
<shortDescription>ActiveMQ Assembly</shortDescription>
|
||||
<description>ActiveMQ Assembly creates an ActiveMQ distribution</description>
|
||||
|
||||
<!-- ============ -->
|
||||
<!-- Dependencies -->
|
||||
<!-- ============ -->
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>${pom.groupId}</groupId>
|
||||
<artifactId>activemq-core</artifactId>
|
||||
<version>${pom.currentVersion}</version>
|
||||
<properties>
|
||||
<activemq.module>true</activemq.module>
|
||||
<lib>true</lib>
|
||||
</properties>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>${pom.groupId}</groupId>
|
||||
<artifactId>activeio-core</artifactId>
|
||||
<version>${activeio_version}</version>
|
||||
<properties>
|
||||
<activemq.module>true</activemq.module>
|
||||
<lib>true</lib>
|
||||
</properties>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>${pom.groupId}</groupId>
|
||||
<artifactId>activemq-core-test</artifactId>
|
||||
<version>${pom.currentVersion}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
<!-- Derby DB used for testing JDBC message store -->
|
||||
<dependency>
|
||||
<groupId>org.apache.derby</groupId>
|
||||
<artifactId>derby</artifactId>
|
||||
<version>${derby_version}</version>
|
||||
<properties>
|
||||
<activemq.module>true</activemq.module>
|
||||
<optional>true</optional>
|
||||
</properties>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.derby</groupId>
|
||||
<artifactId>derbynet</artifactId>
|
||||
<version>${derbynet_version}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<nagEmailAddress>dev@activemq.codehaus.org</nagEmailAddress>
|
||||
<sourceDirectory>src/main/java</sourceDirectory>
|
||||
<unitTestSourceDirectory>src/test/java</unitTestSourceDirectory>
|
||||
|
||||
<integrationUnitTestSourceDirectory/>
|
||||
<aspectSourceDirectory/>
|
||||
|
||||
<unitTest>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/test/resources</directory>
|
||||
<includes>
|
||||
<include>**/*.properties</include>
|
||||
<include>**/*.xml</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
<includes>
|
||||
<include>**/*Test.*</include>
|
||||
</includes>
|
||||
<excludes>
|
||||
|
||||
|
||||
</excludes>
|
||||
</unitTest>
|
||||
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<includes>
|
||||
<include>**/*</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE project>
|
||||
<!--
|
||||
Copyright 2005-2006 The Apache Software Foundation
|
||||
|
||||
Licensed 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>
|
||||
<pomVersion>3</pomVersion>
|
||||
<extend>${basedir}/../etc/project.xml</extend>
|
||||
<name>ActiveMQ :: SoakTest</name>
|
||||
<id>activemq</id>
|
||||
<shortDescription>ActiveMQ Assembly</shortDescription>
|
||||
<description>ActiveMQ Assembly creates an ActiveMQ distribution</description>
|
||||
|
||||
<!-- ============ -->
|
||||
<!-- Dependencies -->
|
||||
<!-- ============ -->
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>${pom.groupId}</groupId>
|
||||
<artifactId>activemq-core</artifactId>
|
||||
<version>${pom.currentVersion}</version>
|
||||
<properties>
|
||||
<activemq.module>true</activemq.module>
|
||||
<lib>true</lib>
|
||||
</properties>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>${pom.groupId}</groupId>
|
||||
<artifactId>activeio-core</artifactId>
|
||||
<version>${activeio_version}</version>
|
||||
<properties>
|
||||
<activemq.module>true</activemq.module>
|
||||
<lib>true</lib>
|
||||
</properties>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>${pom.groupId}</groupId>
|
||||
<artifactId>activemq-core-test</artifactId>
|
||||
<version>${pom.currentVersion}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
<!-- Derby DB used for testing JDBC message store -->
|
||||
<dependency>
|
||||
<groupId>org.apache.derby</groupId>
|
||||
<artifactId>derby</artifactId>
|
||||
<version>${derby_version}</version>
|
||||
<properties>
|
||||
<activemq.module>true</activemq.module>
|
||||
<optional>true</optional>
|
||||
</properties>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.derby</groupId>
|
||||
<artifactId>derbynet</artifactId>
|
||||
<version>${derbynet_version}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<nagEmailAddress>dev@activemq.codehaus.org</nagEmailAddress>
|
||||
<sourceDirectory>src/main/java</sourceDirectory>
|
||||
<unitTestSourceDirectory>src/test/java</unitTestSourceDirectory>
|
||||
|
||||
<integrationUnitTestSourceDirectory/>
|
||||
<aspectSourceDirectory/>
|
||||
|
||||
<unitTest>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/test/resources</directory>
|
||||
<includes>
|
||||
<include>**/*.properties</include>
|
||||
<include>**/*.xml</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
<includes>
|
||||
<include>**/*Test.*</include>
|
||||
</includes>
|
||||
<excludes>
|
||||
|
||||
|
||||
</excludes>
|
||||
</unitTest>
|
||||
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<includes>
|
||||
<include>**/*</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
|
||||
|
|
|
@ -1,69 +1,69 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
Copyright 2005-2006 The Apache Software Foundation
|
||||
|
||||
Licensed 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
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0">
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>incubator-activemq</groupId>
|
||||
<artifactId>activemq-parent</artifactId>
|
||||
<version>4.0.2-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>maven-bundle-plugin</artifactId>
|
||||
<packaging>maven-plugin</packaging>
|
||||
<name>Bundle Plugin</name>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-project</artifactId>
|
||||
<version>2.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-archiver</artifactId>
|
||||
<version>1.0-alpha-5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-archiver</artifactId>
|
||||
<version>2.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-plugin-api</artifactId>
|
||||
<version>2.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-utils</artifactId>
|
||||
<version>1.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-artifact</artifactId>
|
||||
<version>2.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
Copyright 2005-2006 The Apache Software Foundation
|
||||
|
||||
Licensed 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
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0">
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>incubator-activemq</groupId>
|
||||
<artifactId>activemq-parent</artifactId>
|
||||
<version>4.0.2-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>maven-bundle-plugin</artifactId>
|
||||
<packaging>maven-plugin</packaging>
|
||||
<name>Bundle Plugin</name>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-project</artifactId>
|
||||
<version>2.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-archiver</artifactId>
|
||||
<version>1.0-alpha-5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-archiver</artifactId>
|
||||
<version>2.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-plugin-api</artifactId>
|
||||
<version>2.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-utils</artifactId>
|
||||
<version>1.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-artifact</artifactId>
|
||||
<version>2.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
|
@ -1,31 +1,31 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_AcknowledgementMode_hpp_
|
||||
#define ActiveMQ_AcknowledgementMode_hpp_
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
enum AcknowledgementMode {
|
||||
UnknownAckMode, AutoAckMode, ClientAckMode, TransactionalAckMode
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_AcknowledgementMode_hpp_*/
|
||||
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_AcknowledgementMode_hpp_
|
||||
#define ActiveMQ_AcknowledgementMode_hpp_
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
enum AcknowledgementMode {
|
||||
UnknownAckMode, AutoAckMode, ClientAckMode, TransactionalAckMode
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_AcknowledgementMode_hpp_*/
|
||||
|
||||
|
|
|
@ -1,48 +1,48 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#include "activemq/BrokerException.hpp"
|
||||
|
||||
using namespace apache::activemq;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
BrokerException::BrokerException(p<BrokerError> brokerError)
|
||||
{
|
||||
this->brokerError = brokerError ;
|
||||
|
||||
// Build exception message
|
||||
msg.assign( brokerError->getExceptionClass()->c_str() ) ;
|
||||
msg.append( " : " ) ;
|
||||
msg.append( brokerError->getMessage()->c_str() ) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<BrokerError> BrokerException::getBrokerError()
|
||||
{
|
||||
return brokerError ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<string> BrokerException::getJavaStackTrace()
|
||||
{
|
||||
return brokerError->getStackTrace() ;
|
||||
}
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#include "activemq/BrokerException.hpp"
|
||||
|
||||
using namespace apache::activemq;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
BrokerException::BrokerException(p<BrokerError> brokerError)
|
||||
{
|
||||
this->brokerError = brokerError ;
|
||||
|
||||
// Build exception message
|
||||
msg.assign( brokerError->getExceptionClass()->c_str() ) ;
|
||||
msg.append( " : " ) ;
|
||||
msg.append( brokerError->getMessage()->c_str() ) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<BrokerError> BrokerException::getBrokerError()
|
||||
{
|
||||
return brokerError ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<string> BrokerException::getJavaStackTrace()
|
||||
{
|
||||
return brokerError->getStackTrace() ;
|
||||
}
|
||||
|
|
|
@ -1,54 +1,54 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_BrokerException_hpp_
|
||||
#define ActiveMQ_BrokerException_hpp_
|
||||
|
||||
#include <string>
|
||||
#include "activemq/command/BrokerError.hpp"
|
||||
#include "cms/CmsException.hpp"
|
||||
#include "ppr/util/ifr/p"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
using namespace std;
|
||||
using namespace ifr;
|
||||
using namespace apache::cms;
|
||||
using namespace apache::activemq::command;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
class BrokerException : public CmsException
|
||||
{
|
||||
private:
|
||||
p<BrokerError> brokerError ;
|
||||
|
||||
public:
|
||||
BrokerException(p<BrokerError> brokerError) ;
|
||||
virtual ~BrokerException() throw() {}
|
||||
|
||||
virtual p<BrokerError> getBrokerError() ;
|
||||
virtual p<string> getJavaStackTrace() ;
|
||||
};
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_BrokerException_hpp_*/
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_BrokerException_hpp_
|
||||
#define ActiveMQ_BrokerException_hpp_
|
||||
|
||||
#include <string>
|
||||
#include "activemq/command/BrokerError.hpp"
|
||||
#include "cms/CmsException.hpp"
|
||||
#include "ppr/util/ifr/p"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
using namespace std;
|
||||
using namespace ifr;
|
||||
using namespace apache::cms;
|
||||
using namespace apache::activemq::command;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
class BrokerException : public CmsException
|
||||
{
|
||||
private:
|
||||
p<BrokerError> brokerError ;
|
||||
|
||||
public:
|
||||
BrokerException(p<BrokerError> brokerError) ;
|
||||
virtual ~BrokerException() throw() {}
|
||||
|
||||
virtual p<BrokerError> getBrokerError() ;
|
||||
virtual p<string> getJavaStackTrace() ;
|
||||
};
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_BrokerException_hpp_*/
|
||||
|
|
|
@ -1,382 +1,382 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#include "activemq/Connection.hpp"
|
||||
#include "activemq/Session.hpp"
|
||||
|
||||
using namespace apache::activemq;
|
||||
|
||||
|
||||
// --- Constructors -------------------------------------------------
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
Connection::Connection(p<ITransport> transport, p<ConnectionInfo> connectionInfo)
|
||||
{
|
||||
this->transport = transport ;
|
||||
this->connectionInfo = connectionInfo ;
|
||||
this->acknowledgementMode = AutoAckMode ;
|
||||
this->connected = false ;
|
||||
this->closed = false ;
|
||||
this->brokerInfo = NULL ;
|
||||
this->brokerWireFormat = NULL ;
|
||||
this->sessionCounter = 0 ;
|
||||
this->tempDestinationCounter = 0 ;
|
||||
this->localTransactionCounter = 0 ;
|
||||
|
||||
// Hook up as a command listener and start dispatching
|
||||
transport->setCommandListener(smartify(this)) ;
|
||||
transport->start() ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
Connection::~Connection()
|
||||
{
|
||||
// Make sure connection is closed
|
||||
close() ;
|
||||
}
|
||||
|
||||
|
||||
// --- Attribute methods --------------------------------------------
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void Connection::setExceptionListener(p<IExceptionListener> listener)
|
||||
{
|
||||
this->listener = listener ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<IExceptionListener> Connection::getExceptionListener()
|
||||
{
|
||||
return listener ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<ITransport> Connection::getTransport()
|
||||
{
|
||||
return transport ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void Connection::setTransport(p<ITransport> transport)
|
||||
{
|
||||
this->transport = transport ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<string> Connection::getClientId()
|
||||
{
|
||||
return connectionInfo->getClientId() ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void Connection::setClientId(const char* value) throw (CmsException)
|
||||
{
|
||||
if( connected )
|
||||
throw CmsException("You cannot change the client id once a connection is established") ;
|
||||
|
||||
p<string> clientId = new string(value) ;
|
||||
connectionInfo->setClientId( clientId ) ;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<BrokerInfo> Connection::getBrokerInfo()
|
||||
{
|
||||
return brokerInfo ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<WireFormatInfo> Connection::getBrokerWireFormat()
|
||||
{
|
||||
return brokerWireFormat ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
AcknowledgementMode Connection::getAcknowledgementMode()
|
||||
{
|
||||
return acknowledgementMode ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void Connection::setAcknowledgementMode(AcknowledgementMode ackMode)
|
||||
{
|
||||
acknowledgementMode = ackMode ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<ConnectionId> Connection::getConnectionId()
|
||||
{
|
||||
return connectionInfo->getConnectionId() ;
|
||||
}
|
||||
|
||||
|
||||
// --- Operation methods --------------------------------------------
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void Connection::close()
|
||||
{
|
||||
if( !closed )
|
||||
{
|
||||
list< p<ISession> >::iterator sessionIter ;
|
||||
|
||||
// Iterate through all sessions and close them down
|
||||
for( sessionIter = sessions.begin() ;
|
||||
sessionIter != sessions.end() ;
|
||||
sessionIter++ )
|
||||
{
|
||||
(*sessionIter)->close() ;
|
||||
}
|
||||
// Empty session list
|
||||
sessions.clear() ;
|
||||
|
||||
// Remove connection from broker
|
||||
disposeOf( getConnectionId() ) ;
|
||||
|
||||
// Finally, transmit a shutdown command to broker
|
||||
transport->oneway( new ShutdownInfo() ) ;
|
||||
closed = true ;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<ISession> Connection::createSession() throw(CmsException)
|
||||
{
|
||||
return createSession(acknowledgementMode) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<ISession> Connection::createSession(AcknowledgementMode ackMode) throw(CmsException)
|
||||
{
|
||||
p<SessionInfo> sessionInfo = createSessionInfo( ackMode ) ;
|
||||
|
||||
// Send session info to broker
|
||||
syncRequest(sessionInfo) ;
|
||||
|
||||
p<ISession> session = new Session(smartify(this), sessionInfo, ackMode) ;
|
||||
sessions.push_back(session) ;
|
||||
|
||||
return session ;
|
||||
}
|
||||
|
||||
/*
|
||||
* Performs a synchronous request-response with the broker.
|
||||
*/
|
||||
p<Response> Connection::syncRequest(p<ICommand> command) throw(CmsException)
|
||||
{
|
||||
checkConnected() ;
|
||||
|
||||
p<Response> response = transport->request(command) ;
|
||||
|
||||
if( response->getDataStructureType() == ExceptionResponse::TYPE )
|
||||
{
|
||||
p<ExceptionResponse> exceptionResponse = p_cast<ExceptionResponse> (response) ;
|
||||
p<BrokerError> brokerError = exceptionResponse->getException() ;
|
||||
string message ;
|
||||
|
||||
// Build error message
|
||||
message.assign("Request failed: ") ;
|
||||
message.append( brokerError->getExceptionClass()->c_str() ) ;
|
||||
message.append(", ") ;
|
||||
message.append( brokerError->getStackTrace()->c_str() ) ;
|
||||
|
||||
// TODO: Change to CMSException()
|
||||
throw CmsException( message.c_str() ) ;
|
||||
}
|
||||
return response ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void Connection::oneway(p<ICommand> command) throw(CmsException)
|
||||
{
|
||||
checkConnected() ;
|
||||
transport->oneway(command) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void Connection::disposeOf(p<IDataStructure> dataStructure) throw(CmsException)
|
||||
{
|
||||
p<RemoveInfo> command = new RemoveInfo() ;
|
||||
command->setObjectId( dataStructure ) ;
|
||||
syncRequest(command) ;
|
||||
}
|
||||
|
||||
/*
|
||||
* Creates a new temporary destination name.
|
||||
*/
|
||||
p<string> Connection::createTemporaryDestinationName()
|
||||
{
|
||||
p<string> name = new string() ;
|
||||
char* buffer = new char[15] ;
|
||||
|
||||
{
|
||||
LOCKED_SCOPE( mutex );
|
||||
|
||||
name->assign( connectionInfo->getConnectionId()->getValue()->c_str() ) ;
|
||||
name->append( ":" ) ;
|
||||
#ifdef unix
|
||||
sprintf(buffer, "%lld", ++tempDestinationCounter) ;
|
||||
#else
|
||||
sprintf(buffer, "%I64d", ++tempDestinationCounter) ;
|
||||
#endif
|
||||
name->append( buffer ) ;
|
||||
}
|
||||
|
||||
return name ;
|
||||
}
|
||||
|
||||
/*
|
||||
* Creates a new local transaction ID.
|
||||
*/
|
||||
p<LocalTransactionId> Connection::createLocalTransactionId()
|
||||
{
|
||||
p<LocalTransactionId> id = new LocalTransactionId() ;
|
||||
|
||||
id->setConnectionId( getConnectionId() ) ;
|
||||
|
||||
{
|
||||
LOCKED_SCOPE (mutex);
|
||||
id->setValue( ++localTransactionCounter ) ;
|
||||
}
|
||||
|
||||
return id ;
|
||||
}
|
||||
|
||||
|
||||
// --- Implementation methods ---------------------------------------
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<SessionInfo> Connection::createSessionInfo(AcknowledgementMode ackMode)
|
||||
{
|
||||
p<SessionInfo> sessionInfo = new SessionInfo() ;
|
||||
p<SessionId> sessionId = new SessionId() ;
|
||||
|
||||
sessionId->setConnectionId ( connectionInfo->getConnectionId()->getValue() ) ;
|
||||
|
||||
{
|
||||
LOCKED_SCOPE( mutex );
|
||||
sessionId->setValue( ++sessionCounter ) ;
|
||||
}
|
||||
|
||||
sessionInfo->setSessionId( sessionId ) ;
|
||||
return sessionInfo ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void Connection::checkConnected() throw(CmsException)
|
||||
{
|
||||
if( closed )
|
||||
throw ConnectionClosedException("Oops! Connection already closed.") ;
|
||||
|
||||
if( !connected )
|
||||
{
|
||||
connected = true ;
|
||||
|
||||
// Send the connection info and see if we get an ack/nak
|
||||
syncRequest( connectionInfo ) ;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Handle incoming commands.
|
||||
*/
|
||||
void Connection::onCommand(p<ITransport> transport, p<ICommand> command)
|
||||
{
|
||||
if( command->getDataStructureType() == MessageDispatch::TYPE )
|
||||
{
|
||||
p<MessageDispatch> dispatch = p_cast<MessageDispatch> (command) ;
|
||||
p<ConsumerId> consumerId = dispatch->getConsumerId() ;
|
||||
p<MessageConsumer> consumer = NULL ;
|
||||
list< p<ISession> >::const_iterator tempIter ;
|
||||
|
||||
// Iterate through all sessions and check if one has the consumer
|
||||
for( tempIter = sessions.begin() ;
|
||||
tempIter != sessions.end() ;
|
||||
tempIter++ )
|
||||
{
|
||||
consumer = p_cast<Session> (*tempIter)->getConsumer(consumerId) ;
|
||||
|
||||
// Found a match?
|
||||
if( consumer != NULL )
|
||||
break ;
|
||||
}
|
||||
if( consumer == NULL )
|
||||
cout << "ERROR: No such consumer active: " << consumerId->getValue() << endl ;
|
||||
else
|
||||
{
|
||||
p<ActiveMQMessage> message = p_cast<ActiveMQMessage> (dispatch->getMessage()) ;
|
||||
consumer->dispatch(message) ;
|
||||
}
|
||||
}
|
||||
else if( command->getDataStructureType() == WireFormatInfo::TYPE )
|
||||
this->brokerWireFormat = p_cast<WireFormatInfo> (command) ;
|
||||
|
||||
else if( command->getDataStructureType() == BrokerInfo::TYPE )
|
||||
this->brokerInfo = p_cast<BrokerInfo> (command) ;
|
||||
|
||||
else
|
||||
cout << "ERROR: Unknown command: " << command->getDataStructureType() << endl ;
|
||||
}
|
||||
|
||||
/*
|
||||
* Handle incoming broker errors.
|
||||
*/
|
||||
void Connection::onError(p<ITransport> transport, exception& error)
|
||||
{
|
||||
if( listener != NULL )
|
||||
this->listener->onException(error) ;
|
||||
else
|
||||
cout << "ERROR: Received a broker exception: " << error.what() << endl ;
|
||||
}
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#include "activemq/Connection.hpp"
|
||||
#include "activemq/Session.hpp"
|
||||
|
||||
using namespace apache::activemq;
|
||||
|
||||
|
||||
// --- Constructors -------------------------------------------------
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
Connection::Connection(p<ITransport> transport, p<ConnectionInfo> connectionInfo)
|
||||
{
|
||||
this->transport = transport ;
|
||||
this->connectionInfo = connectionInfo ;
|
||||
this->acknowledgementMode = AutoAckMode ;
|
||||
this->connected = false ;
|
||||
this->closed = false ;
|
||||
this->brokerInfo = NULL ;
|
||||
this->brokerWireFormat = NULL ;
|
||||
this->sessionCounter = 0 ;
|
||||
this->tempDestinationCounter = 0 ;
|
||||
this->localTransactionCounter = 0 ;
|
||||
|
||||
// Hook up as a command listener and start dispatching
|
||||
transport->setCommandListener(smartify(this)) ;
|
||||
transport->start() ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
Connection::~Connection()
|
||||
{
|
||||
// Make sure connection is closed
|
||||
close() ;
|
||||
}
|
||||
|
||||
|
||||
// --- Attribute methods --------------------------------------------
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void Connection::setExceptionListener(p<IExceptionListener> listener)
|
||||
{
|
||||
this->listener = listener ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<IExceptionListener> Connection::getExceptionListener()
|
||||
{
|
||||
return listener ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<ITransport> Connection::getTransport()
|
||||
{
|
||||
return transport ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void Connection::setTransport(p<ITransport> transport)
|
||||
{
|
||||
this->transport = transport ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<string> Connection::getClientId()
|
||||
{
|
||||
return connectionInfo->getClientId() ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void Connection::setClientId(const char* value) throw (CmsException)
|
||||
{
|
||||
if( connected )
|
||||
throw CmsException("You cannot change the client id once a connection is established") ;
|
||||
|
||||
p<string> clientId = new string(value) ;
|
||||
connectionInfo->setClientId( clientId ) ;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<BrokerInfo> Connection::getBrokerInfo()
|
||||
{
|
||||
return brokerInfo ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<WireFormatInfo> Connection::getBrokerWireFormat()
|
||||
{
|
||||
return brokerWireFormat ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
AcknowledgementMode Connection::getAcknowledgementMode()
|
||||
{
|
||||
return acknowledgementMode ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void Connection::setAcknowledgementMode(AcknowledgementMode ackMode)
|
||||
{
|
||||
acknowledgementMode = ackMode ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<ConnectionId> Connection::getConnectionId()
|
||||
{
|
||||
return connectionInfo->getConnectionId() ;
|
||||
}
|
||||
|
||||
|
||||
// --- Operation methods --------------------------------------------
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void Connection::close()
|
||||
{
|
||||
if( !closed )
|
||||
{
|
||||
list< p<ISession> >::iterator sessionIter ;
|
||||
|
||||
// Iterate through all sessions and close them down
|
||||
for( sessionIter = sessions.begin() ;
|
||||
sessionIter != sessions.end() ;
|
||||
sessionIter++ )
|
||||
{
|
||||
(*sessionIter)->close() ;
|
||||
}
|
||||
// Empty session list
|
||||
sessions.clear() ;
|
||||
|
||||
// Remove connection from broker
|
||||
disposeOf( getConnectionId() ) ;
|
||||
|
||||
// Finally, transmit a shutdown command to broker
|
||||
transport->oneway( new ShutdownInfo() ) ;
|
||||
closed = true ;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<ISession> Connection::createSession() throw(CmsException)
|
||||
{
|
||||
return createSession(acknowledgementMode) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<ISession> Connection::createSession(AcknowledgementMode ackMode) throw(CmsException)
|
||||
{
|
||||
p<SessionInfo> sessionInfo = createSessionInfo( ackMode ) ;
|
||||
|
||||
// Send session info to broker
|
||||
syncRequest(sessionInfo) ;
|
||||
|
||||
p<ISession> session = new Session(smartify(this), sessionInfo, ackMode) ;
|
||||
sessions.push_back(session) ;
|
||||
|
||||
return session ;
|
||||
}
|
||||
|
||||
/*
|
||||
* Performs a synchronous request-response with the broker.
|
||||
*/
|
||||
p<Response> Connection::syncRequest(p<ICommand> command) throw(CmsException)
|
||||
{
|
||||
checkConnected() ;
|
||||
|
||||
p<Response> response = transport->request(command) ;
|
||||
|
||||
if( response->getDataStructureType() == ExceptionResponse::TYPE )
|
||||
{
|
||||
p<ExceptionResponse> exceptionResponse = p_cast<ExceptionResponse> (response) ;
|
||||
p<BrokerError> brokerError = exceptionResponse->getException() ;
|
||||
string message ;
|
||||
|
||||
// Build error message
|
||||
message.assign("Request failed: ") ;
|
||||
message.append( brokerError->getExceptionClass()->c_str() ) ;
|
||||
message.append(", ") ;
|
||||
message.append( brokerError->getStackTrace()->c_str() ) ;
|
||||
|
||||
// TODO: Change to CMSException()
|
||||
throw CmsException( message.c_str() ) ;
|
||||
}
|
||||
return response ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void Connection::oneway(p<ICommand> command) throw(CmsException)
|
||||
{
|
||||
checkConnected() ;
|
||||
transport->oneway(command) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void Connection::disposeOf(p<IDataStructure> dataStructure) throw(CmsException)
|
||||
{
|
||||
p<RemoveInfo> command = new RemoveInfo() ;
|
||||
command->setObjectId( dataStructure ) ;
|
||||
syncRequest(command) ;
|
||||
}
|
||||
|
||||
/*
|
||||
* Creates a new temporary destination name.
|
||||
*/
|
||||
p<string> Connection::createTemporaryDestinationName()
|
||||
{
|
||||
p<string> name = new string() ;
|
||||
char* buffer = new char[15] ;
|
||||
|
||||
{
|
||||
LOCKED_SCOPE( mutex );
|
||||
|
||||
name->assign( connectionInfo->getConnectionId()->getValue()->c_str() ) ;
|
||||
name->append( ":" ) ;
|
||||
#ifdef unix
|
||||
sprintf(buffer, "%lld", ++tempDestinationCounter) ;
|
||||
#else
|
||||
sprintf(buffer, "%I64d", ++tempDestinationCounter) ;
|
||||
#endif
|
||||
name->append( buffer ) ;
|
||||
}
|
||||
|
||||
return name ;
|
||||
}
|
||||
|
||||
/*
|
||||
* Creates a new local transaction ID.
|
||||
*/
|
||||
p<LocalTransactionId> Connection::createLocalTransactionId()
|
||||
{
|
||||
p<LocalTransactionId> id = new LocalTransactionId() ;
|
||||
|
||||
id->setConnectionId( getConnectionId() ) ;
|
||||
|
||||
{
|
||||
LOCKED_SCOPE (mutex);
|
||||
id->setValue( ++localTransactionCounter ) ;
|
||||
}
|
||||
|
||||
return id ;
|
||||
}
|
||||
|
||||
|
||||
// --- Implementation methods ---------------------------------------
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<SessionInfo> Connection::createSessionInfo(AcknowledgementMode ackMode)
|
||||
{
|
||||
p<SessionInfo> sessionInfo = new SessionInfo() ;
|
||||
p<SessionId> sessionId = new SessionId() ;
|
||||
|
||||
sessionId->setConnectionId ( connectionInfo->getConnectionId()->getValue() ) ;
|
||||
|
||||
{
|
||||
LOCKED_SCOPE( mutex );
|
||||
sessionId->setValue( ++sessionCounter ) ;
|
||||
}
|
||||
|
||||
sessionInfo->setSessionId( sessionId ) ;
|
||||
return sessionInfo ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void Connection::checkConnected() throw(CmsException)
|
||||
{
|
||||
if( closed )
|
||||
throw ConnectionClosedException("Oops! Connection already closed.") ;
|
||||
|
||||
if( !connected )
|
||||
{
|
||||
connected = true ;
|
||||
|
||||
// Send the connection info and see if we get an ack/nak
|
||||
syncRequest( connectionInfo ) ;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Handle incoming commands.
|
||||
*/
|
||||
void Connection::onCommand(p<ITransport> transport, p<ICommand> command)
|
||||
{
|
||||
if( command->getDataStructureType() == MessageDispatch::TYPE )
|
||||
{
|
||||
p<MessageDispatch> dispatch = p_cast<MessageDispatch> (command) ;
|
||||
p<ConsumerId> consumerId = dispatch->getConsumerId() ;
|
||||
p<MessageConsumer> consumer = NULL ;
|
||||
list< p<ISession> >::const_iterator tempIter ;
|
||||
|
||||
// Iterate through all sessions and check if one has the consumer
|
||||
for( tempIter = sessions.begin() ;
|
||||
tempIter != sessions.end() ;
|
||||
tempIter++ )
|
||||
{
|
||||
consumer = p_cast<Session> (*tempIter)->getConsumer(consumerId) ;
|
||||
|
||||
// Found a match?
|
||||
if( consumer != NULL )
|
||||
break ;
|
||||
}
|
||||
if( consumer == NULL )
|
||||
cout << "ERROR: No such consumer active: " << consumerId->getValue() << endl ;
|
||||
else
|
||||
{
|
||||
p<ActiveMQMessage> message = p_cast<ActiveMQMessage> (dispatch->getMessage()) ;
|
||||
consumer->dispatch(message) ;
|
||||
}
|
||||
}
|
||||
else if( command->getDataStructureType() == WireFormatInfo::TYPE )
|
||||
this->brokerWireFormat = p_cast<WireFormatInfo> (command) ;
|
||||
|
||||
else if( command->getDataStructureType() == BrokerInfo::TYPE )
|
||||
this->brokerInfo = p_cast<BrokerInfo> (command) ;
|
||||
|
||||
else
|
||||
cout << "ERROR: Unknown command: " << command->getDataStructureType() << endl ;
|
||||
}
|
||||
|
||||
/*
|
||||
* Handle incoming broker errors.
|
||||
*/
|
||||
void Connection::onError(p<ITransport> transport, exception& error)
|
||||
{
|
||||
if( listener != NULL )
|
||||
this->listener->onException(error) ;
|
||||
else
|
||||
cout << "ERROR: Received a broker exception: " << error.what() << endl ;
|
||||
}
|
||||
|
|
|
@ -1,124 +1,124 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_Connection_hpp_
|
||||
#define ActiveMQ_Connection_hpp_
|
||||
|
||||
#include <iostream>
|
||||
#include <list>
|
||||
#include <string>
|
||||
#include <map>
|
||||
|
||||
#include "cms/ISession.hpp"
|
||||
#include "cms/IConnection.hpp"
|
||||
#include "cms/IExceptionListener.hpp"
|
||||
#include "cms/CmsException.hpp"
|
||||
#include "activemq/ConnectionClosedException.hpp"
|
||||
#include "activemq/MessageConsumer.hpp"
|
||||
#include "activemq/command/BrokerInfo.hpp"
|
||||
#include "activemq/command/WireFormatInfo.hpp"
|
||||
#include "activemq/command/ExceptionResponse.hpp"
|
||||
#include "activemq/command/ConnectionInfo.hpp"
|
||||
#include "activemq/command/LocalTransactionId.hpp"
|
||||
#include "activemq/command/MessageDispatch.hpp"
|
||||
#include "activemq/command/SessionInfo.hpp"
|
||||
#include "activemq/command/SessionId.hpp"
|
||||
#include "activemq/command/ShutdownInfo.hpp"
|
||||
#include "activemq/transport/ITransport.hpp"
|
||||
#include "activemq/transport/ICommandListener.hpp"
|
||||
#include "ppr/thread/SimpleMutex.hpp"
|
||||
#include "ppr/util/ifr/p"
|
||||
|
||||
// Turn off warning message for ignored exception specification
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning( disable : 4290 )
|
||||
#endif
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
using namespace std;
|
||||
using namespace ifr;
|
||||
using namespace apache::cms;
|
||||
using namespace apache::activemq::command;
|
||||
using namespace apache::activemq::transport;
|
||||
using namespace apache::ppr::thread;
|
||||
using namespace apache::ppr::util;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
class Connection : public IConnection, public ICommandListener
|
||||
{
|
||||
private:
|
||||
p<ConnectionInfo> connectionInfo ;
|
||||
p<ITransport> transport ;
|
||||
p<BrokerInfo> brokerInfo ; // from MQ broker
|
||||
p<WireFormatInfo> brokerWireFormat ; // from MQ broker
|
||||
p<IExceptionListener> listener ;
|
||||
list< p<ISession> > sessions ;
|
||||
bool connected,
|
||||
closed ;
|
||||
AcknowledgementMode acknowledgementMode ;
|
||||
long long sessionCounter,
|
||||
tempDestinationCounter,
|
||||
localTransactionCounter ;
|
||||
SimpleMutex mutex ;
|
||||
|
||||
public:
|
||||
// Constructors
|
||||
Connection(p<ITransport> transport, p<ConnectionInfo> connectionInfo) ;
|
||||
virtual ~Connection() ;
|
||||
|
||||
// Attribute methods
|
||||
virtual void setExceptionListener(p<IExceptionListener> listener) ;
|
||||
virtual p<IExceptionListener> getExceptionListener() ;
|
||||
virtual p<ITransport> getTransport() ;
|
||||
virtual void setTransport(p<ITransport> transport) ;
|
||||
virtual p<string> getClientId() ;
|
||||
virtual void setClientId(const char* value) throw (CmsException) ;
|
||||
virtual p<BrokerInfo> getBrokerInfo() ;
|
||||
virtual p<WireFormatInfo> getBrokerWireFormat() ;
|
||||
virtual AcknowledgementMode getAcknowledgementMode() ;
|
||||
virtual void setAcknowledgementMode(AcknowledgementMode mode) ;
|
||||
// virtual void addConsumer(p<ConsumerId> consumerId, p<MessageConsumer> messageConsumer) ;
|
||||
// virtual void removeConsumer(p<ConsumerId> consumerId) ;
|
||||
virtual p<ConnectionId> getConnectionId() ;
|
||||
|
||||
// Operation methods
|
||||
virtual p<ISession> createSession() throw(CmsException) ;
|
||||
virtual p<ISession> createSession(AcknowledgementMode mode) throw(CmsException) ;
|
||||
virtual p<Response> syncRequest(p<ICommand> command) throw(CmsException) ;
|
||||
virtual void oneway(p<ICommand> command) throw(CmsException) ;
|
||||
virtual void disposeOf(p<IDataStructure> dataStructure) throw(CmsException) ;
|
||||
virtual p<string> createTemporaryDestinationName() ;
|
||||
virtual p<LocalTransactionId> createLocalTransactionId() ;
|
||||
virtual void close() ;
|
||||
|
||||
protected:
|
||||
// Implementation methods
|
||||
p<SessionInfo> createSessionInfo(AcknowledgementMode mode) ;
|
||||
void checkConnected() throw(CmsException) ;
|
||||
void onCommand(p<ITransport> transport, p<ICommand> command) ;
|
||||
void onError(p<ITransport> transport, exception& error) ;
|
||||
} ;
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_Connection_hpp_*/
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_Connection_hpp_
|
||||
#define ActiveMQ_Connection_hpp_
|
||||
|
||||
#include <iostream>
|
||||
#include <list>
|
||||
#include <string>
|
||||
#include <map>
|
||||
|
||||
#include "cms/ISession.hpp"
|
||||
#include "cms/IConnection.hpp"
|
||||
#include "cms/IExceptionListener.hpp"
|
||||
#include "cms/CmsException.hpp"
|
||||
#include "activemq/ConnectionClosedException.hpp"
|
||||
#include "activemq/MessageConsumer.hpp"
|
||||
#include "activemq/command/BrokerInfo.hpp"
|
||||
#include "activemq/command/WireFormatInfo.hpp"
|
||||
#include "activemq/command/ExceptionResponse.hpp"
|
||||
#include "activemq/command/ConnectionInfo.hpp"
|
||||
#include "activemq/command/LocalTransactionId.hpp"
|
||||
#include "activemq/command/MessageDispatch.hpp"
|
||||
#include "activemq/command/SessionInfo.hpp"
|
||||
#include "activemq/command/SessionId.hpp"
|
||||
#include "activemq/command/ShutdownInfo.hpp"
|
||||
#include "activemq/transport/ITransport.hpp"
|
||||
#include "activemq/transport/ICommandListener.hpp"
|
||||
#include "ppr/thread/SimpleMutex.hpp"
|
||||
#include "ppr/util/ifr/p"
|
||||
|
||||
// Turn off warning message for ignored exception specification
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning( disable : 4290 )
|
||||
#endif
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
using namespace std;
|
||||
using namespace ifr;
|
||||
using namespace apache::cms;
|
||||
using namespace apache::activemq::command;
|
||||
using namespace apache::activemq::transport;
|
||||
using namespace apache::ppr::thread;
|
||||
using namespace apache::ppr::util;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
class Connection : public IConnection, public ICommandListener
|
||||
{
|
||||
private:
|
||||
p<ConnectionInfo> connectionInfo ;
|
||||
p<ITransport> transport ;
|
||||
p<BrokerInfo> brokerInfo ; // from MQ broker
|
||||
p<WireFormatInfo> brokerWireFormat ; // from MQ broker
|
||||
p<IExceptionListener> listener ;
|
||||
list< p<ISession> > sessions ;
|
||||
bool connected,
|
||||
closed ;
|
||||
AcknowledgementMode acknowledgementMode ;
|
||||
long long sessionCounter,
|
||||
tempDestinationCounter,
|
||||
localTransactionCounter ;
|
||||
SimpleMutex mutex ;
|
||||
|
||||
public:
|
||||
// Constructors
|
||||
Connection(p<ITransport> transport, p<ConnectionInfo> connectionInfo) ;
|
||||
virtual ~Connection() ;
|
||||
|
||||
// Attribute methods
|
||||
virtual void setExceptionListener(p<IExceptionListener> listener) ;
|
||||
virtual p<IExceptionListener> getExceptionListener() ;
|
||||
virtual p<ITransport> getTransport() ;
|
||||
virtual void setTransport(p<ITransport> transport) ;
|
||||
virtual p<string> getClientId() ;
|
||||
virtual void setClientId(const char* value) throw (CmsException) ;
|
||||
virtual p<BrokerInfo> getBrokerInfo() ;
|
||||
virtual p<WireFormatInfo> getBrokerWireFormat() ;
|
||||
virtual AcknowledgementMode getAcknowledgementMode() ;
|
||||
virtual void setAcknowledgementMode(AcknowledgementMode mode) ;
|
||||
// virtual void addConsumer(p<ConsumerId> consumerId, p<MessageConsumer> messageConsumer) ;
|
||||
// virtual void removeConsumer(p<ConsumerId> consumerId) ;
|
||||
virtual p<ConnectionId> getConnectionId() ;
|
||||
|
||||
// Operation methods
|
||||
virtual p<ISession> createSession() throw(CmsException) ;
|
||||
virtual p<ISession> createSession(AcknowledgementMode mode) throw(CmsException) ;
|
||||
virtual p<Response> syncRequest(p<ICommand> command) throw(CmsException) ;
|
||||
virtual void oneway(p<ICommand> command) throw(CmsException) ;
|
||||
virtual void disposeOf(p<IDataStructure> dataStructure) throw(CmsException) ;
|
||||
virtual p<string> createTemporaryDestinationName() ;
|
||||
virtual p<LocalTransactionId> createLocalTransactionId() ;
|
||||
virtual void close() ;
|
||||
|
||||
protected:
|
||||
// Implementation methods
|
||||
p<SessionInfo> createSessionInfo(AcknowledgementMode mode) ;
|
||||
void checkConnected() throw(CmsException) ;
|
||||
void onCommand(p<ITransport> transport, p<ICommand> command) ;
|
||||
void onError(p<ITransport> transport, exception& error) ;
|
||||
} ;
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_Connection_hpp_*/
|
||||
|
|
|
@ -1,29 +1,29 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#include "activemq/ConnectionClosedException.hpp"
|
||||
|
||||
using namespace apache::activemq;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
ConnectionClosedException::ConnectionClosedException(const char* message)
|
||||
: CmsException(message)
|
||||
{
|
||||
// no-op
|
||||
}
|
||||
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#include "activemq/ConnectionClosedException.hpp"
|
||||
|
||||
using namespace apache::activemq;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
ConnectionClosedException::ConnectionClosedException(const char* message)
|
||||
: CmsException(message)
|
||||
{
|
||||
// no-op
|
||||
}
|
||||
|
||||
|
|
|
@ -1,41 +1,41 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_ConnectionClosedException_hpp_
|
||||
#define ActiveMQ_ConnectionClosedException_hpp_
|
||||
|
||||
#include "cms/CmsException.hpp"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
using namespace apache::cms;
|
||||
|
||||
/*
|
||||
* Signals that a connection is being used when it is already closed.
|
||||
*/
|
||||
class ConnectionClosedException : public CmsException
|
||||
{
|
||||
public:
|
||||
ConnectionClosedException(const char* message) ;
|
||||
};
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_ConnectionClosedException_hpp_*/
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_ConnectionClosedException_hpp_
|
||||
#define ActiveMQ_ConnectionClosedException_hpp_
|
||||
|
||||
#include "cms/CmsException.hpp"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
using namespace apache::cms;
|
||||
|
||||
/*
|
||||
* Signals that a connection is being used when it is already closed.
|
||||
*/
|
||||
class ConnectionClosedException : public CmsException
|
||||
{
|
||||
public:
|
||||
ConnectionClosedException(const char* message) ;
|
||||
};
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_ConnectionClosedException_hpp_*/
|
||||
|
|
|
@ -1,47 +1,47 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_ConnectionException_hpp_
|
||||
#define ActiveMQ_ConnectionException_hpp_
|
||||
|
||||
#include "ppr/TraceException.hpp"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
using namespace std ;
|
||||
using namespace apache::ppr;
|
||||
|
||||
/*
|
||||
* Signals that a connection error has occured.
|
||||
*/
|
||||
class ConnectionException : public TraceException
|
||||
{
|
||||
public:
|
||||
ConnectionException() : TraceException()
|
||||
{ /* no-op */ } ;
|
||||
ConnectionException(const char *const& msg) : TraceException(msg)
|
||||
{ /* no-op */ } ;
|
||||
ConnectionException(const char* fileName, int lineNo, const char* msg) : TraceException(msg)
|
||||
{ /* no-op */ } ;
|
||||
} ;
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_ConnectionException_hpp_*/
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_ConnectionException_hpp_
|
||||
#define ActiveMQ_ConnectionException_hpp_
|
||||
|
||||
#include "ppr/TraceException.hpp"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
using namespace std ;
|
||||
using namespace apache::ppr;
|
||||
|
||||
/*
|
||||
* Signals that a connection error has occured.
|
||||
*/
|
||||
class ConnectionException : public TraceException
|
||||
{
|
||||
public:
|
||||
ConnectionException() : TraceException()
|
||||
{ /* no-op */ } ;
|
||||
ConnectionException(const char *const& msg) : TraceException(msg)
|
||||
{ /* no-op */ } ;
|
||||
ConnectionException(const char* fileName, int lineNo, const char* msg) : TraceException(msg)
|
||||
{ /* no-op */ } ;
|
||||
} ;
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_ConnectionException_hpp_*/
|
||||
|
|
|
@ -1,184 +1,184 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#include "activemq/ConnectionFactory.hpp"
|
||||
#include "activemq/Connection.hpp"
|
||||
#include "activemq/protocol/openwire/OpenWireProtocol.hpp"
|
||||
#include "activemq/transport/tcp/TcpTransport.hpp"
|
||||
|
||||
using namespace apache::activemq;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
ConnectionFactory::ConnectionFactory()
|
||||
{
|
||||
// Use default URI
|
||||
brokerUri = new Uri ("tcp://localhost:61616?wireFormat=openwire") ;
|
||||
username = NULL ;
|
||||
password = NULL ;
|
||||
clientId = Guid::getGuidString() ;
|
||||
transportFactory = new TransportFactory() ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
ConnectionFactory::ConnectionFactory(p<Uri> brokerUri)
|
||||
{
|
||||
this->brokerUri = brokerUri;
|
||||
username = NULL ;
|
||||
password = NULL ;
|
||||
clientId = Guid::getGuidString() ;
|
||||
transportFactory = new TransportFactory() ;
|
||||
}
|
||||
|
||||
|
||||
// --- Attribute methods --------------------------------------------
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<Uri> ConnectionFactory::getBrokerUri()
|
||||
{
|
||||
return brokerUri ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void ConnectionFactory::setBrokerUri(p<Uri> brokerUri)
|
||||
{
|
||||
this->brokerUri = brokerUri ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<string> ConnectionFactory::getUsername()
|
||||
{
|
||||
return username ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void ConnectionFactory::setUsername(const char* username)
|
||||
{
|
||||
this->username = new string(username) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<string> ConnectionFactory::getPassword()
|
||||
{
|
||||
return password ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void ConnectionFactory::setPassword(const char* password)
|
||||
{
|
||||
this->password = new string(password);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<string> ConnectionFactory::getClientId()
|
||||
{
|
||||
return clientId ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void ConnectionFactory::setClientId(const char* clientId)
|
||||
{
|
||||
this->clientId = new string(clientId) ;
|
||||
}
|
||||
|
||||
|
||||
// --- Operation methods --------------------------------------------
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<IConnection> ConnectionFactory::createConnection() throw (ConnectionException)
|
||||
{
|
||||
return createConnection( (username != NULL) ? username->c_str() : NULL,
|
||||
(password != NULL) ? password->c_str() : NULL ) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<IConnection> ConnectionFactory::createConnection(const char* username, const char* password) throw (ConnectionException)
|
||||
{
|
||||
p<ConnectionInfo> connectionInfo ;
|
||||
p<ITransport> transport ;
|
||||
p<Connection> connection ;
|
||||
|
||||
|
||||
// Set up a new connection object
|
||||
connectionInfo = createConnectionInfo(username, password) ;
|
||||
transport = createTransport() ;
|
||||
connection = new Connection(transport, connectionInfo) ;
|
||||
connection->setClientId( clientId->c_str() ) ;
|
||||
|
||||
return connection ;
|
||||
}
|
||||
|
||||
|
||||
// --- Implementation methods ---------------------------------------
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<ConnectionInfo> ConnectionFactory::createConnectionInfo(const char* username, const char* password)
|
||||
{
|
||||
p<ConnectionInfo> connectionInfo = new ConnectionInfo() ;
|
||||
p<ConnectionId> connectionId = new ConnectionId() ;
|
||||
p<string> uid = (username != NULL) ? new string(username) : NULL ;
|
||||
p<string> pwd = (password != NULL) ? new string(password) : NULL ;
|
||||
|
||||
connectionId->setValue( Guid::getGuidString() ) ;
|
||||
connectionInfo->setConnectionId( connectionId ) ;
|
||||
connectionInfo->setUserName( uid ) ;
|
||||
connectionInfo->setPassword( pwd ) ;
|
||||
connectionInfo->setClientId( clientId ) ;
|
||||
|
||||
return connectionInfo ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<ITransport> ConnectionFactory::createTransport() throw (ConnectionException)
|
||||
{
|
||||
try
|
||||
{
|
||||
// Create a transport for given URI
|
||||
return transportFactory->createTransport( brokerUri ) ;
|
||||
}
|
||||
catch( SocketException se )
|
||||
{
|
||||
throw ConnectionException(__FILE__, __LINE__, "Failed to connect socket") ;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#include "activemq/ConnectionFactory.hpp"
|
||||
#include "activemq/Connection.hpp"
|
||||
#include "activemq/protocol/openwire/OpenWireProtocol.hpp"
|
||||
#include "activemq/transport/tcp/TcpTransport.hpp"
|
||||
|
||||
using namespace apache::activemq;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
ConnectionFactory::ConnectionFactory()
|
||||
{
|
||||
// Use default URI
|
||||
brokerUri = new Uri ("tcp://localhost:61616?wireFormat=openwire") ;
|
||||
username = NULL ;
|
||||
password = NULL ;
|
||||
clientId = Guid::getGuidString() ;
|
||||
transportFactory = new TransportFactory() ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
ConnectionFactory::ConnectionFactory(p<Uri> brokerUri)
|
||||
{
|
||||
this->brokerUri = brokerUri;
|
||||
username = NULL ;
|
||||
password = NULL ;
|
||||
clientId = Guid::getGuidString() ;
|
||||
transportFactory = new TransportFactory() ;
|
||||
}
|
||||
|
||||
|
||||
// --- Attribute methods --------------------------------------------
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<Uri> ConnectionFactory::getBrokerUri()
|
||||
{
|
||||
return brokerUri ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void ConnectionFactory::setBrokerUri(p<Uri> brokerUri)
|
||||
{
|
||||
this->brokerUri = brokerUri ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<string> ConnectionFactory::getUsername()
|
||||
{
|
||||
return username ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void ConnectionFactory::setUsername(const char* username)
|
||||
{
|
||||
this->username = new string(username) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<string> ConnectionFactory::getPassword()
|
||||
{
|
||||
return password ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void ConnectionFactory::setPassword(const char* password)
|
||||
{
|
||||
this->password = new string(password);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<string> ConnectionFactory::getClientId()
|
||||
{
|
||||
return clientId ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void ConnectionFactory::setClientId(const char* clientId)
|
||||
{
|
||||
this->clientId = new string(clientId) ;
|
||||
}
|
||||
|
||||
|
||||
// --- Operation methods --------------------------------------------
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<IConnection> ConnectionFactory::createConnection() throw (ConnectionException)
|
||||
{
|
||||
return createConnection( (username != NULL) ? username->c_str() : NULL,
|
||||
(password != NULL) ? password->c_str() : NULL ) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<IConnection> ConnectionFactory::createConnection(const char* username, const char* password) throw (ConnectionException)
|
||||
{
|
||||
p<ConnectionInfo> connectionInfo ;
|
||||
p<ITransport> transport ;
|
||||
p<Connection> connection ;
|
||||
|
||||
|
||||
// Set up a new connection object
|
||||
connectionInfo = createConnectionInfo(username, password) ;
|
||||
transport = createTransport() ;
|
||||
connection = new Connection(transport, connectionInfo) ;
|
||||
connection->setClientId( clientId->c_str() ) ;
|
||||
|
||||
return connection ;
|
||||
}
|
||||
|
||||
|
||||
// --- Implementation methods ---------------------------------------
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<ConnectionInfo> ConnectionFactory::createConnectionInfo(const char* username, const char* password)
|
||||
{
|
||||
p<ConnectionInfo> connectionInfo = new ConnectionInfo() ;
|
||||
p<ConnectionId> connectionId = new ConnectionId() ;
|
||||
p<string> uid = (username != NULL) ? new string(username) : NULL ;
|
||||
p<string> pwd = (password != NULL) ? new string(password) : NULL ;
|
||||
|
||||
connectionId->setValue( Guid::getGuidString() ) ;
|
||||
connectionInfo->setConnectionId( connectionId ) ;
|
||||
connectionInfo->setUserName( uid ) ;
|
||||
connectionInfo->setPassword( pwd ) ;
|
||||
connectionInfo->setClientId( clientId ) ;
|
||||
|
||||
return connectionInfo ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<ITransport> ConnectionFactory::createTransport() throw (ConnectionException)
|
||||
{
|
||||
try
|
||||
{
|
||||
// Create a transport for given URI
|
||||
return transportFactory->createTransport( brokerUri ) ;
|
||||
}
|
||||
catch( SocketException se )
|
||||
{
|
||||
throw ConnectionException(__FILE__, __LINE__, "Failed to connect socket") ;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,88 +1,88 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_ConnectionFactory_hpp_
|
||||
#define ActiveMQ_ConnectionFactory_hpp_
|
||||
|
||||
// Must be included before any STL includes
|
||||
#include "ppr/util/Guid.hpp"
|
||||
|
||||
#include <string>
|
||||
#include "cms/IConnection.hpp"
|
||||
#include "cms/IConnectionFactory.hpp"
|
||||
#include "activemq/ConnectionException.hpp"
|
||||
#include "activemq/command/ConnectionInfo.hpp"
|
||||
#include "activemq/command/ConnectionId.hpp"
|
||||
#include "activemq/protocol/IProtocol.hpp"
|
||||
#include "activemq/transport/ITransport.hpp"
|
||||
#include "activemq/transport/ITransportFactory.hpp"
|
||||
#include "activemq/transport/TransportFactory.hpp"
|
||||
#include "ppr/net/Uri.hpp"
|
||||
#include "ppr/util/ifr/p"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
using namespace apache::activemq::command;
|
||||
using namespace apache::activemq::protocol;
|
||||
using namespace apache::activemq::transport;
|
||||
using namespace apache::ppr::net;
|
||||
using namespace ifr;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
class ConnectionFactory : public IConnectionFactory
|
||||
{
|
||||
private:
|
||||
p<Uri> brokerUri ;
|
||||
p<string> username ;
|
||||
p<string> password ;
|
||||
p<string> clientId ;
|
||||
p<IProtocol> protocol ;
|
||||
p<ITransportFactory> transportFactory ;
|
||||
|
||||
public:
|
||||
// Constructors
|
||||
ConnectionFactory() ;
|
||||
ConnectionFactory(p<Uri> uri) ;
|
||||
|
||||
// Attribute methods
|
||||
virtual p<Uri> getBrokerUri() ;
|
||||
virtual void setBrokerUri(p<Uri> brokerUri) ;
|
||||
virtual p<string> getUsername() ;
|
||||
virtual void setUsername(const char* username) ;
|
||||
virtual p<string> getPassword() ;
|
||||
virtual void setPassword(const char* password) ;
|
||||
virtual p<string> getClientId() ;
|
||||
virtual void setClientId(const char* clientId) ;
|
||||
|
||||
// Operation methods
|
||||
virtual p<IConnection> createConnection() throw (ConnectionException) ;
|
||||
virtual p<IConnection> createConnection(const char* username, const char* password) throw (ConnectionException) ;
|
||||
|
||||
protected:
|
||||
// Implementation methods
|
||||
virtual p<ConnectionInfo> createConnectionInfo(const char* username, const char* password) ;
|
||||
virtual p<ITransport> createTransport() throw (ConnectionException) ;
|
||||
} ;
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_ConnectionFactory_hpp_*/
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_ConnectionFactory_hpp_
|
||||
#define ActiveMQ_ConnectionFactory_hpp_
|
||||
|
||||
// Must be included before any STL includes
|
||||
#include "ppr/util/Guid.hpp"
|
||||
|
||||
#include <string>
|
||||
#include "cms/IConnection.hpp"
|
||||
#include "cms/IConnectionFactory.hpp"
|
||||
#include "activemq/ConnectionException.hpp"
|
||||
#include "activemq/command/ConnectionInfo.hpp"
|
||||
#include "activemq/command/ConnectionId.hpp"
|
||||
#include "activemq/protocol/IProtocol.hpp"
|
||||
#include "activemq/transport/ITransport.hpp"
|
||||
#include "activemq/transport/ITransportFactory.hpp"
|
||||
#include "activemq/transport/TransportFactory.hpp"
|
||||
#include "ppr/net/Uri.hpp"
|
||||
#include "ppr/util/ifr/p"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
using namespace apache::activemq::command;
|
||||
using namespace apache::activemq::protocol;
|
||||
using namespace apache::activemq::transport;
|
||||
using namespace apache::ppr::net;
|
||||
using namespace ifr;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
class ConnectionFactory : public IConnectionFactory
|
||||
{
|
||||
private:
|
||||
p<Uri> brokerUri ;
|
||||
p<string> username ;
|
||||
p<string> password ;
|
||||
p<string> clientId ;
|
||||
p<IProtocol> protocol ;
|
||||
p<ITransportFactory> transportFactory ;
|
||||
|
||||
public:
|
||||
// Constructors
|
||||
ConnectionFactory() ;
|
||||
ConnectionFactory(p<Uri> uri) ;
|
||||
|
||||
// Attribute methods
|
||||
virtual p<Uri> getBrokerUri() ;
|
||||
virtual void setBrokerUri(p<Uri> brokerUri) ;
|
||||
virtual p<string> getUsername() ;
|
||||
virtual void setUsername(const char* username) ;
|
||||
virtual p<string> getPassword() ;
|
||||
virtual void setPassword(const char* password) ;
|
||||
virtual p<string> getClientId() ;
|
||||
virtual void setClientId(const char* clientId) ;
|
||||
|
||||
// Operation methods
|
||||
virtual p<IConnection> createConnection() throw (ConnectionException) ;
|
||||
virtual p<IConnection> createConnection(const char* username, const char* password) throw (ConnectionException) ;
|
||||
|
||||
protected:
|
||||
// Implementation methods
|
||||
virtual p<ConnectionInfo> createConnectionInfo(const char* username, const char* password) ;
|
||||
virtual p<ITransport> createTransport() throw (ConnectionException) ;
|
||||
} ;
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_ConnectionFactory_hpp_*/
|
||||
|
|
|
@ -1,29 +1,29 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#include "activemq/ConsumerClosedException.hpp"
|
||||
|
||||
using namespace apache::activemq;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
ConsumerClosedException::ConsumerClosedException(const char* message)
|
||||
: CmsException(message)
|
||||
{
|
||||
// no-op
|
||||
}
|
||||
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#include "activemq/ConsumerClosedException.hpp"
|
||||
|
||||
using namespace apache::activemq;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
ConsumerClosedException::ConsumerClosedException(const char* message)
|
||||
: CmsException(message)
|
||||
{
|
||||
// no-op
|
||||
}
|
||||
|
||||
|
|
|
@ -1,41 +1,41 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_ConsumerClosedException_hpp_
|
||||
#define ActiveMQ_ConsumerClosedException_hpp_
|
||||
|
||||
#include "cms/CmsException.hpp"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
using namespace apache::cms;
|
||||
|
||||
/*
|
||||
* Signals that a consumer is being used when it is already closed.
|
||||
*/
|
||||
class ConsumerClosedException : public CmsException
|
||||
{
|
||||
public:
|
||||
ConsumerClosedException(const char* message) ;
|
||||
};
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_ConsumerClosedException_hpp_*/
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_ConsumerClosedException_hpp_
|
||||
#define ActiveMQ_ConsumerClosedException_hpp_
|
||||
|
||||
#include "cms/CmsException.hpp"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
using namespace apache::cms;
|
||||
|
||||
/*
|
||||
* Signals that a consumer is being used when it is already closed.
|
||||
*/
|
||||
class ConsumerClosedException : public CmsException
|
||||
{
|
||||
public:
|
||||
ConsumerClosedException(const char* message) ;
|
||||
};
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_ConsumerClosedException_hpp_*/
|
||||
|
|
|
@ -1,47 +1,47 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#include "activemq/DestinationFilter.hpp"
|
||||
|
||||
using namespace apache::activemq;
|
||||
|
||||
// Init static constants
|
||||
const char* DestinationFilter::ANY_DESCENDENT = ">" ;
|
||||
const char* DestinationFilter::ANY_CHILD = "*" ;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
DestinationFilter::DestinationFilter()
|
||||
{
|
||||
// no-op
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
DestinationFilter::~DestinationFilter()
|
||||
{
|
||||
// no-op
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
bool DestinationFilter::matches(p<ActiveMQMessage> message)
|
||||
{
|
||||
return matches( message->getDestination() ) ;
|
||||
}
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#include "activemq/DestinationFilter.hpp"
|
||||
|
||||
using namespace apache::activemq;
|
||||
|
||||
// Init static constants
|
||||
const char* DestinationFilter::ANY_DESCENDENT = ">" ;
|
||||
const char* DestinationFilter::ANY_CHILD = "*" ;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
DestinationFilter::DestinationFilter()
|
||||
{
|
||||
// no-op
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
DestinationFilter::~DestinationFilter()
|
||||
{
|
||||
// no-op
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
bool DestinationFilter::matches(p<ActiveMQMessage> message)
|
||||
{
|
||||
return matches( message->getDestination() ) ;
|
||||
}
|
||||
|
|
|
@ -1,52 +1,52 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_DestinationFilter_hpp_
|
||||
#define ActiveMQ_DestinationFilter_hpp_
|
||||
|
||||
#include "activemq/command/ActiveMQMessage.hpp"
|
||||
#include "activemq/command/ActiveMQDestination.hpp"
|
||||
#include "ppr/util/ifr/p"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
using namespace ifr;
|
||||
using namespace apache::activemq::command;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
class DestinationFilter
|
||||
{
|
||||
public:
|
||||
const static char* ANY_DESCENDENT ;
|
||||
const static char* ANY_CHILD ;
|
||||
|
||||
public:
|
||||
DestinationFilter() ;
|
||||
virtual ~DestinationFilter() ;
|
||||
|
||||
virtual bool matches(p<ActiveMQMessage> message) ;
|
||||
virtual bool matches(p<ActiveMQDestination> destination) = 0 ;
|
||||
};
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_DestinationFilter_hpp_*/
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_DestinationFilter_hpp_
|
||||
#define ActiveMQ_DestinationFilter_hpp_
|
||||
|
||||
#include "activemq/command/ActiveMQMessage.hpp"
|
||||
#include "activemq/command/ActiveMQDestination.hpp"
|
||||
#include "ppr/util/ifr/p"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
using namespace ifr;
|
||||
using namespace apache::activemq::command;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
class DestinationFilter
|
||||
{
|
||||
public:
|
||||
const static char* ANY_DESCENDENT ;
|
||||
const static char* ANY_CHILD ;
|
||||
|
||||
public:
|
||||
DestinationFilter() ;
|
||||
virtual ~DestinationFilter() ;
|
||||
|
||||
virtual bool matches(p<ActiveMQMessage> message) ;
|
||||
virtual bool matches(p<ActiveMQDestination> destination) = 0 ;
|
||||
};
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_DestinationFilter_hpp_*/
|
||||
|
|
|
@ -1,140 +1,140 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#include "activemq/Dispatcher.hpp"
|
||||
|
||||
using namespace apache::activemq;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
Dispatcher::Dispatcher()
|
||||
{
|
||||
dispatchQueue = new queue< p<IMessage> > ;
|
||||
redeliverList = new list< p<IMessage> > ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void Dispatcher::redeliverRolledBackMessages()
|
||||
{
|
||||
LOCKED_SCOPE (mutex);
|
||||
|
||||
p<queue< p<IMessage> > > replacementQueue = new queue< p<IMessage> > ;
|
||||
//(dispatchQueue->size() + redeliverList->size() ) ;
|
||||
|
||||
// Copy all messages to be redelivered to the new queue
|
||||
while( !redeliverList->empty() )
|
||||
{
|
||||
replacementQueue->push( redeliverList->front() ) ;
|
||||
redeliverList->pop_front() ;
|
||||
}
|
||||
|
||||
// Copy all messages to be dispatched to the new queue
|
||||
while( dispatchQueue->size() > 0 )
|
||||
{
|
||||
// Get first element in queue
|
||||
p<IMessage> element = p_cast<IMessage> (dispatchQueue->front()) ;
|
||||
|
||||
// Remove first element from queue
|
||||
dispatchQueue->pop() ;
|
||||
|
||||
// Add element to the new queue
|
||||
replacementQueue->push(element) ;
|
||||
}
|
||||
// Switch to the new queue
|
||||
dispatchQueue = replacementQueue ;
|
||||
|
||||
semaphore.notify() ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void Dispatcher::redeliver(p<IMessage> message)
|
||||
{
|
||||
LOCKED_SCOPE (mutex);
|
||||
redeliverList->push_back(message) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void Dispatcher::enqueue(p<IMessage> message)
|
||||
{
|
||||
LOCKED_SCOPE (mutex);
|
||||
dispatchQueue->push(message) ;
|
||||
semaphore.notify() ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<IMessage> Dispatcher::dequeueNoWait()
|
||||
{
|
||||
p<IMessage> msg = NULL ;
|
||||
|
||||
{
|
||||
LOCKED_SCOPE (mutex);
|
||||
|
||||
if( dispatchQueue->size() > 0 )
|
||||
{
|
||||
msg = p_cast<IMessage> (dispatchQueue->front()) ;
|
||||
dispatchQueue->pop() ;
|
||||
}
|
||||
}
|
||||
return msg ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<IMessage> Dispatcher::dequeue(int timeout)
|
||||
{
|
||||
p<IMessage> msg = NULL ;
|
||||
|
||||
{
|
||||
LOCKED_SCOPE (mutex);
|
||||
|
||||
if( dispatchQueue->size() == 0 )
|
||||
semaphore.wait(timeout) ;
|
||||
|
||||
if( dispatchQueue->size() > 0 )
|
||||
{
|
||||
msg = p_cast<IMessage> (dispatchQueue->front()) ;
|
||||
dispatchQueue->pop() ;
|
||||
}
|
||||
}
|
||||
return msg ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<IMessage> Dispatcher::dequeue()
|
||||
{
|
||||
p<IMessage> msg = NULL ;
|
||||
|
||||
{
|
||||
LOCKED_SCOPE (mutex);
|
||||
|
||||
msg = p_cast<IMessage> (dispatchQueue->front()) ;
|
||||
dispatchQueue->pop() ;
|
||||
}
|
||||
|
||||
return msg ;
|
||||
}
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#include "activemq/Dispatcher.hpp"
|
||||
|
||||
using namespace apache::activemq;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
Dispatcher::Dispatcher()
|
||||
{
|
||||
dispatchQueue = new queue< p<IMessage> > ;
|
||||
redeliverList = new list< p<IMessage> > ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void Dispatcher::redeliverRolledBackMessages()
|
||||
{
|
||||
LOCKED_SCOPE (mutex);
|
||||
|
||||
p<queue< p<IMessage> > > replacementQueue = new queue< p<IMessage> > ;
|
||||
//(dispatchQueue->size() + redeliverList->size() ) ;
|
||||
|
||||
// Copy all messages to be redelivered to the new queue
|
||||
while( !redeliverList->empty() )
|
||||
{
|
||||
replacementQueue->push( redeliverList->front() ) ;
|
||||
redeliverList->pop_front() ;
|
||||
}
|
||||
|
||||
// Copy all messages to be dispatched to the new queue
|
||||
while( dispatchQueue->size() > 0 )
|
||||
{
|
||||
// Get first element in queue
|
||||
p<IMessage> element = p_cast<IMessage> (dispatchQueue->front()) ;
|
||||
|
||||
// Remove first element from queue
|
||||
dispatchQueue->pop() ;
|
||||
|
||||
// Add element to the new queue
|
||||
replacementQueue->push(element) ;
|
||||
}
|
||||
// Switch to the new queue
|
||||
dispatchQueue = replacementQueue ;
|
||||
|
||||
semaphore.notify() ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void Dispatcher::redeliver(p<IMessage> message)
|
||||
{
|
||||
LOCKED_SCOPE (mutex);
|
||||
redeliverList->push_back(message) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void Dispatcher::enqueue(p<IMessage> message)
|
||||
{
|
||||
LOCKED_SCOPE (mutex);
|
||||
dispatchQueue->push(message) ;
|
||||
semaphore.notify() ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<IMessage> Dispatcher::dequeueNoWait()
|
||||
{
|
||||
p<IMessage> msg = NULL ;
|
||||
|
||||
{
|
||||
LOCKED_SCOPE (mutex);
|
||||
|
||||
if( dispatchQueue->size() > 0 )
|
||||
{
|
||||
msg = p_cast<IMessage> (dispatchQueue->front()) ;
|
||||
dispatchQueue->pop() ;
|
||||
}
|
||||
}
|
||||
return msg ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<IMessage> Dispatcher::dequeue(int timeout)
|
||||
{
|
||||
p<IMessage> msg = NULL ;
|
||||
|
||||
{
|
||||
LOCKED_SCOPE (mutex);
|
||||
|
||||
if( dispatchQueue->size() == 0 )
|
||||
semaphore.wait(timeout) ;
|
||||
|
||||
if( dispatchQueue->size() > 0 )
|
||||
{
|
||||
msg = p_cast<IMessage> (dispatchQueue->front()) ;
|
||||
dispatchQueue->pop() ;
|
||||
}
|
||||
}
|
||||
return msg ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<IMessage> Dispatcher::dequeue()
|
||||
{
|
||||
p<IMessage> msg = NULL ;
|
||||
|
||||
{
|
||||
LOCKED_SCOPE (mutex);
|
||||
|
||||
msg = p_cast<IMessage> (dispatchQueue->front()) ;
|
||||
dispatchQueue->pop() ;
|
||||
}
|
||||
|
||||
return msg ;
|
||||
}
|
||||
|
|
|
@ -1,65 +1,65 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_Dispatcher_hpp_
|
||||
#define ActiveMQ_Dispatcher_hpp_
|
||||
|
||||
#include <string>
|
||||
#include <list>
|
||||
#include <queue>
|
||||
#include "cms/IMessage.hpp"
|
||||
#include "activemq/command/Response.hpp"
|
||||
#include "ppr/thread/SimpleMutex.hpp"
|
||||
#include "ppr/thread/Semaphore.hpp"
|
||||
#include "ppr/util/ifr/p"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
using namespace ifr;
|
||||
using namespace apache::activemq::command;
|
||||
using namespace apache::cms;
|
||||
using namespace apache::ppr::thread;
|
||||
|
||||
/*
|
||||
* Handles the multi-threaded dispatching between transport and consumers.
|
||||
*/
|
||||
class Dispatcher
|
||||
{
|
||||
private:
|
||||
p<queue< p<IMessage> > > dispatchQueue ;
|
||||
p<list< p<IMessage> > > redeliverList ;
|
||||
SimpleMutex mutex ;
|
||||
Semaphore semaphore ;
|
||||
|
||||
public:
|
||||
Dispatcher() ;
|
||||
virtual ~Dispatcher() {}
|
||||
|
||||
virtual void redeliverRolledBackMessages() ;
|
||||
virtual void redeliver(p<IMessage> message) ;
|
||||
virtual void enqueue(p<IMessage> message) ;
|
||||
virtual p<IMessage> dequeueNoWait() ;
|
||||
virtual p<IMessage> dequeue(int timeout) ;
|
||||
virtual p<IMessage> dequeue() ;
|
||||
} ;
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_Dispatcher_hpp_*/
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_Dispatcher_hpp_
|
||||
#define ActiveMQ_Dispatcher_hpp_
|
||||
|
||||
#include <string>
|
||||
#include <list>
|
||||
#include <queue>
|
||||
#include "cms/IMessage.hpp"
|
||||
#include "activemq/command/Response.hpp"
|
||||
#include "ppr/thread/SimpleMutex.hpp"
|
||||
#include "ppr/thread/Semaphore.hpp"
|
||||
#include "ppr/util/ifr/p"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
using namespace ifr;
|
||||
using namespace apache::activemq::command;
|
||||
using namespace apache::cms;
|
||||
using namespace apache::ppr::thread;
|
||||
|
||||
/*
|
||||
* Handles the multi-threaded dispatching between transport and consumers.
|
||||
*/
|
||||
class Dispatcher
|
||||
{
|
||||
private:
|
||||
p<queue< p<IMessage> > > dispatchQueue ;
|
||||
p<list< p<IMessage> > > redeliverList ;
|
||||
SimpleMutex mutex ;
|
||||
Semaphore semaphore ;
|
||||
|
||||
public:
|
||||
Dispatcher() ;
|
||||
virtual ~Dispatcher() {}
|
||||
|
||||
virtual void redeliverRolledBackMessages() ;
|
||||
virtual void redeliver(p<IMessage> message) ;
|
||||
virtual void enqueue(p<IMessage> message) ;
|
||||
virtual p<IMessage> dequeueNoWait() ;
|
||||
virtual p<IMessage> dequeue(int timeout) ;
|
||||
virtual p<IMessage> dequeue() ;
|
||||
} ;
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_Dispatcher_hpp_*/
|
||||
|
|
|
@ -1,45 +1,45 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_IAcknowledger_hpp_
|
||||
#define ActiveMQ_IAcknowledger_hpp_
|
||||
|
||||
#include "ppr/util/ifr/p"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
namespace command
|
||||
{
|
||||
class ActiveMQMessage ;
|
||||
}
|
||||
using namespace ifr;
|
||||
using namespace apache::activemq::command;
|
||||
|
||||
/*
|
||||
* Interface for message acknowledgers.
|
||||
*/
|
||||
struct IAcknowledger : Interface
|
||||
{
|
||||
virtual void acknowledge(p<ActiveMQMessage> message) = 0 ;
|
||||
} ;
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_IAcknowledger_hpp_*/
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_IAcknowledger_hpp_
|
||||
#define ActiveMQ_IAcknowledger_hpp_
|
||||
|
||||
#include "ppr/util/ifr/p"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
namespace command
|
||||
{
|
||||
class ActiveMQMessage ;
|
||||
}
|
||||
using namespace ifr;
|
||||
using namespace apache::activemq::command;
|
||||
|
||||
/*
|
||||
* Interface for message acknowledgers.
|
||||
*/
|
||||
struct IAcknowledger : Interface
|
||||
{
|
||||
virtual void acknowledge(p<ActiveMQMessage> message) = 0 ;
|
||||
} ;
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_IAcknowledger_hpp_*/
|
||||
|
|
|
@ -1,42 +1,42 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_ICommand_hpp_
|
||||
#define ActiveMQ_ICommand_hpp_
|
||||
|
||||
#include "activemq/IDataStructure.hpp"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
|
||||
/*
|
||||
* An OpenWire command
|
||||
*/
|
||||
struct ICommand : IDataStructure
|
||||
{
|
||||
virtual int getCommandId() = 0;
|
||||
virtual void setCommandId(int value) = 0;
|
||||
virtual bool getResponseRequired() = 0;
|
||||
virtual void setResponseRequired(bool value) = 0;
|
||||
};
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_ICommand_hpp_*/
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_ICommand_hpp_
|
||||
#define ActiveMQ_ICommand_hpp_
|
||||
|
||||
#include "activemq/IDataStructure.hpp"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
|
||||
/*
|
||||
* An OpenWire command
|
||||
*/
|
||||
struct ICommand : IDataStructure
|
||||
{
|
||||
virtual int getCommandId() = 0;
|
||||
virtual void setCommandId(int value) = 0;
|
||||
virtual bool getResponseRequired() = 0;
|
||||
virtual void setResponseRequired(bool value) = 0;
|
||||
};
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_ICommand_hpp_*/
|
||||
|
|
|
@ -1,51 +1,51 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_IDataStructure_hpp_
|
||||
#define ActiveMQ_IDataStructure_hpp_
|
||||
|
||||
#include "ppr/io/IOutputStream.hpp"
|
||||
#include "ppr/io/IInputStream.hpp"
|
||||
#include "ppr/util/ifr/p"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
namespace protocol
|
||||
{
|
||||
struct IMarshaller ;
|
||||
}
|
||||
using namespace ifr;
|
||||
using namespace apache::activemq::protocol;
|
||||
using namespace apache::ppr::io;
|
||||
|
||||
/*
|
||||
* An OpenWire data structure.
|
||||
*/
|
||||
struct IDataStructure : Interface
|
||||
{
|
||||
virtual unsigned char getDataStructureType() = 0 ;
|
||||
virtual bool isMarshallAware() = 0 ;
|
||||
virtual int marshal(p<IMarshaller> marshaller, int mode, p<IOutputStream> writer) = 0 ;
|
||||
virtual void unmarshal(p<IMarshaller> marshaller, int mode, p<IInputStream> reader) = 0 ;
|
||||
} ;
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_IDataStructure_hpp_*/
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_IDataStructure_hpp_
|
||||
#define ActiveMQ_IDataStructure_hpp_
|
||||
|
||||
#include "ppr/io/IOutputStream.hpp"
|
||||
#include "ppr/io/IInputStream.hpp"
|
||||
#include "ppr/util/ifr/p"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
namespace protocol
|
||||
{
|
||||
struct IMarshaller ;
|
||||
}
|
||||
using namespace ifr;
|
||||
using namespace apache::activemq::protocol;
|
||||
using namespace apache::ppr::io;
|
||||
|
||||
/*
|
||||
* An OpenWire data structure.
|
||||
*/
|
||||
struct IDataStructure : Interface
|
||||
{
|
||||
virtual unsigned char getDataStructureType() = 0 ;
|
||||
virtual bool isMarshallAware() = 0 ;
|
||||
virtual int marshal(p<IMarshaller> marshaller, int mode, p<IOutputStream> writer) = 0 ;
|
||||
virtual void unmarshal(p<IMarshaller> marshaller, int mode, p<IInputStream> reader) = 0 ;
|
||||
} ;
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_IDataStructure_hpp_*/
|
||||
|
|
|
@ -1,47 +1,47 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_ISynchronization_hpp_
|
||||
#define ActiveMQ_ISynchronization_hpp_
|
||||
|
||||
#include "ppr/util/ifr/p"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
using namespace ifr;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
struct ISynchronization : Interface
|
||||
{
|
||||
// Called before a commit
|
||||
virtual void beforeCommit() = 0 ;
|
||||
|
||||
// Called after a commit
|
||||
virtual void afterCommit() = 0 ;
|
||||
|
||||
// Called after a transaction rollback
|
||||
virtual void afterRollback() = 0 ;
|
||||
} ;
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_ISynchronization_hpp_*/
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_ISynchronization_hpp_
|
||||
#define ActiveMQ_ISynchronization_hpp_
|
||||
|
||||
#include "ppr/util/ifr/p"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
using namespace ifr;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
struct ISynchronization : Interface
|
||||
{
|
||||
// Called before a commit
|
||||
virtual void beforeCommit() = 0 ;
|
||||
|
||||
// Called after a commit
|
||||
virtual void afterCommit() = 0 ;
|
||||
|
||||
// Called after a transaction rollback
|
||||
virtual void afterRollback() = 0 ;
|
||||
} ;
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_ISynchronization_hpp_*/
|
||||
|
|
|
@ -1,33 +1,33 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_MessageAckType_hpp_
|
||||
#define ActiveMQ_MessageAckType_hpp_
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
enum MessageAckType
|
||||
{
|
||||
DeliveredAck = 0,
|
||||
PoisonAck = 1,
|
||||
ConsumedAck = 2
|
||||
} ;
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_MessageAckType_hpp_*/
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_MessageAckType_hpp_
|
||||
#define ActiveMQ_MessageAckType_hpp_
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
enum MessageAckType
|
||||
{
|
||||
DeliveredAck = 0,
|
||||
PoisonAck = 1,
|
||||
ConsumedAck = 2
|
||||
} ;
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_MessageAckType_hpp_*/
|
||||
|
|
|
@ -1,307 +1,307 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#include "activemq/MessageConsumer.hpp"
|
||||
#include "activemq/Session.hpp"
|
||||
|
||||
using namespace apache::activemq;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
MessageConsumer::MessageConsumer(p<Session> session, p<ConsumerInfo> consumerInfo, AcknowledgementMode acknowledgementMode)
|
||||
{
|
||||
this->session = session ;
|
||||
this->consumerInfo = consumerInfo ;
|
||||
this->acknowledgementMode = acknowledgementMode ;
|
||||
this->dispatcher = new Dispatcher() ;
|
||||
this->listener = NULL ;
|
||||
this->closed = false ;
|
||||
this->maximumRedeliveryCount = 10 ;
|
||||
this->redeliveryTimeout = 500 ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
MessageConsumer::~MessageConsumer()
|
||||
{
|
||||
// Make sure consumer is closed
|
||||
close() ;
|
||||
}
|
||||
|
||||
// Attribute methods ------------------------------------------------
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void MessageConsumer::setMessageListener(p<IMessageListener> listener)
|
||||
{
|
||||
this->listener = listener ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<IMessageListener> MessageConsumer::getMessageListener()
|
||||
{
|
||||
return listener ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<ConsumerId> MessageConsumer::getConsumerId()
|
||||
{
|
||||
return consumerInfo->getConsumerId() ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void MessageConsumer::setMaximumRedeliveryCount(int count)
|
||||
{
|
||||
this->maximumRedeliveryCount = count ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
int MessageConsumer::getMaximumRedeliveryCount()
|
||||
{
|
||||
return maximumRedeliveryCount ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void MessageConsumer::setRedeliveryTimeout(int timeout)
|
||||
{
|
||||
this->redeliveryTimeout = timeout ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
int MessageConsumer::getRedeliveryTimeout()
|
||||
{
|
||||
return redeliveryTimeout ;
|
||||
}
|
||||
|
||||
|
||||
// Operation methods ------------------------------------------------
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<IMessage> MessageConsumer::receive()
|
||||
{
|
||||
checkClosed() ;
|
||||
return autoAcknowledge( dispatcher->dequeue() ) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<IMessage> MessageConsumer::receive(int timeout)
|
||||
{
|
||||
checkClosed() ;
|
||||
return autoAcknowledge( dispatcher->dequeue(timeout) ) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<IMessage> MessageConsumer::receiveNoWait()
|
||||
{
|
||||
checkClosed() ;
|
||||
return autoAcknowledge( dispatcher->dequeueNoWait() ) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void MessageConsumer::redeliverRolledBackMessages()
|
||||
{
|
||||
dispatcher->redeliverRolledBackMessages() ;
|
||||
}
|
||||
|
||||
/*
|
||||
* Transport callback that handles messages dispatching
|
||||
*/
|
||||
void MessageConsumer::dispatch(p<IMessage> message)
|
||||
{
|
||||
dispatcher->enqueue(message) ;
|
||||
|
||||
// Activate background dispatch thread if async listener is set up
|
||||
if( listener != NULL )
|
||||
session->dispatch() ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void MessageConsumer::dispatchAsyncMessages()
|
||||
{
|
||||
while( listener != NULL )
|
||||
{
|
||||
p<IMessage> message = dispatcher->dequeueNoWait() ;
|
||||
|
||||
if( message != NULL )
|
||||
{
|
||||
listener->onMessage(message) ;
|
||||
|
||||
// Auto acknowledge message if selected
|
||||
autoAcknowledge(message) ;
|
||||
}
|
||||
else
|
||||
break ;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* IAcknowledger callback method.
|
||||
*/
|
||||
void MessageConsumer::acknowledge(p<ActiveMQMessage> message)
|
||||
{
|
||||
doClientAcknowledge(message) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void MessageConsumer::close()
|
||||
{
|
||||
if( !closed )
|
||||
{
|
||||
closed = true ;
|
||||
|
||||
// De-register consumer from broker
|
||||
session->getConnection()->disposeOf( consumerInfo->getConsumerId() ) ;
|
||||
|
||||
// Reset internal state (prevent cyclic references)
|
||||
session = NULL ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Implementation methods ------------------------------------------------
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void MessageConsumer::checkClosed() throw(CmsException)
|
||||
{
|
||||
if( closed )
|
||||
throw ConnectionClosedException("Oops! Connection already closed") ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<IMessage> MessageConsumer::autoAcknowledge(p<IMessage> message)
|
||||
{
|
||||
try
|
||||
{
|
||||
// Is the message an ActiveMQMessage? (throws bad_cast otherwise)
|
||||
p<ActiveMQMessage> activeMessage = p_dyncast<ActiveMQMessage> (message) ;
|
||||
|
||||
// Register the handler for client acknowledgment
|
||||
activeMessage->setAcknowledger( smartify(this) ) ;
|
||||
|
||||
if( acknowledgementMode != ClientAckMode )
|
||||
doAcknowledge(activeMessage) ;
|
||||
}
|
||||
catch( bad_cast& bc )
|
||||
{
|
||||
// ignore
|
||||
}
|
||||
return message ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void MessageConsumer::doClientAcknowledge(p<ActiveMQMessage> message)
|
||||
{
|
||||
if( acknowledgementMode == ClientAckMode )
|
||||
doAcknowledge(message);
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void MessageConsumer::doAcknowledge(p<Message> message)
|
||||
{
|
||||
p<MessageAck> ack = createMessageAck(message) ;
|
||||
//cout << "Sending Ack: " << ack->getAckType() << endl ;
|
||||
session->getConnection()->syncRequest(ack) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<MessageAck> MessageConsumer::createMessageAck(p<Message> message)
|
||||
{
|
||||
p<MessageAck> ack = new MessageAck() ;
|
||||
|
||||
// Set ack properties
|
||||
ack->setAckType( ConsumedAck ) ;
|
||||
ack->setConsumerId( consumerInfo->getConsumerId() ) ;
|
||||
ack->setDestination( message->getDestination() ) ;
|
||||
ack->setFirstMessageId( message->getMessageId() ) ;
|
||||
ack->setLastMessageId( message->getMessageId() ) ;
|
||||
ack->setMessageCount( 1 ) ;
|
||||
|
||||
if( session->isTransacted() )
|
||||
{
|
||||
session->doStartTransaction() ;
|
||||
ack->setTransactionId( session->getTransactionContext()->getTransactionId() ) ;
|
||||
session->getTransactionContext()->addSynchronization( new MessageConsumerSynchronization(smartify(this), message) ) ;
|
||||
}
|
||||
return ack ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void MessageConsumer::afterRollback(p<ActiveMQMessage> message)
|
||||
{
|
||||
// Try redeliver of the message again
|
||||
message->setRedeliveryCounter( message->getRedeliveryCounter() + 1 ) ;
|
||||
|
||||
// Check if redeliver count has exceeded maximum
|
||||
if( message->getRedeliveryCounter() > maximumRedeliveryCount )
|
||||
{
|
||||
// Send back a poisoned pill
|
||||
p<MessageAck> ack = new MessageAck() ;
|
||||
ack->setAckType( PoisonAck ) ;
|
||||
ack->setConsumerId( consumerInfo->getConsumerId() ) ;
|
||||
ack->setDestination( message->getDestination() ) ;
|
||||
ack->setFirstMessageId( message->getMessageId() ) ;
|
||||
ack->setLastMessageId( message->getMessageId() ) ;
|
||||
ack->setMessageCount( 1 ) ;
|
||||
session->getConnection()->oneway(ack) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
dispatcher->redeliver(message) ;
|
||||
|
||||
// Re-dispatch the message at some point in the future
|
||||
if( listener != NULL )
|
||||
session->dispatch( redeliveryTimeout ) ;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#include "activemq/MessageConsumer.hpp"
|
||||
#include "activemq/Session.hpp"
|
||||
|
||||
using namespace apache::activemq;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
MessageConsumer::MessageConsumer(p<Session> session, p<ConsumerInfo> consumerInfo, AcknowledgementMode acknowledgementMode)
|
||||
{
|
||||
this->session = session ;
|
||||
this->consumerInfo = consumerInfo ;
|
||||
this->acknowledgementMode = acknowledgementMode ;
|
||||
this->dispatcher = new Dispatcher() ;
|
||||
this->listener = NULL ;
|
||||
this->closed = false ;
|
||||
this->maximumRedeliveryCount = 10 ;
|
||||
this->redeliveryTimeout = 500 ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
MessageConsumer::~MessageConsumer()
|
||||
{
|
||||
// Make sure consumer is closed
|
||||
close() ;
|
||||
}
|
||||
|
||||
// Attribute methods ------------------------------------------------
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void MessageConsumer::setMessageListener(p<IMessageListener> listener)
|
||||
{
|
||||
this->listener = listener ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<IMessageListener> MessageConsumer::getMessageListener()
|
||||
{
|
||||
return listener ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<ConsumerId> MessageConsumer::getConsumerId()
|
||||
{
|
||||
return consumerInfo->getConsumerId() ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void MessageConsumer::setMaximumRedeliveryCount(int count)
|
||||
{
|
||||
this->maximumRedeliveryCount = count ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
int MessageConsumer::getMaximumRedeliveryCount()
|
||||
{
|
||||
return maximumRedeliveryCount ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void MessageConsumer::setRedeliveryTimeout(int timeout)
|
||||
{
|
||||
this->redeliveryTimeout = timeout ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
int MessageConsumer::getRedeliveryTimeout()
|
||||
{
|
||||
return redeliveryTimeout ;
|
||||
}
|
||||
|
||||
|
||||
// Operation methods ------------------------------------------------
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<IMessage> MessageConsumer::receive()
|
||||
{
|
||||
checkClosed() ;
|
||||
return autoAcknowledge( dispatcher->dequeue() ) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<IMessage> MessageConsumer::receive(int timeout)
|
||||
{
|
||||
checkClosed() ;
|
||||
return autoAcknowledge( dispatcher->dequeue(timeout) ) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<IMessage> MessageConsumer::receiveNoWait()
|
||||
{
|
||||
checkClosed() ;
|
||||
return autoAcknowledge( dispatcher->dequeueNoWait() ) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void MessageConsumer::redeliverRolledBackMessages()
|
||||
{
|
||||
dispatcher->redeliverRolledBackMessages() ;
|
||||
}
|
||||
|
||||
/*
|
||||
* Transport callback that handles messages dispatching
|
||||
*/
|
||||
void MessageConsumer::dispatch(p<IMessage> message)
|
||||
{
|
||||
dispatcher->enqueue(message) ;
|
||||
|
||||
// Activate background dispatch thread if async listener is set up
|
||||
if( listener != NULL )
|
||||
session->dispatch() ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void MessageConsumer::dispatchAsyncMessages()
|
||||
{
|
||||
while( listener != NULL )
|
||||
{
|
||||
p<IMessage> message = dispatcher->dequeueNoWait() ;
|
||||
|
||||
if( message != NULL )
|
||||
{
|
||||
listener->onMessage(message) ;
|
||||
|
||||
// Auto acknowledge message if selected
|
||||
autoAcknowledge(message) ;
|
||||
}
|
||||
else
|
||||
break ;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* IAcknowledger callback method.
|
||||
*/
|
||||
void MessageConsumer::acknowledge(p<ActiveMQMessage> message)
|
||||
{
|
||||
doClientAcknowledge(message) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void MessageConsumer::close()
|
||||
{
|
||||
if( !closed )
|
||||
{
|
||||
closed = true ;
|
||||
|
||||
// De-register consumer from broker
|
||||
session->getConnection()->disposeOf( consumerInfo->getConsumerId() ) ;
|
||||
|
||||
// Reset internal state (prevent cyclic references)
|
||||
session = NULL ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Implementation methods ------------------------------------------------
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void MessageConsumer::checkClosed() throw(CmsException)
|
||||
{
|
||||
if( closed )
|
||||
throw ConnectionClosedException("Oops! Connection already closed") ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<IMessage> MessageConsumer::autoAcknowledge(p<IMessage> message)
|
||||
{
|
||||
try
|
||||
{
|
||||
// Is the message an ActiveMQMessage? (throws bad_cast otherwise)
|
||||
p<ActiveMQMessage> activeMessage = p_dyncast<ActiveMQMessage> (message) ;
|
||||
|
||||
// Register the handler for client acknowledgment
|
||||
activeMessage->setAcknowledger( smartify(this) ) ;
|
||||
|
||||
if( acknowledgementMode != ClientAckMode )
|
||||
doAcknowledge(activeMessage) ;
|
||||
}
|
||||
catch( bad_cast& bc )
|
||||
{
|
||||
// ignore
|
||||
}
|
||||
return message ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void MessageConsumer::doClientAcknowledge(p<ActiveMQMessage> message)
|
||||
{
|
||||
if( acknowledgementMode == ClientAckMode )
|
||||
doAcknowledge(message);
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void MessageConsumer::doAcknowledge(p<Message> message)
|
||||
{
|
||||
p<MessageAck> ack = createMessageAck(message) ;
|
||||
//cout << "Sending Ack: " << ack->getAckType() << endl ;
|
||||
session->getConnection()->syncRequest(ack) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<MessageAck> MessageConsumer::createMessageAck(p<Message> message)
|
||||
{
|
||||
p<MessageAck> ack = new MessageAck() ;
|
||||
|
||||
// Set ack properties
|
||||
ack->setAckType( ConsumedAck ) ;
|
||||
ack->setConsumerId( consumerInfo->getConsumerId() ) ;
|
||||
ack->setDestination( message->getDestination() ) ;
|
||||
ack->setFirstMessageId( message->getMessageId() ) ;
|
||||
ack->setLastMessageId( message->getMessageId() ) ;
|
||||
ack->setMessageCount( 1 ) ;
|
||||
|
||||
if( session->isTransacted() )
|
||||
{
|
||||
session->doStartTransaction() ;
|
||||
ack->setTransactionId( session->getTransactionContext()->getTransactionId() ) ;
|
||||
session->getTransactionContext()->addSynchronization( new MessageConsumerSynchronization(smartify(this), message) ) ;
|
||||
}
|
||||
return ack ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void MessageConsumer::afterRollback(p<ActiveMQMessage> message)
|
||||
{
|
||||
// Try redeliver of the message again
|
||||
message->setRedeliveryCounter( message->getRedeliveryCounter() + 1 ) ;
|
||||
|
||||
// Check if redeliver count has exceeded maximum
|
||||
if( message->getRedeliveryCounter() > maximumRedeliveryCount )
|
||||
{
|
||||
// Send back a poisoned pill
|
||||
p<MessageAck> ack = new MessageAck() ;
|
||||
ack->setAckType( PoisonAck ) ;
|
||||
ack->setConsumerId( consumerInfo->getConsumerId() ) ;
|
||||
ack->setDestination( message->getDestination() ) ;
|
||||
ack->setFirstMessageId( message->getMessageId() ) ;
|
||||
ack->setLastMessageId( message->getMessageId() ) ;
|
||||
ack->setMessageCount( 1 ) ;
|
||||
session->getConnection()->oneway(ack) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
dispatcher->redeliver(message) ;
|
||||
|
||||
// Re-dispatch the message at some point in the future
|
||||
if( listener != NULL )
|
||||
session->dispatch( redeliveryTimeout ) ;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,102 +1,102 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_MessageConsumer_hpp_
|
||||
#define ActiveMQ_MessageConsumer_hpp_
|
||||
|
||||
#include <string>
|
||||
#include "cms/IDestination.hpp"
|
||||
#include "cms/IMessage.hpp"
|
||||
#include "cms/IMessageConsumer.hpp"
|
||||
#include "cms/IMessageListener.hpp"
|
||||
#include "cms/CmsException.hpp"
|
||||
#include "activemq/AcknowledgementMode.hpp"
|
||||
#include "activemq/MessageAckType.hpp"
|
||||
#include "activemq/Dispatcher.hpp"
|
||||
#include "activemq/IAcknowledger.hpp"
|
||||
#include "activemq/MessageConsumerSynchronization.hpp"
|
||||
#include "activemq/ConnectionClosedException.hpp"
|
||||
#include "activemq/command/ConsumerInfo.hpp"
|
||||
#include "activemq/command/Message.hpp"
|
||||
#include "activemq/command/ActiveMQMessage.hpp"
|
||||
#include "activemq/command/MessageAck.hpp"
|
||||
#include "ppr/util/ifr/p"
|
||||
#include "ppr/thread/Thread.hpp"
|
||||
|
||||
// Turn off warning message for ignored exception specification
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning( disable : 4290 )
|
||||
#endif
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
using namespace ifr;
|
||||
using namespace apache::cms;
|
||||
using namespace apache::ppr::thread;
|
||||
class Session ;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
class MessageConsumer : public IMessageConsumer, public IAcknowledger
|
||||
{
|
||||
private:
|
||||
p<Session> session ;
|
||||
p<ConsumerInfo> consumerInfo ;
|
||||
p<Dispatcher> dispatcher ;
|
||||
p<IMessageListener> listener ;
|
||||
AcknowledgementMode acknowledgementMode ;
|
||||
bool closed ;
|
||||
int maximumRedeliveryCount,
|
||||
redeliveryTimeout ;
|
||||
|
||||
public:
|
||||
MessageConsumer(p<Session> session, p<ConsumerInfo> consumerInfo, AcknowledgementMode acknowledgementMode) ;
|
||||
virtual ~MessageConsumer() ;
|
||||
|
||||
virtual void setMessageListener(p<IMessageListener> listener) ;
|
||||
virtual p<IMessageListener> getMessageListener() ;
|
||||
virtual p<ConsumerId> getConsumerId() ;
|
||||
virtual void setMaximumRedeliveryCount(int count) ;
|
||||
virtual int getMaximumRedeliveryCount() ;
|
||||
virtual void setRedeliveryTimeout(int timeout) ;
|
||||
virtual int getRedeliveryTimeout() ;
|
||||
|
||||
virtual p<IMessage> receive() ;
|
||||
virtual p<IMessage> receive(int timeout) ;
|
||||
virtual p<IMessage> receiveNoWait() ;
|
||||
virtual void redeliverRolledBackMessages() ;
|
||||
virtual void dispatch(p<IMessage> message) ;
|
||||
virtual void dispatchAsyncMessages() ;
|
||||
virtual void afterRollback(p<ActiveMQMessage> message) ;
|
||||
virtual void acknowledge(p<ActiveMQMessage> message) ;
|
||||
virtual void close() ;
|
||||
|
||||
protected:
|
||||
void checkClosed() throw(CmsException) ;
|
||||
p<IMessage> autoAcknowledge(p<IMessage> message) ;
|
||||
void doClientAcknowledge(p<ActiveMQMessage> message) ;
|
||||
void doAcknowledge(p<Message> message) ;
|
||||
p<MessageAck> createMessageAck(p<Message> message) ;
|
||||
} ;
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_IMessageConsumer_hpp_*/
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_MessageConsumer_hpp_
|
||||
#define ActiveMQ_MessageConsumer_hpp_
|
||||
|
||||
#include <string>
|
||||
#include "cms/IDestination.hpp"
|
||||
#include "cms/IMessage.hpp"
|
||||
#include "cms/IMessageConsumer.hpp"
|
||||
#include "cms/IMessageListener.hpp"
|
||||
#include "cms/CmsException.hpp"
|
||||
#include "activemq/AcknowledgementMode.hpp"
|
||||
#include "activemq/MessageAckType.hpp"
|
||||
#include "activemq/Dispatcher.hpp"
|
||||
#include "activemq/IAcknowledger.hpp"
|
||||
#include "activemq/MessageConsumerSynchronization.hpp"
|
||||
#include "activemq/ConnectionClosedException.hpp"
|
||||
#include "activemq/command/ConsumerInfo.hpp"
|
||||
#include "activemq/command/Message.hpp"
|
||||
#include "activemq/command/ActiveMQMessage.hpp"
|
||||
#include "activemq/command/MessageAck.hpp"
|
||||
#include "ppr/util/ifr/p"
|
||||
#include "ppr/thread/Thread.hpp"
|
||||
|
||||
// Turn off warning message for ignored exception specification
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning( disable : 4290 )
|
||||
#endif
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
using namespace ifr;
|
||||
using namespace apache::cms;
|
||||
using namespace apache::ppr::thread;
|
||||
class Session ;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
class MessageConsumer : public IMessageConsumer, public IAcknowledger
|
||||
{
|
||||
private:
|
||||
p<Session> session ;
|
||||
p<ConsumerInfo> consumerInfo ;
|
||||
p<Dispatcher> dispatcher ;
|
||||
p<IMessageListener> listener ;
|
||||
AcknowledgementMode acknowledgementMode ;
|
||||
bool closed ;
|
||||
int maximumRedeliveryCount,
|
||||
redeliveryTimeout ;
|
||||
|
||||
public:
|
||||
MessageConsumer(p<Session> session, p<ConsumerInfo> consumerInfo, AcknowledgementMode acknowledgementMode) ;
|
||||
virtual ~MessageConsumer() ;
|
||||
|
||||
virtual void setMessageListener(p<IMessageListener> listener) ;
|
||||
virtual p<IMessageListener> getMessageListener() ;
|
||||
virtual p<ConsumerId> getConsumerId() ;
|
||||
virtual void setMaximumRedeliveryCount(int count) ;
|
||||
virtual int getMaximumRedeliveryCount() ;
|
||||
virtual void setRedeliveryTimeout(int timeout) ;
|
||||
virtual int getRedeliveryTimeout() ;
|
||||
|
||||
virtual p<IMessage> receive() ;
|
||||
virtual p<IMessage> receive(int timeout) ;
|
||||
virtual p<IMessage> receiveNoWait() ;
|
||||
virtual void redeliverRolledBackMessages() ;
|
||||
virtual void dispatch(p<IMessage> message) ;
|
||||
virtual void dispatchAsyncMessages() ;
|
||||
virtual void afterRollback(p<ActiveMQMessage> message) ;
|
||||
virtual void acknowledge(p<ActiveMQMessage> message) ;
|
||||
virtual void close() ;
|
||||
|
||||
protected:
|
||||
void checkClosed() throw(CmsException) ;
|
||||
p<IMessage> autoAcknowledge(p<IMessage> message) ;
|
||||
void doClientAcknowledge(p<ActiveMQMessage> message) ;
|
||||
void doAcknowledge(p<Message> message) ;
|
||||
p<MessageAck> createMessageAck(p<Message> message) ;
|
||||
} ;
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_IMessageConsumer_hpp_*/
|
||||
|
|
|
@ -1,60 +1,60 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#include "activemq/MessageConsumerSynchronization.hpp"
|
||||
#include "activemq/MessageConsumer.hpp"
|
||||
|
||||
using namespace apache::activemq;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
MessageConsumerSynchronization::MessageConsumerSynchronization(p<MessageConsumer> consumer, p<Message> message)
|
||||
{
|
||||
this->consumer = consumer ;
|
||||
this->message = message ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
MessageConsumerSynchronization::~MessageConsumerSynchronization()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void MessageConsumerSynchronization::beforeCommit()
|
||||
{
|
||||
// no-op
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void MessageConsumerSynchronization::afterCommit()
|
||||
{
|
||||
// no-op
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void MessageConsumerSynchronization::afterRollback()
|
||||
{
|
||||
consumer->afterRollback( p_cast<ActiveMQMessage> (message)) ;
|
||||
}
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#include "activemq/MessageConsumerSynchronization.hpp"
|
||||
#include "activemq/MessageConsumer.hpp"
|
||||
|
||||
using namespace apache::activemq;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
MessageConsumerSynchronization::MessageConsumerSynchronization(p<MessageConsumer> consumer, p<Message> message)
|
||||
{
|
||||
this->consumer = consumer ;
|
||||
this->message = message ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
MessageConsumerSynchronization::~MessageConsumerSynchronization()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void MessageConsumerSynchronization::beforeCommit()
|
||||
{
|
||||
// no-op
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void MessageConsumerSynchronization::afterCommit()
|
||||
{
|
||||
// no-op
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void MessageConsumerSynchronization::afterRollback()
|
||||
{
|
||||
consumer->afterRollback( p_cast<ActiveMQMessage> (message)) ;
|
||||
}
|
||||
|
|
|
@ -1,54 +1,54 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_MessageConsumerSynchronization_hpp_
|
||||
#define ActiveMQ_MessageConsumerSynchronization_hpp_
|
||||
|
||||
#include "activemq/ISynchronization.hpp"
|
||||
#include "activemq/command/ActiveMQMessage.hpp"
|
||||
#include "activemq/command/Message.hpp"
|
||||
#include "ppr/util/ifr/p"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
using namespace ifr;
|
||||
class MessageConsumer;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
class MessageConsumerSynchronization : public ISynchronization
|
||||
{
|
||||
private:
|
||||
p<MessageConsumer> consumer ;
|
||||
p<Message> message ;
|
||||
|
||||
public:
|
||||
MessageConsumerSynchronization(p<MessageConsumer> consumer, p<Message> message) ;
|
||||
~MessageConsumerSynchronization() ;
|
||||
|
||||
virtual void beforeCommit() ;
|
||||
virtual void afterCommit() ;
|
||||
virtual void afterRollback() ;
|
||||
} ;
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_MessageConsumerSynchronization_hpp_*/
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_MessageConsumerSynchronization_hpp_
|
||||
#define ActiveMQ_MessageConsumerSynchronization_hpp_
|
||||
|
||||
#include "activemq/ISynchronization.hpp"
|
||||
#include "activemq/command/ActiveMQMessage.hpp"
|
||||
#include "activemq/command/Message.hpp"
|
||||
#include "ppr/util/ifr/p"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
using namespace ifr;
|
||||
class MessageConsumer;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
class MessageConsumerSynchronization : public ISynchronization
|
||||
{
|
||||
private:
|
||||
p<MessageConsumer> consumer ;
|
||||
p<Message> message ;
|
||||
|
||||
public:
|
||||
MessageConsumerSynchronization(p<MessageConsumer> consumer, p<Message> message) ;
|
||||
~MessageConsumerSynchronization() ;
|
||||
|
||||
virtual void beforeCommit() ;
|
||||
virtual void afterCommit() ;
|
||||
virtual void afterRollback() ;
|
||||
} ;
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_MessageConsumerSynchronization_hpp_*/
|
||||
|
|
|
@ -1,179 +1,179 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#include "activemq/MessageProducer.hpp"
|
||||
#include "activemq/Session.hpp"
|
||||
|
||||
using namespace apache::activemq;
|
||||
|
||||
|
||||
// Constructors -----------------------------------------------------
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
MessageProducer::MessageProducer(p<Session> session, p<ProducerInfo> producerInfo)
|
||||
{
|
||||
this->session = session ;
|
||||
this->producerInfo = producerInfo ;
|
||||
this->priority = DEFAULT_PRIORITY ;
|
||||
this->timeToLive = DEFAULT_TIMETOLIVE ;
|
||||
this->messageCounter = 0 ;
|
||||
this->persistent = false ;
|
||||
this->disableMessageID = false ;
|
||||
this->disableMessageTimestamp = false ;
|
||||
this->closed = false ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
MessageProducer::~MessageProducer()
|
||||
{
|
||||
// Make sure the producer is closed
|
||||
close() ;
|
||||
}
|
||||
|
||||
|
||||
// Attribute methods ------------------------------------------------
|
||||
|
||||
bool MessageProducer::getPersistent()
|
||||
{
|
||||
return persistent ;
|
||||
}
|
||||
|
||||
void MessageProducer::setPersistent(bool persistent)
|
||||
{
|
||||
this->persistent = persistent ;
|
||||
}
|
||||
|
||||
long long MessageProducer::getTimeToLive()
|
||||
{
|
||||
return timeToLive ;
|
||||
}
|
||||
|
||||
void MessageProducer::getTimeToLive(long long ttl)
|
||||
{
|
||||
this->timeToLive = ttl ;
|
||||
}
|
||||
|
||||
int MessageProducer::getPriority()
|
||||
{
|
||||
return priority ;
|
||||
}
|
||||
|
||||
void MessageProducer::getPriority(int priority)
|
||||
{
|
||||
this->priority = priority ;
|
||||
}
|
||||
|
||||
bool MessageProducer::getDisableMessageID()
|
||||
{
|
||||
return disableMessageID ;
|
||||
}
|
||||
|
||||
void MessageProducer::getDisableMessageID(bool disable)
|
||||
{
|
||||
this->disableMessageID = disable ;
|
||||
}
|
||||
|
||||
bool MessageProducer::getDisableMessageTimestamp()
|
||||
{
|
||||
return disableMessageTimestamp ;
|
||||
}
|
||||
|
||||
void MessageProducer::getDisableMessageTimestamp(bool disable)
|
||||
{
|
||||
this->disableMessageTimestamp = disable ;
|
||||
}
|
||||
|
||||
|
||||
// Operation methods ------------------------------------------------
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void MessageProducer::send(p<IMessage> message)
|
||||
{
|
||||
send(producerInfo->getDestination(), message, DEFAULT_PRIORITY, DEFAULT_TIMETOLIVE) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void MessageProducer::send(p<IDestination> destination, p<IMessage> message)
|
||||
{
|
||||
send(destination, message, DEFAULT_PRIORITY, DEFAULT_TIMETOLIVE) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void MessageProducer::send(p<IDestination> destination, p<IMessage> message, char priority, long long timeToLive)
|
||||
{
|
||||
p<MessageId> msgId = new MessageId() ;
|
||||
msgId->setProducerId( producerInfo->getProducerId() ) ;
|
||||
|
||||
// Acquire next sequence id
|
||||
{
|
||||
LOCKED_SCOPE (mutex);
|
||||
msgId->setProducerSequenceId( ++messageCounter ) ;
|
||||
}
|
||||
|
||||
// Configure the message
|
||||
p<ActiveMQMessage> activeMessage = p_dyncast<ActiveMQMessage> (message) ;
|
||||
activeMessage->setMessageId( msgId ) ;
|
||||
activeMessage->setProducerId( producerInfo->getProducerId() ) ;
|
||||
activeMessage->setDestination( p_dyncast<ActiveMQDestination> (destination) ) ;
|
||||
activeMessage->setPriority(priority) ;
|
||||
|
||||
if( session->isTransacted() )
|
||||
{
|
||||
session->doStartTransaction() ;
|
||||
activeMessage->setTransactionId( session->getTransactionContext()->getTransactionId() ) ;
|
||||
}
|
||||
|
||||
// Set time values if not disabled
|
||||
if( !this->disableMessageTimestamp )
|
||||
{
|
||||
long long timestamp = Time::getCurrentTimeMillis() ;
|
||||
|
||||
// Set message time stamp/expiration
|
||||
activeMessage->setTimestamp(timestamp) ;
|
||||
if( timeToLive > 0 )
|
||||
activeMessage->setExpiration( timestamp + timeToLive ) ;
|
||||
}
|
||||
|
||||
// Finally, transmit the message
|
||||
session->doSend(destination, message) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void MessageProducer::close()
|
||||
{
|
||||
if( !closed )
|
||||
{
|
||||
closed = true ;
|
||||
|
||||
// De-register producer from broker
|
||||
session->getConnection()->disposeOf( producerInfo->getProducerId() ) ;
|
||||
|
||||
// Reset internal state (prevent cyclic references)
|
||||
session = NULL ;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#include "activemq/MessageProducer.hpp"
|
||||
#include "activemq/Session.hpp"
|
||||
|
||||
using namespace apache::activemq;
|
||||
|
||||
|
||||
// Constructors -----------------------------------------------------
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
MessageProducer::MessageProducer(p<Session> session, p<ProducerInfo> producerInfo)
|
||||
{
|
||||
this->session = session ;
|
||||
this->producerInfo = producerInfo ;
|
||||
this->priority = DEFAULT_PRIORITY ;
|
||||
this->timeToLive = DEFAULT_TIMETOLIVE ;
|
||||
this->messageCounter = 0 ;
|
||||
this->persistent = false ;
|
||||
this->disableMessageID = false ;
|
||||
this->disableMessageTimestamp = false ;
|
||||
this->closed = false ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
MessageProducer::~MessageProducer()
|
||||
{
|
||||
// Make sure the producer is closed
|
||||
close() ;
|
||||
}
|
||||
|
||||
|
||||
// Attribute methods ------------------------------------------------
|
||||
|
||||
bool MessageProducer::getPersistent()
|
||||
{
|
||||
return persistent ;
|
||||
}
|
||||
|
||||
void MessageProducer::setPersistent(bool persistent)
|
||||
{
|
||||
this->persistent = persistent ;
|
||||
}
|
||||
|
||||
long long MessageProducer::getTimeToLive()
|
||||
{
|
||||
return timeToLive ;
|
||||
}
|
||||
|
||||
void MessageProducer::getTimeToLive(long long ttl)
|
||||
{
|
||||
this->timeToLive = ttl ;
|
||||
}
|
||||
|
||||
int MessageProducer::getPriority()
|
||||
{
|
||||
return priority ;
|
||||
}
|
||||
|
||||
void MessageProducer::getPriority(int priority)
|
||||
{
|
||||
this->priority = priority ;
|
||||
}
|
||||
|
||||
bool MessageProducer::getDisableMessageID()
|
||||
{
|
||||
return disableMessageID ;
|
||||
}
|
||||
|
||||
void MessageProducer::getDisableMessageID(bool disable)
|
||||
{
|
||||
this->disableMessageID = disable ;
|
||||
}
|
||||
|
||||
bool MessageProducer::getDisableMessageTimestamp()
|
||||
{
|
||||
return disableMessageTimestamp ;
|
||||
}
|
||||
|
||||
void MessageProducer::getDisableMessageTimestamp(bool disable)
|
||||
{
|
||||
this->disableMessageTimestamp = disable ;
|
||||
}
|
||||
|
||||
|
||||
// Operation methods ------------------------------------------------
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void MessageProducer::send(p<IMessage> message)
|
||||
{
|
||||
send(producerInfo->getDestination(), message, DEFAULT_PRIORITY, DEFAULT_TIMETOLIVE) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void MessageProducer::send(p<IDestination> destination, p<IMessage> message)
|
||||
{
|
||||
send(destination, message, DEFAULT_PRIORITY, DEFAULT_TIMETOLIVE) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void MessageProducer::send(p<IDestination> destination, p<IMessage> message, char priority, long long timeToLive)
|
||||
{
|
||||
p<MessageId> msgId = new MessageId() ;
|
||||
msgId->setProducerId( producerInfo->getProducerId() ) ;
|
||||
|
||||
// Acquire next sequence id
|
||||
{
|
||||
LOCKED_SCOPE (mutex);
|
||||
msgId->setProducerSequenceId( ++messageCounter ) ;
|
||||
}
|
||||
|
||||
// Configure the message
|
||||
p<ActiveMQMessage> activeMessage = p_dyncast<ActiveMQMessage> (message) ;
|
||||
activeMessage->setMessageId( msgId ) ;
|
||||
activeMessage->setProducerId( producerInfo->getProducerId() ) ;
|
||||
activeMessage->setDestination( p_dyncast<ActiveMQDestination> (destination) ) ;
|
||||
activeMessage->setPriority(priority) ;
|
||||
|
||||
if( session->isTransacted() )
|
||||
{
|
||||
session->doStartTransaction() ;
|
||||
activeMessage->setTransactionId( session->getTransactionContext()->getTransactionId() ) ;
|
||||
}
|
||||
|
||||
// Set time values if not disabled
|
||||
if( !this->disableMessageTimestamp )
|
||||
{
|
||||
long long timestamp = Time::getCurrentTimeMillis() ;
|
||||
|
||||
// Set message time stamp/expiration
|
||||
activeMessage->setTimestamp(timestamp) ;
|
||||
if( timeToLive > 0 )
|
||||
activeMessage->setExpiration( timestamp + timeToLive ) ;
|
||||
}
|
||||
|
||||
// Finally, transmit the message
|
||||
session->doSend(destination, message) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void MessageProducer::close()
|
||||
{
|
||||
if( !closed )
|
||||
{
|
||||
closed = true ;
|
||||
|
||||
// De-register producer from broker
|
||||
session->getConnection()->disposeOf( producerInfo->getProducerId() ) ;
|
||||
|
||||
// Reset internal state (prevent cyclic references)
|
||||
session = NULL ;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,91 +1,91 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_MessageProducer_hpp_
|
||||
#define ActiveMQ_MessageProducer_hpp_
|
||||
|
||||
#include <string>
|
||||
#include "cms/IDestination.hpp"
|
||||
#include "cms/IMessage.hpp"
|
||||
#include "cms/IMessageProducer.hpp"
|
||||
#include "activemq/command/ProducerInfo.hpp"
|
||||
#include "ppr/thread/SimpleMutex.hpp"
|
||||
#include "ppr/util/Time.hpp"
|
||||
#include "ppr/util/ifr/p"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
using namespace ifr;
|
||||
using namespace apache::cms;
|
||||
using namespace apache::activemq::command;
|
||||
using namespace apache::ppr;
|
||||
using namespace apache::ppr::thread;
|
||||
class Session ;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
class MessageProducer : public IMessageProducer
|
||||
{
|
||||
private:
|
||||
p<Session> session ;
|
||||
p<ProducerInfo> producerInfo ;
|
||||
SimpleMutex mutex ;
|
||||
int priority ;
|
||||
long long messageCounter,
|
||||
timeToLive ;
|
||||
bool closed,
|
||||
persistent,
|
||||
disableMessageID,
|
||||
disableMessageTimestamp ;
|
||||
|
||||
// Default message values
|
||||
const static char DEFAULT_PRIORITY = 4 ;
|
||||
const static long long DEFAULT_TIMETOLIVE = 0 ;
|
||||
|
||||
public:
|
||||
MessageProducer(p<Session> session, p<ProducerInfo> producerInfo) ;
|
||||
virtual ~MessageProducer() ;
|
||||
|
||||
// Attribute methods
|
||||
virtual bool getPersistent() ;
|
||||
virtual void setPersistent(bool persistent) ;
|
||||
virtual long long getTimeToLive() ;
|
||||
virtual void getTimeToLive(long long ttl) ;
|
||||
virtual int getPriority() ;
|
||||
virtual void getPriority(int priority) ;
|
||||
virtual bool getDisableMessageID() ;
|
||||
virtual void getDisableMessageID(bool disable) ;
|
||||
virtual bool getDisableMessageTimestamp() ;
|
||||
virtual void getDisableMessageTimestamp(bool disable) ;
|
||||
|
||||
// Operation methods
|
||||
virtual void send(p<IMessage> message) ;
|
||||
virtual void send(p<IDestination> destination, p<IMessage> message) ;
|
||||
virtual void send(p<IDestination> destination, p<IMessage> message, char priority, long long timeToLive) ;
|
||||
virtual void close() ;
|
||||
|
||||
private:
|
||||
long long getCurrentTimeMillis() ;
|
||||
} ;
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_MessageProducer_hpp_*/
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_MessageProducer_hpp_
|
||||
#define ActiveMQ_MessageProducer_hpp_
|
||||
|
||||
#include <string>
|
||||
#include "cms/IDestination.hpp"
|
||||
#include "cms/IMessage.hpp"
|
||||
#include "cms/IMessageProducer.hpp"
|
||||
#include "activemq/command/ProducerInfo.hpp"
|
||||
#include "ppr/thread/SimpleMutex.hpp"
|
||||
#include "ppr/util/Time.hpp"
|
||||
#include "ppr/util/ifr/p"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
using namespace ifr;
|
||||
using namespace apache::cms;
|
||||
using namespace apache::activemq::command;
|
||||
using namespace apache::ppr;
|
||||
using namespace apache::ppr::thread;
|
||||
class Session ;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
class MessageProducer : public IMessageProducer
|
||||
{
|
||||
private:
|
||||
p<Session> session ;
|
||||
p<ProducerInfo> producerInfo ;
|
||||
SimpleMutex mutex ;
|
||||
int priority ;
|
||||
long long messageCounter,
|
||||
timeToLive ;
|
||||
bool closed,
|
||||
persistent,
|
||||
disableMessageID,
|
||||
disableMessageTimestamp ;
|
||||
|
||||
// Default message values
|
||||
const static char DEFAULT_PRIORITY = 4 ;
|
||||
const static long long DEFAULT_TIMETOLIVE = 0 ;
|
||||
|
||||
public:
|
||||
MessageProducer(p<Session> session, p<ProducerInfo> producerInfo) ;
|
||||
virtual ~MessageProducer() ;
|
||||
|
||||
// Attribute methods
|
||||
virtual bool getPersistent() ;
|
||||
virtual void setPersistent(bool persistent) ;
|
||||
virtual long long getTimeToLive() ;
|
||||
virtual void getTimeToLive(long long ttl) ;
|
||||
virtual int getPriority() ;
|
||||
virtual void getPriority(int priority) ;
|
||||
virtual bool getDisableMessageID() ;
|
||||
virtual void getDisableMessageID(bool disable) ;
|
||||
virtual bool getDisableMessageTimestamp() ;
|
||||
virtual void getDisableMessageTimestamp(bool disable) ;
|
||||
|
||||
// Operation methods
|
||||
virtual void send(p<IMessage> message) ;
|
||||
virtual void send(p<IDestination> destination, p<IMessage> message) ;
|
||||
virtual void send(p<IDestination> destination, p<IMessage> message, char priority, long long timeToLive) ;
|
||||
virtual void close() ;
|
||||
|
||||
private:
|
||||
long long getCurrentTimeMillis() ;
|
||||
} ;
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_MessageProducer_hpp_*/
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,161 +1,161 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_Session_hpp_
|
||||
#define ActiveMQ_Session_hpp_
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include "activemq/AcknowledgementMode.hpp"
|
||||
#include "cms/IMessage.hpp"
|
||||
#include "cms/IBytesMessage.hpp"
|
||||
#include "cms/IMapMessage.hpp"
|
||||
#include "cms/ITextMessage.hpp"
|
||||
#include "cms/ISession.hpp"
|
||||
#include "cms/CmsException.hpp"
|
||||
#include "activemq/IDataStructure.hpp"
|
||||
#include "activemq/MessageConsumer.hpp"
|
||||
#include "activemq/MessageProducer.hpp"
|
||||
#include "activemq/TransactionContext.hpp"
|
||||
#include "activemq/command/ConsumerInfo.hpp"
|
||||
#include "activemq/command/ProducerInfo.hpp"
|
||||
#include "activemq/command/RemoveInfo.hpp"
|
||||
#include "activemq/command/SessionInfo.hpp"
|
||||
#include "activemq/command/SessionId.hpp"
|
||||
#include "ppr/thread/SimpleMutex.hpp"
|
||||
#include "ppr/thread/Semaphore.hpp"
|
||||
#include "ppr/thread/Thread.hpp"
|
||||
#include "ppr/util/ifr/array"
|
||||
#include "ppr/util/ifr/p"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
using namespace ifr;
|
||||
using namespace apache::cms;
|
||||
using namespace apache::ppr::thread;
|
||||
using namespace apache::ppr::util;
|
||||
class Connection;
|
||||
class DispatchThread;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
class Session : public ISession
|
||||
{
|
||||
private:
|
||||
p<Connection> connection ;
|
||||
p<SessionInfo> sessionInfo ;
|
||||
AcknowledgementMode ackMode ;
|
||||
p<TransactionContext> transactionContext ;
|
||||
p<DispatchThread> dispatchThread ;
|
||||
map<long long, p<MessageConsumer> > consumers ;
|
||||
map<long long, p<MessageProducer> > producers ;
|
||||
SimpleMutex mutex ;
|
||||
long consumerCounter,
|
||||
producerCounter ;
|
||||
int prefetchSize ;
|
||||
bool closed ;
|
||||
|
||||
public:
|
||||
Session(p<Connection> connection, p<SessionInfo> sessionInfo, AcknowledgementMode ackMode) ;
|
||||
virtual ~Session() ;
|
||||
|
||||
// Attribute methods
|
||||
virtual bool isTransacted() ;
|
||||
virtual p<Connection> getConnection() ;
|
||||
virtual p<SessionId> getSessionId() ;
|
||||
virtual p<TransactionContext> getTransactionContext() ;
|
||||
virtual p<MessageConsumer> getConsumer(p<ConsumerId> consumerId) ;
|
||||
virtual p<MessageProducer> getProducer(p<ProducerId> producerId) ;
|
||||
|
||||
// Operation methods
|
||||
virtual void commit() throw(CmsException) ;
|
||||
virtual void rollback() throw(CmsException) ;
|
||||
virtual p<IMessageProducer> createProducer() ;
|
||||
virtual p<IMessageProducer> createProducer(p<IDestination> destination) ;
|
||||
virtual p<IMessageConsumer> createConsumer(p<IDestination> destination) ;
|
||||
virtual p<IMessageConsumer> createConsumer(p<IDestination> destination, const char* selector) ;
|
||||
virtual p<IMessageConsumer> createDurableConsumer(p<ITopic> destination, const char* name, const char* selector, bool noLocal) ;
|
||||
virtual p<IQueue> getQueue(const char* name) ;
|
||||
virtual p<ITopic> getTopic(const char* name) ;
|
||||
virtual p<ITemporaryQueue> createTemporaryQueue() ;
|
||||
virtual p<ITemporaryTopic> createTemporaryTopic() ;
|
||||
virtual p<IMessage> createMessage() ;
|
||||
virtual p<IBytesMessage> createBytesMessage() ;
|
||||
virtual p<IBytesMessage> createBytesMessage(char* body, int size) ;
|
||||
virtual p<IMapMessage> createMapMessage() ;
|
||||
virtual p<ITextMessage> createTextMessage() ;
|
||||
virtual p<ITextMessage> createTextMessage(const char* text) ;
|
||||
|
||||
virtual void doSend(p<IDestination> destination, p<IMessage> message) ;
|
||||
virtual void doStartTransaction() ;
|
||||
virtual void dispatch(int delay = 0) ;
|
||||
virtual void dispatchAsyncMessages() ;
|
||||
virtual void close() ;
|
||||
|
||||
protected:
|
||||
// Implementation methods
|
||||
p<ConsumerInfo> createConsumerInfo(p<IDestination> destination, const char* selector) ;
|
||||
p<ProducerInfo> createProducerInfo(p<IDestination> destination) ;
|
||||
void configure(p<IMessage> message) ;
|
||||
} ;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
class DispatchThread : public Thread
|
||||
{
|
||||
public:
|
||||
p<Session> session ;
|
||||
Semaphore semaphore ;
|
||||
bool interrupted ;
|
||||
|
||||
DispatchThread(p<Session> session)
|
||||
{
|
||||
this->session = session ;
|
||||
this->interrupted = false ;
|
||||
}
|
||||
|
||||
void interrupt()
|
||||
{
|
||||
interrupted = true ;
|
||||
}
|
||||
|
||||
void wakeup()
|
||||
{
|
||||
semaphore.notify() ;
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual void run () throw (p<exception>)
|
||||
{
|
||||
while( !interrupted )
|
||||
{
|
||||
// Wait for wake-up call
|
||||
semaphore.wait() ;
|
||||
|
||||
session->dispatchAsyncMessages() ;
|
||||
}
|
||||
}
|
||||
} ;
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_Session_hpp_*/
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_Session_hpp_
|
||||
#define ActiveMQ_Session_hpp_
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include "activemq/AcknowledgementMode.hpp"
|
||||
#include "cms/IMessage.hpp"
|
||||
#include "cms/IBytesMessage.hpp"
|
||||
#include "cms/IMapMessage.hpp"
|
||||
#include "cms/ITextMessage.hpp"
|
||||
#include "cms/ISession.hpp"
|
||||
#include "cms/CmsException.hpp"
|
||||
#include "activemq/IDataStructure.hpp"
|
||||
#include "activemq/MessageConsumer.hpp"
|
||||
#include "activemq/MessageProducer.hpp"
|
||||
#include "activemq/TransactionContext.hpp"
|
||||
#include "activemq/command/ConsumerInfo.hpp"
|
||||
#include "activemq/command/ProducerInfo.hpp"
|
||||
#include "activemq/command/RemoveInfo.hpp"
|
||||
#include "activemq/command/SessionInfo.hpp"
|
||||
#include "activemq/command/SessionId.hpp"
|
||||
#include "ppr/thread/SimpleMutex.hpp"
|
||||
#include "ppr/thread/Semaphore.hpp"
|
||||
#include "ppr/thread/Thread.hpp"
|
||||
#include "ppr/util/ifr/array"
|
||||
#include "ppr/util/ifr/p"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
using namespace ifr;
|
||||
using namespace apache::cms;
|
||||
using namespace apache::ppr::thread;
|
||||
using namespace apache::ppr::util;
|
||||
class Connection;
|
||||
class DispatchThread;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
class Session : public ISession
|
||||
{
|
||||
private:
|
||||
p<Connection> connection ;
|
||||
p<SessionInfo> sessionInfo ;
|
||||
AcknowledgementMode ackMode ;
|
||||
p<TransactionContext> transactionContext ;
|
||||
p<DispatchThread> dispatchThread ;
|
||||
map<long long, p<MessageConsumer> > consumers ;
|
||||
map<long long, p<MessageProducer> > producers ;
|
||||
SimpleMutex mutex ;
|
||||
long consumerCounter,
|
||||
producerCounter ;
|
||||
int prefetchSize ;
|
||||
bool closed ;
|
||||
|
||||
public:
|
||||
Session(p<Connection> connection, p<SessionInfo> sessionInfo, AcknowledgementMode ackMode) ;
|
||||
virtual ~Session() ;
|
||||
|
||||
// Attribute methods
|
||||
virtual bool isTransacted() ;
|
||||
virtual p<Connection> getConnection() ;
|
||||
virtual p<SessionId> getSessionId() ;
|
||||
virtual p<TransactionContext> getTransactionContext() ;
|
||||
virtual p<MessageConsumer> getConsumer(p<ConsumerId> consumerId) ;
|
||||
virtual p<MessageProducer> getProducer(p<ProducerId> producerId) ;
|
||||
|
||||
// Operation methods
|
||||
virtual void commit() throw(CmsException) ;
|
||||
virtual void rollback() throw(CmsException) ;
|
||||
virtual p<IMessageProducer> createProducer() ;
|
||||
virtual p<IMessageProducer> createProducer(p<IDestination> destination) ;
|
||||
virtual p<IMessageConsumer> createConsumer(p<IDestination> destination) ;
|
||||
virtual p<IMessageConsumer> createConsumer(p<IDestination> destination, const char* selector) ;
|
||||
virtual p<IMessageConsumer> createDurableConsumer(p<ITopic> destination, const char* name, const char* selector, bool noLocal) ;
|
||||
virtual p<IQueue> getQueue(const char* name) ;
|
||||
virtual p<ITopic> getTopic(const char* name) ;
|
||||
virtual p<ITemporaryQueue> createTemporaryQueue() ;
|
||||
virtual p<ITemporaryTopic> createTemporaryTopic() ;
|
||||
virtual p<IMessage> createMessage() ;
|
||||
virtual p<IBytesMessage> createBytesMessage() ;
|
||||
virtual p<IBytesMessage> createBytesMessage(char* body, int size) ;
|
||||
virtual p<IMapMessage> createMapMessage() ;
|
||||
virtual p<ITextMessage> createTextMessage() ;
|
||||
virtual p<ITextMessage> createTextMessage(const char* text) ;
|
||||
|
||||
virtual void doSend(p<IDestination> destination, p<IMessage> message) ;
|
||||
virtual void doStartTransaction() ;
|
||||
virtual void dispatch(int delay = 0) ;
|
||||
virtual void dispatchAsyncMessages() ;
|
||||
virtual void close() ;
|
||||
|
||||
protected:
|
||||
// Implementation methods
|
||||
p<ConsumerInfo> createConsumerInfo(p<IDestination> destination, const char* selector) ;
|
||||
p<ProducerInfo> createProducerInfo(p<IDestination> destination) ;
|
||||
void configure(p<IMessage> message) ;
|
||||
} ;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
class DispatchThread : public Thread
|
||||
{
|
||||
public:
|
||||
p<Session> session ;
|
||||
Semaphore semaphore ;
|
||||
bool interrupted ;
|
||||
|
||||
DispatchThread(p<Session> session)
|
||||
{
|
||||
this->session = session ;
|
||||
this->interrupted = false ;
|
||||
}
|
||||
|
||||
void interrupt()
|
||||
{
|
||||
interrupted = true ;
|
||||
}
|
||||
|
||||
void wakeup()
|
||||
{
|
||||
semaphore.notify() ;
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual void run () throw (p<exception>)
|
||||
{
|
||||
while( !interrupted )
|
||||
{
|
||||
// Wait for wake-up call
|
||||
semaphore.wait() ;
|
||||
|
||||
session->dispatchAsyncMessages() ;
|
||||
}
|
||||
}
|
||||
} ;
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_Session_hpp_*/
|
||||
|
|
|
@ -1,149 +1,149 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#include "activemq/TransactionContext.hpp"
|
||||
#include "activemq/Session.hpp"
|
||||
|
||||
using namespace apache::activemq;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
TransactionContext::TransactionContext(p<Session> session)
|
||||
{
|
||||
this->session = session ;
|
||||
this->transactionId = NULL ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
TransactionContext::~TransactionContext()
|
||||
{
|
||||
// no-op
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<TransactionId> TransactionContext::getTransactionId()
|
||||
{
|
||||
return transactionId ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void TransactionContext::addSynchronization(p<ISynchronization> synchronization)
|
||||
{
|
||||
synchronizations.push_back(synchronization) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void TransactionContext::begin()
|
||||
{
|
||||
if( transactionId == NULL )
|
||||
{
|
||||
// Create a new local transaction id
|
||||
transactionId = session->getConnection()->createLocalTransactionId() ;
|
||||
|
||||
// Create a new transaction command
|
||||
p<TransactionInfo> info = new TransactionInfo() ;
|
||||
info->setConnectionId( session->getConnection()->getConnectionId() ) ;
|
||||
info->setTransactionId( transactionId ) ;
|
||||
info->setType( BeginTx ) ;
|
||||
|
||||
// Send begin command to broker
|
||||
session->getConnection()->oneway(info) ;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void TransactionContext::commit()
|
||||
{
|
||||
list< p<ISynchronization> >::const_iterator tempIter ;
|
||||
|
||||
// Iterate through each synchronization and call beforeCommit()
|
||||
for( tempIter = synchronizations.begin() ;
|
||||
tempIter != synchronizations.end() ;
|
||||
tempIter++ )
|
||||
{
|
||||
(*tempIter)->beforeCommit() ;
|
||||
}
|
||||
|
||||
if( transactionId != NULL )
|
||||
{
|
||||
// Create a new transaction command
|
||||
p<TransactionInfo> info = new TransactionInfo() ;
|
||||
info->setConnectionId( session->getConnection()->getConnectionId() ) ;
|
||||
info->setTransactionId( transactionId ) ;
|
||||
info->setType( CommitOnePhaseTx ) ;
|
||||
|
||||
// Reset transaction
|
||||
transactionId = NULL ;
|
||||
|
||||
// Send commit command to broker
|
||||
session->getConnection()->oneway(info) ;
|
||||
}
|
||||
|
||||
// Iterate through each synchronization and call afterCommit()
|
||||
for( tempIter = synchronizations.begin() ;
|
||||
tempIter != synchronizations.end() ;
|
||||
tempIter++ )
|
||||
{
|
||||
(*tempIter)->afterCommit() ;
|
||||
}
|
||||
|
||||
// Clear all syncronizations
|
||||
synchronizations.clear() ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void TransactionContext::rollback()
|
||||
{
|
||||
if( transactionId != NULL )
|
||||
{
|
||||
// Create a new transaction command
|
||||
p<TransactionInfo> info = new TransactionInfo() ;
|
||||
info->setConnectionId( session->getConnection()->getConnectionId() ) ;
|
||||
info->setTransactionId( transactionId ) ;
|
||||
info->setType( RollbackTx ) ;
|
||||
|
||||
// Reset transaction
|
||||
transactionId = NULL ;
|
||||
|
||||
// Send rollback command to broker
|
||||
session->getConnection()->oneway(info) ;
|
||||
}
|
||||
|
||||
list< p<ISynchronization> >::const_iterator tempIter ;
|
||||
|
||||
// Iterate through each synchronization and call afterRollback()
|
||||
for( tempIter = synchronizations.begin() ;
|
||||
tempIter != synchronizations.end() ;
|
||||
tempIter++ )
|
||||
{
|
||||
(*tempIter)->afterRollback() ;
|
||||
}
|
||||
// Clear all syncronizations
|
||||
synchronizations.clear() ;
|
||||
}
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#include "activemq/TransactionContext.hpp"
|
||||
#include "activemq/Session.hpp"
|
||||
|
||||
using namespace apache::activemq;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
TransactionContext::TransactionContext(p<Session> session)
|
||||
{
|
||||
this->session = session ;
|
||||
this->transactionId = NULL ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
TransactionContext::~TransactionContext()
|
||||
{
|
||||
// no-op
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<TransactionId> TransactionContext::getTransactionId()
|
||||
{
|
||||
return transactionId ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void TransactionContext::addSynchronization(p<ISynchronization> synchronization)
|
||||
{
|
||||
synchronizations.push_back(synchronization) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void TransactionContext::begin()
|
||||
{
|
||||
if( transactionId == NULL )
|
||||
{
|
||||
// Create a new local transaction id
|
||||
transactionId = session->getConnection()->createLocalTransactionId() ;
|
||||
|
||||
// Create a new transaction command
|
||||
p<TransactionInfo> info = new TransactionInfo() ;
|
||||
info->setConnectionId( session->getConnection()->getConnectionId() ) ;
|
||||
info->setTransactionId( transactionId ) ;
|
||||
info->setType( BeginTx ) ;
|
||||
|
||||
// Send begin command to broker
|
||||
session->getConnection()->oneway(info) ;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void TransactionContext::commit()
|
||||
{
|
||||
list< p<ISynchronization> >::const_iterator tempIter ;
|
||||
|
||||
// Iterate through each synchronization and call beforeCommit()
|
||||
for( tempIter = synchronizations.begin() ;
|
||||
tempIter != synchronizations.end() ;
|
||||
tempIter++ )
|
||||
{
|
||||
(*tempIter)->beforeCommit() ;
|
||||
}
|
||||
|
||||
if( transactionId != NULL )
|
||||
{
|
||||
// Create a new transaction command
|
||||
p<TransactionInfo> info = new TransactionInfo() ;
|
||||
info->setConnectionId( session->getConnection()->getConnectionId() ) ;
|
||||
info->setTransactionId( transactionId ) ;
|
||||
info->setType( CommitOnePhaseTx ) ;
|
||||
|
||||
// Reset transaction
|
||||
transactionId = NULL ;
|
||||
|
||||
// Send commit command to broker
|
||||
session->getConnection()->oneway(info) ;
|
||||
}
|
||||
|
||||
// Iterate through each synchronization and call afterCommit()
|
||||
for( tempIter = synchronizations.begin() ;
|
||||
tempIter != synchronizations.end() ;
|
||||
tempIter++ )
|
||||
{
|
||||
(*tempIter)->afterCommit() ;
|
||||
}
|
||||
|
||||
// Clear all syncronizations
|
||||
synchronizations.clear() ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void TransactionContext::rollback()
|
||||
{
|
||||
if( transactionId != NULL )
|
||||
{
|
||||
// Create a new transaction command
|
||||
p<TransactionInfo> info = new TransactionInfo() ;
|
||||
info->setConnectionId( session->getConnection()->getConnectionId() ) ;
|
||||
info->setTransactionId( transactionId ) ;
|
||||
info->setType( RollbackTx ) ;
|
||||
|
||||
// Reset transaction
|
||||
transactionId = NULL ;
|
||||
|
||||
// Send rollback command to broker
|
||||
session->getConnection()->oneway(info) ;
|
||||
}
|
||||
|
||||
list< p<ISynchronization> >::const_iterator tempIter ;
|
||||
|
||||
// Iterate through each synchronization and call afterRollback()
|
||||
for( tempIter = synchronizations.begin() ;
|
||||
tempIter != synchronizations.end() ;
|
||||
tempIter++ )
|
||||
{
|
||||
(*tempIter)->afterRollback() ;
|
||||
}
|
||||
// Clear all syncronizations
|
||||
synchronizations.clear() ;
|
||||
}
|
||||
|
|
|
@ -1,61 +1,61 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_TransactionContext_hpp_
|
||||
#define ActiveMQ_TransactionContext_hpp_
|
||||
|
||||
#include <list>
|
||||
#include "activemq/ISynchronization.hpp"
|
||||
#include "activemq/Connection.hpp"
|
||||
#include "activemq/TransactionType.hpp"
|
||||
#include "activemq/command/TransactionId.hpp"
|
||||
#include "activemq/command/TransactionInfo.hpp"
|
||||
#include "ppr/util/ifr/p"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
using namespace ifr;
|
||||
using namespace apache::activemq::command;
|
||||
class Session;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
class TransactionContext
|
||||
{
|
||||
private:
|
||||
p<TransactionId> transactionId ;
|
||||
p<Session> session ;
|
||||
list< p<ISynchronization> > synchronizations ;
|
||||
|
||||
public:
|
||||
TransactionContext(p<Session> session) ;
|
||||
virtual ~TransactionContext() ;
|
||||
|
||||
virtual p<TransactionId> getTransactionId() ;
|
||||
virtual void addSynchronization(p<ISynchronization> synchronization) ;
|
||||
virtual void begin() ;
|
||||
virtual void commit() ;
|
||||
virtual void rollback() ;
|
||||
} ;
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_TransactionContext_hpp_*/
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_TransactionContext_hpp_
|
||||
#define ActiveMQ_TransactionContext_hpp_
|
||||
|
||||
#include <list>
|
||||
#include "activemq/ISynchronization.hpp"
|
||||
#include "activemq/Connection.hpp"
|
||||
#include "activemq/TransactionType.hpp"
|
||||
#include "activemq/command/TransactionId.hpp"
|
||||
#include "activemq/command/TransactionInfo.hpp"
|
||||
#include "ppr/util/ifr/p"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
using namespace ifr;
|
||||
using namespace apache::activemq::command;
|
||||
class Session;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
class TransactionContext
|
||||
{
|
||||
private:
|
||||
p<TransactionId> transactionId ;
|
||||
p<Session> session ;
|
||||
list< p<ISynchronization> > synchronizations ;
|
||||
|
||||
public:
|
||||
TransactionContext(p<Session> session) ;
|
||||
virtual ~TransactionContext() ;
|
||||
|
||||
virtual p<TransactionId> getTransactionId() ;
|
||||
virtual void addSynchronization(p<ISynchronization> synchronization) ;
|
||||
virtual void begin() ;
|
||||
virtual void commit() ;
|
||||
virtual void rollback() ;
|
||||
} ;
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_TransactionContext_hpp_*/
|
||||
|
|
|
@ -1,38 +1,38 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_TransactionType_hpp_
|
||||
#define ActiveMQ_TransactionType_hpp_
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
enum TransactionType
|
||||
{
|
||||
BeginTx = 0,
|
||||
PrepareTx = 1,
|
||||
CommitOnePhaseTx = 2,
|
||||
CommitTwoPhaseTx = 3,
|
||||
RollbackTx = 4,
|
||||
RecoverTx = 5,
|
||||
ForgetTx = 6,
|
||||
EndTx = 7
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_TransactionType_hpp_*/
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_TransactionType_hpp_
|
||||
#define ActiveMQ_TransactionType_hpp_
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
enum TransactionType
|
||||
{
|
||||
BeginTx = 0,
|
||||
PrepareTx = 1,
|
||||
CommitOnePhaseTx = 2,
|
||||
CommitTwoPhaseTx = 3,
|
||||
RollbackTx = 4,
|
||||
RecoverTx = 5,
|
||||
ForgetTx = 6,
|
||||
EndTx = 7
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_TransactionType_hpp_*/
|
||||
|
|
|
@ -1,377 +1,377 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#include "activemq/command/ActiveMQBytesMessage.hpp"
|
||||
|
||||
using namespace apache::activemq::command;
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
ActiveMQBytesMessage::ActiveMQBytesMessage()
|
||||
{
|
||||
this->in = NULL ;
|
||||
this->out = new ByteArrayOutputStream() ;
|
||||
this->readMode = false ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
ActiveMQBytesMessage::ActiveMQBytesMessage(char* body, int size)
|
||||
{
|
||||
// Convert body to SP array
|
||||
array<char> buffer = array<char> (size) ;
|
||||
memcpy(buffer.c_array(), body, size);
|
||||
|
||||
this->in = NULL ;
|
||||
this->out = new ByteArrayOutputStream(buffer) ;
|
||||
this->readMode = false ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
ActiveMQBytesMessage::~ActiveMQBytesMessage()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
unsigned char ActiveMQBytesMessage::getDataStructureType()
|
||||
{
|
||||
return ActiveMQBytesMessage::TYPE ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void ActiveMQBytesMessage::reset()
|
||||
{
|
||||
if( !readMode )
|
||||
{
|
||||
this->in = new ByteArrayInputStream( out->toArray() ) ;
|
||||
this->out = NULL ;
|
||||
this->readMode = true ;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
char ActiveMQBytesMessage::readByte() throw(MessageNotReadableException, MessageEOFException)
|
||||
{
|
||||
// Assert read mode
|
||||
if( !readMode )
|
||||
throw MessageNotReadableException() ;
|
||||
|
||||
try
|
||||
{
|
||||
// Read a single byte
|
||||
return readByte() ;
|
||||
}
|
||||
catch( EOFException eof )
|
||||
{
|
||||
throw MessageEOFException() ;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
int ActiveMQBytesMessage::readBytes(char* buffer, int index, int length) throw (MessageNotReadableException, MessageEOFException)
|
||||
{
|
||||
// Assert read mode
|
||||
if( !readMode )
|
||||
throw MessageNotReadableException() ;
|
||||
|
||||
try
|
||||
{
|
||||
// Read some bytes
|
||||
return in->read(buffer, index, length) ;
|
||||
}
|
||||
catch( EOFException eof )
|
||||
{
|
||||
throw MessageEOFException() ;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
bool ActiveMQBytesMessage::readBoolean() throw(MessageNotReadableException, MessageEOFException)
|
||||
{
|
||||
// Assert read mode
|
||||
if( !readMode )
|
||||
throw MessageNotReadableException() ;
|
||||
|
||||
try
|
||||
{
|
||||
// Read a boolean
|
||||
return in->readBoolean() ;
|
||||
}
|
||||
catch( EOFException eof )
|
||||
{
|
||||
throw MessageEOFException() ;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
double ActiveMQBytesMessage::readDouble() throw(MessageNotReadableException, MessageEOFException)
|
||||
{
|
||||
// Assert read mode
|
||||
if( !readMode )
|
||||
throw MessageNotReadableException() ;
|
||||
|
||||
try
|
||||
{
|
||||
// Read a double
|
||||
return in->readDouble() ;
|
||||
}
|
||||
catch( EOFException eof )
|
||||
{
|
||||
throw MessageEOFException() ;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
float ActiveMQBytesMessage::readFloat() throw(MessageNotReadableException, MessageEOFException)
|
||||
{
|
||||
// Assert read mode
|
||||
if( !readMode )
|
||||
throw MessageNotReadableException() ;
|
||||
|
||||
try
|
||||
{
|
||||
// Read a float
|
||||
return in->readFloat() ;
|
||||
}
|
||||
catch( EOFException eof )
|
||||
{
|
||||
throw MessageEOFException() ;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
short ActiveMQBytesMessage::readShort() throw(MessageNotReadableException, MessageEOFException)
|
||||
{
|
||||
// Assert read mode
|
||||
if( !readMode )
|
||||
throw MessageNotReadableException() ;
|
||||
|
||||
try
|
||||
{
|
||||
// Read a short
|
||||
return in->readShort() ;
|
||||
}
|
||||
catch( EOFException eof )
|
||||
{
|
||||
throw MessageEOFException() ;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
int ActiveMQBytesMessage::readInt() throw(MessageNotReadableException, MessageEOFException)
|
||||
{
|
||||
// Assert read mode
|
||||
if( !readMode )
|
||||
throw MessageNotReadableException() ;
|
||||
|
||||
try
|
||||
{
|
||||
// Read an integer
|
||||
return in->readInt() ;
|
||||
}
|
||||
catch( EOFException eof )
|
||||
{
|
||||
throw MessageEOFException() ;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
long long ActiveMQBytesMessage::readLong() throw(MessageNotReadableException, MessageEOFException)
|
||||
{
|
||||
// Assert read mode
|
||||
if( !readMode )
|
||||
throw MessageNotReadableException() ;
|
||||
|
||||
try
|
||||
{
|
||||
// Read a long long
|
||||
return in->readLong() ;
|
||||
}
|
||||
catch( EOFException eof )
|
||||
{
|
||||
throw MessageEOFException() ;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<string> ActiveMQBytesMessage::readUTF() throw(MessageNotReadableException, MessageEOFException)
|
||||
{
|
||||
// Assert read mode
|
||||
if( !readMode )
|
||||
throw MessageNotReadableException() ;
|
||||
|
||||
try
|
||||
{
|
||||
// Read a string
|
||||
return in->readString() ;
|
||||
}
|
||||
catch( EOFException eof )
|
||||
{
|
||||
throw MessageEOFException() ;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void ActiveMQBytesMessage::writeByte(char value) throw (MessageNotWritableException)
|
||||
{
|
||||
// Assert write mode
|
||||
if( readMode )
|
||||
throw MessageNotWritableException() ;
|
||||
|
||||
// Write a single byte
|
||||
out->writeByte(value) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void ActiveMQBytesMessage::writeBytes(char* value, int index, int length) throw (MessageNotWritableException)
|
||||
{
|
||||
// Assert write mode
|
||||
if( readMode )
|
||||
throw MessageNotWritableException() ;
|
||||
|
||||
// Write some bytes
|
||||
out->write(value, index, length) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void ActiveMQBytesMessage::writeBoolean(bool value) throw (MessageNotWritableException)
|
||||
{
|
||||
// Assert write mode
|
||||
if( readMode )
|
||||
throw MessageNotWritableException() ;
|
||||
|
||||
// Write a boolean
|
||||
out->writeBoolean(value) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void ActiveMQBytesMessage::writeDouble(double value) throw (MessageNotWritableException)
|
||||
{
|
||||
// Assert write mode
|
||||
if( readMode )
|
||||
throw MessageNotWritableException() ;
|
||||
|
||||
// Write a double
|
||||
out->writeDouble(value) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void ActiveMQBytesMessage::writeFloat(float value) throw (MessageNotWritableException)
|
||||
{
|
||||
// Assert write mode
|
||||
if( readMode )
|
||||
throw MessageNotWritableException() ;
|
||||
|
||||
// Write a float
|
||||
out->writeFloat(value) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void ActiveMQBytesMessage::writeInt(int value) throw (MessageNotWritableException)
|
||||
{
|
||||
// Assert write mode
|
||||
if( readMode )
|
||||
throw MessageNotWritableException() ;
|
||||
|
||||
// Write an integer
|
||||
out->writeInt(value) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void ActiveMQBytesMessage::writeLong(long long value) throw (MessageNotWritableException)
|
||||
{
|
||||
// Assert write mode
|
||||
if( readMode )
|
||||
throw MessageNotWritableException() ;
|
||||
|
||||
// Write a long long
|
||||
out->writeLong(value) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void ActiveMQBytesMessage::writeShort(short value) throw (MessageNotWritableException)
|
||||
{
|
||||
// Assert write mode
|
||||
if( readMode )
|
||||
throw MessageNotWritableException() ;
|
||||
|
||||
// Write a short
|
||||
out->writeShort(value) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void ActiveMQBytesMessage::writeUTF(const char* value) throw (MessageNotWritableException)
|
||||
{
|
||||
// Assert write mode
|
||||
if( readMode )
|
||||
throw MessageNotWritableException() ;
|
||||
|
||||
// Write a string
|
||||
p<string> v = new string(value) ;
|
||||
out->writeString(v) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#include "activemq/command/ActiveMQBytesMessage.hpp"
|
||||
|
||||
using namespace apache::activemq::command;
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
ActiveMQBytesMessage::ActiveMQBytesMessage()
|
||||
{
|
||||
this->in = NULL ;
|
||||
this->out = new ByteArrayOutputStream() ;
|
||||
this->readMode = false ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
ActiveMQBytesMessage::ActiveMQBytesMessage(char* body, int size)
|
||||
{
|
||||
// Convert body to SP array
|
||||
array<char> buffer = array<char> (size) ;
|
||||
memcpy(buffer.c_array(), body, size);
|
||||
|
||||
this->in = NULL ;
|
||||
this->out = new ByteArrayOutputStream(buffer) ;
|
||||
this->readMode = false ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
ActiveMQBytesMessage::~ActiveMQBytesMessage()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
unsigned char ActiveMQBytesMessage::getDataStructureType()
|
||||
{
|
||||
return ActiveMQBytesMessage::TYPE ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void ActiveMQBytesMessage::reset()
|
||||
{
|
||||
if( !readMode )
|
||||
{
|
||||
this->in = new ByteArrayInputStream( out->toArray() ) ;
|
||||
this->out = NULL ;
|
||||
this->readMode = true ;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
char ActiveMQBytesMessage::readByte() throw(MessageNotReadableException, MessageEOFException)
|
||||
{
|
||||
// Assert read mode
|
||||
if( !readMode )
|
||||
throw MessageNotReadableException() ;
|
||||
|
||||
try
|
||||
{
|
||||
// Read a single byte
|
||||
return readByte() ;
|
||||
}
|
||||
catch( EOFException eof )
|
||||
{
|
||||
throw MessageEOFException() ;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
int ActiveMQBytesMessage::readBytes(char* buffer, int index, int length) throw (MessageNotReadableException, MessageEOFException)
|
||||
{
|
||||
// Assert read mode
|
||||
if( !readMode )
|
||||
throw MessageNotReadableException() ;
|
||||
|
||||
try
|
||||
{
|
||||
// Read some bytes
|
||||
return in->read(buffer, index, length) ;
|
||||
}
|
||||
catch( EOFException eof )
|
||||
{
|
||||
throw MessageEOFException() ;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
bool ActiveMQBytesMessage::readBoolean() throw(MessageNotReadableException, MessageEOFException)
|
||||
{
|
||||
// Assert read mode
|
||||
if( !readMode )
|
||||
throw MessageNotReadableException() ;
|
||||
|
||||
try
|
||||
{
|
||||
// Read a boolean
|
||||
return in->readBoolean() ;
|
||||
}
|
||||
catch( EOFException eof )
|
||||
{
|
||||
throw MessageEOFException() ;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
double ActiveMQBytesMessage::readDouble() throw(MessageNotReadableException, MessageEOFException)
|
||||
{
|
||||
// Assert read mode
|
||||
if( !readMode )
|
||||
throw MessageNotReadableException() ;
|
||||
|
||||
try
|
||||
{
|
||||
// Read a double
|
||||
return in->readDouble() ;
|
||||
}
|
||||
catch( EOFException eof )
|
||||
{
|
||||
throw MessageEOFException() ;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
float ActiveMQBytesMessage::readFloat() throw(MessageNotReadableException, MessageEOFException)
|
||||
{
|
||||
// Assert read mode
|
||||
if( !readMode )
|
||||
throw MessageNotReadableException() ;
|
||||
|
||||
try
|
||||
{
|
||||
// Read a float
|
||||
return in->readFloat() ;
|
||||
}
|
||||
catch( EOFException eof )
|
||||
{
|
||||
throw MessageEOFException() ;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
short ActiveMQBytesMessage::readShort() throw(MessageNotReadableException, MessageEOFException)
|
||||
{
|
||||
// Assert read mode
|
||||
if( !readMode )
|
||||
throw MessageNotReadableException() ;
|
||||
|
||||
try
|
||||
{
|
||||
// Read a short
|
||||
return in->readShort() ;
|
||||
}
|
||||
catch( EOFException eof )
|
||||
{
|
||||
throw MessageEOFException() ;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
int ActiveMQBytesMessage::readInt() throw(MessageNotReadableException, MessageEOFException)
|
||||
{
|
||||
// Assert read mode
|
||||
if( !readMode )
|
||||
throw MessageNotReadableException() ;
|
||||
|
||||
try
|
||||
{
|
||||
// Read an integer
|
||||
return in->readInt() ;
|
||||
}
|
||||
catch( EOFException eof )
|
||||
{
|
||||
throw MessageEOFException() ;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
long long ActiveMQBytesMessage::readLong() throw(MessageNotReadableException, MessageEOFException)
|
||||
{
|
||||
// Assert read mode
|
||||
if( !readMode )
|
||||
throw MessageNotReadableException() ;
|
||||
|
||||
try
|
||||
{
|
||||
// Read a long long
|
||||
return in->readLong() ;
|
||||
}
|
||||
catch( EOFException eof )
|
||||
{
|
||||
throw MessageEOFException() ;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<string> ActiveMQBytesMessage::readUTF() throw(MessageNotReadableException, MessageEOFException)
|
||||
{
|
||||
// Assert read mode
|
||||
if( !readMode )
|
||||
throw MessageNotReadableException() ;
|
||||
|
||||
try
|
||||
{
|
||||
// Read a string
|
||||
return in->readString() ;
|
||||
}
|
||||
catch( EOFException eof )
|
||||
{
|
||||
throw MessageEOFException() ;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void ActiveMQBytesMessage::writeByte(char value) throw (MessageNotWritableException)
|
||||
{
|
||||
// Assert write mode
|
||||
if( readMode )
|
||||
throw MessageNotWritableException() ;
|
||||
|
||||
// Write a single byte
|
||||
out->writeByte(value) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void ActiveMQBytesMessage::writeBytes(char* value, int index, int length) throw (MessageNotWritableException)
|
||||
{
|
||||
// Assert write mode
|
||||
if( readMode )
|
||||
throw MessageNotWritableException() ;
|
||||
|
||||
// Write some bytes
|
||||
out->write(value, index, length) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void ActiveMQBytesMessage::writeBoolean(bool value) throw (MessageNotWritableException)
|
||||
{
|
||||
// Assert write mode
|
||||
if( readMode )
|
||||
throw MessageNotWritableException() ;
|
||||
|
||||
// Write a boolean
|
||||
out->writeBoolean(value) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void ActiveMQBytesMessage::writeDouble(double value) throw (MessageNotWritableException)
|
||||
{
|
||||
// Assert write mode
|
||||
if( readMode )
|
||||
throw MessageNotWritableException() ;
|
||||
|
||||
// Write a double
|
||||
out->writeDouble(value) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void ActiveMQBytesMessage::writeFloat(float value) throw (MessageNotWritableException)
|
||||
{
|
||||
// Assert write mode
|
||||
if( readMode )
|
||||
throw MessageNotWritableException() ;
|
||||
|
||||
// Write a float
|
||||
out->writeFloat(value) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void ActiveMQBytesMessage::writeInt(int value) throw (MessageNotWritableException)
|
||||
{
|
||||
// Assert write mode
|
||||
if( readMode )
|
||||
throw MessageNotWritableException() ;
|
||||
|
||||
// Write an integer
|
||||
out->writeInt(value) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void ActiveMQBytesMessage::writeLong(long long value) throw (MessageNotWritableException)
|
||||
{
|
||||
// Assert write mode
|
||||
if( readMode )
|
||||
throw MessageNotWritableException() ;
|
||||
|
||||
// Write a long long
|
||||
out->writeLong(value) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void ActiveMQBytesMessage::writeShort(short value) throw (MessageNotWritableException)
|
||||
{
|
||||
// Assert write mode
|
||||
if( readMode )
|
||||
throw MessageNotWritableException() ;
|
||||
|
||||
// Write a short
|
||||
out->writeShort(value) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void ActiveMQBytesMessage::writeUTF(const char* value) throw (MessageNotWritableException)
|
||||
{
|
||||
// Assert write mode
|
||||
if( readMode )
|
||||
throw MessageNotWritableException() ;
|
||||
|
||||
// Write a string
|
||||
p<string> v = new string(value) ;
|
||||
out->writeString(v) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
int ActiveMQBytesMessage::marshal(p<IMarshaller> marshaller, int mode, p<IOutputStream> writer) throw (IOException)
|
||||
{
|
||||
int size = 0 ;
|
||||
|
@ -388,9 +388,9 @@ int ActiveMQBytesMessage::marshal(p<IMarshaller> marshaller, int mode, p<IOutput
|
|||
return size ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void ActiveMQBytesMessage::unmarshal(p<IMarshaller> marshaller, int mode, p<IInputStream> reader) throw (IOException)
|
||||
{
|
||||
// Note! Message content unmarshalling is done in super class
|
||||
|
|
|
@ -1,181 +1,181 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_ActiveMQBytesMessage_hpp_
|
||||
#define ActiveMQ_ActiveMQBytesMessage_hpp_
|
||||
|
||||
// Turn off warning message for ignored exception specification
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning( disable : 4290 )
|
||||
#endif
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include "cms/IBytesMessage.hpp"
|
||||
#include "cms/MessageEOFException.hpp"
|
||||
#include "cms/MessageNotWritableException.hpp"
|
||||
#include "activemq/command/ActiveMQMessage.hpp"
|
||||
#include "ppr/io/ByteArrayInputStream.hpp"
|
||||
#include "ppr/io/ByteArrayOutputStream.hpp"
|
||||
#include "ppr/io/EOFException.hpp"
|
||||
#include "ppr/util/Endian.hpp"
|
||||
#include "ppr/util/MapItemHolder.hpp"
|
||||
#include "ppr/util/ifr/array"
|
||||
#include "ppr/util/ifr/p"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
namespace command
|
||||
{
|
||||
using namespace ifr;
|
||||
using namespace apache::cms;
|
||||
using namespace apache::ppr::io;
|
||||
using namespace apache::ppr::util;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
class ActiveMQBytesMessage : public ActiveMQMessage , public IBytesMessage
|
||||
{
|
||||
private:
|
||||
p<ByteArrayInputStream> in ;
|
||||
p<ByteArrayOutputStream> out ;
|
||||
bool readMode ;
|
||||
|
||||
const static int INITIAL_SIZE = 256 ;
|
||||
const static int EXPAND_SIZE = 128 ;
|
||||
|
||||
public:
|
||||
const static unsigned char TYPE = 24 ;
|
||||
|
||||
public:
|
||||
ActiveMQBytesMessage() ;
|
||||
ActiveMQBytesMessage(char* body, int size) ;
|
||||
virtual ~ActiveMQBytesMessage() ;
|
||||
|
||||
virtual unsigned char getDataStructureType() ;
|
||||
|
||||
virtual void reset() ;
|
||||
virtual char readByte() throw (MessageNotReadableException, MessageEOFException) ;
|
||||
virtual int readBytes(char* buffer, int index, int length) throw (MessageNotReadableException, MessageEOFException) ;
|
||||
virtual bool readBoolean() throw (MessageNotReadableException, MessageEOFException) ;
|
||||
virtual double readDouble() throw (MessageNotReadableException, MessageEOFException) ;
|
||||
virtual float readFloat() throw (MessageNotReadableException, MessageEOFException) ;
|
||||
virtual int readInt() throw (MessageNotReadableException, MessageEOFException) ;
|
||||
virtual long long readLong() throw (MessageNotReadableException, MessageEOFException) ;
|
||||
virtual short readShort() throw (MessageNotReadableException, MessageEOFException) ;
|
||||
virtual p<string> readUTF() throw (MessageNotReadableException, MessageEOFException) ;
|
||||
virtual void writeBoolean(bool value) throw (MessageNotWritableException) ;
|
||||
virtual void writeByte(char value) throw (MessageNotWritableException) ;
|
||||
virtual void writeBytes(char* value, int index, int length) throw (MessageNotWritableException) ;
|
||||
virtual void writeDouble(double value) throw (MessageNotWritableException) ;
|
||||
virtual void writeFloat(float value) throw (MessageNotWritableException) ;
|
||||
virtual void writeInt(int value) throw (MessageNotWritableException) ;
|
||||
virtual void writeLong(long long value) throw (MessageNotWritableException) ;
|
||||
virtual void writeShort(short value) throw (MessageNotWritableException) ;
|
||||
virtual void writeUTF(const char* value) throw (MessageNotWritableException) ;
|
||||
|
||||
virtual int marshal(p<IMarshaller> marshaller, int mode, p<IOutputStream> writer) throw (IOException) ;
|
||||
virtual void unmarshal(p<IMarshaller> marshaller, int mode, p<IInputStream> reader) throw (IOException) ;
|
||||
|
||||
//
|
||||
// The methods below are needed to resolve the multiple
|
||||
// inheritance of IMessage.
|
||||
virtual void acknowledge() {
|
||||
ActiveMQMessage::acknowledge() ;
|
||||
} ;
|
||||
virtual p<PropertyMap> getProperties() {
|
||||
return ActiveMQMessage::getProperties() ;
|
||||
} ;
|
||||
virtual p<string> getJMSCorrelationID() {
|
||||
return ActiveMQMessage::getJMSCorrelationID() ;
|
||||
} ;
|
||||
virtual void setJMSCorrelationID(const char* correlationId) {
|
||||
return ActiveMQMessage::setJMSCorrelationID(correlationId) ;
|
||||
} ;
|
||||
virtual p<IDestination> getJMSDestination() {
|
||||
return ActiveMQMessage::getJMSDestination() ;
|
||||
} ;
|
||||
virtual long long getJMSExpiration() {
|
||||
return ActiveMQMessage::getJMSExpiration() ;
|
||||
} ;
|
||||
virtual void setJMSExpiration(long long time) {
|
||||
return ActiveMQMessage::setJMSExpiration(time) ;
|
||||
} ;
|
||||
virtual p<string> getJMSMessageID() {
|
||||
return ActiveMQMessage::getJMSMessageID() ;
|
||||
} ;
|
||||
virtual bool getJMSPersistent() {
|
||||
return ActiveMQMessage::getJMSPersistent() ;
|
||||
} ;
|
||||
virtual void setJMSPersistent(bool persistent) {
|
||||
return ActiveMQMessage::setJMSPersistent(persistent) ;
|
||||
} ;
|
||||
virtual unsigned char getJMSPriority() {
|
||||
return ActiveMQMessage::getJMSPriority() ;
|
||||
} ;
|
||||
virtual void setJMSPriority(unsigned char priority) {
|
||||
return ActiveMQMessage::setJMSPriority(priority) ;
|
||||
} ;
|
||||
virtual bool getJMSRedelivered() {
|
||||
return ActiveMQMessage::getJMSRedelivered() ;
|
||||
} ;
|
||||
virtual p<IDestination> getJMSReplyTo() {
|
||||
return ActiveMQMessage::getJMSReplyTo() ;
|
||||
} ;
|
||||
virtual void setJMSReplyTo(p<IDestination> destination) {
|
||||
return ActiveMQMessage::setJMSReplyTo(destination) ;
|
||||
} ;
|
||||
virtual long long getJMSTimestamp() {
|
||||
return ActiveMQMessage::getJMSTimestamp() ;
|
||||
} ;
|
||||
virtual p<string> getJMSType() {
|
||||
return ActiveMQMessage::getJMSType() ;
|
||||
} ;
|
||||
virtual void setJMSType(const char* type) {
|
||||
return ActiveMQMessage::setJMSType(type) ;
|
||||
} ;
|
||||
virtual int getJMSXDeliveryCount() {
|
||||
return ActiveMQMessage::getJMSXDeliveryCount() ;
|
||||
} ;
|
||||
virtual p<string> getJMSXGroupID() {
|
||||
return ActiveMQMessage::getJMSXGroupID() ;
|
||||
} ;
|
||||
virtual void setJMSXGroupID(const char* groupId) {
|
||||
return ActiveMQMessage::setJMSXGroupID(groupId) ;
|
||||
} ;
|
||||
virtual int getJMSXGroupSeq() {
|
||||
return ActiveMQMessage::getJMSXGroupSeq() ;
|
||||
} ;
|
||||
virtual void setJMSXGroupSeq(int sequence) {
|
||||
return ActiveMQMessage::setJMSXGroupSeq(sequence) ;
|
||||
} ;
|
||||
virtual p<string> getJMSXProducerTxID() {
|
||||
return ActiveMQMessage::getJMSXProducerTxID() ;
|
||||
} ;
|
||||
|
||||
//private:
|
||||
// void expandBody() ;
|
||||
} ;
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_ActiveMQBytesMessage_hpp_*/
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_ActiveMQBytesMessage_hpp_
|
||||
#define ActiveMQ_ActiveMQBytesMessage_hpp_
|
||||
|
||||
// Turn off warning message for ignored exception specification
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning( disable : 4290 )
|
||||
#endif
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include "cms/IBytesMessage.hpp"
|
||||
#include "cms/MessageEOFException.hpp"
|
||||
#include "cms/MessageNotWritableException.hpp"
|
||||
#include "activemq/command/ActiveMQMessage.hpp"
|
||||
#include "ppr/io/ByteArrayInputStream.hpp"
|
||||
#include "ppr/io/ByteArrayOutputStream.hpp"
|
||||
#include "ppr/io/EOFException.hpp"
|
||||
#include "ppr/util/Endian.hpp"
|
||||
#include "ppr/util/MapItemHolder.hpp"
|
||||
#include "ppr/util/ifr/array"
|
||||
#include "ppr/util/ifr/p"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
namespace command
|
||||
{
|
||||
using namespace ifr;
|
||||
using namespace apache::cms;
|
||||
using namespace apache::ppr::io;
|
||||
using namespace apache::ppr::util;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
class ActiveMQBytesMessage : public ActiveMQMessage , public IBytesMessage
|
||||
{
|
||||
private:
|
||||
p<ByteArrayInputStream> in ;
|
||||
p<ByteArrayOutputStream> out ;
|
||||
bool readMode ;
|
||||
|
||||
const static int INITIAL_SIZE = 256 ;
|
||||
const static int EXPAND_SIZE = 128 ;
|
||||
|
||||
public:
|
||||
const static unsigned char TYPE = 24 ;
|
||||
|
||||
public:
|
||||
ActiveMQBytesMessage() ;
|
||||
ActiveMQBytesMessage(char* body, int size) ;
|
||||
virtual ~ActiveMQBytesMessage() ;
|
||||
|
||||
virtual unsigned char getDataStructureType() ;
|
||||
|
||||
virtual void reset() ;
|
||||
virtual char readByte() throw (MessageNotReadableException, MessageEOFException) ;
|
||||
virtual int readBytes(char* buffer, int index, int length) throw (MessageNotReadableException, MessageEOFException) ;
|
||||
virtual bool readBoolean() throw (MessageNotReadableException, MessageEOFException) ;
|
||||
virtual double readDouble() throw (MessageNotReadableException, MessageEOFException) ;
|
||||
virtual float readFloat() throw (MessageNotReadableException, MessageEOFException) ;
|
||||
virtual int readInt() throw (MessageNotReadableException, MessageEOFException) ;
|
||||
virtual long long readLong() throw (MessageNotReadableException, MessageEOFException) ;
|
||||
virtual short readShort() throw (MessageNotReadableException, MessageEOFException) ;
|
||||
virtual p<string> readUTF() throw (MessageNotReadableException, MessageEOFException) ;
|
||||
virtual void writeBoolean(bool value) throw (MessageNotWritableException) ;
|
||||
virtual void writeByte(char value) throw (MessageNotWritableException) ;
|
||||
virtual void writeBytes(char* value, int index, int length) throw (MessageNotWritableException) ;
|
||||
virtual void writeDouble(double value) throw (MessageNotWritableException) ;
|
||||
virtual void writeFloat(float value) throw (MessageNotWritableException) ;
|
||||
virtual void writeInt(int value) throw (MessageNotWritableException) ;
|
||||
virtual void writeLong(long long value) throw (MessageNotWritableException) ;
|
||||
virtual void writeShort(short value) throw (MessageNotWritableException) ;
|
||||
virtual void writeUTF(const char* value) throw (MessageNotWritableException) ;
|
||||
|
||||
virtual int marshal(p<IMarshaller> marshaller, int mode, p<IOutputStream> writer) throw (IOException) ;
|
||||
virtual void unmarshal(p<IMarshaller> marshaller, int mode, p<IInputStream> reader) throw (IOException) ;
|
||||
|
||||
//
|
||||
// The methods below are needed to resolve the multiple
|
||||
// inheritance of IMessage.
|
||||
virtual void acknowledge() {
|
||||
ActiveMQMessage::acknowledge() ;
|
||||
} ;
|
||||
virtual p<PropertyMap> getProperties() {
|
||||
return ActiveMQMessage::getProperties() ;
|
||||
} ;
|
||||
virtual p<string> getJMSCorrelationID() {
|
||||
return ActiveMQMessage::getJMSCorrelationID() ;
|
||||
} ;
|
||||
virtual void setJMSCorrelationID(const char* correlationId) {
|
||||
return ActiveMQMessage::setJMSCorrelationID(correlationId) ;
|
||||
} ;
|
||||
virtual p<IDestination> getJMSDestination() {
|
||||
return ActiveMQMessage::getJMSDestination() ;
|
||||
} ;
|
||||
virtual long long getJMSExpiration() {
|
||||
return ActiveMQMessage::getJMSExpiration() ;
|
||||
} ;
|
||||
virtual void setJMSExpiration(long long time) {
|
||||
return ActiveMQMessage::setJMSExpiration(time) ;
|
||||
} ;
|
||||
virtual p<string> getJMSMessageID() {
|
||||
return ActiveMQMessage::getJMSMessageID() ;
|
||||
} ;
|
||||
virtual bool getJMSPersistent() {
|
||||
return ActiveMQMessage::getJMSPersistent() ;
|
||||
} ;
|
||||
virtual void setJMSPersistent(bool persistent) {
|
||||
return ActiveMQMessage::setJMSPersistent(persistent) ;
|
||||
} ;
|
||||
virtual unsigned char getJMSPriority() {
|
||||
return ActiveMQMessage::getJMSPriority() ;
|
||||
} ;
|
||||
virtual void setJMSPriority(unsigned char priority) {
|
||||
return ActiveMQMessage::setJMSPriority(priority) ;
|
||||
} ;
|
||||
virtual bool getJMSRedelivered() {
|
||||
return ActiveMQMessage::getJMSRedelivered() ;
|
||||
} ;
|
||||
virtual p<IDestination> getJMSReplyTo() {
|
||||
return ActiveMQMessage::getJMSReplyTo() ;
|
||||
} ;
|
||||
virtual void setJMSReplyTo(p<IDestination> destination) {
|
||||
return ActiveMQMessage::setJMSReplyTo(destination) ;
|
||||
} ;
|
||||
virtual long long getJMSTimestamp() {
|
||||
return ActiveMQMessage::getJMSTimestamp() ;
|
||||
} ;
|
||||
virtual p<string> getJMSType() {
|
||||
return ActiveMQMessage::getJMSType() ;
|
||||
} ;
|
||||
virtual void setJMSType(const char* type) {
|
||||
return ActiveMQMessage::setJMSType(type) ;
|
||||
} ;
|
||||
virtual int getJMSXDeliveryCount() {
|
||||
return ActiveMQMessage::getJMSXDeliveryCount() ;
|
||||
} ;
|
||||
virtual p<string> getJMSXGroupID() {
|
||||
return ActiveMQMessage::getJMSXGroupID() ;
|
||||
} ;
|
||||
virtual void setJMSXGroupID(const char* groupId) {
|
||||
return ActiveMQMessage::setJMSXGroupID(groupId) ;
|
||||
} ;
|
||||
virtual int getJMSXGroupSeq() {
|
||||
return ActiveMQMessage::getJMSXGroupSeq() ;
|
||||
} ;
|
||||
virtual void setJMSXGroupSeq(int sequence) {
|
||||
return ActiveMQMessage::setJMSXGroupSeq(sequence) ;
|
||||
} ;
|
||||
virtual p<string> getJMSXProducerTxID() {
|
||||
return ActiveMQMessage::getJMSXProducerTxID() ;
|
||||
} ;
|
||||
|
||||
//private:
|
||||
// void expandBody() ;
|
||||
} ;
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_ActiveMQBytesMessage_hpp_*/
|
||||
|
|
|
@ -1,352 +1,352 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#include "activemq/DestinationFilter.hpp"
|
||||
#include "activemq/command/ActiveMQDestination.hpp"
|
||||
#include "activemq/command/ActiveMQTempQueue.hpp"
|
||||
#include "activemq/command/ActiveMQTempTopic.hpp"
|
||||
#include "activemq/command/ActiveMQQueue.hpp"
|
||||
#include "activemq/command/ActiveMQTopic.hpp"
|
||||
|
||||
using namespace apache::activemq::command;
|
||||
|
||||
|
||||
// --- Static initialization ----------------------------------------
|
||||
|
||||
const char* ActiveMQDestination::ADVISORY_PREFIX = "ActiveMQ.Advisory." ;
|
||||
const char* ActiveMQDestination::CONSUMER_ADVISORY_PREFIX = "ActiveMQ.Advisory.Consumers." ;
|
||||
const char* ActiveMQDestination::PRODUCER_ADVISORY_PREFIX = "ActiveMQ.Advisory.Producers." ;
|
||||
const char* ActiveMQDestination::CONNECTION_ADVISORY_PREFIX = "ActiveMQ.Advisory.Connections." ;
|
||||
const char* ActiveMQDestination::DEFAULT_ORDERED_TARGET = "coordinator" ;
|
||||
|
||||
const char* ActiveMQDestination::TEMP_PREFIX = "{TD{" ;
|
||||
const char* ActiveMQDestination::TEMP_POSTFIX = "}TD}" ;
|
||||
const char* ActiveMQDestination::COMPOSITE_SEPARATOR = "," ;
|
||||
const char* ActiveMQDestination::QUEUE_PREFIX = "queue://" ;
|
||||
const char* ActiveMQDestination::TOPIC_PREFIX = "topic://" ;
|
||||
|
||||
|
||||
/*
|
||||
* Default constructor
|
||||
*/
|
||||
ActiveMQDestination::ActiveMQDestination()
|
||||
{
|
||||
orderedTarget = new string(DEFAULT_ORDERED_TARGET) ;
|
||||
physicalName = new string("") ;
|
||||
exclusive = false ;
|
||||
ordered = false ;
|
||||
advisory = false ;
|
||||
}
|
||||
|
||||
/*
|
||||
* Constructs the destination with a specified physical name.
|
||||
*
|
||||
* @param name the physical name for the destination.
|
||||
*/
|
||||
ActiveMQDestination::ActiveMQDestination(const char* name)
|
||||
{
|
||||
orderedTarget = new string(DEFAULT_ORDERED_TARGET) ;
|
||||
physicalName = new string(name) ;
|
||||
exclusive = false ;
|
||||
ordered = false ;
|
||||
advisory = ( name != NULL && (physicalName->find(ADVISORY_PREFIX) == 0)) ? true : false ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
ActiveMQDestination::~ActiveMQDestination()
|
||||
{
|
||||
// no-op
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
bool ActiveMQDestination::isAdvisory()
|
||||
{
|
||||
return advisory ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void ActiveMQDestination::setAdvisory(bool advisory)
|
||||
{
|
||||
this->advisory = advisory ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
bool ActiveMQDestination::isConsumerAdvisory()
|
||||
{
|
||||
return ( isAdvisory() && (physicalName->find(CONSUMER_ADVISORY_PREFIX) == 0) ) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
bool ActiveMQDestination::isProducerAdvisory()
|
||||
{
|
||||
return ( isAdvisory() && (physicalName->find(PRODUCER_ADVISORY_PREFIX) == 0) ) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
bool ActiveMQDestination::isConnectionAdvisory()
|
||||
{
|
||||
return ( isAdvisory() && (physicalName->find(CONNECTION_ADVISORY_PREFIX) == 0) ) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
bool ActiveMQDestination::isExclusive()
|
||||
{
|
||||
return exclusive ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void ActiveMQDestination::setExclusive(bool exclusive)
|
||||
{
|
||||
this->exclusive = exclusive ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
bool ActiveMQDestination::isOrdered()
|
||||
{
|
||||
return ordered ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void ActiveMQDestination::setOrdered(bool ordered)
|
||||
{
|
||||
this->ordered = ordered ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<string> ActiveMQDestination::getOrderedTarget()
|
||||
{
|
||||
return orderedTarget ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void ActiveMQDestination::setOrderedTarget(const char* target)
|
||||
{
|
||||
this->orderedTarget->assign(target) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<string> ActiveMQDestination::getPhysicalName()
|
||||
{
|
||||
return physicalName ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void ActiveMQDestination::setPhysicalName(const char* name)
|
||||
{
|
||||
physicalName->assign(name) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
bool ActiveMQDestination::isTopic()
|
||||
{
|
||||
return ( getDestinationType() == ACTIVEMQ_TOPIC ||
|
||||
getDestinationType() == ACTIVEMQ_TEMPORARY_TOPIC ) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
bool ActiveMQDestination::isQueue()
|
||||
{
|
||||
return !isTopic() ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
bool ActiveMQDestination::isTemporary()
|
||||
{
|
||||
return ( getDestinationType() == ACTIVEMQ_TEMPORARY_TOPIC ||
|
||||
getDestinationType() == ACTIVEMQ_TEMPORARY_QUEUE ) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
bool ActiveMQDestination::isComposite()
|
||||
{
|
||||
return ( physicalName->find(ActiveMQDestination::COMPOSITE_SEPARATOR) > 0 ) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
bool ActiveMQDestination::isWildcard()
|
||||
{
|
||||
if( physicalName != NULL )
|
||||
{
|
||||
return ( physicalName->find( DestinationFilter::ANY_CHILD ) >= 0 ||
|
||||
physicalName->find( DestinationFilter::ANY_DESCENDENT ) >= 0 ) ;
|
||||
}
|
||||
return false ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<string> ActiveMQDestination::toString()
|
||||
{
|
||||
return physicalName ;
|
||||
}
|
||||
|
||||
// --- Static methods ---------------------------------------------
|
||||
|
||||
/*
|
||||
* A helper method to return a descriptive string for the topic or queue.
|
||||
*/
|
||||
p<string> ActiveMQDestination::inspect(p<ActiveMQDestination> destination)
|
||||
{
|
||||
p<string> description = new string() ;
|
||||
|
||||
if( typeid(*destination) == typeid(ITopic) )
|
||||
description->assign("Topic(") ;
|
||||
else
|
||||
description->assign("Queue(") ;
|
||||
|
||||
description->append( destination->toString()->c_str() ) ;
|
||||
description->append(")") ;
|
||||
|
||||
return description ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
/*p<ActiveMQDestination> ActiveMQDestination::transform(p<IDestination> destination)
|
||||
{
|
||||
p<ActiveMQDestination> result = NULL ;
|
||||
|
||||
if( destination != NULL )
|
||||
{
|
||||
if( typeid(*destination) == typeid(ActiveMQDestination) )
|
||||
result = p_cast<ActiveMQDestination> (destination) ;
|
||||
|
||||
else
|
||||
{
|
||||
if( typeid(ITopic).before(typeid(IDestination)) )
|
||||
result = new ActiveMQTopic( (p_cast<ITopic> (destination))->getTopicName()->c_str() ) ;
|
||||
|
||||
else if( typeid(*destination).before(typeid(IQueue)) )
|
||||
result = new ActiveMQQueue( (p_cast<IQueue> (destination))->getQueueName()->c_str() ) ;
|
||||
|
||||
else if( typeid(ITemporaryQueue).before(typeid(*destination)) )
|
||||
result = new ActiveMQTempQueue( (p_cast<IQueue> (destination))->getQueueName()->c_str() ) ;
|
||||
|
||||
else if( typeid(ITemporaryTopic).before(typeid(*destination)) )
|
||||
result = new ActiveMQTempTopic( (p_cast<ITopic> (destination))->getTopicName()->c_str() ) ;
|
||||
|
||||
}
|
||||
}
|
||||
return result ;
|
||||
}*/
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<ActiveMQDestination> ActiveMQDestination::createDestination(int type, const char* physicalName)
|
||||
{
|
||||
p<ActiveMQDestination> result = NULL ;
|
||||
|
||||
if( type == ActiveMQDestination::ACTIVEMQ_TOPIC )
|
||||
result = new ActiveMQTopic(physicalName) ;
|
||||
|
||||
else if( type == ActiveMQDestination::ACTIVEMQ_TEMPORARY_TOPIC )
|
||||
result = new ActiveMQTempTopic(physicalName) ;
|
||||
|
||||
else if (type == ActiveMQDestination::ACTIVEMQ_QUEUE)
|
||||
result = new ActiveMQQueue(physicalName) ;
|
||||
|
||||
else
|
||||
result = new ActiveMQTempQueue(physicalName) ;
|
||||
|
||||
return result ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<string> ActiveMQDestination::createTemporaryName(const char* clientId)
|
||||
{
|
||||
p<string> tempName = new string() ;
|
||||
|
||||
tempName->assign( ActiveMQDestination::TEMP_PREFIX ) ;
|
||||
tempName->append(clientId) ;
|
||||
tempName->append( ActiveMQDestination::TEMP_POSTFIX ) ;
|
||||
|
||||
return tempName ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<string> ActiveMQDestination::getClientId(p<ActiveMQDestination> destination)
|
||||
{
|
||||
p<string> answer = NULL ;
|
||||
|
||||
if( destination != NULL && destination->isTemporary() )
|
||||
{
|
||||
p<string> name = destination->getPhysicalName() ;
|
||||
int start = (int)name->find(TEMP_PREFIX),
|
||||
stop ;
|
||||
|
||||
if( start >= 0 )
|
||||
{
|
||||
start += (int)strlen(TEMP_PREFIX) ;
|
||||
stop = (int)name->find_last_of(TEMP_POSTFIX) ;
|
||||
|
||||
if( stop > start && stop < (int)name->length() )
|
||||
answer->assign( name->substr(start, stop) ) ;
|
||||
}
|
||||
}
|
||||
return answer;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#include "activemq/DestinationFilter.hpp"
|
||||
#include "activemq/command/ActiveMQDestination.hpp"
|
||||
#include "activemq/command/ActiveMQTempQueue.hpp"
|
||||
#include "activemq/command/ActiveMQTempTopic.hpp"
|
||||
#include "activemq/command/ActiveMQQueue.hpp"
|
||||
#include "activemq/command/ActiveMQTopic.hpp"
|
||||
|
||||
using namespace apache::activemq::command;
|
||||
|
||||
|
||||
// --- Static initialization ----------------------------------------
|
||||
|
||||
const char* ActiveMQDestination::ADVISORY_PREFIX = "ActiveMQ.Advisory." ;
|
||||
const char* ActiveMQDestination::CONSUMER_ADVISORY_PREFIX = "ActiveMQ.Advisory.Consumers." ;
|
||||
const char* ActiveMQDestination::PRODUCER_ADVISORY_PREFIX = "ActiveMQ.Advisory.Producers." ;
|
||||
const char* ActiveMQDestination::CONNECTION_ADVISORY_PREFIX = "ActiveMQ.Advisory.Connections." ;
|
||||
const char* ActiveMQDestination::DEFAULT_ORDERED_TARGET = "coordinator" ;
|
||||
|
||||
const char* ActiveMQDestination::TEMP_PREFIX = "{TD{" ;
|
||||
const char* ActiveMQDestination::TEMP_POSTFIX = "}TD}" ;
|
||||
const char* ActiveMQDestination::COMPOSITE_SEPARATOR = "," ;
|
||||
const char* ActiveMQDestination::QUEUE_PREFIX = "queue://" ;
|
||||
const char* ActiveMQDestination::TOPIC_PREFIX = "topic://" ;
|
||||
|
||||
|
||||
/*
|
||||
* Default constructor
|
||||
*/
|
||||
ActiveMQDestination::ActiveMQDestination()
|
||||
{
|
||||
orderedTarget = new string(DEFAULT_ORDERED_TARGET) ;
|
||||
physicalName = new string("") ;
|
||||
exclusive = false ;
|
||||
ordered = false ;
|
||||
advisory = false ;
|
||||
}
|
||||
|
||||
/*
|
||||
* Constructs the destination with a specified physical name.
|
||||
*
|
||||
* @param name the physical name for the destination.
|
||||
*/
|
||||
ActiveMQDestination::ActiveMQDestination(const char* name)
|
||||
{
|
||||
orderedTarget = new string(DEFAULT_ORDERED_TARGET) ;
|
||||
physicalName = new string(name) ;
|
||||
exclusive = false ;
|
||||
ordered = false ;
|
||||
advisory = ( name != NULL && (physicalName->find(ADVISORY_PREFIX) == 0)) ? true : false ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
ActiveMQDestination::~ActiveMQDestination()
|
||||
{
|
||||
// no-op
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
bool ActiveMQDestination::isAdvisory()
|
||||
{
|
||||
return advisory ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void ActiveMQDestination::setAdvisory(bool advisory)
|
||||
{
|
||||
this->advisory = advisory ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
bool ActiveMQDestination::isConsumerAdvisory()
|
||||
{
|
||||
return ( isAdvisory() && (physicalName->find(CONSUMER_ADVISORY_PREFIX) == 0) ) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
bool ActiveMQDestination::isProducerAdvisory()
|
||||
{
|
||||
return ( isAdvisory() && (physicalName->find(PRODUCER_ADVISORY_PREFIX) == 0) ) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
bool ActiveMQDestination::isConnectionAdvisory()
|
||||
{
|
||||
return ( isAdvisory() && (physicalName->find(CONNECTION_ADVISORY_PREFIX) == 0) ) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
bool ActiveMQDestination::isExclusive()
|
||||
{
|
||||
return exclusive ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void ActiveMQDestination::setExclusive(bool exclusive)
|
||||
{
|
||||
this->exclusive = exclusive ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
bool ActiveMQDestination::isOrdered()
|
||||
{
|
||||
return ordered ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void ActiveMQDestination::setOrdered(bool ordered)
|
||||
{
|
||||
this->ordered = ordered ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<string> ActiveMQDestination::getOrderedTarget()
|
||||
{
|
||||
return orderedTarget ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void ActiveMQDestination::setOrderedTarget(const char* target)
|
||||
{
|
||||
this->orderedTarget->assign(target) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<string> ActiveMQDestination::getPhysicalName()
|
||||
{
|
||||
return physicalName ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void ActiveMQDestination::setPhysicalName(const char* name)
|
||||
{
|
||||
physicalName->assign(name) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
bool ActiveMQDestination::isTopic()
|
||||
{
|
||||
return ( getDestinationType() == ACTIVEMQ_TOPIC ||
|
||||
getDestinationType() == ACTIVEMQ_TEMPORARY_TOPIC ) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
bool ActiveMQDestination::isQueue()
|
||||
{
|
||||
return !isTopic() ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
bool ActiveMQDestination::isTemporary()
|
||||
{
|
||||
return ( getDestinationType() == ACTIVEMQ_TEMPORARY_TOPIC ||
|
||||
getDestinationType() == ACTIVEMQ_TEMPORARY_QUEUE ) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
bool ActiveMQDestination::isComposite()
|
||||
{
|
||||
return ( physicalName->find(ActiveMQDestination::COMPOSITE_SEPARATOR) > 0 ) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
bool ActiveMQDestination::isWildcard()
|
||||
{
|
||||
if( physicalName != NULL )
|
||||
{
|
||||
return ( physicalName->find( DestinationFilter::ANY_CHILD ) >= 0 ||
|
||||
physicalName->find( DestinationFilter::ANY_DESCENDENT ) >= 0 ) ;
|
||||
}
|
||||
return false ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<string> ActiveMQDestination::toString()
|
||||
{
|
||||
return physicalName ;
|
||||
}
|
||||
|
||||
// --- Static methods ---------------------------------------------
|
||||
|
||||
/*
|
||||
* A helper method to return a descriptive string for the topic or queue.
|
||||
*/
|
||||
p<string> ActiveMQDestination::inspect(p<ActiveMQDestination> destination)
|
||||
{
|
||||
p<string> description = new string() ;
|
||||
|
||||
if( typeid(*destination) == typeid(ITopic) )
|
||||
description->assign("Topic(") ;
|
||||
else
|
||||
description->assign("Queue(") ;
|
||||
|
||||
description->append( destination->toString()->c_str() ) ;
|
||||
description->append(")") ;
|
||||
|
||||
return description ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
/*p<ActiveMQDestination> ActiveMQDestination::transform(p<IDestination> destination)
|
||||
{
|
||||
p<ActiveMQDestination> result = NULL ;
|
||||
|
||||
if( destination != NULL )
|
||||
{
|
||||
if( typeid(*destination) == typeid(ActiveMQDestination) )
|
||||
result = p_cast<ActiveMQDestination> (destination) ;
|
||||
|
||||
else
|
||||
{
|
||||
if( typeid(ITopic).before(typeid(IDestination)) )
|
||||
result = new ActiveMQTopic( (p_cast<ITopic> (destination))->getTopicName()->c_str() ) ;
|
||||
|
||||
else if( typeid(*destination).before(typeid(IQueue)) )
|
||||
result = new ActiveMQQueue( (p_cast<IQueue> (destination))->getQueueName()->c_str() ) ;
|
||||
|
||||
else if( typeid(ITemporaryQueue).before(typeid(*destination)) )
|
||||
result = new ActiveMQTempQueue( (p_cast<IQueue> (destination))->getQueueName()->c_str() ) ;
|
||||
|
||||
else if( typeid(ITemporaryTopic).before(typeid(*destination)) )
|
||||
result = new ActiveMQTempTopic( (p_cast<ITopic> (destination))->getTopicName()->c_str() ) ;
|
||||
|
||||
}
|
||||
}
|
||||
return result ;
|
||||
}*/
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<ActiveMQDestination> ActiveMQDestination::createDestination(int type, const char* physicalName)
|
||||
{
|
||||
p<ActiveMQDestination> result = NULL ;
|
||||
|
||||
if( type == ActiveMQDestination::ACTIVEMQ_TOPIC )
|
||||
result = new ActiveMQTopic(physicalName) ;
|
||||
|
||||
else if( type == ActiveMQDestination::ACTIVEMQ_TEMPORARY_TOPIC )
|
||||
result = new ActiveMQTempTopic(physicalName) ;
|
||||
|
||||
else if (type == ActiveMQDestination::ACTIVEMQ_QUEUE)
|
||||
result = new ActiveMQQueue(physicalName) ;
|
||||
|
||||
else
|
||||
result = new ActiveMQTempQueue(physicalName) ;
|
||||
|
||||
return result ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<string> ActiveMQDestination::createTemporaryName(const char* clientId)
|
||||
{
|
||||
p<string> tempName = new string() ;
|
||||
|
||||
tempName->assign( ActiveMQDestination::TEMP_PREFIX ) ;
|
||||
tempName->append(clientId) ;
|
||||
tempName->append( ActiveMQDestination::TEMP_POSTFIX ) ;
|
||||
|
||||
return tempName ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<string> ActiveMQDestination::getClientId(p<ActiveMQDestination> destination)
|
||||
{
|
||||
p<string> answer = NULL ;
|
||||
|
||||
if( destination != NULL && destination->isTemporary() )
|
||||
{
|
||||
p<string> name = destination->getPhysicalName() ;
|
||||
int start = (int)name->find(TEMP_PREFIX),
|
||||
stop ;
|
||||
|
||||
if( start >= 0 )
|
||||
{
|
||||
start += (int)strlen(TEMP_PREFIX) ;
|
||||
stop = (int)name->find_last_of(TEMP_POSTFIX) ;
|
||||
|
||||
if( stop > start && stop < (int)name->length() )
|
||||
answer->assign( name->substr(start, stop) ) ;
|
||||
}
|
||||
}
|
||||
return answer;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
int ActiveMQDestination::marshal(p<IMarshaller> marshaller, int mode, p<IOutputStream> writer) throw (IOException)
|
||||
{
|
||||
int size = 0 ;
|
||||
|
@ -355,9 +355,9 @@ int ActiveMQDestination::marshal(p<IMarshaller> marshaller, int mode, p<IOutputS
|
|||
return size ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void ActiveMQDestination::unmarshal(p<IMarshaller> marshaller, int mode, p<IInputStream> reader) throw (IOException)
|
||||
{
|
||||
physicalName = p_cast<string>(marshaller->unmarshalString(mode, reader)) ;
|
||||
|
|
|
@ -1,137 +1,137 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_ActiveMQDestination_hpp_
|
||||
#define ActiveMQ_ActiveMQDestination_hpp_
|
||||
|
||||
#include <typeinfo>
|
||||
#include "cms/IDestination.hpp"
|
||||
#include "cms/ITopic.hpp"
|
||||
#include "cms/IQueue.hpp"
|
||||
#include "cms/ITemporaryTopic.hpp"
|
||||
#include "cms/ITemporaryQueue.hpp"
|
||||
#include "activemq/command/AbstractCommand.hpp"
|
||||
#include "activemq/protocol/IMarshaller.hpp"
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_ActiveMQDestination_hpp_
|
||||
#define ActiveMQ_ActiveMQDestination_hpp_
|
||||
|
||||
#include <typeinfo>
|
||||
#include "cms/IDestination.hpp"
|
||||
#include "cms/ITopic.hpp"
|
||||
#include "cms/IQueue.hpp"
|
||||
#include "cms/ITemporaryTopic.hpp"
|
||||
#include "cms/ITemporaryQueue.hpp"
|
||||
#include "activemq/command/AbstractCommand.hpp"
|
||||
#include "activemq/protocol/IMarshaller.hpp"
|
||||
#include "ppr/io/IOutputStream.hpp"
|
||||
#include "ppr/io/IInputStream.hpp"
|
||||
#include "ppr/io/IOException.hpp"
|
||||
#include "ppr/util/ifr/p"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
namespace command
|
||||
{
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
namespace command
|
||||
{
|
||||
using namespace ifr;
|
||||
using namespace apache::activemq;
|
||||
using namespace apache::activemq::protocol;
|
||||
using namespace apache::cms;
|
||||
using namespace apache::ppr::io;
|
||||
class ActiveMQQueue ;
|
||||
class ActiveMQTempQueue ;
|
||||
class ActiveMQTopic ;
|
||||
class ActiveMQTempTopic ;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
class ActiveMQDestination : public AbstractCommand, public IDestination
|
||||
{
|
||||
private:
|
||||
p<string> orderedTarget,
|
||||
physicalName ;
|
||||
bool exclusive,
|
||||
ordered,
|
||||
advisory ;
|
||||
|
||||
// Prefix/postfix for queue/topic names
|
||||
static const char* TEMP_PREFIX ;
|
||||
static const char* TEMP_POSTFIX ;
|
||||
static const char* COMPOSITE_SEPARATOR ;
|
||||
static const char* QUEUE_PREFIX ;
|
||||
static const char* TOPIC_PREFIX ;
|
||||
|
||||
public:
|
||||
// Destination type constants
|
||||
static const int ACTIVEMQ_TOPIC = 1 ;
|
||||
static const int ACTIVEMQ_TEMPORARY_TOPIC = 2 ;
|
||||
static const int ACTIVEMQ_QUEUE = 3 ;
|
||||
static const int ACTIVEMQ_TEMPORARY_QUEUE = 4 ;
|
||||
|
||||
// Prefixes for Advisory message destinations
|
||||
static const char* ADVISORY_PREFIX ;
|
||||
static const char* CONSUMER_ADVISORY_PREFIX ;
|
||||
static const char* PRODUCER_ADVISORY_PREFIX ;
|
||||
static const char* CONNECTION_ADVISORY_PREFIX ;
|
||||
|
||||
// The default target for ordered destinations
|
||||
static const char* DEFAULT_ORDERED_TARGET ;
|
||||
|
||||
protected:
|
||||
ActiveMQDestination() ;
|
||||
ActiveMQDestination(const char* name) ;
|
||||
|
||||
public:
|
||||
virtual ~ActiveMQDestination() ;
|
||||
|
||||
// Attributes methods
|
||||
virtual bool isAdvisory() ;
|
||||
virtual void setAdvisory(bool advisory) ;
|
||||
virtual bool isConsumerAdvisory() ;
|
||||
virtual bool isProducerAdvisory() ;
|
||||
virtual bool isConnectionAdvisory() ;
|
||||
virtual bool isExclusive() ;
|
||||
virtual void setExclusive(bool exclusive) ;
|
||||
virtual bool isOrdered() ;
|
||||
virtual void setOrdered(bool ordered) ;
|
||||
virtual p<string> getOrderedTarget() ;
|
||||
virtual void setOrderedTarget(const char* target) ;
|
||||
virtual p<string> getPhysicalName() ;
|
||||
virtual void setPhysicalName(const char* name) ;
|
||||
virtual bool isTopic() ;
|
||||
virtual bool isQueue() ;
|
||||
virtual bool isTemporary() ;
|
||||
virtual bool isComposite() ;
|
||||
virtual bool isWildcard() ;
|
||||
virtual p<string> toString() ;
|
||||
|
||||
using namespace apache::activemq;
|
||||
using namespace apache::activemq::protocol;
|
||||
using namespace apache::cms;
|
||||
using namespace apache::ppr::io;
|
||||
class ActiveMQQueue ;
|
||||
class ActiveMQTempQueue ;
|
||||
class ActiveMQTopic ;
|
||||
class ActiveMQTempTopic ;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
class ActiveMQDestination : public AbstractCommand, public IDestination
|
||||
{
|
||||
private:
|
||||
p<string> orderedTarget,
|
||||
physicalName ;
|
||||
bool exclusive,
|
||||
ordered,
|
||||
advisory ;
|
||||
|
||||
// Prefix/postfix for queue/topic names
|
||||
static const char* TEMP_PREFIX ;
|
||||
static const char* TEMP_POSTFIX ;
|
||||
static const char* COMPOSITE_SEPARATOR ;
|
||||
static const char* QUEUE_PREFIX ;
|
||||
static const char* TOPIC_PREFIX ;
|
||||
|
||||
public:
|
||||
// Destination type constants
|
||||
static const int ACTIVEMQ_TOPIC = 1 ;
|
||||
static const int ACTIVEMQ_TEMPORARY_TOPIC = 2 ;
|
||||
static const int ACTIVEMQ_QUEUE = 3 ;
|
||||
static const int ACTIVEMQ_TEMPORARY_QUEUE = 4 ;
|
||||
|
||||
// Prefixes for Advisory message destinations
|
||||
static const char* ADVISORY_PREFIX ;
|
||||
static const char* CONSUMER_ADVISORY_PREFIX ;
|
||||
static const char* PRODUCER_ADVISORY_PREFIX ;
|
||||
static const char* CONNECTION_ADVISORY_PREFIX ;
|
||||
|
||||
// The default target for ordered destinations
|
||||
static const char* DEFAULT_ORDERED_TARGET ;
|
||||
|
||||
protected:
|
||||
ActiveMQDestination() ;
|
||||
ActiveMQDestination(const char* name) ;
|
||||
|
||||
public:
|
||||
virtual ~ActiveMQDestination() ;
|
||||
|
||||
// Attributes methods
|
||||
virtual bool isAdvisory() ;
|
||||
virtual void setAdvisory(bool advisory) ;
|
||||
virtual bool isConsumerAdvisory() ;
|
||||
virtual bool isProducerAdvisory() ;
|
||||
virtual bool isConnectionAdvisory() ;
|
||||
virtual bool isExclusive() ;
|
||||
virtual void setExclusive(bool exclusive) ;
|
||||
virtual bool isOrdered() ;
|
||||
virtual void setOrdered(bool ordered) ;
|
||||
virtual p<string> getOrderedTarget() ;
|
||||
virtual void setOrderedTarget(const char* target) ;
|
||||
virtual p<string> getPhysicalName() ;
|
||||
virtual void setPhysicalName(const char* name) ;
|
||||
virtual bool isTopic() ;
|
||||
virtual bool isQueue() ;
|
||||
virtual bool isTemporary() ;
|
||||
virtual bool isComposite() ;
|
||||
virtual bool isWildcard() ;
|
||||
virtual p<string> toString() ;
|
||||
|
||||
virtual int marshal(p<IMarshaller> marshaller, int mode, p<IOutputStream> writer) throw (IOException) ;
|
||||
virtual void unmarshal(p<IMarshaller> marshaller, int mode, p<IInputStream> reader) throw (IOException) ;
|
||||
|
||||
//
|
||||
// Abstract methods
|
||||
|
||||
// Factory method to create a child destination if this destination is a composite.
|
||||
virtual p<ActiveMQDestination> createDestination(const char* name) = 0 ;
|
||||
virtual int getDestinationType() = 0 ;
|
||||
|
||||
//
|
||||
// Static methods
|
||||
|
||||
static p<string> inspect(p<ActiveMQDestination> destination) ;
|
||||
//static p<ActiveMQDestination> transform(p<IDestination> destination) ;
|
||||
static p<ActiveMQDestination> createDestination(int type, const char* physicalName) ;
|
||||
static p<string> createTemporaryName(const char* clientId) ;
|
||||
static p<string> getClientId(p<ActiveMQDestination> destination) ;
|
||||
} ;
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_ActiveMQDestination_hpp_*/
|
||||
|
||||
//
|
||||
// Abstract methods
|
||||
|
||||
// Factory method to create a child destination if this destination is a composite.
|
||||
virtual p<ActiveMQDestination> createDestination(const char* name) = 0 ;
|
||||
virtual int getDestinationType() = 0 ;
|
||||
|
||||
//
|
||||
// Static methods
|
||||
|
||||
static p<string> inspect(p<ActiveMQDestination> destination) ;
|
||||
//static p<ActiveMQDestination> transform(p<IDestination> destination) ;
|
||||
static p<ActiveMQDestination> createDestination(int type, const char* physicalName) ;
|
||||
static p<string> createTemporaryName(const char* clientId) ;
|
||||
static p<string> getClientId(p<ActiveMQDestination> destination) ;
|
||||
} ;
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_ActiveMQDestination_hpp_*/
|
||||
|
|
|
@ -1,460 +1,460 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#include "activemq/command/ActiveMQMapMessage.hpp"
|
||||
#include "ppr/io/ByteArrayOutputStream.hpp"
|
||||
#include "ppr/io/ByteArrayInputStream.hpp"
|
||||
|
||||
using namespace apache::activemq::command;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
ActiveMQMapMessage::ActiveMQMapMessage()
|
||||
{
|
||||
contentMap = new PropertyMap() ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
ActiveMQMapMessage::~ActiveMQMapMessage()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
unsigned char ActiveMQMapMessage::getDataStructureType()
|
||||
{
|
||||
return ActiveMQMapMessage::TYPE ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<PropertyMap> ActiveMQMapMessage::getBody()
|
||||
{
|
||||
return contentMap ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
bool ActiveMQMapMessage::getBoolean(const char* name) throw (MessageFormatException, IllegalArgumentException)
|
||||
{
|
||||
// Assert arguments
|
||||
if( name == NULL || strcmp(name, "") == 0 )
|
||||
throw IllegalArgumentException("Invalid key name") ;
|
||||
|
||||
PropertyMap::iterator tempIter ;
|
||||
string key = string(name) ;
|
||||
|
||||
// Check if key exists in map
|
||||
tempIter = contentMap->find(key) ;
|
||||
if( tempIter == contentMap->end() )
|
||||
throw MessageFormatException("No boolean value available for given key") ;
|
||||
|
||||
try
|
||||
{
|
||||
// Try to get value as a boolean
|
||||
return tempIter->second.getBoolean() ;
|
||||
}
|
||||
catch( ConversionException ce )
|
||||
{
|
||||
throw MessageFormatException( ce.what() ) ;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void ActiveMQMapMessage::setBoolean(const char* name, bool value) throw (IllegalArgumentException)
|
||||
{
|
||||
// Assert arguments
|
||||
if( name == NULL || strcmp(name, "") == 0 )
|
||||
throw IllegalArgumentException("Invalid key name") ;
|
||||
|
||||
string key = name ;
|
||||
//contentMap->insert (pair<string,p<MapItemHolder> > (key, new MapItemHolder(value)));
|
||||
(*contentMap)[key] = MapItemHolder(value);
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
char ActiveMQMapMessage::getByte(const char* name) throw (MessageFormatException, IllegalArgumentException)
|
||||
{
|
||||
// Assert arguments
|
||||
if( name == NULL || strcmp(name, "") == 0 )
|
||||
throw IllegalArgumentException("Invalid key name") ;
|
||||
|
||||
PropertyMap::iterator tempIter ;
|
||||
string key = string(name) ;
|
||||
|
||||
// Check if key exists in map
|
||||
tempIter = contentMap->find(key) ;
|
||||
if( tempIter == contentMap->end() )
|
||||
throw MessageFormatException("No byte value available for given key") ;
|
||||
|
||||
try
|
||||
{
|
||||
// Try to get value as a byte
|
||||
return tempIter->second.getByte() ;
|
||||
}
|
||||
catch( ConversionException ce )
|
||||
{
|
||||
throw MessageFormatException( ce.what() ) ;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void ActiveMQMapMessage::setByte(const char* name, char value) throw (IllegalArgumentException)
|
||||
{
|
||||
// Assert arguments
|
||||
if( name == NULL || strcmp(name, "") == 0 )
|
||||
throw IllegalArgumentException("Invalid key name") ;
|
||||
|
||||
string key = name ;
|
||||
(*contentMap)[key] = MapItemHolder(value);
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
array<char> ActiveMQMapMessage::getBytes(const char* name) throw (MessageFormatException, IllegalArgumentException)
|
||||
{
|
||||
// Assert arguments
|
||||
if( name == NULL || strcmp(name, "") == 0 )
|
||||
throw IllegalArgumentException("Invalid key name") ;
|
||||
|
||||
PropertyMap::iterator tempIter ;
|
||||
string key = string(name) ;
|
||||
|
||||
// Check if key exists in map
|
||||
tempIter = contentMap->find(key) ;
|
||||
if( tempIter == contentMap->end() )
|
||||
throw MessageFormatException("No byte array value available for given key") ;
|
||||
|
||||
try
|
||||
{
|
||||
// Try to get value as a byte array
|
||||
return tempIter->second.getBytes() ;
|
||||
}
|
||||
catch( ConversionException ce )
|
||||
{
|
||||
throw MessageFormatException( ce.what() ) ;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void ActiveMQMapMessage::setBytes(const char* name, array<char> value) throw (IllegalArgumentException)
|
||||
{
|
||||
// Assert arguments
|
||||
if( name == NULL || strcmp(name, "") == 0 )
|
||||
throw IllegalArgumentException("Invalid key name") ;
|
||||
|
||||
string key = name ;
|
||||
(*contentMap)[key] = MapItemHolder(value);
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
double ActiveMQMapMessage::getDouble(const char* name) throw (MessageFormatException, IllegalArgumentException)
|
||||
{
|
||||
// Assert arguments
|
||||
if( name == NULL || strcmp(name, "") == 0 )
|
||||
throw IllegalArgumentException("Invalid key name") ;
|
||||
|
||||
PropertyMap::iterator tempIter ;
|
||||
string key = name ;
|
||||
|
||||
// Check if key exists in map
|
||||
tempIter = contentMap->find(key) ;
|
||||
if( tempIter == contentMap->end() )
|
||||
throw MessageFormatException("No double value available for given key") ;
|
||||
|
||||
try
|
||||
{
|
||||
// Try to get value as a double
|
||||
return tempIter->second.getDouble() ;
|
||||
}
|
||||
catch( ConversionException ce )
|
||||
{
|
||||
throw MessageFormatException( ce.what() ) ;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void ActiveMQMapMessage::setDouble(const char* name, double value) throw (IllegalArgumentException)
|
||||
{
|
||||
// Assert arguments
|
||||
if( name == NULL || strcmp(name, "") == 0 )
|
||||
throw IllegalArgumentException("Invalid key name") ;
|
||||
|
||||
string key = name ;
|
||||
(*contentMap)[key] = MapItemHolder(value) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
float ActiveMQMapMessage::getFloat(const char* name) throw (MessageFormatException, IllegalArgumentException)
|
||||
{
|
||||
// Assert arguments
|
||||
if( name == NULL || strcmp(name, "") == 0 )
|
||||
throw IllegalArgumentException("Invalid key name") ;
|
||||
|
||||
PropertyMap::iterator tempIter ;
|
||||
string key = name ;
|
||||
|
||||
// Check if key exists in map
|
||||
tempIter = contentMap->find(key) ;
|
||||
if( tempIter == contentMap->end() )
|
||||
throw MessageFormatException("No float value available for given key") ;
|
||||
|
||||
try
|
||||
{
|
||||
// Try to get value as a float
|
||||
return tempIter->second.getFloat() ;
|
||||
}
|
||||
catch( ConversionException ce )
|
||||
{
|
||||
throw MessageFormatException( ce.what() ) ;
|
||||
}
|
||||
}
|
||||
|
||||
/*F
|
||||
*
|
||||
*/
|
||||
void ActiveMQMapMessage::setFloat(const char* name, float value) throw (IllegalArgumentException)
|
||||
{
|
||||
// Assert arguments
|
||||
if( name == NULL || strcmp(name, "") == 0 )
|
||||
throw IllegalArgumentException("Invalid key name") ;
|
||||
|
||||
string key = name ;
|
||||
(*contentMap)[key] = MapItemHolder(value) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
int ActiveMQMapMessage::getInt(const char* name) throw (MessageFormatException, IllegalArgumentException)
|
||||
{
|
||||
// Assert arguments
|
||||
if( name == NULL || strcmp(name, "") == 0 )
|
||||
throw IllegalArgumentException("Invalid key name") ;
|
||||
|
||||
PropertyMap::iterator tempIter ;
|
||||
string key = name ;
|
||||
|
||||
// Check if key exists in map
|
||||
tempIter = contentMap->find(key) ;
|
||||
if( tempIter == contentMap->end() )
|
||||
throw MessageFormatException("No integer value available for given key") ;
|
||||
|
||||
try
|
||||
{
|
||||
// Try to get value as an integer
|
||||
return tempIter->second.getInt() ;
|
||||
}
|
||||
catch( ConversionException ce )
|
||||
{
|
||||
throw MessageFormatException( ce.what() ) ;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void ActiveMQMapMessage::setInt(const char* name, int value) throw (IllegalArgumentException)
|
||||
{
|
||||
// Assert arguments
|
||||
if( name == NULL || strcmp(name, "") == 0 )
|
||||
throw IllegalArgumentException("Invalid key name") ;
|
||||
|
||||
string key = name ;
|
||||
(*contentMap)[key] = MapItemHolder(value) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
long long ActiveMQMapMessage::getLong(const char* name) throw (MessageFormatException, IllegalArgumentException)
|
||||
{
|
||||
// Assert arguments
|
||||
if( name == NULL || strcmp(name, "") == 0 )
|
||||
throw IllegalArgumentException("Invalid key name") ;
|
||||
|
||||
PropertyMap::iterator tempIter ;
|
||||
string key = name ;
|
||||
|
||||
// Check if key exists in map
|
||||
tempIter = contentMap->find(key) ;
|
||||
if( tempIter == contentMap->end() )
|
||||
throw MessageFormatException("No long value available for given key") ;
|
||||
|
||||
try
|
||||
{
|
||||
// Try to get value as a long
|
||||
return tempIter->second.getLong() ;
|
||||
}
|
||||
catch( ConversionException ce )
|
||||
{
|
||||
throw MessageFormatException( ce.what() ) ;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void ActiveMQMapMessage::setLong(const char* name, long long value) throw (IllegalArgumentException)
|
||||
{
|
||||
// Assert arguments
|
||||
if( name == NULL || strcmp(name, "") == 0 )
|
||||
throw IllegalArgumentException("Invalid key name") ;
|
||||
|
||||
string key = name ;
|
||||
(*contentMap)[key] = MapItemHolder(value) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
short ActiveMQMapMessage::getShort(const char* name) throw (MessageFormatException, IllegalArgumentException)
|
||||
{
|
||||
// Assert arguments
|
||||
if( name == NULL || strcmp(name, "") == 0 )
|
||||
throw IllegalArgumentException("Invalid key name") ;
|
||||
|
||||
PropertyMap::iterator tempIter ;
|
||||
string key = name ;
|
||||
|
||||
// Check if key exists in map
|
||||
tempIter = contentMap->find(key) ;
|
||||
if( tempIter == contentMap->end() )
|
||||
throw MessageFormatException("No short value available for given key") ;
|
||||
|
||||
try
|
||||
{
|
||||
// Try to get value as a short
|
||||
return tempIter->second.getShort() ;
|
||||
}
|
||||
catch( ConversionException ce )
|
||||
{
|
||||
throw MessageFormatException( ce.what() ) ;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void ActiveMQMapMessage::setShort(const char* name, short value) throw (IllegalArgumentException)
|
||||
{
|
||||
// Assert arguments
|
||||
if( name == NULL || strcmp(name, "") == 0 )
|
||||
throw IllegalArgumentException("Invalid key name") ;
|
||||
|
||||
string key = name ;
|
||||
(*contentMap)[key] = MapItemHolder(value) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<string> ActiveMQMapMessage::getString(const char* name) throw (MessageFormatException, IllegalArgumentException)
|
||||
{
|
||||
// Assert arguments
|
||||
if( name == NULL || strcmp(name, "") == 0 )
|
||||
throw IllegalArgumentException("Invalid key name") ;
|
||||
|
||||
PropertyMap::iterator tempIter ;
|
||||
string key = name ;
|
||||
|
||||
// Check if key exists in map
|
||||
tempIter = contentMap->find(key) ;
|
||||
if( tempIter == contentMap->end() )
|
||||
throw MessageFormatException("No short value available for given key") ;
|
||||
|
||||
try
|
||||
{
|
||||
// Try to get value as a string
|
||||
return tempIter->second.getString() ;
|
||||
}
|
||||
catch( ConversionException ce )
|
||||
{
|
||||
throw MessageFormatException( ce.what() ) ;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void ActiveMQMapMessage::setString(const char* name, p<string> value) throw (IllegalArgumentException)
|
||||
{
|
||||
// Assert arguments
|
||||
if( name == NULL || strcmp(name, "") == 0 )
|
||||
throw IllegalArgumentException("Invalid key name") ;
|
||||
|
||||
string key = name ;
|
||||
(*contentMap)[key] = MapItemHolder(value) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
array<string> ActiveMQMapMessage::getMapNames()
|
||||
{
|
||||
PropertyMap::iterator tempIter ;
|
||||
array<string> keyNames (contentMap->size()) ;
|
||||
int index = 0 ;
|
||||
|
||||
for( tempIter = contentMap->begin() ;
|
||||
tempIter != contentMap->end() ;
|
||||
tempIter++ )
|
||||
{
|
||||
keyNames[index++] = new string(tempIter->first) ;
|
||||
}
|
||||
return keyNames ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
bool ActiveMQMapMessage::itemExists(const char* name)
|
||||
{
|
||||
PropertyMap::iterator tempIter ;
|
||||
string key = name ;
|
||||
|
||||
// Check if key exists in map
|
||||
tempIter = contentMap->find(key) ;
|
||||
return ( tempIter != contentMap->end() ) ? true : false ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#include "activemq/command/ActiveMQMapMessage.hpp"
|
||||
#include "ppr/io/ByteArrayOutputStream.hpp"
|
||||
#include "ppr/io/ByteArrayInputStream.hpp"
|
||||
|
||||
using namespace apache::activemq::command;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
ActiveMQMapMessage::ActiveMQMapMessage()
|
||||
{
|
||||
contentMap = new PropertyMap() ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
ActiveMQMapMessage::~ActiveMQMapMessage()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
unsigned char ActiveMQMapMessage::getDataStructureType()
|
||||
{
|
||||
return ActiveMQMapMessage::TYPE ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<PropertyMap> ActiveMQMapMessage::getBody()
|
||||
{
|
||||
return contentMap ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
bool ActiveMQMapMessage::getBoolean(const char* name) throw (MessageFormatException, IllegalArgumentException)
|
||||
{
|
||||
// Assert arguments
|
||||
if( name == NULL || strcmp(name, "") == 0 )
|
||||
throw IllegalArgumentException("Invalid key name") ;
|
||||
|
||||
PropertyMap::iterator tempIter ;
|
||||
string key = string(name) ;
|
||||
|
||||
// Check if key exists in map
|
||||
tempIter = contentMap->find(key) ;
|
||||
if( tempIter == contentMap->end() )
|
||||
throw MessageFormatException("No boolean value available for given key") ;
|
||||
|
||||
try
|
||||
{
|
||||
// Try to get value as a boolean
|
||||
return tempIter->second.getBoolean() ;
|
||||
}
|
||||
catch( ConversionException ce )
|
||||
{
|
||||
throw MessageFormatException( ce.what() ) ;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void ActiveMQMapMessage::setBoolean(const char* name, bool value) throw (IllegalArgumentException)
|
||||
{
|
||||
// Assert arguments
|
||||
if( name == NULL || strcmp(name, "") == 0 )
|
||||
throw IllegalArgumentException("Invalid key name") ;
|
||||
|
||||
string key = name ;
|
||||
//contentMap->insert (pair<string,p<MapItemHolder> > (key, new MapItemHolder(value)));
|
||||
(*contentMap)[key] = MapItemHolder(value);
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
char ActiveMQMapMessage::getByte(const char* name) throw (MessageFormatException, IllegalArgumentException)
|
||||
{
|
||||
// Assert arguments
|
||||
if( name == NULL || strcmp(name, "") == 0 )
|
||||
throw IllegalArgumentException("Invalid key name") ;
|
||||
|
||||
PropertyMap::iterator tempIter ;
|
||||
string key = string(name) ;
|
||||
|
||||
// Check if key exists in map
|
||||
tempIter = contentMap->find(key) ;
|
||||
if( tempIter == contentMap->end() )
|
||||
throw MessageFormatException("No byte value available for given key") ;
|
||||
|
||||
try
|
||||
{
|
||||
// Try to get value as a byte
|
||||
return tempIter->second.getByte() ;
|
||||
}
|
||||
catch( ConversionException ce )
|
||||
{
|
||||
throw MessageFormatException( ce.what() ) ;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void ActiveMQMapMessage::setByte(const char* name, char value) throw (IllegalArgumentException)
|
||||
{
|
||||
// Assert arguments
|
||||
if( name == NULL || strcmp(name, "") == 0 )
|
||||
throw IllegalArgumentException("Invalid key name") ;
|
||||
|
||||
string key = name ;
|
||||
(*contentMap)[key] = MapItemHolder(value);
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
array<char> ActiveMQMapMessage::getBytes(const char* name) throw (MessageFormatException, IllegalArgumentException)
|
||||
{
|
||||
// Assert arguments
|
||||
if( name == NULL || strcmp(name, "") == 0 )
|
||||
throw IllegalArgumentException("Invalid key name") ;
|
||||
|
||||
PropertyMap::iterator tempIter ;
|
||||
string key = string(name) ;
|
||||
|
||||
// Check if key exists in map
|
||||
tempIter = contentMap->find(key) ;
|
||||
if( tempIter == contentMap->end() )
|
||||
throw MessageFormatException("No byte array value available for given key") ;
|
||||
|
||||
try
|
||||
{
|
||||
// Try to get value as a byte array
|
||||
return tempIter->second.getBytes() ;
|
||||
}
|
||||
catch( ConversionException ce )
|
||||
{
|
||||
throw MessageFormatException( ce.what() ) ;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void ActiveMQMapMessage::setBytes(const char* name, array<char> value) throw (IllegalArgumentException)
|
||||
{
|
||||
// Assert arguments
|
||||
if( name == NULL || strcmp(name, "") == 0 )
|
||||
throw IllegalArgumentException("Invalid key name") ;
|
||||
|
||||
string key = name ;
|
||||
(*contentMap)[key] = MapItemHolder(value);
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
double ActiveMQMapMessage::getDouble(const char* name) throw (MessageFormatException, IllegalArgumentException)
|
||||
{
|
||||
// Assert arguments
|
||||
if( name == NULL || strcmp(name, "") == 0 )
|
||||
throw IllegalArgumentException("Invalid key name") ;
|
||||
|
||||
PropertyMap::iterator tempIter ;
|
||||
string key = name ;
|
||||
|
||||
// Check if key exists in map
|
||||
tempIter = contentMap->find(key) ;
|
||||
if( tempIter == contentMap->end() )
|
||||
throw MessageFormatException("No double value available for given key") ;
|
||||
|
||||
try
|
||||
{
|
||||
// Try to get value as a double
|
||||
return tempIter->second.getDouble() ;
|
||||
}
|
||||
catch( ConversionException ce )
|
||||
{
|
||||
throw MessageFormatException( ce.what() ) ;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void ActiveMQMapMessage::setDouble(const char* name, double value) throw (IllegalArgumentException)
|
||||
{
|
||||
// Assert arguments
|
||||
if( name == NULL || strcmp(name, "") == 0 )
|
||||
throw IllegalArgumentException("Invalid key name") ;
|
||||
|
||||
string key = name ;
|
||||
(*contentMap)[key] = MapItemHolder(value) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
float ActiveMQMapMessage::getFloat(const char* name) throw (MessageFormatException, IllegalArgumentException)
|
||||
{
|
||||
// Assert arguments
|
||||
if( name == NULL || strcmp(name, "") == 0 )
|
||||
throw IllegalArgumentException("Invalid key name") ;
|
||||
|
||||
PropertyMap::iterator tempIter ;
|
||||
string key = name ;
|
||||
|
||||
// Check if key exists in map
|
||||
tempIter = contentMap->find(key) ;
|
||||
if( tempIter == contentMap->end() )
|
||||
throw MessageFormatException("No float value available for given key") ;
|
||||
|
||||
try
|
||||
{
|
||||
// Try to get value as a float
|
||||
return tempIter->second.getFloat() ;
|
||||
}
|
||||
catch( ConversionException ce )
|
||||
{
|
||||
throw MessageFormatException( ce.what() ) ;
|
||||
}
|
||||
}
|
||||
|
||||
/*F
|
||||
*
|
||||
*/
|
||||
void ActiveMQMapMessage::setFloat(const char* name, float value) throw (IllegalArgumentException)
|
||||
{
|
||||
// Assert arguments
|
||||
if( name == NULL || strcmp(name, "") == 0 )
|
||||
throw IllegalArgumentException("Invalid key name") ;
|
||||
|
||||
string key = name ;
|
||||
(*contentMap)[key] = MapItemHolder(value) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
int ActiveMQMapMessage::getInt(const char* name) throw (MessageFormatException, IllegalArgumentException)
|
||||
{
|
||||
// Assert arguments
|
||||
if( name == NULL || strcmp(name, "") == 0 )
|
||||
throw IllegalArgumentException("Invalid key name") ;
|
||||
|
||||
PropertyMap::iterator tempIter ;
|
||||
string key = name ;
|
||||
|
||||
// Check if key exists in map
|
||||
tempIter = contentMap->find(key) ;
|
||||
if( tempIter == contentMap->end() )
|
||||
throw MessageFormatException("No integer value available for given key") ;
|
||||
|
||||
try
|
||||
{
|
||||
// Try to get value as an integer
|
||||
return tempIter->second.getInt() ;
|
||||
}
|
||||
catch( ConversionException ce )
|
||||
{
|
||||
throw MessageFormatException( ce.what() ) ;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void ActiveMQMapMessage::setInt(const char* name, int value) throw (IllegalArgumentException)
|
||||
{
|
||||
// Assert arguments
|
||||
if( name == NULL || strcmp(name, "") == 0 )
|
||||
throw IllegalArgumentException("Invalid key name") ;
|
||||
|
||||
string key = name ;
|
||||
(*contentMap)[key] = MapItemHolder(value) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
long long ActiveMQMapMessage::getLong(const char* name) throw (MessageFormatException, IllegalArgumentException)
|
||||
{
|
||||
// Assert arguments
|
||||
if( name == NULL || strcmp(name, "") == 0 )
|
||||
throw IllegalArgumentException("Invalid key name") ;
|
||||
|
||||
PropertyMap::iterator tempIter ;
|
||||
string key = name ;
|
||||
|
||||
// Check if key exists in map
|
||||
tempIter = contentMap->find(key) ;
|
||||
if( tempIter == contentMap->end() )
|
||||
throw MessageFormatException("No long value available for given key") ;
|
||||
|
||||
try
|
||||
{
|
||||
// Try to get value as a long
|
||||
return tempIter->second.getLong() ;
|
||||
}
|
||||
catch( ConversionException ce )
|
||||
{
|
||||
throw MessageFormatException( ce.what() ) ;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void ActiveMQMapMessage::setLong(const char* name, long long value) throw (IllegalArgumentException)
|
||||
{
|
||||
// Assert arguments
|
||||
if( name == NULL || strcmp(name, "") == 0 )
|
||||
throw IllegalArgumentException("Invalid key name") ;
|
||||
|
||||
string key = name ;
|
||||
(*contentMap)[key] = MapItemHolder(value) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
short ActiveMQMapMessage::getShort(const char* name) throw (MessageFormatException, IllegalArgumentException)
|
||||
{
|
||||
// Assert arguments
|
||||
if( name == NULL || strcmp(name, "") == 0 )
|
||||
throw IllegalArgumentException("Invalid key name") ;
|
||||
|
||||
PropertyMap::iterator tempIter ;
|
||||
string key = name ;
|
||||
|
||||
// Check if key exists in map
|
||||
tempIter = contentMap->find(key) ;
|
||||
if( tempIter == contentMap->end() )
|
||||
throw MessageFormatException("No short value available for given key") ;
|
||||
|
||||
try
|
||||
{
|
||||
// Try to get value as a short
|
||||
return tempIter->second.getShort() ;
|
||||
}
|
||||
catch( ConversionException ce )
|
||||
{
|
||||
throw MessageFormatException( ce.what() ) ;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void ActiveMQMapMessage::setShort(const char* name, short value) throw (IllegalArgumentException)
|
||||
{
|
||||
// Assert arguments
|
||||
if( name == NULL || strcmp(name, "") == 0 )
|
||||
throw IllegalArgumentException("Invalid key name") ;
|
||||
|
||||
string key = name ;
|
||||
(*contentMap)[key] = MapItemHolder(value) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<string> ActiveMQMapMessage::getString(const char* name) throw (MessageFormatException, IllegalArgumentException)
|
||||
{
|
||||
// Assert arguments
|
||||
if( name == NULL || strcmp(name, "") == 0 )
|
||||
throw IllegalArgumentException("Invalid key name") ;
|
||||
|
||||
PropertyMap::iterator tempIter ;
|
||||
string key = name ;
|
||||
|
||||
// Check if key exists in map
|
||||
tempIter = contentMap->find(key) ;
|
||||
if( tempIter == contentMap->end() )
|
||||
throw MessageFormatException("No short value available for given key") ;
|
||||
|
||||
try
|
||||
{
|
||||
// Try to get value as a string
|
||||
return tempIter->second.getString() ;
|
||||
}
|
||||
catch( ConversionException ce )
|
||||
{
|
||||
throw MessageFormatException( ce.what() ) ;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void ActiveMQMapMessage::setString(const char* name, p<string> value) throw (IllegalArgumentException)
|
||||
{
|
||||
// Assert arguments
|
||||
if( name == NULL || strcmp(name, "") == 0 )
|
||||
throw IllegalArgumentException("Invalid key name") ;
|
||||
|
||||
string key = name ;
|
||||
(*contentMap)[key] = MapItemHolder(value) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
array<string> ActiveMQMapMessage::getMapNames()
|
||||
{
|
||||
PropertyMap::iterator tempIter ;
|
||||
array<string> keyNames (contentMap->size()) ;
|
||||
int index = 0 ;
|
||||
|
||||
for( tempIter = contentMap->begin() ;
|
||||
tempIter != contentMap->end() ;
|
||||
tempIter++ )
|
||||
{
|
||||
keyNames[index++] = new string(tempIter->first) ;
|
||||
}
|
||||
return keyNames ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
bool ActiveMQMapMessage::itemExists(const char* name)
|
||||
{
|
||||
PropertyMap::iterator tempIter ;
|
||||
string key = name ;
|
||||
|
||||
// Check if key exists in map
|
||||
tempIter = contentMap->find(key) ;
|
||||
return ( tempIter != contentMap->end() ) ? true : false ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
int ActiveMQMapMessage::marshal(p<IMarshaller> marshaller, int mode, p<IOutputStream> writer) throw (IOException)
|
||||
{
|
||||
int size = 0 ;
|
||||
|
@ -476,9 +476,9 @@ int ActiveMQMapMessage::marshal(p<IMarshaller> marshaller, int mode, p<IOutputSt
|
|||
return size ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void ActiveMQMapMessage::unmarshal(p<IMarshaller> marshaller, int mode, p<IInputStream> reader) throw (IOException)
|
||||
{
|
||||
// Note! Message content unmarshalling is done in super class
|
||||
|
|
|
@ -1,175 +1,175 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_ActiveMQMapMessage_hpp_
|
||||
#define ActiveMQ_ActiveMQMapMessage_hpp_
|
||||
|
||||
// Turn off warning message for ignored exception specification
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning( disable : 4290 )
|
||||
#endif
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include "cms/IMapMessage.hpp"
|
||||
#include "cms/MessageFormatException.hpp"
|
||||
#include "activemq/command/ActiveMQMessage.hpp"
|
||||
#include "ppr/IllegalArgumentException.hpp"
|
||||
#include "ppr/io/IOutputStream.hpp"
|
||||
#include "ppr/io/IInputStream.hpp"
|
||||
#include "ppr/util/MapItemHolder.hpp"
|
||||
#include "ppr/util/ifr/array"
|
||||
#include "ppr/util/ifr/p"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
namespace command
|
||||
{
|
||||
using namespace ifr;
|
||||
using namespace std;
|
||||
using namespace apache::cms;
|
||||
using namespace apache::ppr;
|
||||
using namespace apache::ppr::io;
|
||||
using namespace apache::ppr::util;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
class ActiveMQMapMessage : public ActiveMQMessage, public IMapMessage
|
||||
{
|
||||
private:
|
||||
p<string> text ;
|
||||
p<PropertyMap> contentMap ;
|
||||
|
||||
public:
|
||||
const static unsigned char TYPE = 25 ;
|
||||
|
||||
public:
|
||||
ActiveMQMapMessage() ;
|
||||
virtual ~ActiveMQMapMessage() ;
|
||||
|
||||
virtual unsigned char getDataStructureType() ;
|
||||
|
||||
virtual p<PropertyMap> getBody() ;
|
||||
virtual bool getBoolean(const char* name) throw (MessageFormatException, IllegalArgumentException) ;
|
||||
virtual void setBoolean(const char* name, bool value) throw (IllegalArgumentException) ;
|
||||
virtual char getByte(const char* name) throw (MessageFormatException, IllegalArgumentException) ;
|
||||
virtual void setByte(const char* name, char value) throw (IllegalArgumentException) ;
|
||||
virtual array<char> getBytes(const char* name) throw (MessageFormatException, IllegalArgumentException) ;
|
||||
virtual void setBytes(const char* name, array<char> value) throw (IllegalArgumentException) ;
|
||||
virtual double getDouble(const char* name) throw (MessageFormatException, IllegalArgumentException) ;
|
||||
virtual void setDouble(const char* name, double value) throw (IllegalArgumentException) ;
|
||||
virtual float getFloat(const char* name) throw (MessageFormatException, IllegalArgumentException) ;
|
||||
virtual void setFloat(const char* name, float value) throw (IllegalArgumentException) ;
|
||||
virtual int getInt(const char* name) throw (MessageFormatException, IllegalArgumentException) ;
|
||||
virtual void setInt(const char* name, int value) throw (IllegalArgumentException) ;
|
||||
virtual long long getLong(const char* name) throw (MessageFormatException, IllegalArgumentException) ;
|
||||
virtual void setLong(const char* name, long long value) throw (IllegalArgumentException) ;
|
||||
virtual short getShort(const char* name) throw (MessageFormatException, IllegalArgumentException) ;
|
||||
virtual void setShort(const char* name, short value) throw (IllegalArgumentException) ;
|
||||
virtual p<string> getString(const char* name) throw (MessageFormatException, IllegalArgumentException) ;
|
||||
virtual void setString(const char* name, p<string> value) throw (IllegalArgumentException) ;
|
||||
virtual array<string> getMapNames() ;
|
||||
virtual bool itemExists(const char* name) ;
|
||||
|
||||
virtual int marshal(p<IMarshaller> marshaller, int mode, p<IOutputStream> writer) throw (IOException) ;
|
||||
virtual void unmarshal(p<IMarshaller> marshaller, int mode, p<IInputStream> reader) throw (IOException) ;
|
||||
|
||||
//
|
||||
// The methods below are needed to resolve the multiple
|
||||
// inheritance of IMessage.
|
||||
virtual void acknowledge() {
|
||||
ActiveMQMessage::acknowledge() ;
|
||||
} ;
|
||||
virtual p<PropertyMap> getProperties() {
|
||||
return ActiveMQMessage::getProperties() ;
|
||||
} ;
|
||||
virtual p<string> getJMSCorrelationID() {
|
||||
return ActiveMQMessage::getJMSCorrelationID() ;
|
||||
} ;
|
||||
virtual void setJMSCorrelationID(const char* correlationId) {
|
||||
return ActiveMQMessage::setJMSCorrelationID(correlationId) ;
|
||||
} ;
|
||||
virtual p<IDestination> getJMSDestination() {
|
||||
return ActiveMQMessage::getJMSDestination() ;
|
||||
} ;
|
||||
virtual long long getJMSExpiration() {
|
||||
return ActiveMQMessage::getJMSExpiration() ;
|
||||
} ;
|
||||
virtual void setJMSExpiration(long long time) {
|
||||
return ActiveMQMessage::setJMSExpiration(time) ;
|
||||
} ;
|
||||
virtual p<string> getJMSMessageID() {
|
||||
return ActiveMQMessage::getJMSMessageID() ;
|
||||
} ;
|
||||
virtual bool getJMSPersistent() {
|
||||
return ActiveMQMessage::getJMSPersistent() ;
|
||||
} ;
|
||||
virtual void setJMSPersistent(bool persistent) {
|
||||
return ActiveMQMessage::setJMSPersistent(persistent) ;
|
||||
} ;
|
||||
virtual unsigned char getJMSPriority() {
|
||||
return ActiveMQMessage::getJMSPriority() ;
|
||||
} ;
|
||||
virtual void setJMSPriority(unsigned char priority) {
|
||||
return ActiveMQMessage::setJMSPriority(priority) ;
|
||||
} ;
|
||||
virtual bool getJMSRedelivered() {
|
||||
return ActiveMQMessage::getJMSRedelivered() ;
|
||||
} ;
|
||||
virtual p<IDestination> getJMSReplyTo() {
|
||||
return ActiveMQMessage::getJMSReplyTo() ;
|
||||
} ;
|
||||
virtual void setJMSReplyTo(p<IDestination> destination) {
|
||||
return ActiveMQMessage::setJMSReplyTo(destination) ;
|
||||
} ;
|
||||
virtual long long getJMSTimestamp() {
|
||||
return ActiveMQMessage::getJMSTimestamp() ;
|
||||
} ;
|
||||
virtual p<string> getJMSType() {
|
||||
return ActiveMQMessage::getJMSType() ;
|
||||
} ;
|
||||
virtual void setJMSType(const char* type) {
|
||||
return ActiveMQMessage::setJMSType(type) ;
|
||||
} ;
|
||||
virtual int getJMSXDeliveryCount() {
|
||||
return ActiveMQMessage::getJMSXDeliveryCount() ;
|
||||
} ;
|
||||
virtual p<string> getJMSXGroupID() {
|
||||
return ActiveMQMessage::getJMSXGroupID() ;
|
||||
} ;
|
||||
virtual void setJMSXGroupID(const char* groupId) {
|
||||
return ActiveMQMessage::setJMSXGroupID(groupId) ;
|
||||
} ;
|
||||
virtual int getJMSXGroupSeq() {
|
||||
return ActiveMQMessage::getJMSXGroupSeq() ;
|
||||
} ;
|
||||
virtual void setJMSXGroupSeq(int sequence) {
|
||||
return ActiveMQMessage::setJMSXGroupSeq(sequence) ;
|
||||
} ;
|
||||
virtual p<string> getJMSXProducerTxID() {
|
||||
return ActiveMQMessage::getJMSXProducerTxID() ;
|
||||
} ;
|
||||
} ;
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_ActiveMQMapMessage_hpp_*/
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_ActiveMQMapMessage_hpp_
|
||||
#define ActiveMQ_ActiveMQMapMessage_hpp_
|
||||
|
||||
// Turn off warning message for ignored exception specification
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning( disable : 4290 )
|
||||
#endif
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include "cms/IMapMessage.hpp"
|
||||
#include "cms/MessageFormatException.hpp"
|
||||
#include "activemq/command/ActiveMQMessage.hpp"
|
||||
#include "ppr/IllegalArgumentException.hpp"
|
||||
#include "ppr/io/IOutputStream.hpp"
|
||||
#include "ppr/io/IInputStream.hpp"
|
||||
#include "ppr/util/MapItemHolder.hpp"
|
||||
#include "ppr/util/ifr/array"
|
||||
#include "ppr/util/ifr/p"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
namespace command
|
||||
{
|
||||
using namespace ifr;
|
||||
using namespace std;
|
||||
using namespace apache::cms;
|
||||
using namespace apache::ppr;
|
||||
using namespace apache::ppr::io;
|
||||
using namespace apache::ppr::util;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
class ActiveMQMapMessage : public ActiveMQMessage, public IMapMessage
|
||||
{
|
||||
private:
|
||||
p<string> text ;
|
||||
p<PropertyMap> contentMap ;
|
||||
|
||||
public:
|
||||
const static unsigned char TYPE = 25 ;
|
||||
|
||||
public:
|
||||
ActiveMQMapMessage() ;
|
||||
virtual ~ActiveMQMapMessage() ;
|
||||
|
||||
virtual unsigned char getDataStructureType() ;
|
||||
|
||||
virtual p<PropertyMap> getBody() ;
|
||||
virtual bool getBoolean(const char* name) throw (MessageFormatException, IllegalArgumentException) ;
|
||||
virtual void setBoolean(const char* name, bool value) throw (IllegalArgumentException) ;
|
||||
virtual char getByte(const char* name) throw (MessageFormatException, IllegalArgumentException) ;
|
||||
virtual void setByte(const char* name, char value) throw (IllegalArgumentException) ;
|
||||
virtual array<char> getBytes(const char* name) throw (MessageFormatException, IllegalArgumentException) ;
|
||||
virtual void setBytes(const char* name, array<char> value) throw (IllegalArgumentException) ;
|
||||
virtual double getDouble(const char* name) throw (MessageFormatException, IllegalArgumentException) ;
|
||||
virtual void setDouble(const char* name, double value) throw (IllegalArgumentException) ;
|
||||
virtual float getFloat(const char* name) throw (MessageFormatException, IllegalArgumentException) ;
|
||||
virtual void setFloat(const char* name, float value) throw (IllegalArgumentException) ;
|
||||
virtual int getInt(const char* name) throw (MessageFormatException, IllegalArgumentException) ;
|
||||
virtual void setInt(const char* name, int value) throw (IllegalArgumentException) ;
|
||||
virtual long long getLong(const char* name) throw (MessageFormatException, IllegalArgumentException) ;
|
||||
virtual void setLong(const char* name, long long value) throw (IllegalArgumentException) ;
|
||||
virtual short getShort(const char* name) throw (MessageFormatException, IllegalArgumentException) ;
|
||||
virtual void setShort(const char* name, short value) throw (IllegalArgumentException) ;
|
||||
virtual p<string> getString(const char* name) throw (MessageFormatException, IllegalArgumentException) ;
|
||||
virtual void setString(const char* name, p<string> value) throw (IllegalArgumentException) ;
|
||||
virtual array<string> getMapNames() ;
|
||||
virtual bool itemExists(const char* name) ;
|
||||
|
||||
virtual int marshal(p<IMarshaller> marshaller, int mode, p<IOutputStream> writer) throw (IOException) ;
|
||||
virtual void unmarshal(p<IMarshaller> marshaller, int mode, p<IInputStream> reader) throw (IOException) ;
|
||||
|
||||
//
|
||||
// The methods below are needed to resolve the multiple
|
||||
// inheritance of IMessage.
|
||||
virtual void acknowledge() {
|
||||
ActiveMQMessage::acknowledge() ;
|
||||
} ;
|
||||
virtual p<PropertyMap> getProperties() {
|
||||
return ActiveMQMessage::getProperties() ;
|
||||
} ;
|
||||
virtual p<string> getJMSCorrelationID() {
|
||||
return ActiveMQMessage::getJMSCorrelationID() ;
|
||||
} ;
|
||||
virtual void setJMSCorrelationID(const char* correlationId) {
|
||||
return ActiveMQMessage::setJMSCorrelationID(correlationId) ;
|
||||
} ;
|
||||
virtual p<IDestination> getJMSDestination() {
|
||||
return ActiveMQMessage::getJMSDestination() ;
|
||||
} ;
|
||||
virtual long long getJMSExpiration() {
|
||||
return ActiveMQMessage::getJMSExpiration() ;
|
||||
} ;
|
||||
virtual void setJMSExpiration(long long time) {
|
||||
return ActiveMQMessage::setJMSExpiration(time) ;
|
||||
} ;
|
||||
virtual p<string> getJMSMessageID() {
|
||||
return ActiveMQMessage::getJMSMessageID() ;
|
||||
} ;
|
||||
virtual bool getJMSPersistent() {
|
||||
return ActiveMQMessage::getJMSPersistent() ;
|
||||
} ;
|
||||
virtual void setJMSPersistent(bool persistent) {
|
||||
return ActiveMQMessage::setJMSPersistent(persistent) ;
|
||||
} ;
|
||||
virtual unsigned char getJMSPriority() {
|
||||
return ActiveMQMessage::getJMSPriority() ;
|
||||
} ;
|
||||
virtual void setJMSPriority(unsigned char priority) {
|
||||
return ActiveMQMessage::setJMSPriority(priority) ;
|
||||
} ;
|
||||
virtual bool getJMSRedelivered() {
|
||||
return ActiveMQMessage::getJMSRedelivered() ;
|
||||
} ;
|
||||
virtual p<IDestination> getJMSReplyTo() {
|
||||
return ActiveMQMessage::getJMSReplyTo() ;
|
||||
} ;
|
||||
virtual void setJMSReplyTo(p<IDestination> destination) {
|
||||
return ActiveMQMessage::setJMSReplyTo(destination) ;
|
||||
} ;
|
||||
virtual long long getJMSTimestamp() {
|
||||
return ActiveMQMessage::getJMSTimestamp() ;
|
||||
} ;
|
||||
virtual p<string> getJMSType() {
|
||||
return ActiveMQMessage::getJMSType() ;
|
||||
} ;
|
||||
virtual void setJMSType(const char* type) {
|
||||
return ActiveMQMessage::setJMSType(type) ;
|
||||
} ;
|
||||
virtual int getJMSXDeliveryCount() {
|
||||
return ActiveMQMessage::getJMSXDeliveryCount() ;
|
||||
} ;
|
||||
virtual p<string> getJMSXGroupID() {
|
||||
return ActiveMQMessage::getJMSXGroupID() ;
|
||||
} ;
|
||||
virtual void setJMSXGroupID(const char* groupId) {
|
||||
return ActiveMQMessage::setJMSXGroupID(groupId) ;
|
||||
} ;
|
||||
virtual int getJMSXGroupSeq() {
|
||||
return ActiveMQMessage::getJMSXGroupSeq() ;
|
||||
} ;
|
||||
virtual void setJMSXGroupSeq(int sequence) {
|
||||
return ActiveMQMessage::setJMSXGroupSeq(sequence) ;
|
||||
} ;
|
||||
virtual p<string> getJMSXProducerTxID() {
|
||||
return ActiveMQMessage::getJMSXProducerTxID() ;
|
||||
} ;
|
||||
} ;
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_ActiveMQMapMessage_hpp_*/
|
||||
|
|
|
@ -1,374 +1,374 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#include "activemq/command/ActiveMQMessage.hpp"
|
||||
#include "ppr/io/ByteArrayOutputStream.hpp"
|
||||
#include "ppr/io/ByteArrayInputStream.hpp"
|
||||
|
||||
using namespace apache::activemq::command;
|
||||
|
||||
|
||||
// Constructors -----------------------------------------------------
|
||||
|
||||
|
||||
// Attribute methods ------------------------------------------------
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
unsigned char ActiveMQMessage::getDataStructureType()
|
||||
{
|
||||
return ActiveMQMessage::TYPE ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<IDestination> ActiveMQMessage::getFromDestination()
|
||||
{
|
||||
return this->destination ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void ActiveMQMessage::setFromDestination(p<IDestination> destination)
|
||||
{
|
||||
this->destination = p_dyncast<ActiveMQDestination> (destination) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void ActiveMQMessage::setAcknowledger(p<IAcknowledger> acknowledger)
|
||||
{
|
||||
this->acknowledger = acknowledger ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<PropertyMap> ActiveMQMessage::getProperties()
|
||||
{
|
||||
if( properties == NULL )
|
||||
properties = new PropertyMap() ;
|
||||
|
||||
return properties;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<string> ActiveMQMessage::getJMSCorrelationID()
|
||||
{
|
||||
return this->correlationId ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void ActiveMQMessage::setJMSCorrelationID(const char* correlationId)
|
||||
{
|
||||
this->correlationId = new string(correlationId) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<IDestination> ActiveMQMessage::getJMSDestination()
|
||||
{
|
||||
return this->originalDestination ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
long long ActiveMQMessage::getJMSExpiration()
|
||||
{
|
||||
return this->expiration ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void ActiveMQMessage::setJMSExpiration(long long time)
|
||||
{
|
||||
this->expiration = time ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<string> ActiveMQMessage::getJMSMessageID()
|
||||
{
|
||||
p<string> str ;
|
||||
p<ProducerId> pid = this->getMessageId()->getProducerId() ;
|
||||
char buffer[256] ;
|
||||
|
||||
// Compose message id as a string
|
||||
#ifdef unix
|
||||
sprintf(buffer, "%s:%lld:%lld:%lld", pid->getConnectionId()->c_str(),
|
||||
pid->getSessionId(),
|
||||
pid->getValue(),
|
||||
messageId->getProducerSequenceId() ) ;
|
||||
#else
|
||||
sprintf(buffer, "%s:%I64d:%I64d:%I64d", pid->getConnectionId()->c_str(),
|
||||
pid->getSessionId(),
|
||||
pid->getValue(),
|
||||
messageId->getProducerSequenceId() ) ;
|
||||
#endif
|
||||
|
||||
str = new string(buffer) ;
|
||||
return str ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
bool ActiveMQMessage::getJMSPersistent()
|
||||
{
|
||||
return this->persistent ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void ActiveMQMessage::setJMSPersistent(bool persistent)
|
||||
{
|
||||
this->persistent = persistent ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
unsigned char ActiveMQMessage::getJMSPriority()
|
||||
{
|
||||
return this->priority ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void ActiveMQMessage::setJMSPriority(unsigned char priority)
|
||||
{
|
||||
this->priority = priority ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
bool ActiveMQMessage::getJMSRedelivered()
|
||||
{
|
||||
return ( this->redeliveryCounter > 0 ) ? true : false ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<IDestination> ActiveMQMessage::getJMSReplyTo()
|
||||
{
|
||||
return this->replyTo ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void ActiveMQMessage::setJMSReplyTo(p<IDestination> destination)
|
||||
{
|
||||
this->replyTo = p_dyncast<ActiveMQDestination> (destination) ;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
long long ActiveMQMessage::getJMSTimestamp()
|
||||
{
|
||||
return this->timestamp ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<string> ActiveMQMessage::getJMSType()
|
||||
{
|
||||
return this->type ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void ActiveMQMessage::setJMSType(const char* type)
|
||||
{
|
||||
this->type = new string(type) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
int ActiveMQMessage::getJMSXDeliveryCount()
|
||||
{
|
||||
return this->redeliveryCounter + 1 ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<string> ActiveMQMessage::getJMSXGroupID()
|
||||
{
|
||||
return this->groupID ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void ActiveMQMessage::setJMSXGroupID(const char* groupId)
|
||||
{
|
||||
this->groupID = new string(groupId) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
int ActiveMQMessage::getJMSXGroupSeq()
|
||||
{
|
||||
return this->groupSequence ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void ActiveMQMessage::setJMSXGroupSeq(int sequence)
|
||||
{
|
||||
this->groupSequence = sequence ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<string> ActiveMQMessage::getJMSXProducerTxID()
|
||||
{
|
||||
p<TransactionId> txId = this->originalTransactionId ;
|
||||
p<string> str ;
|
||||
|
||||
if( txId == NULL )
|
||||
txId = this->transactionId ;
|
||||
|
||||
if( txId != NULL )
|
||||
{
|
||||
if( txId->getDataStructureType() == LocalTransactionId::TYPE )
|
||||
{
|
||||
p<LocalTransactionId> localTxId = p_cast<LocalTransactionId> (txId) ;
|
||||
char buffer[256] ;
|
||||
|
||||
// Compose local transaction id string
|
||||
#ifdef unix
|
||||
sprintf(buffer, "%lld", localTxId->getValue() ) ;
|
||||
#else
|
||||
sprintf(buffer, "%I64d", localTxId->getValue() ) ;
|
||||
#endif
|
||||
|
||||
str = new string(buffer ) ;
|
||||
return str ;
|
||||
}
|
||||
else if( txId->getDataStructureType() == XATransactionId::TYPE )
|
||||
{
|
||||
p<XATransactionId> xaTxId = p_cast<XATransactionId> (txId) ;
|
||||
char buffer[256] ;
|
||||
|
||||
// Compose XA transaction id string
|
||||
sprintf(buffer, "XID:%d:%s:%s", xaTxId->getFormatId(),
|
||||
Hex::toString( xaTxId->getGlobalTransactionId() )->c_str(),
|
||||
Hex::toString( xaTxId->getBranchQualifier() )->c_str() ) ;
|
||||
|
||||
str = new string(buffer ) ;
|
||||
return str ;
|
||||
}
|
||||
return NULL ;
|
||||
}
|
||||
return NULL ;
|
||||
}
|
||||
|
||||
|
||||
// Operation methods ------------------------------------------------
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void ActiveMQMessage::acknowledge()
|
||||
{
|
||||
if( acknowledger != NULL )
|
||||
acknowledger->acknowledge(smartify(this)) ;
|
||||
}
|
||||
|
||||
|
||||
// Implementation methods -------------------------------------------
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
int ActiveMQMessage::marshal(p<IMarshaller> marshaller, int mode, p<IOutputStream> writer) throw(IOException)
|
||||
{
|
||||
int size = 0 ;
|
||||
|
||||
// Update message content if available
|
||||
if( mode == IMarshaller::MARSHAL_SIZE && this->properties != NULL )
|
||||
{
|
||||
p<ByteArrayOutputStream> arrayWriter = new ByteArrayOutputStream() ;
|
||||
|
||||
// Marshal properties into a byte array
|
||||
marshaller->marshalMap(properties, IMarshaller::MARSHAL_WRITE, arrayWriter) ;
|
||||
|
||||
// Store properties byte array in message content
|
||||
this->marshalledProperties = arrayWriter->toArray() ;
|
||||
}
|
||||
// Note! Message propertys marshalling is done in super class
|
||||
size += Message::marshal(marshaller, mode, writer) ;
|
||||
|
||||
return size ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void ActiveMQMessage::unmarshal(p<IMarshaller> marshaller, int mode, p<IInputStream> reader) throw(IOException)
|
||||
{
|
||||
// Note! Message property unmarshalling is done in super class
|
||||
Message::unmarshal(marshaller, mode, reader) ;
|
||||
|
||||
// Extract properties from message
|
||||
if( mode == IMarshaller::MARSHAL_READ )
|
||||
{
|
||||
if( this->marshalledProperties != NULL )
|
||||
{
|
||||
p<ByteArrayInputStream> arrayReader = new ByteArrayInputStream( this->marshalledProperties ) ;
|
||||
|
||||
// Unmarshal map into a map
|
||||
properties = marshaller->unmarshalMap(mode, arrayReader) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Static methods ---------------------------------------------------
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
/*p<ActiveMQMessage> ActiveMQMessage::transform(p<IMessage> message)
|
||||
{
|
||||
return p_cast<ActiveMQMessage> (message) ;
|
||||
}*/
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#include "activemq/command/ActiveMQMessage.hpp"
|
||||
#include "ppr/io/ByteArrayOutputStream.hpp"
|
||||
#include "ppr/io/ByteArrayInputStream.hpp"
|
||||
|
||||
using namespace apache::activemq::command;
|
||||
|
||||
|
||||
// Constructors -----------------------------------------------------
|
||||
|
||||
|
||||
// Attribute methods ------------------------------------------------
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
unsigned char ActiveMQMessage::getDataStructureType()
|
||||
{
|
||||
return ActiveMQMessage::TYPE ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<IDestination> ActiveMQMessage::getFromDestination()
|
||||
{
|
||||
return this->destination ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void ActiveMQMessage::setFromDestination(p<IDestination> destination)
|
||||
{
|
||||
this->destination = p_dyncast<ActiveMQDestination> (destination) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void ActiveMQMessage::setAcknowledger(p<IAcknowledger> acknowledger)
|
||||
{
|
||||
this->acknowledger = acknowledger ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<PropertyMap> ActiveMQMessage::getProperties()
|
||||
{
|
||||
if( properties == NULL )
|
||||
properties = new PropertyMap() ;
|
||||
|
||||
return properties;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<string> ActiveMQMessage::getJMSCorrelationID()
|
||||
{
|
||||
return this->correlationId ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void ActiveMQMessage::setJMSCorrelationID(const char* correlationId)
|
||||
{
|
||||
this->correlationId = new string(correlationId) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<IDestination> ActiveMQMessage::getJMSDestination()
|
||||
{
|
||||
return this->originalDestination ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
long long ActiveMQMessage::getJMSExpiration()
|
||||
{
|
||||
return this->expiration ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void ActiveMQMessage::setJMSExpiration(long long time)
|
||||
{
|
||||
this->expiration = time ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<string> ActiveMQMessage::getJMSMessageID()
|
||||
{
|
||||
p<string> str ;
|
||||
p<ProducerId> pid = this->getMessageId()->getProducerId() ;
|
||||
char buffer[256] ;
|
||||
|
||||
// Compose message id as a string
|
||||
#ifdef unix
|
||||
sprintf(buffer, "%s:%lld:%lld:%lld", pid->getConnectionId()->c_str(),
|
||||
pid->getSessionId(),
|
||||
pid->getValue(),
|
||||
messageId->getProducerSequenceId() ) ;
|
||||
#else
|
||||
sprintf(buffer, "%s:%I64d:%I64d:%I64d", pid->getConnectionId()->c_str(),
|
||||
pid->getSessionId(),
|
||||
pid->getValue(),
|
||||
messageId->getProducerSequenceId() ) ;
|
||||
#endif
|
||||
|
||||
str = new string(buffer) ;
|
||||
return str ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
bool ActiveMQMessage::getJMSPersistent()
|
||||
{
|
||||
return this->persistent ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void ActiveMQMessage::setJMSPersistent(bool persistent)
|
||||
{
|
||||
this->persistent = persistent ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
unsigned char ActiveMQMessage::getJMSPriority()
|
||||
{
|
||||
return this->priority ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void ActiveMQMessage::setJMSPriority(unsigned char priority)
|
||||
{
|
||||
this->priority = priority ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
bool ActiveMQMessage::getJMSRedelivered()
|
||||
{
|
||||
return ( this->redeliveryCounter > 0 ) ? true : false ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<IDestination> ActiveMQMessage::getJMSReplyTo()
|
||||
{
|
||||
return this->replyTo ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void ActiveMQMessage::setJMSReplyTo(p<IDestination> destination)
|
||||
{
|
||||
this->replyTo = p_dyncast<ActiveMQDestination> (destination) ;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
long long ActiveMQMessage::getJMSTimestamp()
|
||||
{
|
||||
return this->timestamp ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<string> ActiveMQMessage::getJMSType()
|
||||
{
|
||||
return this->type ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void ActiveMQMessage::setJMSType(const char* type)
|
||||
{
|
||||
this->type = new string(type) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
int ActiveMQMessage::getJMSXDeliveryCount()
|
||||
{
|
||||
return this->redeliveryCounter + 1 ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<string> ActiveMQMessage::getJMSXGroupID()
|
||||
{
|
||||
return this->groupID ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void ActiveMQMessage::setJMSXGroupID(const char* groupId)
|
||||
{
|
||||
this->groupID = new string(groupId) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
int ActiveMQMessage::getJMSXGroupSeq()
|
||||
{
|
||||
return this->groupSequence ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void ActiveMQMessage::setJMSXGroupSeq(int sequence)
|
||||
{
|
||||
this->groupSequence = sequence ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<string> ActiveMQMessage::getJMSXProducerTxID()
|
||||
{
|
||||
p<TransactionId> txId = this->originalTransactionId ;
|
||||
p<string> str ;
|
||||
|
||||
if( txId == NULL )
|
||||
txId = this->transactionId ;
|
||||
|
||||
if( txId != NULL )
|
||||
{
|
||||
if( txId->getDataStructureType() == LocalTransactionId::TYPE )
|
||||
{
|
||||
p<LocalTransactionId> localTxId = p_cast<LocalTransactionId> (txId) ;
|
||||
char buffer[256] ;
|
||||
|
||||
// Compose local transaction id string
|
||||
#ifdef unix
|
||||
sprintf(buffer, "%lld", localTxId->getValue() ) ;
|
||||
#else
|
||||
sprintf(buffer, "%I64d", localTxId->getValue() ) ;
|
||||
#endif
|
||||
|
||||
str = new string(buffer ) ;
|
||||
return str ;
|
||||
}
|
||||
else if( txId->getDataStructureType() == XATransactionId::TYPE )
|
||||
{
|
||||
p<XATransactionId> xaTxId = p_cast<XATransactionId> (txId) ;
|
||||
char buffer[256] ;
|
||||
|
||||
// Compose XA transaction id string
|
||||
sprintf(buffer, "XID:%d:%s:%s", xaTxId->getFormatId(),
|
||||
Hex::toString( xaTxId->getGlobalTransactionId() )->c_str(),
|
||||
Hex::toString( xaTxId->getBranchQualifier() )->c_str() ) ;
|
||||
|
||||
str = new string(buffer ) ;
|
||||
return str ;
|
||||
}
|
||||
return NULL ;
|
||||
}
|
||||
return NULL ;
|
||||
}
|
||||
|
||||
|
||||
// Operation methods ------------------------------------------------
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void ActiveMQMessage::acknowledge()
|
||||
{
|
||||
if( acknowledger != NULL )
|
||||
acknowledger->acknowledge(smartify(this)) ;
|
||||
}
|
||||
|
||||
|
||||
// Implementation methods -------------------------------------------
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
int ActiveMQMessage::marshal(p<IMarshaller> marshaller, int mode, p<IOutputStream> writer) throw(IOException)
|
||||
{
|
||||
int size = 0 ;
|
||||
|
||||
// Update message content if available
|
||||
if( mode == IMarshaller::MARSHAL_SIZE && this->properties != NULL )
|
||||
{
|
||||
p<ByteArrayOutputStream> arrayWriter = new ByteArrayOutputStream() ;
|
||||
|
||||
// Marshal properties into a byte array
|
||||
marshaller->marshalMap(properties, IMarshaller::MARSHAL_WRITE, arrayWriter) ;
|
||||
|
||||
// Store properties byte array in message content
|
||||
this->marshalledProperties = arrayWriter->toArray() ;
|
||||
}
|
||||
// Note! Message propertys marshalling is done in super class
|
||||
size += Message::marshal(marshaller, mode, writer) ;
|
||||
|
||||
return size ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void ActiveMQMessage::unmarshal(p<IMarshaller> marshaller, int mode, p<IInputStream> reader) throw(IOException)
|
||||
{
|
||||
// Note! Message property unmarshalling is done in super class
|
||||
Message::unmarshal(marshaller, mode, reader) ;
|
||||
|
||||
// Extract properties from message
|
||||
if( mode == IMarshaller::MARSHAL_READ )
|
||||
{
|
||||
if( this->marshalledProperties != NULL )
|
||||
{
|
||||
p<ByteArrayInputStream> arrayReader = new ByteArrayInputStream( this->marshalledProperties ) ;
|
||||
|
||||
// Unmarshal map into a map
|
||||
properties = marshaller->unmarshalMap(mode, arrayReader) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Static methods ---------------------------------------------------
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
/*p<ActiveMQMessage> ActiveMQMessage::transform(p<IMessage> message)
|
||||
{
|
||||
return p_cast<ActiveMQMessage> (message) ;
|
||||
}*/
|
||||
|
|
|
@ -1,104 +1,104 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_ActiveMQMessage_hpp_
|
||||
#define ActiveMQ_ActiveMQMessage_hpp_
|
||||
|
||||
#include <string>
|
||||
#include "cms/IDestination.hpp"
|
||||
#include "cms/IMessage.hpp"
|
||||
#include "activemq/IAcknowledger.hpp"
|
||||
#include "activemq/command/Message.hpp"
|
||||
#include "activemq/command/LocalTransactionId.hpp"
|
||||
#include "activemq/command/XATransactionId.hpp"
|
||||
#include "ppr/io/IOException.hpp"
|
||||
#include "ppr/util/Hex.hpp"
|
||||
#include "ppr/util/MapItemHolder.hpp"
|
||||
#include "ppr/util/ifr/p"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
namespace command
|
||||
{
|
||||
using namespace ifr;
|
||||
using namespace apache::activemq;
|
||||
using namespace apache::cms;
|
||||
using namespace apache::ppr::io;
|
||||
using namespace apache::ppr::util;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
class ActiveMQMessage : public Message, public IMessage
|
||||
{
|
||||
private:
|
||||
p<IAcknowledger> acknowledger ;
|
||||
p<PropertyMap> properties ;
|
||||
|
||||
public:
|
||||
const static unsigned char TYPE = 23 ;
|
||||
|
||||
public:
|
||||
// Attributes
|
||||
virtual unsigned char getDataStructureType() ;
|
||||
virtual p<IDestination> getFromDestination() ;
|
||||
virtual void setFromDestination(p<IDestination> destination) ;
|
||||
virtual void setAcknowledger(p<IAcknowledger> acknowledger) ;
|
||||
virtual p<PropertyMap> getProperties() ;
|
||||
virtual p<string> getJMSCorrelationID() ;
|
||||
virtual void setJMSCorrelationID(const char* correlationId) ;
|
||||
virtual p<IDestination> getJMSDestination() ;
|
||||
virtual long long getJMSExpiration() ;
|
||||
virtual void setJMSExpiration(long long time) ;
|
||||
virtual p<string> getJMSMessageID() ;
|
||||
virtual bool getJMSPersistent() ;
|
||||
virtual void setJMSPersistent(bool persistent) ;
|
||||
virtual unsigned char getJMSPriority() ;
|
||||
virtual void setJMSPriority(unsigned char priority) ;
|
||||
virtual bool getJMSRedelivered() ;
|
||||
virtual p<IDestination> getJMSReplyTo() ;
|
||||
virtual void setJMSReplyTo(p<IDestination> destination) ;
|
||||
virtual long long getJMSTimestamp() ;
|
||||
virtual p<string> getJMSType() ;
|
||||
virtual void setJMSType(const char* type) ;
|
||||
virtual int getJMSXDeliveryCount() ;
|
||||
virtual p<string> getJMSXGroupID() ;
|
||||
virtual void setJMSXGroupID(const char* groupId) ;
|
||||
virtual int getJMSXGroupSeq() ;
|
||||
virtual void setJMSXGroupSeq(int sequence) ;
|
||||
virtual p<string> getJMSXProducerTxID() ;
|
||||
|
||||
// Operations
|
||||
virtual void acknowledge() ;
|
||||
|
||||
protected:
|
||||
// Implementation
|
||||
int marshal(p<IMarshaller> marshaller, int mode, p<IOutputStream> writer) throw(IOException) ;
|
||||
void unmarshal(p<IMarshaller> marshaller, int mode, p<IInputStream> reader) throw(IOException) ;
|
||||
|
||||
public:
|
||||
// Static methods
|
||||
//static p<ActiveMQMessage> transform(p<IMessage> message) ;
|
||||
} ;
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_ActiveMQMessage_hpp_*/
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_ActiveMQMessage_hpp_
|
||||
#define ActiveMQ_ActiveMQMessage_hpp_
|
||||
|
||||
#include <string>
|
||||
#include "cms/IDestination.hpp"
|
||||
#include "cms/IMessage.hpp"
|
||||
#include "activemq/IAcknowledger.hpp"
|
||||
#include "activemq/command/Message.hpp"
|
||||
#include "activemq/command/LocalTransactionId.hpp"
|
||||
#include "activemq/command/XATransactionId.hpp"
|
||||
#include "ppr/io/IOException.hpp"
|
||||
#include "ppr/util/Hex.hpp"
|
||||
#include "ppr/util/MapItemHolder.hpp"
|
||||
#include "ppr/util/ifr/p"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
namespace command
|
||||
{
|
||||
using namespace ifr;
|
||||
using namespace apache::activemq;
|
||||
using namespace apache::cms;
|
||||
using namespace apache::ppr::io;
|
||||
using namespace apache::ppr::util;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
class ActiveMQMessage : public Message, public IMessage
|
||||
{
|
||||
private:
|
||||
p<IAcknowledger> acknowledger ;
|
||||
p<PropertyMap> properties ;
|
||||
|
||||
public:
|
||||
const static unsigned char TYPE = 23 ;
|
||||
|
||||
public:
|
||||
// Attributes
|
||||
virtual unsigned char getDataStructureType() ;
|
||||
virtual p<IDestination> getFromDestination() ;
|
||||
virtual void setFromDestination(p<IDestination> destination) ;
|
||||
virtual void setAcknowledger(p<IAcknowledger> acknowledger) ;
|
||||
virtual p<PropertyMap> getProperties() ;
|
||||
virtual p<string> getJMSCorrelationID() ;
|
||||
virtual void setJMSCorrelationID(const char* correlationId) ;
|
||||
virtual p<IDestination> getJMSDestination() ;
|
||||
virtual long long getJMSExpiration() ;
|
||||
virtual void setJMSExpiration(long long time) ;
|
||||
virtual p<string> getJMSMessageID() ;
|
||||
virtual bool getJMSPersistent() ;
|
||||
virtual void setJMSPersistent(bool persistent) ;
|
||||
virtual unsigned char getJMSPriority() ;
|
||||
virtual void setJMSPriority(unsigned char priority) ;
|
||||
virtual bool getJMSRedelivered() ;
|
||||
virtual p<IDestination> getJMSReplyTo() ;
|
||||
virtual void setJMSReplyTo(p<IDestination> destination) ;
|
||||
virtual long long getJMSTimestamp() ;
|
||||
virtual p<string> getJMSType() ;
|
||||
virtual void setJMSType(const char* type) ;
|
||||
virtual int getJMSXDeliveryCount() ;
|
||||
virtual p<string> getJMSXGroupID() ;
|
||||
virtual void setJMSXGroupID(const char* groupId) ;
|
||||
virtual int getJMSXGroupSeq() ;
|
||||
virtual void setJMSXGroupSeq(int sequence) ;
|
||||
virtual p<string> getJMSXProducerTxID() ;
|
||||
|
||||
// Operations
|
||||
virtual void acknowledge() ;
|
||||
|
||||
protected:
|
||||
// Implementation
|
||||
int marshal(p<IMarshaller> marshaller, int mode, p<IOutputStream> writer) throw(IOException) ;
|
||||
void unmarshal(p<IMarshaller> marshaller, int mode, p<IInputStream> reader) throw(IOException) ;
|
||||
|
||||
public:
|
||||
// Static methods
|
||||
//static p<ActiveMQMessage> transform(p<IMessage> message) ;
|
||||
} ;
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_ActiveMQMessage_hpp_*/
|
||||
|
|
|
@ -1,35 +1,35 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#include "activemq/command/ActiveMQObjectMessage.hpp"
|
||||
|
||||
using namespace apache::activemq::command;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
ActiveMQObjectMessage::ActiveMQObjectMessage()
|
||||
{
|
||||
}
|
||||
|
||||
ActiveMQObjectMessage::~ActiveMQObjectMessage()
|
||||
{
|
||||
}
|
||||
|
||||
unsigned char ActiveMQObjectMessage::getDataStructureType()
|
||||
{
|
||||
return ActiveMQObjectMessage::TYPE ;
|
||||
}
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#include "activemq/command/ActiveMQObjectMessage.hpp"
|
||||
|
||||
using namespace apache::activemq::command;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
ActiveMQObjectMessage::ActiveMQObjectMessage()
|
||||
{
|
||||
}
|
||||
|
||||
ActiveMQObjectMessage::~ActiveMQObjectMessage()
|
||||
{
|
||||
}
|
||||
|
||||
unsigned char ActiveMQObjectMessage::getDataStructureType()
|
||||
{
|
||||
return ActiveMQObjectMessage::TYPE ;
|
||||
}
|
||||
|
|
|
@ -1,53 +1,53 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_ActiveMQObjectMessage_hpp_
|
||||
#define ActiveMQ_ActiveMQObjectMessage_hpp_
|
||||
|
||||
#include <string>
|
||||
#include "activemq/command/ActiveMQMessage.hpp"
|
||||
#include "ppr/util/ifr/p"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
namespace command
|
||||
{
|
||||
using namespace ifr;
|
||||
using namespace std;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
class ActiveMQObjectMessage : public ActiveMQMessage
|
||||
{
|
||||
public:
|
||||
const static unsigned char TYPE = 26 ;
|
||||
|
||||
public:
|
||||
ActiveMQObjectMessage() ;
|
||||
virtual ~ActiveMQObjectMessage() ;
|
||||
|
||||
virtual unsigned char getDataStructureType() ;
|
||||
} ;
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_ActiveMQObjectMessage_hpp_*/
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_ActiveMQObjectMessage_hpp_
|
||||
#define ActiveMQ_ActiveMQObjectMessage_hpp_
|
||||
|
||||
#include <string>
|
||||
#include "activemq/command/ActiveMQMessage.hpp"
|
||||
#include "ppr/util/ifr/p"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
namespace command
|
||||
{
|
||||
using namespace ifr;
|
||||
using namespace std;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
class ActiveMQObjectMessage : public ActiveMQMessage
|
||||
{
|
||||
public:
|
||||
const static unsigned char TYPE = 26 ;
|
||||
|
||||
public:
|
||||
ActiveMQObjectMessage() ;
|
||||
virtual ~ActiveMQObjectMessage() ;
|
||||
|
||||
virtual unsigned char getDataStructureType() ;
|
||||
} ;
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_ActiveMQObjectMessage_hpp_*/
|
||||
|
|
|
@ -1,75 +1,75 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#include "activemq/command/ActiveMQQueue.hpp"
|
||||
|
||||
using namespace apache::activemq::command;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
ActiveMQQueue::ActiveMQQueue()
|
||||
: ActiveMQDestination()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
ActiveMQQueue::ActiveMQQueue(const char* name)
|
||||
: ActiveMQDestination(name)
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
ActiveMQQueue::~ActiveMQQueue()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
unsigned char ActiveMQQueue::getDataStructureType()
|
||||
{
|
||||
return ActiveMQQueue::TYPE ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<string> ActiveMQQueue::getQueueName()
|
||||
{
|
||||
return this->getPhysicalName() ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
int ActiveMQQueue::getDestinationType()
|
||||
{
|
||||
return ActiveMQDestination::ACTIVEMQ_QUEUE ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<ActiveMQDestination> ActiveMQQueue::createDestination(const char* name)
|
||||
{
|
||||
p<ActiveMQQueue> queue = new ActiveMQQueue(name) ;
|
||||
return queue ;
|
||||
}
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#include "activemq/command/ActiveMQQueue.hpp"
|
||||
|
||||
using namespace apache::activemq::command;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
ActiveMQQueue::ActiveMQQueue()
|
||||
: ActiveMQDestination()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
ActiveMQQueue::ActiveMQQueue(const char* name)
|
||||
: ActiveMQDestination(name)
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
ActiveMQQueue::~ActiveMQQueue()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
unsigned char ActiveMQQueue::getDataStructureType()
|
||||
{
|
||||
return ActiveMQQueue::TYPE ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<string> ActiveMQQueue::getQueueName()
|
||||
{
|
||||
return this->getPhysicalName() ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
int ActiveMQQueue::getDestinationType()
|
||||
{
|
||||
return ActiveMQDestination::ACTIVEMQ_QUEUE ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<ActiveMQDestination> ActiveMQQueue::createDestination(const char* name)
|
||||
{
|
||||
p<ActiveMQQueue> queue = new ActiveMQQueue(name) ;
|
||||
return queue ;
|
||||
}
|
||||
|
|
|
@ -1,55 +1,55 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_ActiveMQQueue_hpp_
|
||||
#define ActiveMQ_ActiveMQQueue_hpp_
|
||||
|
||||
#include "cms/IQueue.hpp"
|
||||
#include "activemq/command/ActiveMQDestination.hpp"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
namespace command
|
||||
{
|
||||
using namespace apache::cms;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
class ActiveMQQueue : public ActiveMQDestination, public IQueue
|
||||
{
|
||||
public:
|
||||
const static unsigned char TYPE = 100 ;
|
||||
|
||||
public:
|
||||
ActiveMQQueue() ;
|
||||
ActiveMQQueue(const char* name) ;
|
||||
virtual ~ActiveMQQueue() ;
|
||||
|
||||
virtual unsigned char getDataStructureType() ;
|
||||
virtual p<string> getQueueName() ;
|
||||
virtual int getDestinationType() ;
|
||||
virtual p<ActiveMQDestination> createDestination(const char* name) ;
|
||||
} ;
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_ActiveMQQueue_hpp_*/
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_ActiveMQQueue_hpp_
|
||||
#define ActiveMQ_ActiveMQQueue_hpp_
|
||||
|
||||
#include "cms/IQueue.hpp"
|
||||
#include "activemq/command/ActiveMQDestination.hpp"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
namespace command
|
||||
{
|
||||
using namespace apache::cms;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
class ActiveMQQueue : public ActiveMQDestination, public IQueue
|
||||
{
|
||||
public:
|
||||
const static unsigned char TYPE = 100 ;
|
||||
|
||||
public:
|
||||
ActiveMQQueue() ;
|
||||
ActiveMQQueue(const char* name) ;
|
||||
virtual ~ActiveMQQueue() ;
|
||||
|
||||
virtual unsigned char getDataStructureType() ;
|
||||
virtual p<string> getQueueName() ;
|
||||
virtual int getDestinationType() ;
|
||||
virtual p<ActiveMQDestination> createDestination(const char* name) ;
|
||||
} ;
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_ActiveMQQueue_hpp_*/
|
||||
|
|
|
@ -1,35 +1,35 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#include "activemq/command/ActiveMQStreamMessage.hpp"
|
||||
|
||||
using namespace apache::activemq::command;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
ActiveMQStreamMessage::ActiveMQStreamMessage()
|
||||
{
|
||||
}
|
||||
|
||||
ActiveMQStreamMessage::~ActiveMQStreamMessage()
|
||||
{
|
||||
}
|
||||
|
||||
unsigned char ActiveMQStreamMessage::getDataStructureType()
|
||||
{
|
||||
return ActiveMQStreamMessage::TYPE ;
|
||||
}
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#include "activemq/command/ActiveMQStreamMessage.hpp"
|
||||
|
||||
using namespace apache::activemq::command;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
ActiveMQStreamMessage::ActiveMQStreamMessage()
|
||||
{
|
||||
}
|
||||
|
||||
ActiveMQStreamMessage::~ActiveMQStreamMessage()
|
||||
{
|
||||
}
|
||||
|
||||
unsigned char ActiveMQStreamMessage::getDataStructureType()
|
||||
{
|
||||
return ActiveMQStreamMessage::TYPE ;
|
||||
}
|
||||
|
|
|
@ -1,53 +1,53 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_ActiveMQStreamMessage_hpp_
|
||||
#define ActiveMQ_ActiveMQStreamMessage_hpp_
|
||||
|
||||
#include <string>
|
||||
#include "activemq/command/ActiveMQMessage.hpp"
|
||||
#include "ppr/util/ifr/p"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
namespace command
|
||||
{
|
||||
using namespace ifr;
|
||||
using namespace std;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
class ActiveMQStreamMessage : public ActiveMQMessage
|
||||
{
|
||||
public:
|
||||
const static unsigned char TYPE = 27 ;
|
||||
|
||||
public:
|
||||
ActiveMQStreamMessage() ;
|
||||
virtual ~ActiveMQStreamMessage() ;
|
||||
|
||||
virtual unsigned char getDataStructureType() ;
|
||||
} ;
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_ActiveMQStreamMessage_hpp_*/
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_ActiveMQStreamMessage_hpp_
|
||||
#define ActiveMQ_ActiveMQStreamMessage_hpp_
|
||||
|
||||
#include <string>
|
||||
#include "activemq/command/ActiveMQMessage.hpp"
|
||||
#include "ppr/util/ifr/p"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
namespace command
|
||||
{
|
||||
using namespace ifr;
|
||||
using namespace std;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
class ActiveMQStreamMessage : public ActiveMQMessage
|
||||
{
|
||||
public:
|
||||
const static unsigned char TYPE = 27 ;
|
||||
|
||||
public:
|
||||
ActiveMQStreamMessage() ;
|
||||
virtual ~ActiveMQStreamMessage() ;
|
||||
|
||||
virtual unsigned char getDataStructureType() ;
|
||||
} ;
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_ActiveMQStreamMessage_hpp_*/
|
||||
|
|
|
@ -1,53 +1,53 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#include "activemq/command/ActiveMQTempDestination.hpp"
|
||||
|
||||
using namespace apache::activemq::command;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
ActiveMQTempDestination::ActiveMQTempDestination()
|
||||
: ActiveMQDestination()
|
||||
{
|
||||
// no-op
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
ActiveMQTempDestination::ActiveMQTempDestination(const char* name)
|
||||
: ActiveMQDestination(name)
|
||||
{
|
||||
// no-op
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
ActiveMQTempDestination::~ActiveMQTempDestination()
|
||||
{
|
||||
// no-op
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
unsigned char ActiveMQTempDestination::getDataStructureType()
|
||||
{
|
||||
return ActiveMQTempDestination::TYPE ;
|
||||
}
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#include "activemq/command/ActiveMQTempDestination.hpp"
|
||||
|
||||
using namespace apache::activemq::command;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
ActiveMQTempDestination::ActiveMQTempDestination()
|
||||
: ActiveMQDestination()
|
||||
{
|
||||
// no-op
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
ActiveMQTempDestination::ActiveMQTempDestination(const char* name)
|
||||
: ActiveMQDestination(name)
|
||||
{
|
||||
// no-op
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
ActiveMQTempDestination::~ActiveMQTempDestination()
|
||||
{
|
||||
// no-op
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
unsigned char ActiveMQTempDestination::getDataStructureType()
|
||||
{
|
||||
return ActiveMQTempDestination::TYPE ;
|
||||
}
|
||||
|
|
|
@ -1,50 +1,50 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_ActiveMQTempDestination_hpp_
|
||||
#define ActiveMQ_ActiveMQTempDestination_hpp_
|
||||
|
||||
#include "activemq/command/ActiveMQDestination.hpp"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
namespace command
|
||||
{
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
class ActiveMQTempDestination : public ActiveMQDestination
|
||||
{
|
||||
public:
|
||||
const static unsigned char TYPE = 0 ;
|
||||
|
||||
public:
|
||||
ActiveMQTempDestination() ;
|
||||
ActiveMQTempDestination(const char* name) ;
|
||||
virtual ~ActiveMQTempDestination() ;
|
||||
|
||||
virtual unsigned char getDataStructureType() ;
|
||||
} ;
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_ActiveMQTempDestination_hpp_*/
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_ActiveMQTempDestination_hpp_
|
||||
#define ActiveMQ_ActiveMQTempDestination_hpp_
|
||||
|
||||
#include "activemq/command/ActiveMQDestination.hpp"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
namespace command
|
||||
{
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
class ActiveMQTempDestination : public ActiveMQDestination
|
||||
{
|
||||
public:
|
||||
const static unsigned char TYPE = 0 ;
|
||||
|
||||
public:
|
||||
ActiveMQTempDestination() ;
|
||||
ActiveMQTempDestination(const char* name) ;
|
||||
virtual ~ActiveMQTempDestination() ;
|
||||
|
||||
virtual unsigned char getDataStructureType() ;
|
||||
} ;
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_ActiveMQTempDestination_hpp_*/
|
||||
|
|
|
@ -1,75 +1,75 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#include "activemq/command/ActiveMQTempQueue.hpp"
|
||||
|
||||
using namespace apache::activemq::command;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
ActiveMQTempQueue::ActiveMQTempQueue()
|
||||
: ActiveMQTempDestination()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
ActiveMQTempQueue::ActiveMQTempQueue(const char* name)
|
||||
: ActiveMQTempDestination(name)
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
ActiveMQTempQueue::~ActiveMQTempQueue()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
unsigned char ActiveMQTempQueue::getDataStructureType()
|
||||
{
|
||||
return ActiveMQTempQueue::TYPE ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<string> ActiveMQTempQueue::getQueueName()
|
||||
{
|
||||
return this->getPhysicalName() ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
int ActiveMQTempQueue::getDestinationType()
|
||||
{
|
||||
return ActiveMQDestination::ACTIVEMQ_QUEUE ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<ActiveMQDestination> ActiveMQTempQueue::createDestination(const char* name)
|
||||
{
|
||||
p<ActiveMQTempQueue> tempQueue = new ActiveMQTempQueue(name) ;
|
||||
return tempQueue ;
|
||||
}
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#include "activemq/command/ActiveMQTempQueue.hpp"
|
||||
|
||||
using namespace apache::activemq::command;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
ActiveMQTempQueue::ActiveMQTempQueue()
|
||||
: ActiveMQTempDestination()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
ActiveMQTempQueue::ActiveMQTempQueue(const char* name)
|
||||
: ActiveMQTempDestination(name)
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
ActiveMQTempQueue::~ActiveMQTempQueue()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
unsigned char ActiveMQTempQueue::getDataStructureType()
|
||||
{
|
||||
return ActiveMQTempQueue::TYPE ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<string> ActiveMQTempQueue::getQueueName()
|
||||
{
|
||||
return this->getPhysicalName() ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
int ActiveMQTempQueue::getDestinationType()
|
||||
{
|
||||
return ActiveMQDestination::ACTIVEMQ_QUEUE ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<ActiveMQDestination> ActiveMQTempQueue::createDestination(const char* name)
|
||||
{
|
||||
p<ActiveMQTempQueue> tempQueue = new ActiveMQTempQueue(name) ;
|
||||
return tempQueue ;
|
||||
}
|
||||
|
|
|
@ -1,55 +1,55 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_ActiveMQTempQueue_hpp_
|
||||
#define ActiveMQ_ActiveMQTempQueue_hpp_
|
||||
|
||||
#include "cms/ITemporaryQueue.hpp"
|
||||
#include "activemq/command/ActiveMQTempDestination.hpp"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
namespace command
|
||||
{
|
||||
using namespace apache::cms;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
class ActiveMQTempQueue : public ActiveMQTempDestination, public ITemporaryQueue
|
||||
{
|
||||
public:
|
||||
const static unsigned char TYPE = 102 ;
|
||||
|
||||
public:
|
||||
ActiveMQTempQueue() ;
|
||||
ActiveMQTempQueue(const char* name) ;
|
||||
virtual ~ActiveMQTempQueue() ;
|
||||
|
||||
virtual unsigned char getDataStructureType() ;
|
||||
virtual p<string> getQueueName() ;
|
||||
virtual int getDestinationType() ;
|
||||
virtual p<ActiveMQDestination> createDestination(const char* name) ;
|
||||
} ;
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_ActiveMQTempQueue_hpp_*/
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_ActiveMQTempQueue_hpp_
|
||||
#define ActiveMQ_ActiveMQTempQueue_hpp_
|
||||
|
||||
#include "cms/ITemporaryQueue.hpp"
|
||||
#include "activemq/command/ActiveMQTempDestination.hpp"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
namespace command
|
||||
{
|
||||
using namespace apache::cms;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
class ActiveMQTempQueue : public ActiveMQTempDestination, public ITemporaryQueue
|
||||
{
|
||||
public:
|
||||
const static unsigned char TYPE = 102 ;
|
||||
|
||||
public:
|
||||
ActiveMQTempQueue() ;
|
||||
ActiveMQTempQueue(const char* name) ;
|
||||
virtual ~ActiveMQTempQueue() ;
|
||||
|
||||
virtual unsigned char getDataStructureType() ;
|
||||
virtual p<string> getQueueName() ;
|
||||
virtual int getDestinationType() ;
|
||||
virtual p<ActiveMQDestination> createDestination(const char* name) ;
|
||||
} ;
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_ActiveMQTempQueue_hpp_*/
|
||||
|
|
|
@ -1,75 +1,75 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#include "activemq/command/ActiveMQTempTopic.hpp"
|
||||
|
||||
using namespace apache::activemq::command;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
ActiveMQTempTopic::ActiveMQTempTopic()
|
||||
: ActiveMQTempDestination()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
ActiveMQTempTopic::ActiveMQTempTopic(const char* name)
|
||||
: ActiveMQTempDestination(name)
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
ActiveMQTempTopic::~ActiveMQTempTopic()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
unsigned char ActiveMQTempTopic::getDataStructureType()
|
||||
{
|
||||
return ActiveMQTempTopic::TYPE ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<string> ActiveMQTempTopic::getTopicName()
|
||||
{
|
||||
return this->getPhysicalName() ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
int ActiveMQTempTopic::getDestinationType()
|
||||
{
|
||||
return ActiveMQDestination::ACTIVEMQ_TOPIC ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<ActiveMQDestination> ActiveMQTempTopic::createDestination(const char* name)
|
||||
{
|
||||
p<ActiveMQTempTopic> tempTopic = new ActiveMQTempTopic(name) ;
|
||||
return tempTopic ;
|
||||
}
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#include "activemq/command/ActiveMQTempTopic.hpp"
|
||||
|
||||
using namespace apache::activemq::command;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
ActiveMQTempTopic::ActiveMQTempTopic()
|
||||
: ActiveMQTempDestination()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
ActiveMQTempTopic::ActiveMQTempTopic(const char* name)
|
||||
: ActiveMQTempDestination(name)
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
ActiveMQTempTopic::~ActiveMQTempTopic()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
unsigned char ActiveMQTempTopic::getDataStructureType()
|
||||
{
|
||||
return ActiveMQTempTopic::TYPE ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<string> ActiveMQTempTopic::getTopicName()
|
||||
{
|
||||
return this->getPhysicalName() ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
int ActiveMQTempTopic::getDestinationType()
|
||||
{
|
||||
return ActiveMQDestination::ACTIVEMQ_TOPIC ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<ActiveMQDestination> ActiveMQTempTopic::createDestination(const char* name)
|
||||
{
|
||||
p<ActiveMQTempTopic> tempTopic = new ActiveMQTempTopic(name) ;
|
||||
return tempTopic ;
|
||||
}
|
||||
|
|
|
@ -1,55 +1,55 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_ActiveMQTempTopic_hpp_
|
||||
#define ActiveMQ_ActiveMQTempTopic_hpp_
|
||||
|
||||
#include "cms/ITemporaryTopic.hpp"
|
||||
#include "activemq/command/ActiveMQTempDestination.hpp"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
namespace command
|
||||
{
|
||||
using namespace apache::cms;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
class ActiveMQTempTopic : public ActiveMQTempDestination, public ITemporaryTopic
|
||||
{
|
||||
public:
|
||||
const static unsigned char TYPE = 103 ;
|
||||
|
||||
public:
|
||||
ActiveMQTempTopic() ;
|
||||
ActiveMQTempTopic(const char* name) ;
|
||||
virtual ~ActiveMQTempTopic() ;
|
||||
|
||||
virtual unsigned char getDataStructureType() ;
|
||||
virtual p<string> getTopicName() ;
|
||||
virtual int getDestinationType() ;
|
||||
virtual p<ActiveMQDestination> createDestination(const char* name) ;
|
||||
} ;
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_ActiveMQTempTopic_hpp_*/
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_ActiveMQTempTopic_hpp_
|
||||
#define ActiveMQ_ActiveMQTempTopic_hpp_
|
||||
|
||||
#include "cms/ITemporaryTopic.hpp"
|
||||
#include "activemq/command/ActiveMQTempDestination.hpp"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
namespace command
|
||||
{
|
||||
using namespace apache::cms;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
class ActiveMQTempTopic : public ActiveMQTempDestination, public ITemporaryTopic
|
||||
{
|
||||
public:
|
||||
const static unsigned char TYPE = 103 ;
|
||||
|
||||
public:
|
||||
ActiveMQTempTopic() ;
|
||||
ActiveMQTempTopic(const char* name) ;
|
||||
virtual ~ActiveMQTempTopic() ;
|
||||
|
||||
virtual unsigned char getDataStructureType() ;
|
||||
virtual p<string> getTopicName() ;
|
||||
virtual int getDestinationType() ;
|
||||
virtual p<ActiveMQDestination> createDestination(const char* name) ;
|
||||
} ;
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_ActiveMQTempTopic_hpp_*/
|
||||
|
|
|
@ -1,98 +1,98 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#include "activemq/command/ActiveMQTextMessage.hpp"
|
||||
|
||||
using namespace apache::activemq::command;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
ActiveMQTextMessage::ActiveMQTextMessage()
|
||||
{
|
||||
setText(NULL) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
ActiveMQTextMessage::ActiveMQTextMessage(const char* text)
|
||||
{
|
||||
setText(text) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
ActiveMQTextMessage::~ActiveMQTextMessage()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
unsigned char ActiveMQTextMessage::getDataStructureType()
|
||||
{
|
||||
return ActiveMQTextMessage::TYPE ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<string> ActiveMQTextMessage::getText()
|
||||
{
|
||||
// Extract text from message content
|
||||
if( this->content.size() > 0 )
|
||||
{
|
||||
int utflen = 0 ;
|
||||
char* buffer = this->content.c_array() ;
|
||||
|
||||
// TODO: assuming that the text is ASCII
|
||||
utflen |= (char) ((buffer[0] << 24) & 0xFF) ;
|
||||
utflen |= (char) ((buffer[1] >> 16) & 0xFF);
|
||||
utflen |= (char) ((buffer[2] >> 8) & 0xFF);
|
||||
utflen |= (char) ((buffer[3] >> 0) & 0xFF);
|
||||
|
||||
p<string> text = new string( buffer + 4, this->content.size() - 4 ) ;
|
||||
return text ;
|
||||
}
|
||||
return NULL ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void ActiveMQTextMessage::setText(const char* text)
|
||||
{
|
||||
if( text != NULL )
|
||||
{
|
||||
int length = (int)strlen(text) ;
|
||||
int utflen = length ;
|
||||
|
||||
// TODO: assuming that the text is ASCII
|
||||
this->content = array<char> (length + 4) ;
|
||||
|
||||
this->content[0] = (char) ((utflen >> 24) & 0xFF) ;
|
||||
this->content[1] = (char) ((utflen >> 16) & 0xFF);
|
||||
this->content[2] = (char) ((utflen >> 8) & 0xFF);
|
||||
this->content[3] = (char) ((utflen >> 0) & 0xFF);
|
||||
|
||||
for( int i = 0 ; i < length ; i++ )
|
||||
this->content[4+i] = text[i] ;
|
||||
}
|
||||
else
|
||||
this->content = NULL ;
|
||||
}
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#include "activemq/command/ActiveMQTextMessage.hpp"
|
||||
|
||||
using namespace apache::activemq::command;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
ActiveMQTextMessage::ActiveMQTextMessage()
|
||||
{
|
||||
setText(NULL) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
ActiveMQTextMessage::ActiveMQTextMessage(const char* text)
|
||||
{
|
||||
setText(text) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
ActiveMQTextMessage::~ActiveMQTextMessage()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
unsigned char ActiveMQTextMessage::getDataStructureType()
|
||||
{
|
||||
return ActiveMQTextMessage::TYPE ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<string> ActiveMQTextMessage::getText()
|
||||
{
|
||||
// Extract text from message content
|
||||
if( this->content.size() > 0 )
|
||||
{
|
||||
int utflen = 0 ;
|
||||
char* buffer = this->content.c_array() ;
|
||||
|
||||
// TODO: assuming that the text is ASCII
|
||||
utflen |= (char) ((buffer[0] << 24) & 0xFF) ;
|
||||
utflen |= (char) ((buffer[1] >> 16) & 0xFF);
|
||||
utflen |= (char) ((buffer[2] >> 8) & 0xFF);
|
||||
utflen |= (char) ((buffer[3] >> 0) & 0xFF);
|
||||
|
||||
p<string> text = new string( buffer + 4, this->content.size() - 4 ) ;
|
||||
return text ;
|
||||
}
|
||||
return NULL ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void ActiveMQTextMessage::setText(const char* text)
|
||||
{
|
||||
if( text != NULL )
|
||||
{
|
||||
int length = (int)strlen(text) ;
|
||||
int utflen = length ;
|
||||
|
||||
// TODO: assuming that the text is ASCII
|
||||
this->content = array<char> (length + 4) ;
|
||||
|
||||
this->content[0] = (char) ((utflen >> 24) & 0xFF) ;
|
||||
this->content[1] = (char) ((utflen >> 16) & 0xFF);
|
||||
this->content[2] = (char) ((utflen >> 8) & 0xFF);
|
||||
this->content[3] = (char) ((utflen >> 0) & 0xFF);
|
||||
|
||||
for( int i = 0 ; i < length ; i++ )
|
||||
this->content[4+i] = text[i] ;
|
||||
}
|
||||
else
|
||||
this->content = NULL ;
|
||||
}
|
||||
|
|
|
@ -1,135 +1,135 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_ActiveMQTextMessage_hpp_
|
||||
#define ActiveMQ_ActiveMQTextMessage_hpp_
|
||||
|
||||
#include <string>
|
||||
#include "cms/ITextMessage.hpp"
|
||||
#include "activemq/command/ActiveMQMessage.hpp"
|
||||
#include "ppr/util/MapItemHolder.hpp"
|
||||
#include "ppr/util/ifr/p"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
namespace command
|
||||
{
|
||||
using namespace ifr;
|
||||
using namespace apache::cms;
|
||||
using namespace apache::ppr::util;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
class ActiveMQTextMessage : public ActiveMQMessage, public ITextMessage
|
||||
{
|
||||
public:
|
||||
const static unsigned char TYPE = 28 ;
|
||||
|
||||
public:
|
||||
ActiveMQTextMessage() ;
|
||||
ActiveMQTextMessage(const char* text) ;
|
||||
virtual ~ActiveMQTextMessage() ;
|
||||
|
||||
virtual unsigned char getDataStructureType() ;
|
||||
virtual p<string> getText() ;
|
||||
virtual void setText(const char* text) ;
|
||||
|
||||
//
|
||||
// The methods below are needed to resolve the multiple
|
||||
// inheritance of IMessage.
|
||||
virtual void acknowledge() {
|
||||
ActiveMQMessage::acknowledge() ;
|
||||
} ;
|
||||
virtual p<PropertyMap> getProperties() {
|
||||
return ActiveMQMessage::getProperties() ;
|
||||
} ;
|
||||
virtual p<string> getJMSCorrelationID() {
|
||||
return ActiveMQMessage::getJMSCorrelationID() ;
|
||||
} ;
|
||||
virtual void setJMSCorrelationID(const char* correlationId) {
|
||||
return ActiveMQMessage::setJMSCorrelationID(correlationId) ;
|
||||
} ;
|
||||
virtual p<IDestination> getJMSDestination() {
|
||||
return ActiveMQMessage::getJMSDestination() ;
|
||||
} ;
|
||||
virtual long long getJMSExpiration() {
|
||||
return ActiveMQMessage::getJMSExpiration() ;
|
||||
} ;
|
||||
virtual void setJMSExpiration(long long time) {
|
||||
return ActiveMQMessage::setJMSExpiration(time) ;
|
||||
} ;
|
||||
virtual p<string> getJMSMessageID() {
|
||||
return ActiveMQMessage::getJMSMessageID() ;
|
||||
} ;
|
||||
virtual bool getJMSPersistent() {
|
||||
return ActiveMQMessage::getJMSPersistent() ;
|
||||
} ;
|
||||
virtual void setJMSPersistent(bool persistent) {
|
||||
return ActiveMQMessage::setJMSPersistent(persistent) ;
|
||||
} ;
|
||||
virtual unsigned char getJMSPriority() {
|
||||
return ActiveMQMessage::getJMSPriority() ;
|
||||
} ;
|
||||
virtual void setJMSPriority(unsigned char priority) {
|
||||
return ActiveMQMessage::setJMSPriority(priority) ;
|
||||
} ;
|
||||
virtual bool getJMSRedelivered() {
|
||||
return ActiveMQMessage::getJMSRedelivered() ;
|
||||
} ;
|
||||
virtual p<IDestination> getJMSReplyTo() {
|
||||
return ActiveMQMessage::getJMSReplyTo() ;
|
||||
} ;
|
||||
virtual void setJMSReplyTo(p<IDestination> destination) {
|
||||
return ActiveMQMessage::setJMSReplyTo(destination) ;
|
||||
} ;
|
||||
virtual long long getJMSTimestamp() {
|
||||
return ActiveMQMessage::getJMSTimestamp() ;
|
||||
} ;
|
||||
virtual p<string> getJMSType() {
|
||||
return ActiveMQMessage::getJMSType() ;
|
||||
} ;
|
||||
virtual void setJMSType(const char* type) {
|
||||
return ActiveMQMessage::setJMSType(type) ;
|
||||
} ;
|
||||
virtual int getJMSXDeliveryCount() {
|
||||
return ActiveMQMessage::getJMSXDeliveryCount() ;
|
||||
} ;
|
||||
virtual p<string> getJMSXGroupID() {
|
||||
return ActiveMQMessage::getJMSXGroupID() ;
|
||||
} ;
|
||||
virtual void setJMSXGroupID(const char* groupId) {
|
||||
return ActiveMQMessage::setJMSXGroupID(groupId) ;
|
||||
} ;
|
||||
virtual int getJMSXGroupSeq() {
|
||||
return ActiveMQMessage::getJMSXGroupSeq() ;
|
||||
} ;
|
||||
virtual void setJMSXGroupSeq(int sequence) {
|
||||
return ActiveMQMessage::setJMSXGroupSeq(sequence) ;
|
||||
} ;
|
||||
virtual p<string> getJMSXProducerTxID() {
|
||||
return ActiveMQMessage::getJMSXProducerTxID() ;
|
||||
} ;
|
||||
} ;
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_ActiveMQTextMessage_hpp_*/
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_ActiveMQTextMessage_hpp_
|
||||
#define ActiveMQ_ActiveMQTextMessage_hpp_
|
||||
|
||||
#include <string>
|
||||
#include "cms/ITextMessage.hpp"
|
||||
#include "activemq/command/ActiveMQMessage.hpp"
|
||||
#include "ppr/util/MapItemHolder.hpp"
|
||||
#include "ppr/util/ifr/p"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
namespace command
|
||||
{
|
||||
using namespace ifr;
|
||||
using namespace apache::cms;
|
||||
using namespace apache::ppr::util;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
class ActiveMQTextMessage : public ActiveMQMessage, public ITextMessage
|
||||
{
|
||||
public:
|
||||
const static unsigned char TYPE = 28 ;
|
||||
|
||||
public:
|
||||
ActiveMQTextMessage() ;
|
||||
ActiveMQTextMessage(const char* text) ;
|
||||
virtual ~ActiveMQTextMessage() ;
|
||||
|
||||
virtual unsigned char getDataStructureType() ;
|
||||
virtual p<string> getText() ;
|
||||
virtual void setText(const char* text) ;
|
||||
|
||||
//
|
||||
// The methods below are needed to resolve the multiple
|
||||
// inheritance of IMessage.
|
||||
virtual void acknowledge() {
|
||||
ActiveMQMessage::acknowledge() ;
|
||||
} ;
|
||||
virtual p<PropertyMap> getProperties() {
|
||||
return ActiveMQMessage::getProperties() ;
|
||||
} ;
|
||||
virtual p<string> getJMSCorrelationID() {
|
||||
return ActiveMQMessage::getJMSCorrelationID() ;
|
||||
} ;
|
||||
virtual void setJMSCorrelationID(const char* correlationId) {
|
||||
return ActiveMQMessage::setJMSCorrelationID(correlationId) ;
|
||||
} ;
|
||||
virtual p<IDestination> getJMSDestination() {
|
||||
return ActiveMQMessage::getJMSDestination() ;
|
||||
} ;
|
||||
virtual long long getJMSExpiration() {
|
||||
return ActiveMQMessage::getJMSExpiration() ;
|
||||
} ;
|
||||
virtual void setJMSExpiration(long long time) {
|
||||
return ActiveMQMessage::setJMSExpiration(time) ;
|
||||
} ;
|
||||
virtual p<string> getJMSMessageID() {
|
||||
return ActiveMQMessage::getJMSMessageID() ;
|
||||
} ;
|
||||
virtual bool getJMSPersistent() {
|
||||
return ActiveMQMessage::getJMSPersistent() ;
|
||||
} ;
|
||||
virtual void setJMSPersistent(bool persistent) {
|
||||
return ActiveMQMessage::setJMSPersistent(persistent) ;
|
||||
} ;
|
||||
virtual unsigned char getJMSPriority() {
|
||||
return ActiveMQMessage::getJMSPriority() ;
|
||||
} ;
|
||||
virtual void setJMSPriority(unsigned char priority) {
|
||||
return ActiveMQMessage::setJMSPriority(priority) ;
|
||||
} ;
|
||||
virtual bool getJMSRedelivered() {
|
||||
return ActiveMQMessage::getJMSRedelivered() ;
|
||||
} ;
|
||||
virtual p<IDestination> getJMSReplyTo() {
|
||||
return ActiveMQMessage::getJMSReplyTo() ;
|
||||
} ;
|
||||
virtual void setJMSReplyTo(p<IDestination> destination) {
|
||||
return ActiveMQMessage::setJMSReplyTo(destination) ;
|
||||
} ;
|
||||
virtual long long getJMSTimestamp() {
|
||||
return ActiveMQMessage::getJMSTimestamp() ;
|
||||
} ;
|
||||
virtual p<string> getJMSType() {
|
||||
return ActiveMQMessage::getJMSType() ;
|
||||
} ;
|
||||
virtual void setJMSType(const char* type) {
|
||||
return ActiveMQMessage::setJMSType(type) ;
|
||||
} ;
|
||||
virtual int getJMSXDeliveryCount() {
|
||||
return ActiveMQMessage::getJMSXDeliveryCount() ;
|
||||
} ;
|
||||
virtual p<string> getJMSXGroupID() {
|
||||
return ActiveMQMessage::getJMSXGroupID() ;
|
||||
} ;
|
||||
virtual void setJMSXGroupID(const char* groupId) {
|
||||
return ActiveMQMessage::setJMSXGroupID(groupId) ;
|
||||
} ;
|
||||
virtual int getJMSXGroupSeq() {
|
||||
return ActiveMQMessage::getJMSXGroupSeq() ;
|
||||
} ;
|
||||
virtual void setJMSXGroupSeq(int sequence) {
|
||||
return ActiveMQMessage::setJMSXGroupSeq(sequence) ;
|
||||
} ;
|
||||
virtual p<string> getJMSXProducerTxID() {
|
||||
return ActiveMQMessage::getJMSXProducerTxID() ;
|
||||
} ;
|
||||
} ;
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_ActiveMQTextMessage_hpp_*/
|
||||
|
|
|
@ -1,75 +1,75 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#include "activemq/command/ActiveMQTopic.hpp"
|
||||
|
||||
using namespace apache::activemq::command;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
ActiveMQTopic::ActiveMQTopic()
|
||||
: ActiveMQDestination()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
ActiveMQTopic::ActiveMQTopic(const char* name)
|
||||
: ActiveMQDestination(name)
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
ActiveMQTopic::~ActiveMQTopic()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
unsigned char ActiveMQTopic::getDataStructureType()
|
||||
{
|
||||
return ActiveMQTopic::TYPE ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<string> ActiveMQTopic::getTopicName()
|
||||
{
|
||||
return this->getPhysicalName() ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
int ActiveMQTopic::getDestinationType()
|
||||
{
|
||||
return ActiveMQDestination::ACTIVEMQ_TOPIC ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<ActiveMQDestination> ActiveMQTopic::createDestination(const char* name)
|
||||
{
|
||||
p<ActiveMQTopic> topic = new ActiveMQTopic(name) ;
|
||||
return topic ;
|
||||
}
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#include "activemq/command/ActiveMQTopic.hpp"
|
||||
|
||||
using namespace apache::activemq::command;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
ActiveMQTopic::ActiveMQTopic()
|
||||
: ActiveMQDestination()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
ActiveMQTopic::ActiveMQTopic(const char* name)
|
||||
: ActiveMQDestination(name)
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
ActiveMQTopic::~ActiveMQTopic()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
unsigned char ActiveMQTopic::getDataStructureType()
|
||||
{
|
||||
return ActiveMQTopic::TYPE ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<string> ActiveMQTopic::getTopicName()
|
||||
{
|
||||
return this->getPhysicalName() ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
int ActiveMQTopic::getDestinationType()
|
||||
{
|
||||
return ActiveMQDestination::ACTIVEMQ_TOPIC ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<ActiveMQDestination> ActiveMQTopic::createDestination(const char* name)
|
||||
{
|
||||
p<ActiveMQTopic> topic = new ActiveMQTopic(name) ;
|
||||
return topic ;
|
||||
}
|
||||
|
|
|
@ -1,55 +1,55 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_ActiveMQTopic_hpp_
|
||||
#define ActiveMQ_ActiveMQTopic_hpp_
|
||||
|
||||
#include "cms/ITopic.hpp"
|
||||
#include "activemq/command/ActiveMQDestination.hpp"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
namespace command
|
||||
{
|
||||
using namespace apache::cms;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
class ActiveMQTopic : public ActiveMQDestination, public ITopic
|
||||
{
|
||||
public:
|
||||
const static unsigned char TYPE = 101 ;
|
||||
|
||||
public:
|
||||
ActiveMQTopic() ;
|
||||
ActiveMQTopic(const char* name) ;
|
||||
virtual ~ActiveMQTopic() ;
|
||||
|
||||
virtual unsigned char getDataStructureType() ;
|
||||
virtual p<string> getTopicName() ;
|
||||
virtual int getDestinationType() ;
|
||||
virtual p<ActiveMQDestination> createDestination(const char* name) ;
|
||||
} ;
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_ActiveMQTopic_hpp_*/
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_ActiveMQTopic_hpp_
|
||||
#define ActiveMQ_ActiveMQTopic_hpp_
|
||||
|
||||
#include "cms/ITopic.hpp"
|
||||
#include "activemq/command/ActiveMQDestination.hpp"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
namespace command
|
||||
{
|
||||
using namespace apache::cms;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
class ActiveMQTopic : public ActiveMQDestination, public ITopic
|
||||
{
|
||||
public:
|
||||
const static unsigned char TYPE = 101 ;
|
||||
|
||||
public:
|
||||
ActiveMQTopic() ;
|
||||
ActiveMQTopic(const char* name) ;
|
||||
virtual ~ActiveMQTopic() ;
|
||||
|
||||
virtual unsigned char getDataStructureType() ;
|
||||
virtual p<string> getTopicName() ;
|
||||
virtual int getDestinationType() ;
|
||||
virtual p<ActiveMQDestination> createDestination(const char* name) ;
|
||||
} ;
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_ActiveMQTopic_hpp_*/
|
||||
|
|
|
@ -1,57 +1,57 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#include "activemq/command/BaseCommand.hpp"
|
||||
|
||||
using namespace apache::activemq::command;
|
||||
|
||||
|
||||
// Attribute methods ------------------------------------------------
|
||||
|
||||
int BaseCommand::getHashCode()
|
||||
{
|
||||
return ( commandId * 38 ) + getDataStructureType() ;
|
||||
}
|
||||
|
||||
|
||||
// Operation methods ------------------------------------------------
|
||||
|
||||
bool BaseCommand::operator== (BaseCommand& that)
|
||||
{
|
||||
if( this->getDataStructureType() == that.getDataStructureType() &&
|
||||
this->commandId == that.commandId )
|
||||
{
|
||||
return true ;
|
||||
}
|
||||
return false ;
|
||||
}
|
||||
|
||||
p<string> BaseCommand::toString()
|
||||
{
|
||||
p<string> str = new string() ;
|
||||
char buffer[10] ;
|
||||
|
||||
str->assign( getDataStructureTypeAsString( getDataStructureType() )->c_str() ) ;
|
||||
|
||||
if( str->length() == 0 )
|
||||
str->assign("") ;
|
||||
|
||||
str->append(": id = ") ;
|
||||
sprintf(buffer, "%d", commandId) ;
|
||||
str->append( buffer ) ;
|
||||
|
||||
return str ;
|
||||
}
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#include "activemq/command/BaseCommand.hpp"
|
||||
|
||||
using namespace apache::activemq::command;
|
||||
|
||||
|
||||
// Attribute methods ------------------------------------------------
|
||||
|
||||
int BaseCommand::getHashCode()
|
||||
{
|
||||
return ( commandId * 38 ) + getDataStructureType() ;
|
||||
}
|
||||
|
||||
|
||||
// Operation methods ------------------------------------------------
|
||||
|
||||
bool BaseCommand::operator== (BaseCommand& that)
|
||||
{
|
||||
if( this->getDataStructureType() == that.getDataStructureType() &&
|
||||
this->commandId == that.commandId )
|
||||
{
|
||||
return true ;
|
||||
}
|
||||
return false ;
|
||||
}
|
||||
|
||||
p<string> BaseCommand::toString()
|
||||
{
|
||||
p<string> str = new string() ;
|
||||
char buffer[10] ;
|
||||
|
||||
str->assign( getDataStructureTypeAsString( getDataStructureType() )->c_str() ) ;
|
||||
|
||||
if( str->length() == 0 )
|
||||
str->assign("") ;
|
||||
|
||||
str->append(": id = ") ;
|
||||
sprintf(buffer, "%d", commandId) ;
|
||||
str->append( buffer ) ;
|
||||
|
||||
return str ;
|
||||
}
|
||||
|
|
|
@ -1,51 +1,51 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_BaseCommand_hpp_
|
||||
#define ActiveMQ_BaseCommand_hpp_
|
||||
|
||||
#include <string>
|
||||
#include "activemq/command/AbstractCommand.hpp"
|
||||
#include "ppr/util/ifr/p"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
namespace command
|
||||
{
|
||||
using namespace ifr;
|
||||
using namespace std;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
class BaseCommand : public AbstractCommand
|
||||
{
|
||||
public:
|
||||
// Equals operator
|
||||
bool operator== (BaseCommand& other) ;
|
||||
|
||||
virtual int getHashCode() ;
|
||||
virtual p<string> toString() ;
|
||||
};
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_BaseCommand_hpp_*/
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_BaseCommand_hpp_
|
||||
#define ActiveMQ_BaseCommand_hpp_
|
||||
|
||||
#include <string>
|
||||
#include "activemq/command/AbstractCommand.hpp"
|
||||
#include "ppr/util/ifr/p"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
namespace command
|
||||
{
|
||||
using namespace ifr;
|
||||
using namespace std;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
class BaseCommand : public AbstractCommand
|
||||
{
|
||||
public:
|
||||
// Equals operator
|
||||
bool operator== (BaseCommand& other) ;
|
||||
|
||||
virtual int getHashCode() ;
|
||||
virtual p<string> toString() ;
|
||||
};
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_BaseCommand_hpp_*/
|
||||
|
|
|
@ -1,45 +1,45 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_BooleanExpression_hpp_
|
||||
#define ActiveMQ_BooleanExpression_hpp_
|
||||
|
||||
#include "activemq/command/BaseCommand.hpp"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
namespace command
|
||||
{
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
class BooleanExpression : public BaseCommand
|
||||
{
|
||||
protected:
|
||||
|
||||
protected:
|
||||
BooleanExpression() {}
|
||||
} ;
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_BooleanExpression_hpp_*/
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_BooleanExpression_hpp_
|
||||
#define ActiveMQ_BooleanExpression_hpp_
|
||||
|
||||
#include "activemq/command/BaseCommand.hpp"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
namespace command
|
||||
{
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
class BooleanExpression : public BaseCommand
|
||||
{
|
||||
protected:
|
||||
|
||||
protected:
|
||||
BooleanExpression() {}
|
||||
} ;
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_BooleanExpression_hpp_*/
|
||||
|
|
|
@ -1,126 +1,126 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#include "activemq/command/BrokerError.hpp"
|
||||
|
||||
using namespace apache::activemq::command;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
BrokerError::BrokerError()
|
||||
{
|
||||
message = new string() ;
|
||||
exceptionClass = new string() ;
|
||||
stackTraceElements = NULL ;
|
||||
cause = NULL ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<string> BrokerError::getMessage()
|
||||
{
|
||||
return message ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void BrokerError::setMessage(const char* msg)
|
||||
{
|
||||
this->message->assign(msg) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<string> BrokerError::getExceptionClass()
|
||||
{
|
||||
return exceptionClass ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void BrokerError::setExceptionClass(const char* exClass)
|
||||
{
|
||||
this->exceptionClass->assign(exClass) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
array<StackTraceElement> BrokerError::getStackTraceElements()
|
||||
{
|
||||
return stackTraceElements ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void BrokerError::setStackTraceElements(array<StackTraceElement> elements)
|
||||
{
|
||||
this->stackTraceElements = elements ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<BrokerError> BrokerError::getCause()
|
||||
{
|
||||
return cause ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void BrokerError::setCause(p<BrokerError> cause)
|
||||
{
|
||||
this->cause = cause ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<string> BrokerError::getStackTrace()
|
||||
{
|
||||
ostringstream sstream ;
|
||||
p<string> trace ;
|
||||
printStackTrace(sstream) ;
|
||||
trace = new string (sstream.str());
|
||||
return trace ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void BrokerError::printStackTrace(ostream& out)
|
||||
{
|
||||
out << getptr(exceptionClass) << ": " << getptr(message) << endl ;
|
||||
|
||||
for( size_t i = 0; i < sizeof(stackTraceElements)/sizeof(stackTraceElements[0]); i++ )
|
||||
{
|
||||
p<StackTraceElement> element = stackTraceElements[i] ;
|
||||
out << " at " << getptr(element->className) << "." << getptr(element->methodName) << "(" << getptr(element->fileName) << ":" << element->lineNumber << ")" << endl ;
|
||||
}
|
||||
// Dump any nested exceptions
|
||||
if( cause != NULL )
|
||||
{
|
||||
out << "Nested Exception:" << endl ;
|
||||
cause->printStackTrace(out) ;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#include "activemq/command/BrokerError.hpp"
|
||||
|
||||
using namespace apache::activemq::command;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
BrokerError::BrokerError()
|
||||
{
|
||||
message = new string() ;
|
||||
exceptionClass = new string() ;
|
||||
stackTraceElements = NULL ;
|
||||
cause = NULL ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<string> BrokerError::getMessage()
|
||||
{
|
||||
return message ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void BrokerError::setMessage(const char* msg)
|
||||
{
|
||||
this->message->assign(msg) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<string> BrokerError::getExceptionClass()
|
||||
{
|
||||
return exceptionClass ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void BrokerError::setExceptionClass(const char* exClass)
|
||||
{
|
||||
this->exceptionClass->assign(exClass) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
array<StackTraceElement> BrokerError::getStackTraceElements()
|
||||
{
|
||||
return stackTraceElements ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void BrokerError::setStackTraceElements(array<StackTraceElement> elements)
|
||||
{
|
||||
this->stackTraceElements = elements ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<BrokerError> BrokerError::getCause()
|
||||
{
|
||||
return cause ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void BrokerError::setCause(p<BrokerError> cause)
|
||||
{
|
||||
this->cause = cause ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<string> BrokerError::getStackTrace()
|
||||
{
|
||||
ostringstream sstream ;
|
||||
p<string> trace ;
|
||||
printStackTrace(sstream) ;
|
||||
trace = new string (sstream.str());
|
||||
return trace ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void BrokerError::printStackTrace(ostream& out)
|
||||
{
|
||||
out << getptr(exceptionClass) << ": " << getptr(message) << endl ;
|
||||
|
||||
for( size_t i = 0; i < sizeof(stackTraceElements)/sizeof(stackTraceElements[0]); i++ )
|
||||
{
|
||||
p<StackTraceElement> element = stackTraceElements[i] ;
|
||||
out << " at " << getptr(element->className) << "." << getptr(element->methodName) << "(" << getptr(element->fileName) << ":" << element->lineNumber << ")" << endl ;
|
||||
}
|
||||
// Dump any nested exceptions
|
||||
if( cause != NULL )
|
||||
{
|
||||
out << "Nested Exception:" << endl ;
|
||||
cause->printStackTrace(out) ;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,78 +1,78 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_BrokerError_hpp_
|
||||
#define ActiveMQ_BrokerError_hpp_
|
||||
|
||||
#include <string>
|
||||
#include <ostream>
|
||||
#include <sstream>
|
||||
#include "activemq/command/AbstractCommand.hpp"
|
||||
#include "ppr/util/ifr/array"
|
||||
#include "ppr/util/ifr/p"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
namespace command
|
||||
{
|
||||
using namespace ifr ;
|
||||
using namespace std ;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
struct StackTraceElement
|
||||
{
|
||||
p<string> className ;
|
||||
p<string> fileName ;
|
||||
p<string> methodName ;
|
||||
int lineNumber ;
|
||||
} ;
|
||||
|
||||
/*
|
||||
* Represents an exception on the broker.
|
||||
*/
|
||||
class BrokerError : public AbstractCommand
|
||||
{
|
||||
private:
|
||||
p<string> message ;
|
||||
p<string> exceptionClass ;
|
||||
array<StackTraceElement> stackTraceElements ;
|
||||
p<BrokerError> cause ;
|
||||
|
||||
public:
|
||||
BrokerError() ;
|
||||
|
||||
virtual p<string> getMessage() ;
|
||||
virtual void setMessage(const char* msg) ;
|
||||
virtual p<string> getExceptionClass() ;
|
||||
virtual void setExceptionClass(const char* exClass) ;
|
||||
virtual array<StackTraceElement> getStackTraceElements() ;
|
||||
virtual void setStackTraceElements(array<StackTraceElement> elements) ;
|
||||
virtual p<BrokerError> getCause() ;
|
||||
virtual void setCause(p<BrokerError> cause) ;
|
||||
virtual p<string> getStackTrace() ;
|
||||
virtual void printStackTrace(ostream& out) ;
|
||||
} ;
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_BrokerError_hpp_*/
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_BrokerError_hpp_
|
||||
#define ActiveMQ_BrokerError_hpp_
|
||||
|
||||
#include <string>
|
||||
#include <ostream>
|
||||
#include <sstream>
|
||||
#include "activemq/command/AbstractCommand.hpp"
|
||||
#include "ppr/util/ifr/array"
|
||||
#include "ppr/util/ifr/p"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
namespace command
|
||||
{
|
||||
using namespace ifr ;
|
||||
using namespace std ;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
struct StackTraceElement
|
||||
{
|
||||
p<string> className ;
|
||||
p<string> fileName ;
|
||||
p<string> methodName ;
|
||||
int lineNumber ;
|
||||
} ;
|
||||
|
||||
/*
|
||||
* Represents an exception on the broker.
|
||||
*/
|
||||
class BrokerError : public AbstractCommand
|
||||
{
|
||||
private:
|
||||
p<string> message ;
|
||||
p<string> exceptionClass ;
|
||||
array<StackTraceElement> stackTraceElements ;
|
||||
p<BrokerError> cause ;
|
||||
|
||||
public:
|
||||
BrokerError() ;
|
||||
|
||||
virtual p<string> getMessage() ;
|
||||
virtual void setMessage(const char* msg) ;
|
||||
virtual p<string> getExceptionClass() ;
|
||||
virtual void setExceptionClass(const char* exClass) ;
|
||||
virtual array<StackTraceElement> getStackTraceElements() ;
|
||||
virtual void setStackTraceElements(array<StackTraceElement> elements) ;
|
||||
virtual p<BrokerError> getCause() ;
|
||||
virtual void setCause(p<BrokerError> cause) ;
|
||||
virtual p<string> getStackTrace() ;
|
||||
virtual void printStackTrace(ostream& out) ;
|
||||
} ;
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_BrokerError_hpp_*/
|
||||
|
|
|
@ -1,165 +1,165 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#include "activemq/command/WireFormatInfo.hpp"
|
||||
|
||||
using namespace apache::activemq::command;
|
||||
|
||||
/*
|
||||
*
|
||||
* Marshalling code for Open Wire Format for WireFormatInfo
|
||||
*
|
||||
*
|
||||
* NOTE!: This file is autogenerated - do not modify!
|
||||
* if you need to make a change, please see the Groovy scripts in the
|
||||
* activemq-core module
|
||||
*
|
||||
*/
|
||||
WireFormatInfo::WireFormatInfo()
|
||||
{
|
||||
this->magic = array<char> (8) ;
|
||||
this->version = 0 ;
|
||||
this->propsByteSize = 0 ;
|
||||
this->properties = new PropertyMap() ;
|
||||
}
|
||||
|
||||
unsigned char WireFormatInfo::getDataStructureType()
|
||||
{
|
||||
return WireFormatInfo::TYPE ;
|
||||
}
|
||||
|
||||
|
||||
array<char> WireFormatInfo::getMagic()
|
||||
{
|
||||
return magic ;
|
||||
}
|
||||
|
||||
void WireFormatInfo::setMagic(array<char> magic)
|
||||
{
|
||||
this->magic = magic ;
|
||||
}
|
||||
|
||||
|
||||
int WireFormatInfo::getVersion()
|
||||
{
|
||||
return version ;
|
||||
}
|
||||
|
||||
void WireFormatInfo::setVersion(int version)
|
||||
{
|
||||
this->version = version ;
|
||||
}
|
||||
|
||||
|
||||
bool WireFormatInfo::getCacheEnabled()
|
||||
{
|
||||
return (*properties)["CacheEnabled"].getBoolean() ;
|
||||
}
|
||||
|
||||
void WireFormatInfo::setCacheEnabled(bool cacheEnabled)
|
||||
{
|
||||
(*properties)["CacheEnabled"] = MapItemHolder(cacheEnabled) ;
|
||||
}
|
||||
|
||||
|
||||
bool WireFormatInfo::getStackTraceEnabled()
|
||||
{
|
||||
return (*properties)["StackTraceEnabled"].getBoolean() ;
|
||||
}
|
||||
|
||||
void WireFormatInfo::setStackTraceEnabled(bool stackTraceEnabled)
|
||||
{
|
||||
(*properties)["StackTraceEnabled"] = MapItemHolder(stackTraceEnabled) ;
|
||||
}
|
||||
|
||||
|
||||
bool WireFormatInfo::getTcpNoDelayEnabled()
|
||||
{
|
||||
return (*properties)["TcpNoDelayedEnabled"].getBoolean() ;
|
||||
}
|
||||
|
||||
void WireFormatInfo::setTcpNoDelayEnabled(bool tcpNoDelayEnabled)
|
||||
{
|
||||
(*properties)["TcpNoDelayedEnabled"] = MapItemHolder(tcpNoDelayEnabled) ;
|
||||
}
|
||||
|
||||
|
||||
bool WireFormatInfo::getSizePrefixDisabled()
|
||||
{
|
||||
return (*properties)["SizePrefixDisabled"].getBoolean() ;
|
||||
}
|
||||
|
||||
void WireFormatInfo::setSizePrefixDisabled(bool sizePrefixDisabled)
|
||||
{
|
||||
(*properties)["SizePrefixDisabled"] = MapItemHolder(sizePrefixDisabled) ;
|
||||
}
|
||||
|
||||
|
||||
bool WireFormatInfo::getTightEncodingEnabled()
|
||||
{
|
||||
return (*properties)["TightEncodingEnabled"].getBoolean() ;
|
||||
}
|
||||
|
||||
void WireFormatInfo::setTightEncodingEnabled(bool tightEncodingEnabled)
|
||||
{
|
||||
(*properties)["TightEncodingEnabled"] = MapItemHolder(tightEncodingEnabled) ;
|
||||
}
|
||||
|
||||
int WireFormatInfo::marshal(p<IMarshaller> marshaller, int mode, p<IOutputStream> writer) throw (IOException)
|
||||
{
|
||||
int size = 0 ;
|
||||
|
||||
// BUG: Should write array size
|
||||
//size += marshaller->marshalByteArray(magic, mode, writer) ;
|
||||
size += (int)magic.size() ;
|
||||
|
||||
if( mode == IMarshaller::MARSHAL_WRITE )
|
||||
writer->write(magic.c_array(), 0, size) ;
|
||||
|
||||
size += marshaller->marshalInt(version, mode, writer) ;
|
||||
size += marshaller->marshalBoolean( properties != NULL, mode, writer) ;
|
||||
|
||||
if( mode == IMarshaller::MARSHAL_SIZE )
|
||||
{
|
||||
//propsByteSize = sizeof(int) ;
|
||||
propsByteSize += marshaller->marshalMap(properties, mode, writer) ;
|
||||
size += propsByteSize ;
|
||||
}
|
||||
else
|
||||
{
|
||||
size += marshaller->marshalInt(propsByteSize, mode, writer) ;
|
||||
size += marshaller->marshalMap(properties, mode, writer) ;
|
||||
}
|
||||
return size ;
|
||||
}
|
||||
|
||||
void WireFormatInfo::unmarshal(p<IMarshaller> marshaller, int mode, p<IInputStream> reader) throw (IOException)
|
||||
{
|
||||
bool isNonNullProps ;
|
||||
|
||||
// BUG: Should read array size
|
||||
//magic = marshaller->unmarshalByteArray(mode, reader) ;
|
||||
reader->read(magic.c_array(), 0, 8) ;
|
||||
version = marshaller->unmarshalInt(mode, reader) ;
|
||||
isNonNullProps = marshaller->unmarshalBoolean(mode, reader) ;
|
||||
if( isNonNullProps )
|
||||
{
|
||||
propsByteSize = marshaller->unmarshalInt(mode, reader) ;
|
||||
properties = marshaller->unmarshalMap(mode, reader) ;
|
||||
}
|
||||
else
|
||||
properties = NULL ;
|
||||
}
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#include "activemq/command/WireFormatInfo.hpp"
|
||||
|
||||
using namespace apache::activemq::command;
|
||||
|
||||
/*
|
||||
*
|
||||
* Marshalling code for Open Wire Format for WireFormatInfo
|
||||
*
|
||||
*
|
||||
* NOTE!: This file is autogenerated - do not modify!
|
||||
* if you need to make a change, please see the Groovy scripts in the
|
||||
* activemq-core module
|
||||
*
|
||||
*/
|
||||
WireFormatInfo::WireFormatInfo()
|
||||
{
|
||||
this->magic = array<char> (8) ;
|
||||
this->version = 0 ;
|
||||
this->propsByteSize = 0 ;
|
||||
this->properties = new PropertyMap() ;
|
||||
}
|
||||
|
||||
unsigned char WireFormatInfo::getDataStructureType()
|
||||
{
|
||||
return WireFormatInfo::TYPE ;
|
||||
}
|
||||
|
||||
|
||||
array<char> WireFormatInfo::getMagic()
|
||||
{
|
||||
return magic ;
|
||||
}
|
||||
|
||||
void WireFormatInfo::setMagic(array<char> magic)
|
||||
{
|
||||
this->magic = magic ;
|
||||
}
|
||||
|
||||
|
||||
int WireFormatInfo::getVersion()
|
||||
{
|
||||
return version ;
|
||||
}
|
||||
|
||||
void WireFormatInfo::setVersion(int version)
|
||||
{
|
||||
this->version = version ;
|
||||
}
|
||||
|
||||
|
||||
bool WireFormatInfo::getCacheEnabled()
|
||||
{
|
||||
return (*properties)["CacheEnabled"].getBoolean() ;
|
||||
}
|
||||
|
||||
void WireFormatInfo::setCacheEnabled(bool cacheEnabled)
|
||||
{
|
||||
(*properties)["CacheEnabled"] = MapItemHolder(cacheEnabled) ;
|
||||
}
|
||||
|
||||
|
||||
bool WireFormatInfo::getStackTraceEnabled()
|
||||
{
|
||||
return (*properties)["StackTraceEnabled"].getBoolean() ;
|
||||
}
|
||||
|
||||
void WireFormatInfo::setStackTraceEnabled(bool stackTraceEnabled)
|
||||
{
|
||||
(*properties)["StackTraceEnabled"] = MapItemHolder(stackTraceEnabled) ;
|
||||
}
|
||||
|
||||
|
||||
bool WireFormatInfo::getTcpNoDelayEnabled()
|
||||
{
|
||||
return (*properties)["TcpNoDelayedEnabled"].getBoolean() ;
|
||||
}
|
||||
|
||||
void WireFormatInfo::setTcpNoDelayEnabled(bool tcpNoDelayEnabled)
|
||||
{
|
||||
(*properties)["TcpNoDelayedEnabled"] = MapItemHolder(tcpNoDelayEnabled) ;
|
||||
}
|
||||
|
||||
|
||||
bool WireFormatInfo::getSizePrefixDisabled()
|
||||
{
|
||||
return (*properties)["SizePrefixDisabled"].getBoolean() ;
|
||||
}
|
||||
|
||||
void WireFormatInfo::setSizePrefixDisabled(bool sizePrefixDisabled)
|
||||
{
|
||||
(*properties)["SizePrefixDisabled"] = MapItemHolder(sizePrefixDisabled) ;
|
||||
}
|
||||
|
||||
|
||||
bool WireFormatInfo::getTightEncodingEnabled()
|
||||
{
|
||||
return (*properties)["TightEncodingEnabled"].getBoolean() ;
|
||||
}
|
||||
|
||||
void WireFormatInfo::setTightEncodingEnabled(bool tightEncodingEnabled)
|
||||
{
|
||||
(*properties)["TightEncodingEnabled"] = MapItemHolder(tightEncodingEnabled) ;
|
||||
}
|
||||
|
||||
int WireFormatInfo::marshal(p<IMarshaller> marshaller, int mode, p<IOutputStream> writer) throw (IOException)
|
||||
{
|
||||
int size = 0 ;
|
||||
|
||||
// BUG: Should write array size
|
||||
//size += marshaller->marshalByteArray(magic, mode, writer) ;
|
||||
size += (int)magic.size() ;
|
||||
|
||||
if( mode == IMarshaller::MARSHAL_WRITE )
|
||||
writer->write(magic.c_array(), 0, size) ;
|
||||
|
||||
size += marshaller->marshalInt(version, mode, writer) ;
|
||||
size += marshaller->marshalBoolean( properties != NULL, mode, writer) ;
|
||||
|
||||
if( mode == IMarshaller::MARSHAL_SIZE )
|
||||
{
|
||||
//propsByteSize = sizeof(int) ;
|
||||
propsByteSize += marshaller->marshalMap(properties, mode, writer) ;
|
||||
size += propsByteSize ;
|
||||
}
|
||||
else
|
||||
{
|
||||
size += marshaller->marshalInt(propsByteSize, mode, writer) ;
|
||||
size += marshaller->marshalMap(properties, mode, writer) ;
|
||||
}
|
||||
return size ;
|
||||
}
|
||||
|
||||
void WireFormatInfo::unmarshal(p<IMarshaller> marshaller, int mode, p<IInputStream> reader) throw (IOException)
|
||||
{
|
||||
bool isNonNullProps ;
|
||||
|
||||
// BUG: Should read array size
|
||||
//magic = marshaller->unmarshalByteArray(mode, reader) ;
|
||||
reader->read(magic.c_array(), 0, 8) ;
|
||||
version = marshaller->unmarshalInt(mode, reader) ;
|
||||
isNonNullProps = marshaller->unmarshalBoolean(mode, reader) ;
|
||||
if( isNonNullProps )
|
||||
{
|
||||
propsByteSize = marshaller->unmarshalInt(mode, reader) ;
|
||||
properties = marshaller->unmarshalMap(mode, reader) ;
|
||||
}
|
||||
else
|
||||
properties = NULL ;
|
||||
}
|
||||
|
|
|
@ -1,84 +1,84 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_IMarshaller_hpp_
|
||||
#define ActiveMQ_IMarshaller_hpp_
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include "activemq/IDataStructure.hpp"
|
||||
#include "ppr/io/IOutputStream.hpp"
|
||||
#include "ppr/io/IInputStream.hpp"
|
||||
#include "ppr/io/IOException.hpp"
|
||||
#include "ppr/util/MapItemHolder.hpp"
|
||||
#include "ppr/util/ifr/array"
|
||||
#include "ppr/util/ifr/p"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
namespace protocol
|
||||
{
|
||||
using namespace ifr ;
|
||||
using namespace std ;
|
||||
using namespace apache::activemq;
|
||||
using namespace apache::ppr::io;
|
||||
using namespace apache::ppr::util;
|
||||
|
||||
/*
|
||||
* Represents a wire protocol marshaller.
|
||||
*/
|
||||
struct IMarshaller : Interface
|
||||
{
|
||||
// Marshal modes
|
||||
const static int MARSHAL_SIZE = 1 ;
|
||||
const static int MARSHAL_WRITE = 2 ;
|
||||
const static int MARSHAL_READ = 3 ;
|
||||
|
||||
virtual int marshalBoolean(bool value, int mode, p<IOutputStream> writer) throw(IOException) = 0 ;
|
||||
virtual int marshalByte(char value, int mode, p<IOutputStream> writer) throw(IOException) = 0 ;
|
||||
virtual int marshalShort(short value, int mode, p<IOutputStream> writer) throw(IOException) = 0 ;
|
||||
virtual int marshalInt(int value, int mode, p<IOutputStream> writer) throw(IOException) = 0 ;
|
||||
virtual int marshalLong(long long value, int mode, p<IOutputStream> writer) throw(IOException) = 0 ;
|
||||
virtual int marshalFloat(float value, int mode, p<IOutputStream> writer) throw(IOException) = 0 ;
|
||||
virtual int marshalDouble(double value, int mode, p<IOutputStream> writer) throw(IOException) = 0 ;
|
||||
virtual int marshalString(p<string> value, int mode, p<IOutputStream> writer) throw(IOException) = 0 ;
|
||||
virtual int marshalObject(p<IDataStructure> object, int mode, p<IOutputStream> writer) throw(IOException) = 0 ;
|
||||
virtual int marshalObjectArray(array<IDataStructure> object, int mode, p<IOutputStream> writer) throw(IOException) = 0 ;
|
||||
virtual int marshalByteArray(array<char> value, int mode, p<IOutputStream> writer) throw(IOException) = 0 ;
|
||||
virtual int marshalMap(p<PropertyMap> value, int mode, p<IOutputStream> writer) throw(IOException) = 0 ;
|
||||
|
||||
virtual bool unmarshalBoolean(int mode, p<IInputStream> reader) throw(IOException) = 0 ;
|
||||
virtual char unmarshalByte(int mode, p<IInputStream> reader) throw(IOException) = 0 ;
|
||||
virtual short unmarshalShort(int mode, p<IInputStream> reader) throw(IOException) = 0 ;
|
||||
virtual int unmarshalInt(int mode, p<IInputStream> reader) throw(IOException) = 0 ;
|
||||
virtual long long unmarshalLong(int mode, p<IInputStream> reader) throw(IOException) = 0 ;
|
||||
virtual float unmarshalFloat(int mode, p<IInputStream> reader) throw(IOException) = 0 ;
|
||||
virtual double unmarshalDouble(int mode, p<IInputStream> reader) throw(IOException) = 0 ;
|
||||
virtual p<string> unmarshalString(int mode, p<IInputStream> reader) throw(IOException) = 0 ;
|
||||
virtual p<IDataStructure> unmarshalObject(int mode, p<IInputStream> reader) throw(IOException) = 0 ;
|
||||
virtual array<IDataStructure> unmarshalObjectArray(int mode, p<IInputStream> reader) throw(IOException) = 0 ;
|
||||
virtual array<char> unmarshalByteArray(int mode, p<IInputStream> reader) throw(IOException) = 0 ;
|
||||
virtual p<PropertyMap> unmarshalMap(int mode, p<IInputStream> reader) throw(IOException) = 0 ;
|
||||
} ;
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_IMarshaller_hpp_*/
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_IMarshaller_hpp_
|
||||
#define ActiveMQ_IMarshaller_hpp_
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include "activemq/IDataStructure.hpp"
|
||||
#include "ppr/io/IOutputStream.hpp"
|
||||
#include "ppr/io/IInputStream.hpp"
|
||||
#include "ppr/io/IOException.hpp"
|
||||
#include "ppr/util/MapItemHolder.hpp"
|
||||
#include "ppr/util/ifr/array"
|
||||
#include "ppr/util/ifr/p"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
namespace protocol
|
||||
{
|
||||
using namespace ifr ;
|
||||
using namespace std ;
|
||||
using namespace apache::activemq;
|
||||
using namespace apache::ppr::io;
|
||||
using namespace apache::ppr::util;
|
||||
|
||||
/*
|
||||
* Represents a wire protocol marshaller.
|
||||
*/
|
||||
struct IMarshaller : Interface
|
||||
{
|
||||
// Marshal modes
|
||||
const static int MARSHAL_SIZE = 1 ;
|
||||
const static int MARSHAL_WRITE = 2 ;
|
||||
const static int MARSHAL_READ = 3 ;
|
||||
|
||||
virtual int marshalBoolean(bool value, int mode, p<IOutputStream> writer) throw(IOException) = 0 ;
|
||||
virtual int marshalByte(char value, int mode, p<IOutputStream> writer) throw(IOException) = 0 ;
|
||||
virtual int marshalShort(short value, int mode, p<IOutputStream> writer) throw(IOException) = 0 ;
|
||||
virtual int marshalInt(int value, int mode, p<IOutputStream> writer) throw(IOException) = 0 ;
|
||||
virtual int marshalLong(long long value, int mode, p<IOutputStream> writer) throw(IOException) = 0 ;
|
||||
virtual int marshalFloat(float value, int mode, p<IOutputStream> writer) throw(IOException) = 0 ;
|
||||
virtual int marshalDouble(double value, int mode, p<IOutputStream> writer) throw(IOException) = 0 ;
|
||||
virtual int marshalString(p<string> value, int mode, p<IOutputStream> writer) throw(IOException) = 0 ;
|
||||
virtual int marshalObject(p<IDataStructure> object, int mode, p<IOutputStream> writer) throw(IOException) = 0 ;
|
||||
virtual int marshalObjectArray(array<IDataStructure> object, int mode, p<IOutputStream> writer) throw(IOException) = 0 ;
|
||||
virtual int marshalByteArray(array<char> value, int mode, p<IOutputStream> writer) throw(IOException) = 0 ;
|
||||
virtual int marshalMap(p<PropertyMap> value, int mode, p<IOutputStream> writer) throw(IOException) = 0 ;
|
||||
|
||||
virtual bool unmarshalBoolean(int mode, p<IInputStream> reader) throw(IOException) = 0 ;
|
||||
virtual char unmarshalByte(int mode, p<IInputStream> reader) throw(IOException) = 0 ;
|
||||
virtual short unmarshalShort(int mode, p<IInputStream> reader) throw(IOException) = 0 ;
|
||||
virtual int unmarshalInt(int mode, p<IInputStream> reader) throw(IOException) = 0 ;
|
||||
virtual long long unmarshalLong(int mode, p<IInputStream> reader) throw(IOException) = 0 ;
|
||||
virtual float unmarshalFloat(int mode, p<IInputStream> reader) throw(IOException) = 0 ;
|
||||
virtual double unmarshalDouble(int mode, p<IInputStream> reader) throw(IOException) = 0 ;
|
||||
virtual p<string> unmarshalString(int mode, p<IInputStream> reader) throw(IOException) = 0 ;
|
||||
virtual p<IDataStructure> unmarshalObject(int mode, p<IInputStream> reader) throw(IOException) = 0 ;
|
||||
virtual array<IDataStructure> unmarshalObjectArray(int mode, p<IInputStream> reader) throw(IOException) = 0 ;
|
||||
virtual array<char> unmarshalByteArray(int mode, p<IInputStream> reader) throw(IOException) = 0 ;
|
||||
virtual p<PropertyMap> unmarshalMap(int mode, p<IInputStream> reader) throw(IOException) = 0 ;
|
||||
} ;
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_IMarshaller_hpp_*/
|
||||
|
|
|
@ -1,53 +1,53 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_IProtocol_hpp_
|
||||
#define ActiveMQ_IProtocol_hpp_
|
||||
|
||||
#include "activemq/IDataStructure.hpp"
|
||||
#include "activemq/transport/ITransport.hpp"
|
||||
#include "ppr/io/IOutputStream.hpp"
|
||||
#include "ppr/io/IInputStream.hpp"
|
||||
#include "ppr/io/IOException.hpp"
|
||||
#include "ppr/util/ifr/p"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
namespace protocol
|
||||
{
|
||||
using namespace ifr ;
|
||||
using namespace apache::activemq;
|
||||
using namespace apache::activemq::transport;
|
||||
using namespace apache::ppr::io;
|
||||
|
||||
/*
|
||||
* Represents the logical protocol layer.
|
||||
*/
|
||||
struct IProtocol : Interface
|
||||
{
|
||||
virtual void handshake(p<ITransport> transport) = 0 ;
|
||||
virtual void marshal(p<IDataStructure> object, p<IOutputStream> writer) throw(IOException) = 0 ;
|
||||
virtual p<IDataStructure> unmarshal(p<IInputStream> reader) throw(IOException) = 0 ;
|
||||
} ;
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_IProtocol_hpp_*/
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_IProtocol_hpp_
|
||||
#define ActiveMQ_IProtocol_hpp_
|
||||
|
||||
#include "activemq/IDataStructure.hpp"
|
||||
#include "activemq/transport/ITransport.hpp"
|
||||
#include "ppr/io/IOutputStream.hpp"
|
||||
#include "ppr/io/IInputStream.hpp"
|
||||
#include "ppr/io/IOException.hpp"
|
||||
#include "ppr/util/ifr/p"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
namespace protocol
|
||||
{
|
||||
using namespace ifr ;
|
||||
using namespace apache::activemq;
|
||||
using namespace apache::activemq::transport;
|
||||
using namespace apache::ppr::io;
|
||||
|
||||
/*
|
||||
* Represents the logical protocol layer.
|
||||
*/
|
||||
struct IProtocol : Interface
|
||||
{
|
||||
virtual void handshake(p<ITransport> transport) = 0 ;
|
||||
virtual void marshal(p<IDataStructure> object, p<IOutputStream> writer) throw(IOException) = 0 ;
|
||||
virtual p<IDataStructure> unmarshal(p<IInputStream> reader) throw(IOException) = 0 ;
|
||||
} ;
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_IProtocol_hpp_*/
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,112 +1,112 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_OpenWireMarshaller_hpp_
|
||||
#define ActiveMQ_OpenWireMarshaller_hpp_
|
||||
|
||||
// Turn off warning message for ignored exception specification
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning( disable : 4290 )
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include "activemq/IDataStructure.hpp"
|
||||
#include "activemq/command/AbstractCommand.hpp"
|
||||
#include "activemq/command/WireFormatInfo.hpp"
|
||||
#include "activemq/protocol/IMarshaller.hpp"
|
||||
#include "activemq/protocol/openwire/OpenWireProtocol.hpp"
|
||||
#include "ppr/io/DataOutputStream.hpp"
|
||||
#include "ppr/io/DataInputStream.hpp"
|
||||
#include "ppr/io/IOException.hpp"
|
||||
#include "ppr/util/MapItemHolder.hpp"
|
||||
#include "ppr/util/ifr/array"
|
||||
#include "ppr/util/ifr/p"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
namespace protocol
|
||||
{
|
||||
namespace openwire
|
||||
{
|
||||
using namespace ifr ;
|
||||
using namespace apache::activemq;
|
||||
using namespace apache::activemq::command;
|
||||
using namespace apache::activemq::protocol;
|
||||
using namespace apache::ppr::io;
|
||||
using namespace apache::ppr::util;
|
||||
|
||||
/*
|
||||
* A helper class with marshalling methods for the OpenWire protocol.
|
||||
*/
|
||||
class OpenWireMarshaller : public IMarshaller
|
||||
{
|
||||
private:
|
||||
p<WireFormatInfo> formatInfo ;
|
||||
|
||||
public:
|
||||
// Primitive types
|
||||
static const unsigned char TYPE_NULL = 0 ;
|
||||
static const unsigned char TYPE_BOOLEAN = 1 ;
|
||||
static const unsigned char TYPE_BYTE = 2 ;
|
||||
static const unsigned char TYPE_CHAR = 3 ;
|
||||
static const unsigned char TYPE_SHORT = 4 ;
|
||||
static const unsigned char TYPE_INTEGER = 5 ;
|
||||
static const unsigned char TYPE_LONG = 6 ;
|
||||
static const unsigned char TYPE_DOUBLE = 7 ;
|
||||
static const unsigned char TYPE_FLOAT = 8 ;
|
||||
static const unsigned char TYPE_STRING = 9 ;
|
||||
static const unsigned char TYPE_BYTEARRAY = 10 ;
|
||||
|
||||
public:
|
||||
OpenWireMarshaller(p<WireFormatInfo> formatInfo) ;
|
||||
|
||||
virtual int marshalBoolean(bool value, int mode, p<IOutputStream> writer) throw(IOException) ;
|
||||
virtual int marshalByte(char value, int mode, p<IOutputStream> writer) throw(IOException) ;
|
||||
virtual int marshalShort(short value, int mode, p<IOutputStream> writer) throw(IOException) ;
|
||||
virtual int marshalInt(int value, int mode, p<IOutputStream> writer) throw(IOException) ;
|
||||
virtual int marshalLong(long long value, int mode, p<IOutputStream> writer) throw(IOException) ;
|
||||
virtual int marshalFloat(float value, int mode, p<IOutputStream> writer) throw(IOException) ;
|
||||
virtual int marshalDouble(double value, int mode, p<IOutputStream> writer) throw(IOException) ;
|
||||
virtual int marshalString(p<string> value, int mode, p<IOutputStream> writer) throw(IOException) ;
|
||||
virtual int marshalObject(p<IDataStructure> object, int mode, p<IOutputStream> writer) throw(IOException) ;
|
||||
virtual int marshalObjectArray(array<IDataStructure> object, int mode, p<IOutputStream> writer) throw(IOException) ;
|
||||
virtual int marshalByteArray(array<char> value, int mode, p<IOutputStream> writer) throw(IOException) ;
|
||||
virtual int marshalMap(p<PropertyMap> value, int mode, p<IOutputStream> writer) throw(IOException) ;
|
||||
|
||||
virtual bool unmarshalBoolean(int mode, p<IInputStream> reader) throw(IOException) ;
|
||||
virtual char unmarshalByte(int mode, p<IInputStream> reader) throw(IOException) ;
|
||||
virtual short unmarshalShort(int mode, p<IInputStream> reader) throw(IOException) ;
|
||||
virtual int unmarshalInt(int mode, p<IInputStream> reader) throw(IOException) ;
|
||||
virtual long long unmarshalLong(int mode, p<IInputStream> reader) throw(IOException) ;
|
||||
virtual float unmarshalFloat(int mode, p<IInputStream> reader) throw(IOException) ;
|
||||
virtual double unmarshalDouble(int mode, p<IInputStream> reader) throw(IOException) ;
|
||||
virtual p<string> unmarshalString(int mode, p<IInputStream> reader) throw(IOException) ;
|
||||
virtual p<IDataStructure> unmarshalObject(int mode, p<IInputStream> reader) throw(IOException) ;
|
||||
virtual array<IDataStructure> unmarshalObjectArray(int mode, p<IInputStream> reader) throw(IOException) ;
|
||||
virtual array<char> unmarshalByteArray(int mode, p<IInputStream> reader) throw(IOException) ;
|
||||
virtual p<PropertyMap> unmarshalMap(int mode, p<IInputStream> reader) throw(IOException) ;
|
||||
} ;
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_OpenWireMarshaller_hpp_*/
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_OpenWireMarshaller_hpp_
|
||||
#define ActiveMQ_OpenWireMarshaller_hpp_
|
||||
|
||||
// Turn off warning message for ignored exception specification
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning( disable : 4290 )
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include "activemq/IDataStructure.hpp"
|
||||
#include "activemq/command/AbstractCommand.hpp"
|
||||
#include "activemq/command/WireFormatInfo.hpp"
|
||||
#include "activemq/protocol/IMarshaller.hpp"
|
||||
#include "activemq/protocol/openwire/OpenWireProtocol.hpp"
|
||||
#include "ppr/io/DataOutputStream.hpp"
|
||||
#include "ppr/io/DataInputStream.hpp"
|
||||
#include "ppr/io/IOException.hpp"
|
||||
#include "ppr/util/MapItemHolder.hpp"
|
||||
#include "ppr/util/ifr/array"
|
||||
#include "ppr/util/ifr/p"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
namespace protocol
|
||||
{
|
||||
namespace openwire
|
||||
{
|
||||
using namespace ifr ;
|
||||
using namespace apache::activemq;
|
||||
using namespace apache::activemq::command;
|
||||
using namespace apache::activemq::protocol;
|
||||
using namespace apache::ppr::io;
|
||||
using namespace apache::ppr::util;
|
||||
|
||||
/*
|
||||
* A helper class with marshalling methods for the OpenWire protocol.
|
||||
*/
|
||||
class OpenWireMarshaller : public IMarshaller
|
||||
{
|
||||
private:
|
||||
p<WireFormatInfo> formatInfo ;
|
||||
|
||||
public:
|
||||
// Primitive types
|
||||
static const unsigned char TYPE_NULL = 0 ;
|
||||
static const unsigned char TYPE_BOOLEAN = 1 ;
|
||||
static const unsigned char TYPE_BYTE = 2 ;
|
||||
static const unsigned char TYPE_CHAR = 3 ;
|
||||
static const unsigned char TYPE_SHORT = 4 ;
|
||||
static const unsigned char TYPE_INTEGER = 5 ;
|
||||
static const unsigned char TYPE_LONG = 6 ;
|
||||
static const unsigned char TYPE_DOUBLE = 7 ;
|
||||
static const unsigned char TYPE_FLOAT = 8 ;
|
||||
static const unsigned char TYPE_STRING = 9 ;
|
||||
static const unsigned char TYPE_BYTEARRAY = 10 ;
|
||||
|
||||
public:
|
||||
OpenWireMarshaller(p<WireFormatInfo> formatInfo) ;
|
||||
|
||||
virtual int marshalBoolean(bool value, int mode, p<IOutputStream> writer) throw(IOException) ;
|
||||
virtual int marshalByte(char value, int mode, p<IOutputStream> writer) throw(IOException) ;
|
||||
virtual int marshalShort(short value, int mode, p<IOutputStream> writer) throw(IOException) ;
|
||||
virtual int marshalInt(int value, int mode, p<IOutputStream> writer) throw(IOException) ;
|
||||
virtual int marshalLong(long long value, int mode, p<IOutputStream> writer) throw(IOException) ;
|
||||
virtual int marshalFloat(float value, int mode, p<IOutputStream> writer) throw(IOException) ;
|
||||
virtual int marshalDouble(double value, int mode, p<IOutputStream> writer) throw(IOException) ;
|
||||
virtual int marshalString(p<string> value, int mode, p<IOutputStream> writer) throw(IOException) ;
|
||||
virtual int marshalObject(p<IDataStructure> object, int mode, p<IOutputStream> writer) throw(IOException) ;
|
||||
virtual int marshalObjectArray(array<IDataStructure> object, int mode, p<IOutputStream> writer) throw(IOException) ;
|
||||
virtual int marshalByteArray(array<char> value, int mode, p<IOutputStream> writer) throw(IOException) ;
|
||||
virtual int marshalMap(p<PropertyMap> value, int mode, p<IOutputStream> writer) throw(IOException) ;
|
||||
|
||||
virtual bool unmarshalBoolean(int mode, p<IInputStream> reader) throw(IOException) ;
|
||||
virtual char unmarshalByte(int mode, p<IInputStream> reader) throw(IOException) ;
|
||||
virtual short unmarshalShort(int mode, p<IInputStream> reader) throw(IOException) ;
|
||||
virtual int unmarshalInt(int mode, p<IInputStream> reader) throw(IOException) ;
|
||||
virtual long long unmarshalLong(int mode, p<IInputStream> reader) throw(IOException) ;
|
||||
virtual float unmarshalFloat(int mode, p<IInputStream> reader) throw(IOException) ;
|
||||
virtual double unmarshalDouble(int mode, p<IInputStream> reader) throw(IOException) ;
|
||||
virtual p<string> unmarshalString(int mode, p<IInputStream> reader) throw(IOException) ;
|
||||
virtual p<IDataStructure> unmarshalObject(int mode, p<IInputStream> reader) throw(IOException) ;
|
||||
virtual array<IDataStructure> unmarshalObjectArray(int mode, p<IInputStream> reader) throw(IOException) ;
|
||||
virtual array<char> unmarshalByteArray(int mode, p<IInputStream> reader) throw(IOException) ;
|
||||
virtual p<PropertyMap> unmarshalMap(int mode, p<IInputStream> reader) throw(IOException) ;
|
||||
} ;
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_OpenWireMarshaller_hpp_*/
|
||||
|
|
|
@ -1,142 +1,142 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#include "activemq/protocol/openwire/OpenWireProtocol.hpp"
|
||||
#include "activemq/protocol/openwire/OpenWireMarshaller.hpp"
|
||||
|
||||
using namespace apache::activemq::protocol::openwire;
|
||||
|
||||
// --- Static initialization ----------------------------------------
|
||||
|
||||
const char OpenWireProtocol::MAGIC[8] = { 'A', 'c', 't', 'i', 'v', 'e', 'M', 'Q' } ;
|
||||
const int OpenWireProtocol::PROTOCOL_VERSION = 1 ;
|
||||
const char OpenWireProtocol::NULL_TYPE = 0 ;
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
OpenWireProtocol::OpenWireProtocol()
|
||||
{
|
||||
array<char> magic (8);
|
||||
memcpy (magic.c_array(), "ActiveMQ", 8);
|
||||
|
||||
// Create and configure wire format
|
||||
wireFormatInfo = new WireFormatInfo() ;
|
||||
wireFormatInfo->setMagic( magic ) ;
|
||||
wireFormatInfo->setVersion( PROTOCOL_VERSION ) ;
|
||||
wireFormatInfo->setStackTraceEnabled(true) ;
|
||||
wireFormatInfo->setTcpNoDelayEnabled(true) ;
|
||||
wireFormatInfo->setSizePrefixDisabled(false) ;
|
||||
wireFormatInfo->setTightEncodingEnabled(false) ;
|
||||
|
||||
// Create wire marshaller
|
||||
wireMarshaller = new OpenWireMarshaller(wireFormatInfo) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<WireFormatInfo> OpenWireProtocol::getWireFormatInfo()
|
||||
{
|
||||
return wireFormatInfo ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
bool OpenWireProtocol::getStackTraceEnabled()
|
||||
{
|
||||
return wireFormatInfo->getStackTraceEnabled() ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void OpenWireProtocol::handshake(p<ITransport> transport)
|
||||
{
|
||||
// Send the wireformat we're using
|
||||
transport->oneway( getWireFormatInfo() ) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void OpenWireProtocol::marshal(p<IDataStructure> object, p<IOutputStream> writer) throw(IOException)
|
||||
{
|
||||
int size = 0 ;
|
||||
|
||||
// Was a non-NULL object supplied
|
||||
if( object != NULL )
|
||||
{
|
||||
unsigned char dataType = object->getDataStructureType() ;
|
||||
|
||||
// Calculate size to be marshalled if configured
|
||||
if( !wireFormatInfo->getSizePrefixDisabled() )
|
||||
{
|
||||
size = 1 ; // data structure type
|
||||
size += object->marshal(wireMarshaller, IMarshaller::MARSHAL_SIZE, writer) ;
|
||||
|
||||
// Write size header
|
||||
writer->writeInt(size) ;
|
||||
}
|
||||
// Finally, write command type and body
|
||||
writer->writeByte(dataType) ;
|
||||
object->marshal(wireMarshaller, IMarshaller::MARSHAL_WRITE, writer) ;
|
||||
}
|
||||
else // ...NULL object
|
||||
{
|
||||
// Calculate size to be marshalled if configured
|
||||
if( !wireFormatInfo->getSizePrefixDisabled() )
|
||||
{
|
||||
// Calculate size to be marshalled
|
||||
size = 1 ; // data structure type
|
||||
|
||||
// Write size header
|
||||
writer->writeInt(size) ;
|
||||
}
|
||||
// Write NULL command type and empty body
|
||||
writer->writeByte(NULL_TYPE) ;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<IDataStructure> OpenWireProtocol::unmarshal(p<IInputStream> reader) throw(IOException)
|
||||
{
|
||||
int size = 0 ;
|
||||
|
||||
// Read packet size if configured
|
||||
if( !wireFormatInfo->getSizePrefixDisabled() )
|
||||
size = reader->readInt() ;
|
||||
|
||||
// First byte is the data structure type
|
||||
unsigned char dataType = reader->readByte() ;
|
||||
|
||||
// Check for NULL type
|
||||
if( dataType == NULL_TYPE )
|
||||
return NULL ;
|
||||
|
||||
// Create command object
|
||||
p<IDataStructure> object = AbstractCommand::createObject(dataType) ;
|
||||
if( object == NULL )
|
||||
throw IOException("Unmarshal failed; unknown data structure type %d, at %s line %d", dataType, __FILE__, __LINE__) ;
|
||||
|
||||
// Finally, unmarshal command body
|
||||
object->unmarshal(wireMarshaller, IMarshaller::MARSHAL_READ, reader) ;
|
||||
return object ;
|
||||
}
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#include "activemq/protocol/openwire/OpenWireProtocol.hpp"
|
||||
#include "activemq/protocol/openwire/OpenWireMarshaller.hpp"
|
||||
|
||||
using namespace apache::activemq::protocol::openwire;
|
||||
|
||||
// --- Static initialization ----------------------------------------
|
||||
|
||||
const char OpenWireProtocol::MAGIC[8] = { 'A', 'c', 't', 'i', 'v', 'e', 'M', 'Q' } ;
|
||||
const int OpenWireProtocol::PROTOCOL_VERSION = 1 ;
|
||||
const char OpenWireProtocol::NULL_TYPE = 0 ;
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
OpenWireProtocol::OpenWireProtocol()
|
||||
{
|
||||
array<char> magic (8);
|
||||
memcpy (magic.c_array(), "ActiveMQ", 8);
|
||||
|
||||
// Create and configure wire format
|
||||
wireFormatInfo = new WireFormatInfo() ;
|
||||
wireFormatInfo->setMagic( magic ) ;
|
||||
wireFormatInfo->setVersion( PROTOCOL_VERSION ) ;
|
||||
wireFormatInfo->setStackTraceEnabled(true) ;
|
||||
wireFormatInfo->setTcpNoDelayEnabled(true) ;
|
||||
wireFormatInfo->setSizePrefixDisabled(false) ;
|
||||
wireFormatInfo->setTightEncodingEnabled(false) ;
|
||||
|
||||
// Create wire marshaller
|
||||
wireMarshaller = new OpenWireMarshaller(wireFormatInfo) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<WireFormatInfo> OpenWireProtocol::getWireFormatInfo()
|
||||
{
|
||||
return wireFormatInfo ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
bool OpenWireProtocol::getStackTraceEnabled()
|
||||
{
|
||||
return wireFormatInfo->getStackTraceEnabled() ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void OpenWireProtocol::handshake(p<ITransport> transport)
|
||||
{
|
||||
// Send the wireformat we're using
|
||||
transport->oneway( getWireFormatInfo() ) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void OpenWireProtocol::marshal(p<IDataStructure> object, p<IOutputStream> writer) throw(IOException)
|
||||
{
|
||||
int size = 0 ;
|
||||
|
||||
// Was a non-NULL object supplied
|
||||
if( object != NULL )
|
||||
{
|
||||
unsigned char dataType = object->getDataStructureType() ;
|
||||
|
||||
// Calculate size to be marshalled if configured
|
||||
if( !wireFormatInfo->getSizePrefixDisabled() )
|
||||
{
|
||||
size = 1 ; // data structure type
|
||||
size += object->marshal(wireMarshaller, IMarshaller::MARSHAL_SIZE, writer) ;
|
||||
|
||||
// Write size header
|
||||
writer->writeInt(size) ;
|
||||
}
|
||||
// Finally, write command type and body
|
||||
writer->writeByte(dataType) ;
|
||||
object->marshal(wireMarshaller, IMarshaller::MARSHAL_WRITE, writer) ;
|
||||
}
|
||||
else // ...NULL object
|
||||
{
|
||||
// Calculate size to be marshalled if configured
|
||||
if( !wireFormatInfo->getSizePrefixDisabled() )
|
||||
{
|
||||
// Calculate size to be marshalled
|
||||
size = 1 ; // data structure type
|
||||
|
||||
// Write size header
|
||||
writer->writeInt(size) ;
|
||||
}
|
||||
// Write NULL command type and empty body
|
||||
writer->writeByte(NULL_TYPE) ;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<IDataStructure> OpenWireProtocol::unmarshal(p<IInputStream> reader) throw(IOException)
|
||||
{
|
||||
int size = 0 ;
|
||||
|
||||
// Read packet size if configured
|
||||
if( !wireFormatInfo->getSizePrefixDisabled() )
|
||||
size = reader->readInt() ;
|
||||
|
||||
// First byte is the data structure type
|
||||
unsigned char dataType = reader->readByte() ;
|
||||
|
||||
// Check for NULL type
|
||||
if( dataType == NULL_TYPE )
|
||||
return NULL ;
|
||||
|
||||
// Create command object
|
||||
p<IDataStructure> object = AbstractCommand::createObject(dataType) ;
|
||||
if( object == NULL )
|
||||
throw IOException("Unmarshal failed; unknown data structure type %d, at %s line %d", dataType, __FILE__, __LINE__) ;
|
||||
|
||||
// Finally, unmarshal command body
|
||||
object->unmarshal(wireMarshaller, IMarshaller::MARSHAL_READ, reader) ;
|
||||
return object ;
|
||||
}
|
||||
|
|
|
@ -1,142 +1,142 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#include "activemq/transport/CorrelatorFilter.hpp"
|
||||
|
||||
using namespace apache::activemq::transport;
|
||||
|
||||
|
||||
// --- Constructors -------------------------------------------------
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
CorrelatorFilter::CorrelatorFilter(p<ITransport> next) :
|
||||
TransportFilter(next)
|
||||
{
|
||||
this->next = next ;
|
||||
this->nextCommandId = 0 ;
|
||||
}
|
||||
|
||||
|
||||
// --- Operation methods --------------------------------------------
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void CorrelatorFilter::oneway(p<ICommand> command)
|
||||
{
|
||||
// Set command id and that no response is required
|
||||
command->setCommandId( getNextCommandId() ) ;
|
||||
command->setResponseRequired(false) ;
|
||||
|
||||
this->next->oneway(command) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<FutureResponse> CorrelatorFilter::asyncRequest(p<ICommand> command)
|
||||
{
|
||||
// Set command id and that a response is required
|
||||
command->setCommandId( getNextCommandId() ) ;
|
||||
command->setResponseRequired(true) ;
|
||||
|
||||
// Register a future response holder with the command id
|
||||
p<FutureResponse> future = new FutureResponse() ;
|
||||
requestMap[command->getCommandId()] = future ;
|
||||
|
||||
// Transmit command
|
||||
this->next->oneway(command) ;
|
||||
|
||||
return future ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<Response> CorrelatorFilter::request(p<ICommand> command)
|
||||
{
|
||||
p<FutureResponse> future = asyncRequest(command) ;
|
||||
p<Response> response = future->getResponse() ;
|
||||
|
||||
if( response == NULL )
|
||||
{
|
||||
p<BrokerError> brokerError = new BrokerError() ;
|
||||
brokerError->setMessage("Timed out waiting for response from broker") ;
|
||||
throw BrokerException(brokerError) ;
|
||||
}
|
||||
else if ( response->getDataStructureType() == ExceptionResponse::TYPE )
|
||||
{
|
||||
p<ExceptionResponse> er = p_cast<ExceptionResponse> (response) ;
|
||||
p<BrokerError> brokerError = er->getException() ;
|
||||
throw BrokerException(brokerError) ;
|
||||
}
|
||||
return response ;
|
||||
}
|
||||
|
||||
|
||||
// --- Event methods ------------------------------------------------
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void CorrelatorFilter::onCommand(p<ITransport> transport, p<ICommand> command)
|
||||
{
|
||||
if( command->getDataStructureType() == Response::TYPE )
|
||||
{
|
||||
p<Response> response = p_cast<Response>(command) ;
|
||||
p<FutureResponse> future = requestMap[response->getCorrelationId()] ;
|
||||
|
||||
if( future != NULL )
|
||||
{
|
||||
if( response->getDataStructureType() == ExceptionResponse::TYPE )
|
||||
{
|
||||
p<ExceptionResponse> er = p_cast<ExceptionResponse> (response) ;
|
||||
p<BrokerError> brokerError = er->getException() ;
|
||||
|
||||
if( listener != NULL )
|
||||
{
|
||||
BrokerException brokerException = BrokerException(brokerError) ;
|
||||
listener->onError(smartify(this), brokerException) ;
|
||||
}
|
||||
}
|
||||
future->setResponse(response) ;
|
||||
}
|
||||
else
|
||||
cout << "Unknown response ID: " << response->getCorrelationId() << endl ;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( listener != NULL )
|
||||
listener->onCommand(smartify(this), command) ;
|
||||
else
|
||||
cout << "ERROR: No handler available to process command: " << command->getDataStructureType() << endl ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// --- Implementation methods ---------------------------------------
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
int CorrelatorFilter::getNextCommandId()
|
||||
{
|
||||
// Wait for lock and then fetch next command id
|
||||
LOCKED_SCOPE (mutex);
|
||||
return (short) ++nextCommandId ;
|
||||
}
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#include "activemq/transport/CorrelatorFilter.hpp"
|
||||
|
||||
using namespace apache::activemq::transport;
|
||||
|
||||
|
||||
// --- Constructors -------------------------------------------------
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
CorrelatorFilter::CorrelatorFilter(p<ITransport> next) :
|
||||
TransportFilter(next)
|
||||
{
|
||||
this->next = next ;
|
||||
this->nextCommandId = 0 ;
|
||||
}
|
||||
|
||||
|
||||
// --- Operation methods --------------------------------------------
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void CorrelatorFilter::oneway(p<ICommand> command)
|
||||
{
|
||||
// Set command id and that no response is required
|
||||
command->setCommandId( getNextCommandId() ) ;
|
||||
command->setResponseRequired(false) ;
|
||||
|
||||
this->next->oneway(command) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<FutureResponse> CorrelatorFilter::asyncRequest(p<ICommand> command)
|
||||
{
|
||||
// Set command id and that a response is required
|
||||
command->setCommandId( getNextCommandId() ) ;
|
||||
command->setResponseRequired(true) ;
|
||||
|
||||
// Register a future response holder with the command id
|
||||
p<FutureResponse> future = new FutureResponse() ;
|
||||
requestMap[command->getCommandId()] = future ;
|
||||
|
||||
// Transmit command
|
||||
this->next->oneway(command) ;
|
||||
|
||||
return future ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<Response> CorrelatorFilter::request(p<ICommand> command)
|
||||
{
|
||||
p<FutureResponse> future = asyncRequest(command) ;
|
||||
p<Response> response = future->getResponse() ;
|
||||
|
||||
if( response == NULL )
|
||||
{
|
||||
p<BrokerError> brokerError = new BrokerError() ;
|
||||
brokerError->setMessage("Timed out waiting for response from broker") ;
|
||||
throw BrokerException(brokerError) ;
|
||||
}
|
||||
else if ( response->getDataStructureType() == ExceptionResponse::TYPE )
|
||||
{
|
||||
p<ExceptionResponse> er = p_cast<ExceptionResponse> (response) ;
|
||||
p<BrokerError> brokerError = er->getException() ;
|
||||
throw BrokerException(brokerError) ;
|
||||
}
|
||||
return response ;
|
||||
}
|
||||
|
||||
|
||||
// --- Event methods ------------------------------------------------
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void CorrelatorFilter::onCommand(p<ITransport> transport, p<ICommand> command)
|
||||
{
|
||||
if( command->getDataStructureType() == Response::TYPE )
|
||||
{
|
||||
p<Response> response = p_cast<Response>(command) ;
|
||||
p<FutureResponse> future = requestMap[response->getCorrelationId()] ;
|
||||
|
||||
if( future != NULL )
|
||||
{
|
||||
if( response->getDataStructureType() == ExceptionResponse::TYPE )
|
||||
{
|
||||
p<ExceptionResponse> er = p_cast<ExceptionResponse> (response) ;
|
||||
p<BrokerError> brokerError = er->getException() ;
|
||||
|
||||
if( listener != NULL )
|
||||
{
|
||||
BrokerException brokerException = BrokerException(brokerError) ;
|
||||
listener->onError(smartify(this), brokerException) ;
|
||||
}
|
||||
}
|
||||
future->setResponse(response) ;
|
||||
}
|
||||
else
|
||||
cout << "Unknown response ID: " << response->getCorrelationId() << endl ;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( listener != NULL )
|
||||
listener->onCommand(smartify(this), command) ;
|
||||
else
|
||||
cout << "ERROR: No handler available to process command: " << command->getDataStructureType() << endl ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// --- Implementation methods ---------------------------------------
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
int CorrelatorFilter::getNextCommandId()
|
||||
{
|
||||
// Wait for lock and then fetch next command id
|
||||
LOCKED_SCOPE (mutex);
|
||||
return (short) ++nextCommandId ;
|
||||
}
|
||||
|
|
|
@ -1,66 +1,66 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_CorrelatorFilter_hpp_
|
||||
#define ActiveMQ_CorrelatorFilter_hpp_
|
||||
|
||||
#include <iostream>
|
||||
#include "activemq/BrokerException.hpp"
|
||||
#include "activemq/command/Response.hpp"
|
||||
#include "activemq/command/ExceptionResponse.hpp"
|
||||
#include "activemq/transport/TransportFilter.hpp"
|
||||
#include "ppr/util/ifr/p"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
namespace transport
|
||||
{
|
||||
using namespace ifr;
|
||||
using namespace apache::activemq;
|
||||
using namespace apache::activemq::command;
|
||||
|
||||
/*
|
||||
* Interface for commands.
|
||||
*/
|
||||
class CorrelatorFilter : public TransportFilter
|
||||
{
|
||||
protected:
|
||||
SimpleMutex mutex ;
|
||||
map<int, p<FutureResponse> > requestMap ;
|
||||
int nextCommandId ;
|
||||
|
||||
public:
|
||||
CorrelatorFilter(p<ITransport> next) ;
|
||||
virtual ~CorrelatorFilter() {}
|
||||
|
||||
virtual void oneway(p<ICommand> command) ;
|
||||
virtual p<FutureResponse> asyncRequest(p<ICommand> command) ;
|
||||
virtual p<Response> request(p<ICommand> command) ;
|
||||
|
||||
virtual void onCommand(p<ITransport> transport, p<ICommand> command) ;
|
||||
|
||||
protected:
|
||||
virtual int getNextCommandId() ;
|
||||
} ;
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_CorrelatorFilter_hpp_*/
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_CorrelatorFilter_hpp_
|
||||
#define ActiveMQ_CorrelatorFilter_hpp_
|
||||
|
||||
#include <iostream>
|
||||
#include "activemq/BrokerException.hpp"
|
||||
#include "activemq/command/Response.hpp"
|
||||
#include "activemq/command/ExceptionResponse.hpp"
|
||||
#include "activemq/transport/TransportFilter.hpp"
|
||||
#include "ppr/util/ifr/p"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
namespace transport
|
||||
{
|
||||
using namespace ifr;
|
||||
using namespace apache::activemq;
|
||||
using namespace apache::activemq::command;
|
||||
|
||||
/*
|
||||
* Interface for commands.
|
||||
*/
|
||||
class CorrelatorFilter : public TransportFilter
|
||||
{
|
||||
protected:
|
||||
SimpleMutex mutex ;
|
||||
map<int, p<FutureResponse> > requestMap ;
|
||||
int nextCommandId ;
|
||||
|
||||
public:
|
||||
CorrelatorFilter(p<ITransport> next) ;
|
||||
virtual ~CorrelatorFilter() {}
|
||||
|
||||
virtual void oneway(p<ICommand> command) ;
|
||||
virtual p<FutureResponse> asyncRequest(p<ICommand> command) ;
|
||||
virtual p<Response> request(p<ICommand> command) ;
|
||||
|
||||
virtual void onCommand(p<ITransport> transport, p<ICommand> command) ;
|
||||
|
||||
protected:
|
||||
virtual int getNextCommandId() ;
|
||||
} ;
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_CorrelatorFilter_hpp_*/
|
||||
|
|
|
@ -1,80 +1,80 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#include "activemq/transport/FutureResponse.hpp"
|
||||
|
||||
using namespace apache::activemq::transport;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
FutureResponse::FutureResponse()
|
||||
{
|
||||
complete = false ;
|
||||
response = NULL ;
|
||||
maxWait = 3 ;
|
||||
mutex = new SimpleMutex() ;
|
||||
semaphore = new Semaphore() ;
|
||||
}
|
||||
|
||||
p<Response> FutureResponse::getResponse()
|
||||
{
|
||||
// Wait for response to arrive
|
||||
LOCKED_SCOPE (mutex);
|
||||
while ( response == NULL )
|
||||
{
|
||||
LOCKED_SCOPE_UNLOCK;
|
||||
semaphore->wait(maxWait); // BUG: Why have a max wait when what you do is just to wait again and again? //dafah
|
||||
LOCKED_SCOPE_RELOCK;
|
||||
}
|
||||
return response ;
|
||||
}
|
||||
|
||||
void FutureResponse::setResponse(p<Response> response)
|
||||
{
|
||||
{
|
||||
LOCKED_SCOPE (mutex);
|
||||
this->response = response ;
|
||||
complete = true ;
|
||||
}
|
||||
// Signal that response has arrived
|
||||
semaphore->notify() ;
|
||||
}
|
||||
|
||||
bool FutureResponse::isCompleted()
|
||||
{
|
||||
return complete ;
|
||||
}
|
||||
|
||||
bool FutureResponse::getCompletedSynchronously()
|
||||
{
|
||||
return false ;
|
||||
}
|
||||
|
||||
p<SimpleMutex> FutureResponse::getAsyncWaitHandle()
|
||||
{
|
||||
return mutex ;
|
||||
}
|
||||
|
||||
p<Response> FutureResponse::getAsyncState()
|
||||
{
|
||||
return response ;
|
||||
}
|
||||
|
||||
void FutureResponse::setAsyncState(p<Response> response)
|
||||
{
|
||||
setResponse( response ) ;
|
||||
}
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#include "activemq/transport/FutureResponse.hpp"
|
||||
|
||||
using namespace apache::activemq::transport;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
FutureResponse::FutureResponse()
|
||||
{
|
||||
complete = false ;
|
||||
response = NULL ;
|
||||
maxWait = 3 ;
|
||||
mutex = new SimpleMutex() ;
|
||||
semaphore = new Semaphore() ;
|
||||
}
|
||||
|
||||
p<Response> FutureResponse::getResponse()
|
||||
{
|
||||
// Wait for response to arrive
|
||||
LOCKED_SCOPE (mutex);
|
||||
while ( response == NULL )
|
||||
{
|
||||
LOCKED_SCOPE_UNLOCK;
|
||||
semaphore->wait(maxWait); // BUG: Why have a max wait when what you do is just to wait again and again? //dafah
|
||||
LOCKED_SCOPE_RELOCK;
|
||||
}
|
||||
return response ;
|
||||
}
|
||||
|
||||
void FutureResponse::setResponse(p<Response> response)
|
||||
{
|
||||
{
|
||||
LOCKED_SCOPE (mutex);
|
||||
this->response = response ;
|
||||
complete = true ;
|
||||
}
|
||||
// Signal that response has arrived
|
||||
semaphore->notify() ;
|
||||
}
|
||||
|
||||
bool FutureResponse::isCompleted()
|
||||
{
|
||||
return complete ;
|
||||
}
|
||||
|
||||
bool FutureResponse::getCompletedSynchronously()
|
||||
{
|
||||
return false ;
|
||||
}
|
||||
|
||||
p<SimpleMutex> FutureResponse::getAsyncWaitHandle()
|
||||
{
|
||||
return mutex ;
|
||||
}
|
||||
|
||||
p<Response> FutureResponse::getAsyncState()
|
||||
{
|
||||
return response ;
|
||||
}
|
||||
|
||||
void FutureResponse::setAsyncState(p<Response> response)
|
||||
{
|
||||
setResponse( response ) ;
|
||||
}
|
||||
|
|
|
@ -1,66 +1,66 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_FutureResponse_hpp_
|
||||
#define ActiveMQ_FutureResponse_hpp_
|
||||
|
||||
#include <string>
|
||||
#include "activemq/command/Response.hpp"
|
||||
#include "ppr/thread/SimpleMutex.hpp"
|
||||
#include "ppr/thread/Semaphore.hpp"
|
||||
#include "ppr/util/ifr/p"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
namespace transport
|
||||
{
|
||||
using namespace ifr;
|
||||
using namespace apache::activemq::command;
|
||||
using namespace apache::ppr::thread;
|
||||
|
||||
/*
|
||||
* Interface for commands.
|
||||
*/
|
||||
class FutureResponse
|
||||
{
|
||||
private:
|
||||
p<Response> response ;
|
||||
p<SimpleMutex> mutex ;
|
||||
p<Semaphore> semaphore ;
|
||||
int maxWait ;
|
||||
bool complete ;
|
||||
|
||||
public:
|
||||
FutureResponse() ;
|
||||
virtual ~FutureResponse() {}
|
||||
|
||||
virtual p<Response> getResponse() ;
|
||||
virtual void setResponse(p<Response> response) ;
|
||||
virtual p<Response> getAsyncState() ;
|
||||
virtual void setAsyncState(p<Response> response) ;
|
||||
virtual p<SimpleMutex> getAsyncWaitHandle() ; // BUG: Shouldn't we return the semaphore here? What is it needed for? SHouldn't we require to use getResponse() instead? //dafah
|
||||
virtual bool isCompleted() ;
|
||||
virtual bool getCompletedSynchronously() ;
|
||||
} ;
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_FutureResponse_hpp_*/
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_FutureResponse_hpp_
|
||||
#define ActiveMQ_FutureResponse_hpp_
|
||||
|
||||
#include <string>
|
||||
#include "activemq/command/Response.hpp"
|
||||
#include "ppr/thread/SimpleMutex.hpp"
|
||||
#include "ppr/thread/Semaphore.hpp"
|
||||
#include "ppr/util/ifr/p"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
namespace transport
|
||||
{
|
||||
using namespace ifr;
|
||||
using namespace apache::activemq::command;
|
||||
using namespace apache::ppr::thread;
|
||||
|
||||
/*
|
||||
* Interface for commands.
|
||||
*/
|
||||
class FutureResponse
|
||||
{
|
||||
private:
|
||||
p<Response> response ;
|
||||
p<SimpleMutex> mutex ;
|
||||
p<Semaphore> semaphore ;
|
||||
int maxWait ;
|
||||
bool complete ;
|
||||
|
||||
public:
|
||||
FutureResponse() ;
|
||||
virtual ~FutureResponse() {}
|
||||
|
||||
virtual p<Response> getResponse() ;
|
||||
virtual void setResponse(p<Response> response) ;
|
||||
virtual p<Response> getAsyncState() ;
|
||||
virtual void setAsyncState(p<Response> response) ;
|
||||
virtual p<SimpleMutex> getAsyncWaitHandle() ; // BUG: Shouldn't we return the semaphore here? What is it needed for? SHouldn't we require to use getResponse() instead? //dafah
|
||||
virtual bool isCompleted() ;
|
||||
virtual bool getCompletedSynchronously() ;
|
||||
} ;
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_FutureResponse_hpp_*/
|
||||
|
|
|
@ -1,51 +1,51 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_ICommandListener_hpp_
|
||||
#define ActiveMQ_ICommandListener_hpp_
|
||||
|
||||
#include <exception>
|
||||
#include "activemq/ICommand.hpp"
|
||||
#include "ppr/util/ifr/p"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
namespace transport
|
||||
{
|
||||
using namespace ifr;
|
||||
using namespace std;
|
||||
using namespace apache::activemq;
|
||||
using namespace apache::activemq::command;
|
||||
using namespace apache::cms;
|
||||
struct ITransport;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
struct ICommandListener : Interface
|
||||
{
|
||||
virtual void onCommand(p<ITransport> transport, p<ICommand> command) = 0 ;
|
||||
virtual void onError(p<ITransport> transport, exception& error) = 0 ;
|
||||
} ;
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_ICommandListener_hpp_*/
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_ICommandListener_hpp_
|
||||
#define ActiveMQ_ICommandListener_hpp_
|
||||
|
||||
#include <exception>
|
||||
#include "activemq/ICommand.hpp"
|
||||
#include "ppr/util/ifr/p"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
namespace transport
|
||||
{
|
||||
using namespace ifr;
|
||||
using namespace std;
|
||||
using namespace apache::activemq;
|
||||
using namespace apache::activemq::command;
|
||||
using namespace apache::cms;
|
||||
struct ITransport;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
struct ICommandListener : Interface
|
||||
{
|
||||
virtual void onCommand(p<ITransport> transport, p<ICommand> command) = 0 ;
|
||||
virtual void onError(p<ITransport> transport, exception& error) = 0 ;
|
||||
} ;
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_ICommandListener_hpp_*/
|
||||
|
|
|
@ -1,56 +1,56 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_ITransport_hpp_
|
||||
#define ActiveMQ_ITransport_hpp_
|
||||
|
||||
#include "cms/IStartable.hpp"
|
||||
#include "activemq/ICommand.hpp"
|
||||
#include "activemq/command/Response.hpp"
|
||||
#include "activemq/transport/FutureResponse.hpp"
|
||||
#include "activemq/transport/ICommandListener.hpp"
|
||||
#include "ppr/util/ifr/p"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
namespace transport
|
||||
{
|
||||
using namespace ifr ;
|
||||
using namespace apache::cms;
|
||||
using namespace apache::activemq;
|
||||
using namespace apache::activemq::command;
|
||||
|
||||
/*
|
||||
* Represents the logical networking transport layer.
|
||||
*/
|
||||
struct ITransport : IStartable
|
||||
{
|
||||
virtual void setCommandListener(p<ICommandListener> listener) = 0 ;
|
||||
virtual p<ICommandListener> getCommandListener() = 0 ;
|
||||
|
||||
virtual void oneway(p<ICommand> command) = 0 ;
|
||||
virtual p<FutureResponse> asyncRequest(p<ICommand> command) = 0 ;
|
||||
virtual p<Response> request(p<ICommand> command) = 0 ;
|
||||
} ;
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_ITransport_hpp_*/
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_ITransport_hpp_
|
||||
#define ActiveMQ_ITransport_hpp_
|
||||
|
||||
#include "cms/IStartable.hpp"
|
||||
#include "activemq/ICommand.hpp"
|
||||
#include "activemq/command/Response.hpp"
|
||||
#include "activemq/transport/FutureResponse.hpp"
|
||||
#include "activemq/transport/ICommandListener.hpp"
|
||||
#include "ppr/util/ifr/p"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
namespace transport
|
||||
{
|
||||
using namespace ifr ;
|
||||
using namespace apache::cms;
|
||||
using namespace apache::activemq;
|
||||
using namespace apache::activemq::command;
|
||||
|
||||
/*
|
||||
* Represents the logical networking transport layer.
|
||||
*/
|
||||
struct ITransport : IStartable
|
||||
{
|
||||
virtual void setCommandListener(p<ICommandListener> listener) = 0 ;
|
||||
virtual p<ICommandListener> getCommandListener() = 0 ;
|
||||
|
||||
virtual void oneway(p<ICommand> command) = 0 ;
|
||||
virtual p<FutureResponse> asyncRequest(p<ICommand> command) = 0 ;
|
||||
virtual p<Response> request(p<ICommand> command) = 0 ;
|
||||
} ;
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_ITransport_hpp_*/
|
||||
|
|
|
@ -1,49 +1,49 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_ITransportFactory_hpp_
|
||||
#define ActiveMQ_ITransportFactory_hpp_
|
||||
|
||||
#include "activemq/transport/ITransport.hpp"
|
||||
#include "ppr/IllegalArgumentException.hpp"
|
||||
#include "ppr/net/SocketException.hpp"
|
||||
#include "ppr/net/Uri.hpp"
|
||||
#include "ppr/util/ifr/p"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
namespace transport
|
||||
{
|
||||
using namespace ifr ;
|
||||
using namespace apache::ppr;
|
||||
using namespace apache::ppr::net;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
struct ITransportFactory : Interface
|
||||
{
|
||||
virtual p<ITransport> createTransport(p<Uri> location) throw (SocketException, IllegalArgumentException) = 0 ;
|
||||
} ;
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_ITransportFactory_hpp_*/
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_ITransportFactory_hpp_
|
||||
#define ActiveMQ_ITransportFactory_hpp_
|
||||
|
||||
#include "activemq/transport/ITransport.hpp"
|
||||
#include "ppr/IllegalArgumentException.hpp"
|
||||
#include "ppr/net/SocketException.hpp"
|
||||
#include "ppr/net/Uri.hpp"
|
||||
#include "ppr/util/ifr/p"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
namespace transport
|
||||
{
|
||||
using namespace ifr ;
|
||||
using namespace apache::ppr;
|
||||
using namespace apache::ppr::net;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
struct ITransportFactory : Interface
|
||||
{
|
||||
virtual p<ITransport> createTransport(p<Uri> location) throw (SocketException, IllegalArgumentException) = 0 ;
|
||||
} ;
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_ITransportFactory_hpp_*/
|
||||
|
|
|
@ -1,106 +1,106 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#include "activemq/transport/LoggingFilter.hpp"
|
||||
|
||||
using namespace apache::activemq::transport;
|
||||
|
||||
|
||||
// --- Constructors -------------------------------------------------
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
LoggingFilter::LoggingFilter(p<ITransport> next) :
|
||||
TransportFilter(next)
|
||||
{
|
||||
this->next = next ;
|
||||
}
|
||||
|
||||
|
||||
// --- Operation methods --------------------------------------------
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void LoggingFilter::oneway(p<ICommand> command)
|
||||
{
|
||||
int cmdid = command->getCommandId(),
|
||||
corrid = -1 ;
|
||||
|
||||
// Get correlation id if a response
|
||||
if( command->getDataStructureType() == Response::TYPE )
|
||||
corrid = p_cast<Response>(command)->getCorrelationId() ;
|
||||
|
||||
// Dump log entry
|
||||
printf("Sending command: cmd.id = %d, corr.id = %d, type = %s\n",
|
||||
cmdid, corrid,
|
||||
AbstractCommand::getDataStructureTypeAsString(command->getDataStructureType())->c_str() ) ;
|
||||
|
||||
/* cout << "Sending command: id = " <<
|
||||
command->getCommandId() <<
|
||||
", type = " <<
|
||||
AbstractCommand::getDataStructureTypeAsString(command->getDataStructureType())->c_str() <<
|
||||
endl ;*/
|
||||
|
||||
this->next->oneway(command) ;
|
||||
}
|
||||
|
||||
|
||||
// --- Event methods ------------------------------------------------
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void LoggingFilter::onCommand(p<ITransport> transport, p<ICommand> command)
|
||||
{
|
||||
if( command == NULL )
|
||||
cout << "Received NULL command" << endl ;
|
||||
else
|
||||
{
|
||||
int cmdid = command->getCommandId(),
|
||||
corrid = -1 ;
|
||||
|
||||
// Get correlation id if a response
|
||||
if( command->getDataStructureType() == Response::TYPE )
|
||||
corrid = p_cast<Response>(command)->getCorrelationId() ;
|
||||
|
||||
// Dump log entry
|
||||
printf("Received command: cmd.id = %d, corr.id = %d, type = %s\n",
|
||||
cmdid, corrid,
|
||||
AbstractCommand::getDataStructureTypeAsString(command->getDataStructureType())->c_str() ) ;
|
||||
|
||||
/* cout << "Recived command: id = " <<
|
||||
command->getCommandId() <<
|
||||
", type = " <<
|
||||
AbstractCommand::getDataStructureTypeAsString(command->getDataStructureType())->c_str() <<
|
||||
endl ;*/
|
||||
}
|
||||
|
||||
// Forward incoming command to "real" listener
|
||||
this->listener->onCommand(transport, command) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void LoggingFilter::onError(p<ITransport> transport, exception& error)
|
||||
{
|
||||
cout << "Received exception = '" << error.what() << "'" << endl ;
|
||||
|
||||
// Forward incoming exception to "real" listener
|
||||
this->listener->onError(transport, error) ;
|
||||
}
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#include "activemq/transport/LoggingFilter.hpp"
|
||||
|
||||
using namespace apache::activemq::transport;
|
||||
|
||||
|
||||
// --- Constructors -------------------------------------------------
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
LoggingFilter::LoggingFilter(p<ITransport> next) :
|
||||
TransportFilter(next)
|
||||
{
|
||||
this->next = next ;
|
||||
}
|
||||
|
||||
|
||||
// --- Operation methods --------------------------------------------
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void LoggingFilter::oneway(p<ICommand> command)
|
||||
{
|
||||
int cmdid = command->getCommandId(),
|
||||
corrid = -1 ;
|
||||
|
||||
// Get correlation id if a response
|
||||
if( command->getDataStructureType() == Response::TYPE )
|
||||
corrid = p_cast<Response>(command)->getCorrelationId() ;
|
||||
|
||||
// Dump log entry
|
||||
printf("Sending command: cmd.id = %d, corr.id = %d, type = %s\n",
|
||||
cmdid, corrid,
|
||||
AbstractCommand::getDataStructureTypeAsString(command->getDataStructureType())->c_str() ) ;
|
||||
|
||||
/* cout << "Sending command: id = " <<
|
||||
command->getCommandId() <<
|
||||
", type = " <<
|
||||
AbstractCommand::getDataStructureTypeAsString(command->getDataStructureType())->c_str() <<
|
||||
endl ;*/
|
||||
|
||||
this->next->oneway(command) ;
|
||||
}
|
||||
|
||||
|
||||
// --- Event methods ------------------------------------------------
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void LoggingFilter::onCommand(p<ITransport> transport, p<ICommand> command)
|
||||
{
|
||||
if( command == NULL )
|
||||
cout << "Received NULL command" << endl ;
|
||||
else
|
||||
{
|
||||
int cmdid = command->getCommandId(),
|
||||
corrid = -1 ;
|
||||
|
||||
// Get correlation id if a response
|
||||
if( command->getDataStructureType() == Response::TYPE )
|
||||
corrid = p_cast<Response>(command)->getCorrelationId() ;
|
||||
|
||||
// Dump log entry
|
||||
printf("Received command: cmd.id = %d, corr.id = %d, type = %s\n",
|
||||
cmdid, corrid,
|
||||
AbstractCommand::getDataStructureTypeAsString(command->getDataStructureType())->c_str() ) ;
|
||||
|
||||
/* cout << "Recived command: id = " <<
|
||||
command->getCommandId() <<
|
||||
", type = " <<
|
||||
AbstractCommand::getDataStructureTypeAsString(command->getDataStructureType())->c_str() <<
|
||||
endl ;*/
|
||||
}
|
||||
|
||||
// Forward incoming command to "real" listener
|
||||
this->listener->onCommand(transport, command) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void LoggingFilter::onError(p<ITransport> transport, exception& error)
|
||||
{
|
||||
cout << "Received exception = '" << error.what() << "'" << endl ;
|
||||
|
||||
// Forward incoming exception to "real" listener
|
||||
this->listener->onError(transport, error) ;
|
||||
}
|
||||
|
|
|
@ -1,57 +1,57 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_LoggingFilter_hpp_
|
||||
#define ActiveMQ_LoggingFilter_hpp_
|
||||
|
||||
#include <iostream>
|
||||
#include <exception>
|
||||
#include "activemq/transport/TransportFilter.hpp"
|
||||
#include "ppr/util/ifr/p"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
namespace transport
|
||||
{
|
||||
using namespace ifr;
|
||||
using namespace std;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
class LoggingFilter : public TransportFilter
|
||||
{
|
||||
protected:
|
||||
p<ITransport> next ;
|
||||
|
||||
public:
|
||||
LoggingFilter(p<ITransport> next) ;
|
||||
virtual ~LoggingFilter() {}
|
||||
|
||||
virtual void oneway(p<ICommand> command) ;
|
||||
|
||||
virtual void onCommand(p<ITransport> transport, p<ICommand> command) ;
|
||||
virtual void onError(p<ITransport> transport, exception& error) ;
|
||||
} ;
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_LoggingFilter_hpp_*/
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_LoggingFilter_hpp_
|
||||
#define ActiveMQ_LoggingFilter_hpp_
|
||||
|
||||
#include <iostream>
|
||||
#include <exception>
|
||||
#include "activemq/transport/TransportFilter.hpp"
|
||||
#include "ppr/util/ifr/p"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
namespace transport
|
||||
{
|
||||
using namespace ifr;
|
||||
using namespace std;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
class LoggingFilter : public TransportFilter
|
||||
{
|
||||
protected:
|
||||
p<ITransport> next ;
|
||||
|
||||
public:
|
||||
LoggingFilter(p<ITransport> next) ;
|
||||
virtual ~LoggingFilter() {}
|
||||
|
||||
virtual void oneway(p<ICommand> command) ;
|
||||
|
||||
virtual void onCommand(p<ITransport> transport, p<ICommand> command) ;
|
||||
virtual void onError(p<ITransport> transport, exception& error) ;
|
||||
} ;
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_LoggingFilter_hpp_*/
|
||||
|
|
|
@ -1,72 +1,72 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#include "activemq/transport/MutexFilter.hpp"
|
||||
|
||||
using namespace apache::activemq::transport;
|
||||
|
||||
// --- Constructors -------------------------------------------------
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
MutexFilter::MutexFilter(p<ITransport> next) :
|
||||
TransportFilter(next)
|
||||
{
|
||||
this->next = next ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
MutexFilter::~MutexFilter()
|
||||
{
|
||||
// Wait for transmission lock before disposal
|
||||
LOCKED_SCOPE (mutex) ;
|
||||
}
|
||||
|
||||
|
||||
// --- Operation methods --------------------------------------------
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void MutexFilter::oneway(p<ICommand> command)
|
||||
{
|
||||
// Wait for transmission lock and then transmit command
|
||||
LOCKED_SCOPE (mutex) ;
|
||||
this->next->oneway(command) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<FutureResponse> MutexFilter::asyncRequest(p<ICommand> command)
|
||||
{
|
||||
// Wait for transmission lock and then transmit command
|
||||
LOCKED_SCOPE (mutex) ;
|
||||
return this->next->asyncRequest(command) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<Response> MutexFilter::request(p<ICommand> command)
|
||||
{
|
||||
// Wait for transmission lock and then transmit command
|
||||
LOCKED_SCOPE (mutex) ;
|
||||
return this->next->request(command) ;
|
||||
}
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#include "activemq/transport/MutexFilter.hpp"
|
||||
|
||||
using namespace apache::activemq::transport;
|
||||
|
||||
// --- Constructors -------------------------------------------------
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
MutexFilter::MutexFilter(p<ITransport> next) :
|
||||
TransportFilter(next)
|
||||
{
|
||||
this->next = next ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
MutexFilter::~MutexFilter()
|
||||
{
|
||||
// Wait for transmission lock before disposal
|
||||
LOCKED_SCOPE (mutex) ;
|
||||
}
|
||||
|
||||
|
||||
// --- Operation methods --------------------------------------------
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void MutexFilter::oneway(p<ICommand> command)
|
||||
{
|
||||
// Wait for transmission lock and then transmit command
|
||||
LOCKED_SCOPE (mutex) ;
|
||||
this->next->oneway(command) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<FutureResponse> MutexFilter::asyncRequest(p<ICommand> command)
|
||||
{
|
||||
// Wait for transmission lock and then transmit command
|
||||
LOCKED_SCOPE (mutex) ;
|
||||
return this->next->asyncRequest(command) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<Response> MutexFilter::request(p<ICommand> command)
|
||||
{
|
||||
// Wait for transmission lock and then transmit command
|
||||
LOCKED_SCOPE (mutex) ;
|
||||
return this->next->request(command) ;
|
||||
}
|
||||
|
|
|
@ -1,56 +1,56 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_MutexFilter_hpp_
|
||||
#define ActiveMQ_MutexFilter_hpp_
|
||||
|
||||
#include "activemq/transport/TransportFilter.hpp"
|
||||
#include "ppr/thread/SimpleMutex.hpp"
|
||||
#include "ppr/util/ifr/p"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
namespace transport
|
||||
{
|
||||
using namespace ifr;
|
||||
using namespace apache::ppr::thread;
|
||||
|
||||
/*
|
||||
* A filter transport which gaurds access to the next transport
|
||||
* using a mutex.
|
||||
*/
|
||||
class MutexFilter : public TransportFilter
|
||||
{
|
||||
protected:
|
||||
SimpleMutex mutex ;
|
||||
|
||||
public:
|
||||
MutexFilter(p<ITransport> next) ;
|
||||
virtual ~MutexFilter() ;
|
||||
|
||||
virtual void oneway(p<ICommand> command) ;
|
||||
virtual p<FutureResponse> asyncRequest(p<ICommand> command) ;
|
||||
virtual p<Response> request(p<ICommand> command) ;
|
||||
} ;
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_MutexFilter_hpp_*/
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_MutexFilter_hpp_
|
||||
#define ActiveMQ_MutexFilter_hpp_
|
||||
|
||||
#include "activemq/transport/TransportFilter.hpp"
|
||||
#include "ppr/thread/SimpleMutex.hpp"
|
||||
#include "ppr/util/ifr/p"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
namespace transport
|
||||
{
|
||||
using namespace ifr;
|
||||
using namespace apache::ppr::thread;
|
||||
|
||||
/*
|
||||
* A filter transport which gaurds access to the next transport
|
||||
* using a mutex.
|
||||
*/
|
||||
class MutexFilter : public TransportFilter
|
||||
{
|
||||
protected:
|
||||
SimpleMutex mutex ;
|
||||
|
||||
public:
|
||||
MutexFilter(p<ITransport> next) ;
|
||||
virtual ~MutexFilter() ;
|
||||
|
||||
virtual void oneway(p<ICommand> command) ;
|
||||
virtual p<FutureResponse> asyncRequest(p<ICommand> command) ;
|
||||
virtual p<Response> request(p<ICommand> command) ;
|
||||
} ;
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_MutexFilter_hpp_*/
|
||||
|
|
|
@ -1,91 +1,91 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#include "activemq/transport/TransportFactory.hpp"
|
||||
#include <cctype>
|
||||
#include <algorithm>
|
||||
|
||||
using namespace apache::activemq::transport;
|
||||
|
||||
|
||||
// --- Constructors -------------------------------------------------
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
TransportFactory::TransportFactory()
|
||||
{
|
||||
socketFactory = new SocketFactory() ;
|
||||
}
|
||||
|
||||
|
||||
// --- Operation methods --------------------------------------------
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<ITransport> TransportFactory::createTransport(p<Uri> location) throw (SocketException, IllegalArgumentException)
|
||||
{
|
||||
p<ISocket> socket ;
|
||||
p<ITransport> transport ;
|
||||
p<IProtocol> protocol ;
|
||||
string uriString ;
|
||||
|
||||
// Make an URI all lower case string
|
||||
uriString = location->toString() ;
|
||||
std::transform(uriString.begin(), uriString.end(), uriString.begin(), (int(*)(int))tolower) ; // The explicit cast is needed to compile on Linux
|
||||
|
||||
// Create and open socket
|
||||
cout << "Opening socket to: " << location->host() << " on port " << location->port() << endl ;
|
||||
socket = connect(location->host().c_str(), location->port()) ;
|
||||
|
||||
// Create wire protocol depending on specified query parameter
|
||||
if( uriString.find("protocol=openwire") != string::npos )
|
||||
protocol = new OpenWireProtocol() ;
|
||||
else
|
||||
throw IllegalArgumentException("Unknown or unspecified wire protocol") ;
|
||||
|
||||
// Create transport depending on specified URI scheme
|
||||
if( uriString.find("tcp://") != string::npos )
|
||||
transport = new TcpTransport(socket, protocol) ;
|
||||
else
|
||||
throw IllegalArgumentException("Cannot create transport for unknown URI scheme") ;
|
||||
|
||||
// Chain logging filter is requested in URI query
|
||||
if( uriString.find("trace=true") != string::npos )
|
||||
transport = new LoggingFilter(transport) ;
|
||||
|
||||
// Chain correlator and mutext filters
|
||||
transport = new CorrelatorFilter(transport) ;
|
||||
transport = new MutexFilter(transport) ;
|
||||
|
||||
return transport ;
|
||||
}
|
||||
|
||||
|
||||
// --- Implementation methods ---------------------------------------
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<ISocket> TransportFactory::connect(const char* host, int port) throw (SocketException)
|
||||
{
|
||||
p<ISocket> socket = socketFactory->createSocket() ;
|
||||
|
||||
// Try to connect socket to given address and port
|
||||
socket->connect(host, port) ;
|
||||
return socket ;
|
||||
}
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#include "activemq/transport/TransportFactory.hpp"
|
||||
#include <cctype>
|
||||
#include <algorithm>
|
||||
|
||||
using namespace apache::activemq::transport;
|
||||
|
||||
|
||||
// --- Constructors -------------------------------------------------
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
TransportFactory::TransportFactory()
|
||||
{
|
||||
socketFactory = new SocketFactory() ;
|
||||
}
|
||||
|
||||
|
||||
// --- Operation methods --------------------------------------------
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<ITransport> TransportFactory::createTransport(p<Uri> location) throw (SocketException, IllegalArgumentException)
|
||||
{
|
||||
p<ISocket> socket ;
|
||||
p<ITransport> transport ;
|
||||
p<IProtocol> protocol ;
|
||||
string uriString ;
|
||||
|
||||
// Make an URI all lower case string
|
||||
uriString = location->toString() ;
|
||||
std::transform(uriString.begin(), uriString.end(), uriString.begin(), (int(*)(int))tolower) ; // The explicit cast is needed to compile on Linux
|
||||
|
||||
// Create and open socket
|
||||
cout << "Opening socket to: " << location->host() << " on port " << location->port() << endl ;
|
||||
socket = connect(location->host().c_str(), location->port()) ;
|
||||
|
||||
// Create wire protocol depending on specified query parameter
|
||||
if( uriString.find("protocol=openwire") != string::npos )
|
||||
protocol = new OpenWireProtocol() ;
|
||||
else
|
||||
throw IllegalArgumentException("Unknown or unspecified wire protocol") ;
|
||||
|
||||
// Create transport depending on specified URI scheme
|
||||
if( uriString.find("tcp://") != string::npos )
|
||||
transport = new TcpTransport(socket, protocol) ;
|
||||
else
|
||||
throw IllegalArgumentException("Cannot create transport for unknown URI scheme") ;
|
||||
|
||||
// Chain logging filter is requested in URI query
|
||||
if( uriString.find("trace=true") != string::npos )
|
||||
transport = new LoggingFilter(transport) ;
|
||||
|
||||
// Chain correlator and mutext filters
|
||||
transport = new CorrelatorFilter(transport) ;
|
||||
transport = new MutexFilter(transport) ;
|
||||
|
||||
return transport ;
|
||||
}
|
||||
|
||||
|
||||
// --- Implementation methods ---------------------------------------
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<ISocket> TransportFactory::connect(const char* host, int port) throw (SocketException)
|
||||
{
|
||||
p<ISocket> socket = socketFactory->createSocket() ;
|
||||
|
||||
// Try to connect socket to given address and port
|
||||
socket->connect(host, port) ;
|
||||
return socket ;
|
||||
}
|
||||
|
|
|
@ -1,79 +1,79 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_TransportFactory_hpp_
|
||||
#define ActiveMQ_TransportFactory_hpp_
|
||||
|
||||
// Turn off warning message for ignored exception specification
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning( disable : 4290 )
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
#include "activemq/protocol/IProtocol.hpp"
|
||||
#include "activemq/protocol/openwire/OpenWireProtocol.hpp"
|
||||
#include "activemq/transport/ITransport.hpp"
|
||||
#include "activemq/transport/ITransportFactory.hpp"
|
||||
#include "activemq/transport/LoggingFilter.hpp"
|
||||
#include "activemq/transport/MutexFilter.hpp"
|
||||
#include "activemq/transport/CorrelatorFilter.hpp"
|
||||
#include "activemq/transport/tcp/TcpTransport.hpp"
|
||||
#include "ppr/IllegalArgumentException.hpp"
|
||||
#include "ppr/net/ISocket.hpp"
|
||||
#include "ppr/net/Socket.hpp"
|
||||
#include "ppr/net/SocketException.hpp"
|
||||
#include "ppr/net/ISocketFactory.hpp"
|
||||
#include "ppr/net/SocketFactory.hpp"
|
||||
#include "ppr/util/ifr/p"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
namespace transport
|
||||
{
|
||||
using namespace ifr ;
|
||||
using namespace std;
|
||||
using namespace apache::activemq::protocol;
|
||||
using namespace apache::activemq::protocol::openwire;
|
||||
using namespace apache::activemq::transport::tcp;
|
||||
using namespace apache::ppr::net;
|
||||
|
||||
/*
|
||||
* An implementation of ITransport that uses sockets to communicate with
|
||||
* the broker.
|
||||
*/
|
||||
class TransportFactory : public ITransportFactory
|
||||
{
|
||||
private:
|
||||
p<ISocketFactory> socketFactory ;
|
||||
|
||||
public:
|
||||
TransportFactory() ;
|
||||
virtual ~TransportFactory() {}
|
||||
|
||||
virtual p<ITransport> createTransport(p<Uri> location) throw (SocketException, IllegalArgumentException) ;
|
||||
|
||||
protected:
|
||||
virtual p<ISocket> connect(const char* host, int port) throw (SocketException) ;
|
||||
} ;
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_TransportFactory_hpp_*/
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_TransportFactory_hpp_
|
||||
#define ActiveMQ_TransportFactory_hpp_
|
||||
|
||||
// Turn off warning message for ignored exception specification
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning( disable : 4290 )
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
#include "activemq/protocol/IProtocol.hpp"
|
||||
#include "activemq/protocol/openwire/OpenWireProtocol.hpp"
|
||||
#include "activemq/transport/ITransport.hpp"
|
||||
#include "activemq/transport/ITransportFactory.hpp"
|
||||
#include "activemq/transport/LoggingFilter.hpp"
|
||||
#include "activemq/transport/MutexFilter.hpp"
|
||||
#include "activemq/transport/CorrelatorFilter.hpp"
|
||||
#include "activemq/transport/tcp/TcpTransport.hpp"
|
||||
#include "ppr/IllegalArgumentException.hpp"
|
||||
#include "ppr/net/ISocket.hpp"
|
||||
#include "ppr/net/Socket.hpp"
|
||||
#include "ppr/net/SocketException.hpp"
|
||||
#include "ppr/net/ISocketFactory.hpp"
|
||||
#include "ppr/net/SocketFactory.hpp"
|
||||
#include "ppr/util/ifr/p"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
namespace transport
|
||||
{
|
||||
using namespace ifr ;
|
||||
using namespace std;
|
||||
using namespace apache::activemq::protocol;
|
||||
using namespace apache::activemq::protocol::openwire;
|
||||
using namespace apache::activemq::transport::tcp;
|
||||
using namespace apache::ppr::net;
|
||||
|
||||
/*
|
||||
* An implementation of ITransport that uses sockets to communicate with
|
||||
* the broker.
|
||||
*/
|
||||
class TransportFactory : public ITransportFactory
|
||||
{
|
||||
private:
|
||||
p<ISocketFactory> socketFactory ;
|
||||
|
||||
public:
|
||||
TransportFactory() ;
|
||||
virtual ~TransportFactory() {}
|
||||
|
||||
virtual p<ITransport> createTransport(p<Uri> location) throw (SocketException, IllegalArgumentException) ;
|
||||
|
||||
protected:
|
||||
virtual p<ISocket> connect(const char* host, int port) throw (SocketException) ;
|
||||
} ;
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_TransportFactory_hpp_*/
|
||||
|
|
|
@ -1,112 +1,112 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#include "activemq/transport/TransportFilter.hpp"
|
||||
|
||||
using namespace apache::activemq::transport;
|
||||
|
||||
|
||||
// --- Constructors -------------------------------------------------
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
TransportFilter::TransportFilter(p<ITransport> next)
|
||||
{
|
||||
this->next = next ;
|
||||
this->listener = NULL ;
|
||||
|
||||
// Set us up as the command listener for next link in chain
|
||||
next->setCommandListener( smartify(this) ) ;
|
||||
}
|
||||
|
||||
|
||||
// --- Attribute methods --------------------------------------------
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void TransportFilter::setCommandListener(p<ICommandListener> listener)
|
||||
{
|
||||
this->listener = listener ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<ICommandListener> TransportFilter::getCommandListener()
|
||||
{
|
||||
return this->listener ;
|
||||
}
|
||||
|
||||
|
||||
// --- Operation methods --------------------------------------------
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void TransportFilter::start()
|
||||
{
|
||||
if( listener == NULL )
|
||||
throw InvalidOperationException ("Command listener cannot be null when Start is called.") ;
|
||||
|
||||
// Start next link in chain
|
||||
this->next->start() ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void TransportFilter::oneway(p<ICommand> command)
|
||||
{
|
||||
this->next->oneway(command) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<FutureResponse> TransportFilter::asyncRequest(p<ICommand> command)
|
||||
{
|
||||
return this->next->asyncRequest(command) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<Response> TransportFilter::request(p<ICommand> command)
|
||||
{
|
||||
return this->next->request(command) ;
|
||||
}
|
||||
|
||||
// --- Event methods ------------------------------------------------
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void TransportFilter::onCommand(p<ITransport> transport, p<ICommand> command)
|
||||
{
|
||||
// Forward incoming command to "real" listener
|
||||
this->listener->onCommand(transport, command) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void TransportFilter::onError(p<ITransport> transport, exception& error)
|
||||
{
|
||||
// Forward incoming exception to "real" listener
|
||||
this->listener->onError(transport, error) ;
|
||||
}
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#include "activemq/transport/TransportFilter.hpp"
|
||||
|
||||
using namespace apache::activemq::transport;
|
||||
|
||||
|
||||
// --- Constructors -------------------------------------------------
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
TransportFilter::TransportFilter(p<ITransport> next)
|
||||
{
|
||||
this->next = next ;
|
||||
this->listener = NULL ;
|
||||
|
||||
// Set us up as the command listener for next link in chain
|
||||
next->setCommandListener( smartify(this) ) ;
|
||||
}
|
||||
|
||||
|
||||
// --- Attribute methods --------------------------------------------
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void TransportFilter::setCommandListener(p<ICommandListener> listener)
|
||||
{
|
||||
this->listener = listener ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<ICommandListener> TransportFilter::getCommandListener()
|
||||
{
|
||||
return this->listener ;
|
||||
}
|
||||
|
||||
|
||||
// --- Operation methods --------------------------------------------
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void TransportFilter::start()
|
||||
{
|
||||
if( listener == NULL )
|
||||
throw InvalidOperationException ("Command listener cannot be null when Start is called.") ;
|
||||
|
||||
// Start next link in chain
|
||||
this->next->start() ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void TransportFilter::oneway(p<ICommand> command)
|
||||
{
|
||||
this->next->oneway(command) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<FutureResponse> TransportFilter::asyncRequest(p<ICommand> command)
|
||||
{
|
||||
return this->next->asyncRequest(command) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<Response> TransportFilter::request(p<ICommand> command)
|
||||
{
|
||||
return this->next->request(command) ;
|
||||
}
|
||||
|
||||
// --- Event methods ------------------------------------------------
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void TransportFilter::onCommand(p<ITransport> transport, p<ICommand> command)
|
||||
{
|
||||
// Forward incoming command to "real" listener
|
||||
this->listener->onCommand(transport, command) ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void TransportFilter::onError(p<ITransport> transport, exception& error)
|
||||
{
|
||||
// Forward incoming exception to "real" listener
|
||||
this->listener->onError(transport, error) ;
|
||||
}
|
||||
|
|
|
@ -1,66 +1,66 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_TransportFilter_hpp_
|
||||
#define ActiveMQ_TransportFilter_hpp_
|
||||
|
||||
#include <string>
|
||||
#include "activemq/command/Response.hpp"
|
||||
#include "activemq/transport/ITransport.hpp"
|
||||
#include "ppr/InvalidOperationException.hpp"
|
||||
#include "ppr/util/ifr/p"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
namespace transport
|
||||
{
|
||||
using namespace ifr;
|
||||
using namespace apache::activemq::command;
|
||||
using namespace apache::ppr;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
class TransportFilter : public ITransport, public ICommandListener
|
||||
{
|
||||
protected:
|
||||
p<ITransport> next ;
|
||||
p<ICommandListener> listener ;
|
||||
|
||||
public:
|
||||
TransportFilter(p<ITransport> next) ;
|
||||
virtual ~TransportFilter() {}
|
||||
|
||||
virtual void setCommandListener(p<ICommandListener> listener) ;
|
||||
virtual p<ICommandListener> getCommandListener() ;
|
||||
|
||||
virtual void start() ;
|
||||
virtual void oneway(p<ICommand> command) ;
|
||||
virtual p<FutureResponse> asyncRequest(p<ICommand> command) ;
|
||||
virtual p<Response> request(p<ICommand> command) ;
|
||||
|
||||
virtual void onCommand(p<ITransport> transport, p<ICommand> command) ;
|
||||
virtual void onError(p<ITransport> transport, exception& error) ;
|
||||
} ;
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_TransportFilter_hpp_*/
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_TransportFilter_hpp_
|
||||
#define ActiveMQ_TransportFilter_hpp_
|
||||
|
||||
#include <string>
|
||||
#include "activemq/command/Response.hpp"
|
||||
#include "activemq/transport/ITransport.hpp"
|
||||
#include "ppr/InvalidOperationException.hpp"
|
||||
#include "ppr/util/ifr/p"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
namespace transport
|
||||
{
|
||||
using namespace ifr;
|
||||
using namespace apache::activemq::command;
|
||||
using namespace apache::ppr;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
class TransportFilter : public ITransport, public ICommandListener
|
||||
{
|
||||
protected:
|
||||
p<ITransport> next ;
|
||||
p<ICommandListener> listener ;
|
||||
|
||||
public:
|
||||
TransportFilter(p<ITransport> next) ;
|
||||
virtual ~TransportFilter() {}
|
||||
|
||||
virtual void setCommandListener(p<ICommandListener> listener) ;
|
||||
virtual p<ICommandListener> getCommandListener() ;
|
||||
|
||||
virtual void start() ;
|
||||
virtual void oneway(p<ICommand> command) ;
|
||||
virtual p<FutureResponse> asyncRequest(p<ICommand> command) ;
|
||||
virtual p<Response> request(p<ICommand> command) ;
|
||||
|
||||
virtual void onCommand(p<ITransport> transport, p<ICommand> command) ;
|
||||
virtual void onError(p<ITransport> transport, exception& error) ;
|
||||
} ;
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_TransportFilter_hpp_*/
|
||||
|
|
|
@ -1,157 +1,157 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#include "activemq/transport/tcp/TcpTransport.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace apache::activemq::transport::tcp;
|
||||
|
||||
|
||||
// --- Constructors -------------------------------------------------
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
TcpTransport::TcpTransport(p<ISocket> socket, p<IProtocol> wireProtocol)
|
||||
{
|
||||
// Initialize members
|
||||
this->socket = socket ;
|
||||
this->protocol = wireProtocol ;
|
||||
this->reader = NULL ;
|
||||
this->writer = NULL ;
|
||||
this->listener = NULL ;
|
||||
this->readThread = NULL ;
|
||||
this->started = false ;
|
||||
this->closed = false ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
TcpTransport::~TcpTransport()
|
||||
{
|
||||
closed = true ;
|
||||
readThread->join() ;
|
||||
reader->close() ;
|
||||
socket->close() ;
|
||||
}
|
||||
|
||||
|
||||
// --- Attribute methods --------------------------------------------
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void TcpTransport::setCommandListener(p<ICommandListener> listener)
|
||||
{
|
||||
this->listener = listener ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<ICommandListener> TcpTransport::getCommandListener()
|
||||
{
|
||||
return this->listener ;
|
||||
}
|
||||
|
||||
|
||||
// --- Operation methods --------------------------------------------
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void TcpTransport::start()
|
||||
{
|
||||
if( !started )
|
||||
{
|
||||
// Must have a command listener
|
||||
if( listener == NULL )
|
||||
throw InvalidOperationException("Command listener cannot be null when TCP transport start is called.") ;
|
||||
|
||||
started = true ;
|
||||
|
||||
// Create the I/O streams
|
||||
writer = new SocketOutputStream(socket) ;
|
||||
reader = new SocketInputStream(socket) ;
|
||||
|
||||
// Create and start the background read thread
|
||||
readThread = new ReadThread(this) ;
|
||||
readThread->start() ;
|
||||
|
||||
// Ask protocol handler to handshake
|
||||
protocol->handshake( smartify(this) ) ;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void TcpTransport::oneway(p<ICommand> command)
|
||||
{
|
||||
protocol->marshal(command, writer) ;
|
||||
writer->flush() ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<FutureResponse> TcpTransport::asyncRequest(p<ICommand> command)
|
||||
{
|
||||
throw InvalidOperationException("Use a CorrelatorFilter if you want to issue asynchrounous request calls.") ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<Response> TcpTransport::request(p<ICommand> command)
|
||||
{
|
||||
throw InvalidOperationException("Use a CorrelatorFilter if you want to issue request calls.") ;
|
||||
}
|
||||
|
||||
|
||||
// --- Implementation methods ---------------------------------------
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void TcpTransport::readLoop()
|
||||
{
|
||||
// Continue loop until closed or aborted
|
||||
while( !closed )
|
||||
{
|
||||
p<ICommand> command = NULL ;
|
||||
|
||||
try
|
||||
{
|
||||
// Read next command
|
||||
command = p_cast<ICommand> (protocol->unmarshal(reader)) ;
|
||||
|
||||
// Forward to command listener
|
||||
|
||||
listener->onCommand(smartify(this), command) ;
|
||||
}
|
||||
catch( exception& e )
|
||||
{
|
||||
// Socket closed or error
|
||||
if( !closed )
|
||||
listener->onError(smartify(this), e) ;
|
||||
|
||||
cout << "Exiting read loop due to exception: " << e.what() << endl ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#include "activemq/transport/tcp/TcpTransport.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace apache::activemq::transport::tcp;
|
||||
|
||||
|
||||
// --- Constructors -------------------------------------------------
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
TcpTransport::TcpTransport(p<ISocket> socket, p<IProtocol> wireProtocol)
|
||||
{
|
||||
// Initialize members
|
||||
this->socket = socket ;
|
||||
this->protocol = wireProtocol ;
|
||||
this->reader = NULL ;
|
||||
this->writer = NULL ;
|
||||
this->listener = NULL ;
|
||||
this->readThread = NULL ;
|
||||
this->started = false ;
|
||||
this->closed = false ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
TcpTransport::~TcpTransport()
|
||||
{
|
||||
closed = true ;
|
||||
readThread->join() ;
|
||||
reader->close() ;
|
||||
socket->close() ;
|
||||
}
|
||||
|
||||
|
||||
// --- Attribute methods --------------------------------------------
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void TcpTransport::setCommandListener(p<ICommandListener> listener)
|
||||
{
|
||||
this->listener = listener ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<ICommandListener> TcpTransport::getCommandListener()
|
||||
{
|
||||
return this->listener ;
|
||||
}
|
||||
|
||||
|
||||
// --- Operation methods --------------------------------------------
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void TcpTransport::start()
|
||||
{
|
||||
if( !started )
|
||||
{
|
||||
// Must have a command listener
|
||||
if( listener == NULL )
|
||||
throw InvalidOperationException("Command listener cannot be null when TCP transport start is called.") ;
|
||||
|
||||
started = true ;
|
||||
|
||||
// Create the I/O streams
|
||||
writer = new SocketOutputStream(socket) ;
|
||||
reader = new SocketInputStream(socket) ;
|
||||
|
||||
// Create and start the background read thread
|
||||
readThread = new ReadThread(this) ;
|
||||
readThread->start() ;
|
||||
|
||||
// Ask protocol handler to handshake
|
||||
protocol->handshake( smartify(this) ) ;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void TcpTransport::oneway(p<ICommand> command)
|
||||
{
|
||||
protocol->marshal(command, writer) ;
|
||||
writer->flush() ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<FutureResponse> TcpTransport::asyncRequest(p<ICommand> command)
|
||||
{
|
||||
throw InvalidOperationException("Use a CorrelatorFilter if you want to issue asynchrounous request calls.") ;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
p<Response> TcpTransport::request(p<ICommand> command)
|
||||
{
|
||||
throw InvalidOperationException("Use a CorrelatorFilter if you want to issue request calls.") ;
|
||||
}
|
||||
|
||||
|
||||
// --- Implementation methods ---------------------------------------
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
void TcpTransport::readLoop()
|
||||
{
|
||||
// Continue loop until closed or aborted
|
||||
while( !closed )
|
||||
{
|
||||
p<ICommand> command = NULL ;
|
||||
|
||||
try
|
||||
{
|
||||
// Read next command
|
||||
command = p_cast<ICommand> (protocol->unmarshal(reader)) ;
|
||||
|
||||
// Forward to command listener
|
||||
|
||||
listener->onCommand(smartify(this), command) ;
|
||||
}
|
||||
catch( exception& e )
|
||||
{
|
||||
// Socket closed or error
|
||||
if( !closed )
|
||||
listener->onError(smartify(this), e) ;
|
||||
|
||||
cout << "Exiting read loop due to exception: " << e.what() << endl ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,128 +1,128 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_TcpTransport_hpp_
|
||||
#define ActiveMQ_TcpTransport_hpp_
|
||||
|
||||
// Turn off warning message for ignored exception specification
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning( disable : 4290 )
|
||||
#endif
|
||||
|
||||
#include <iostream>
|
||||
#include <map>
|
||||
#include "cms/CmsException.hpp"
|
||||
#include "activemq/BrokerException.hpp"
|
||||
#include "activemq/ICommand.hpp"
|
||||
#include "activemq/command/BaseCommand.hpp"
|
||||
#include "activemq/command/Response.hpp"
|
||||
#include "activemq/command/ExceptionResponse.hpp"
|
||||
#include "activemq/protocol/IProtocol.hpp"
|
||||
#include "activemq/transport/FutureResponse.hpp"
|
||||
#include "activemq/transport/ITransport.hpp"
|
||||
#include "activemq/transport/ICommandListener.hpp"
|
||||
#include "ppr/InvalidOperationException.hpp"
|
||||
#include "ppr/io/SocketInputStream.hpp"
|
||||
#include "ppr/io/SocketOutputStream.hpp"
|
||||
#include "ppr/net/ISocket.hpp"
|
||||
#include "ppr/net/Socket.hpp"
|
||||
#include "ppr/net/SocketException.hpp"
|
||||
#include "ppr/net/ISocketFactory.hpp"
|
||||
#include "ppr/net/SocketFactory.hpp"
|
||||
#include "ppr/thread/SimpleMutex.hpp"
|
||||
#include "ppr/thread/Thread.hpp"
|
||||
#include "ppr/util/ifr/p"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
namespace transport
|
||||
{
|
||||
namespace tcp
|
||||
{
|
||||
using namespace ifr ;
|
||||
using namespace std;
|
||||
using namespace apache::activemq;
|
||||
using namespace apache::activemq::command;
|
||||
using namespace apache::activemq::protocol;
|
||||
using namespace apache::ppr;
|
||||
using namespace apache::ppr::io;
|
||||
using namespace apache::ppr::net;
|
||||
using namespace apache::ppr::thread;
|
||||
using namespace apache::ppr::util;
|
||||
class ReadThread ;
|
||||
|
||||
/*
|
||||
* An implementation of ITransport that uses TCP to communicate with
|
||||
* the broker.
|
||||
*/
|
||||
class TcpTransport : public ITransport
|
||||
{
|
||||
private:
|
||||
p<IProtocol> protocol ;
|
||||
p<SocketInputStream> reader ;
|
||||
p<SocketOutputStream> writer ;
|
||||
p<ICommandListener> listener ;
|
||||
p<ReadThread> readThread ;
|
||||
p<ISocket> socket ;
|
||||
bool closed,
|
||||
started ;
|
||||
|
||||
public:
|
||||
TcpTransport(p<ISocket> socket, p<IProtocol> wireProtocol) ;
|
||||
virtual ~TcpTransport() ;
|
||||
|
||||
virtual void setCommandListener(p<ICommandListener> listener) ;
|
||||
virtual p<ICommandListener> getCommandListener() ;
|
||||
|
||||
virtual void start() ;
|
||||
virtual void oneway(p<ICommand> command) ;
|
||||
virtual p<FutureResponse> asyncRequest(p<ICommand> command) ;
|
||||
virtual p<Response> request(p<ICommand> command) ;
|
||||
|
||||
public:
|
||||
void readLoop() ;
|
||||
} ;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
class ReadThread : public Thread
|
||||
{
|
||||
private:
|
||||
TcpTransport* transport ;
|
||||
|
||||
public:
|
||||
ReadThread(TcpTransport* transport)
|
||||
{
|
||||
this->transport = transport ;
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual void run() throw(p<exception>)
|
||||
{
|
||||
transport->readLoop() ;
|
||||
}
|
||||
} ;
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_TcpTransport_hpp_*/
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#ifndef ActiveMQ_TcpTransport_hpp_
|
||||
#define ActiveMQ_TcpTransport_hpp_
|
||||
|
||||
// Turn off warning message for ignored exception specification
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning( disable : 4290 )
|
||||
#endif
|
||||
|
||||
#include <iostream>
|
||||
#include <map>
|
||||
#include "cms/CmsException.hpp"
|
||||
#include "activemq/BrokerException.hpp"
|
||||
#include "activemq/ICommand.hpp"
|
||||
#include "activemq/command/BaseCommand.hpp"
|
||||
#include "activemq/command/Response.hpp"
|
||||
#include "activemq/command/ExceptionResponse.hpp"
|
||||
#include "activemq/protocol/IProtocol.hpp"
|
||||
#include "activemq/transport/FutureResponse.hpp"
|
||||
#include "activemq/transport/ITransport.hpp"
|
||||
#include "activemq/transport/ICommandListener.hpp"
|
||||
#include "ppr/InvalidOperationException.hpp"
|
||||
#include "ppr/io/SocketInputStream.hpp"
|
||||
#include "ppr/io/SocketOutputStream.hpp"
|
||||
#include "ppr/net/ISocket.hpp"
|
||||
#include "ppr/net/Socket.hpp"
|
||||
#include "ppr/net/SocketException.hpp"
|
||||
#include "ppr/net/ISocketFactory.hpp"
|
||||
#include "ppr/net/SocketFactory.hpp"
|
||||
#include "ppr/thread/SimpleMutex.hpp"
|
||||
#include "ppr/thread/Thread.hpp"
|
||||
#include "ppr/util/ifr/p"
|
||||
|
||||
namespace apache
|
||||
{
|
||||
namespace activemq
|
||||
{
|
||||
namespace transport
|
||||
{
|
||||
namespace tcp
|
||||
{
|
||||
using namespace ifr ;
|
||||
using namespace std;
|
||||
using namespace apache::activemq;
|
||||
using namespace apache::activemq::command;
|
||||
using namespace apache::activemq::protocol;
|
||||
using namespace apache::ppr;
|
||||
using namespace apache::ppr::io;
|
||||
using namespace apache::ppr::net;
|
||||
using namespace apache::ppr::thread;
|
||||
using namespace apache::ppr::util;
|
||||
class ReadThread ;
|
||||
|
||||
/*
|
||||
* An implementation of ITransport that uses TCP to communicate with
|
||||
* the broker.
|
||||
*/
|
||||
class TcpTransport : public ITransport
|
||||
{
|
||||
private:
|
||||
p<IProtocol> protocol ;
|
||||
p<SocketInputStream> reader ;
|
||||
p<SocketOutputStream> writer ;
|
||||
p<ICommandListener> listener ;
|
||||
p<ReadThread> readThread ;
|
||||
p<ISocket> socket ;
|
||||
bool closed,
|
||||
started ;
|
||||
|
||||
public:
|
||||
TcpTransport(p<ISocket> socket, p<IProtocol> wireProtocol) ;
|
||||
virtual ~TcpTransport() ;
|
||||
|
||||
virtual void setCommandListener(p<ICommandListener> listener) ;
|
||||
virtual p<ICommandListener> getCommandListener() ;
|
||||
|
||||
virtual void start() ;
|
||||
virtual void oneway(p<ICommand> command) ;
|
||||
virtual p<FutureResponse> asyncRequest(p<ICommand> command) ;
|
||||
virtual p<Response> request(p<ICommand> command) ;
|
||||
|
||||
public:
|
||||
void readLoop() ;
|
||||
} ;
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
class ReadThread : public Thread
|
||||
{
|
||||
private:
|
||||
TcpTransport* transport ;
|
||||
|
||||
public:
|
||||
ReadThread(TcpTransport* transport)
|
||||
{
|
||||
this->transport = transport ;
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual void run() throw(p<exception>)
|
||||
{
|
||||
transport->readLoop() ;
|
||||
}
|
||||
} ;
|
||||
|
||||
/* namespace */
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /*ActiveMQ_TcpTransport_hpp_*/
|
||||
|
|
|
@ -1,46 +1,46 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#include "cms/CmsException.hpp"
|
||||
|
||||
using namespace apache::cms;
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
CmsException::CmsException()
|
||||
: msg("")
|
||||
{
|
||||
// no-op
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
CmsException::CmsException(const char* message)
|
||||
: msg(message)
|
||||
{
|
||||
// no-op
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
CmsException::~CmsException () throw ()
|
||||
{
|
||||
// no-op
|
||||
}
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
#include "cms/CmsException.hpp"
|
||||
|
||||
using namespace apache::cms;
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
CmsException::CmsException()
|
||||
: msg("")
|
||||
{
|
||||
// no-op
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
CmsException::CmsException(const char* message)
|
||||
: msg(message)
|
||||
{
|
||||
// no-op
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*/
|
||||
CmsException::~CmsException () throw ()
|
||||
{
|
||||
// no-op
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue