index
int64
0
0
repo_id
stringlengths
9
205
file_path
stringlengths
31
246
content
stringlengths
1
12.2M
__index_level_0__
int64
0
10k
0
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v11/MarshallerFactory.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.codec.v11; import org.apache.activemq.openwire.codec.DataStreamMarshaller; import org.apache.activemq.openwire.codec.OpenWireFormat; public class MarshallerFactory { /** * Creates a Map of command type -> Marshallers */ static final private DataStreamMarshaller marshaller[] = new DataStreamMarshaller[256]; static { add(new OpenWireBlobMessageMarshaller()); add(new OpenWireBytesMessageMarshaller()); add(new OpenWireMapMessageMarshaller()); add(new OpenWireMessageMarshaller()); add(new OpenWireObjectMessageMarshaller()); add(new OpenWireQueueMarshaller()); add(new OpenWireStreamMessageMarshaller()); add(new OpenWireTempQueueMarshaller()); add(new OpenWireTempTopicMarshaller()); add(new OpenWireTextMessageMarshaller()); add(new OpenWireTopicMarshaller()); add(new BrokerIdMarshaller()); add(new BrokerInfoMarshaller()); add(new ConnectionControlMarshaller()); add(new ConnectionErrorMarshaller()); add(new ConnectionIdMarshaller()); add(new ConnectionInfoMarshaller()); add(new ConsumerControlMarshaller()); add(new ConsumerIdMarshaller()); add(new ConsumerInfoMarshaller()); add(new ControlCommandMarshaller()); add(new DataArrayResponseMarshaller()); add(new DataResponseMarshaller()); add(new DestinationInfoMarshaller()); add(new DiscoveryEventMarshaller()); add(new ExceptionResponseMarshaller()); add(new FlushCommandMarshaller()); add(new IntegerResponseMarshaller()); add(new JournalQueueAckMarshaller()); add(new JournalTopicAckMarshaller()); add(new JournalTraceMarshaller()); add(new JournalTransactionMarshaller()); add(new KeepAliveInfoMarshaller()); add(new LastPartialCommandMarshaller()); add(new LocalTransactionIdMarshaller()); add(new MessageAckMarshaller()); add(new MessageDispatchMarshaller()); add(new MessageDispatchNotificationMarshaller()); add(new MessageIdMarshaller()); add(new MessagePullMarshaller()); add(new NetworkBridgeFilterMarshaller()); add(new PartialCommandMarshaller()); add(new ProducerAckMarshaller()); add(new ProducerIdMarshaller()); add(new ProducerInfoMarshaller()); add(new RemoveInfoMarshaller()); add(new RemoveSubscriptionInfoMarshaller()); add(new ReplayCommandMarshaller()); add(new ResponseMarshaller()); add(new SessionIdMarshaller()); add(new SessionInfoMarshaller()); add(new ShutdownInfoMarshaller()); add(new SubscriptionInfoMarshaller()); add(new TransactionInfoMarshaller()); add(new WireFormatInfoMarshaller()); add(new XATransactionIdMarshaller()); } static private void add(DataStreamMarshaller dsm) { marshaller[dsm.getDataStructureType()] = dsm; } static public DataStreamMarshaller[] createMarshallerMap(OpenWireFormat wireFormat) { return marshaller; } }
1,300
0
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v11/DataResponseMarshaller.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.codec.v11; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import org.apache.activemq.openwire.codec.BooleanStream; import org.apache.activemq.openwire.codec.OpenWireFormat; import org.apache.activemq.openwire.commands.DataResponse; import org.apache.activemq.openwire.commands.DataStructure; public class DataResponseMarshaller extends ResponseMarshaller { /** * Return the type of Data Structure we marshal * * @return short representation of the type data structure */ @Override public byte getDataStructureType() { return DataResponse.DATA_STRUCTURE_TYPE; } /** * @return a new object instance */ @Override public DataStructure createObject() { return new DataResponse(); } /** * Un-marshal an object instance from the data input stream * * @param o * the object to un-marshal * @param dataIn * the data input stream to build the object from * @throws IOException */ @Override public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException { super.tightUnmarshal(wireFormat, o, dataIn, bs); DataResponse info = (DataResponse) o; info.setData(tightUnmarsalNestedObject(wireFormat, dataIn, bs)); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { DataResponse info = (DataResponse) o; int rc = super.tightMarshal1(wireFormat, o, bs); rc += tightMarshalNestedObject1(wireFormat, info.getData(), bs); return rc + 0; } /** * Write a object instance to data output stream * * @param o * the instance to be marshaled * @param dataOut * the output stream * @throws IOException * thrown if an error occurs */ @Override public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { super.tightMarshal2(wireFormat, o, dataOut, bs); DataResponse info = (DataResponse) o; tightMarshalNestedObject2(wireFormat, info.getData(), dataOut, bs); } /** * Un-marshal an object instance from the data input stream * * @param o * the object to un-marshal * @param dataIn * the data input stream to build the object from * @throws IOException */ @Override public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { super.looseUnmarshal(wireFormat, o, dataIn); DataResponse info = (DataResponse) o; info.setData(looseUnmarsalNestedObject(wireFormat, dataIn)); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { DataResponse info = (DataResponse) o; super.looseMarshal(wireFormat, o, dataOut); looseMarshalNestedObject(wireFormat, info.getData(), dataOut); } }
1,301
0
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v11/MessageDispatchNotificationMarshaller.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.codec.v11; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import org.apache.activemq.openwire.codec.BooleanStream; import org.apache.activemq.openwire.codec.OpenWireFormat; import org.apache.activemq.openwire.commands.ConsumerId; import org.apache.activemq.openwire.commands.DataStructure; import org.apache.activemq.openwire.commands.MessageDispatchNotification; import org.apache.activemq.openwire.commands.MessageId; import org.apache.activemq.openwire.commands.OpenWireDestination; public class MessageDispatchNotificationMarshaller extends BaseCommandMarshaller { /** * Return the type of Data Structure we marshal * * @return short representation of the type data structure */ @Override public byte getDataStructureType() { return MessageDispatchNotification.DATA_STRUCTURE_TYPE; } /** * @return a new object instance */ @Override public DataStructure createObject() { return new MessageDispatchNotification(); } /** * 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 */ @Override public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException { super.tightUnmarshal(wireFormat, o, dataIn, bs); MessageDispatchNotification info = (MessageDispatchNotification) o; info.setConsumerId((ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs)); info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs)); info.setDeliverySequenceId(tightUnmarshalLong(wireFormat, dataIn, bs)); info.setMessageId((MessageId) tightUnmarsalNestedObject(wireFormat, dataIn, bs)); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { MessageDispatchNotification info = (MessageDispatchNotification) o; int rc = super.tightMarshal1(wireFormat, o, bs); rc += tightMarshalCachedObject1(wireFormat, info.getConsumerId(), bs); rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs); rc += tightMarshalLong1(wireFormat, info.getDeliverySequenceId(), bs); rc += tightMarshalNestedObject1(wireFormat, info.getMessageId(), bs); return rc + 0; } /** * Write a object instance to data output stream * * @param o * the instance to be marshaled * @param dataOut * the output stream * @throws IOException * thrown if an error occurs */ @Override public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { super.tightMarshal2(wireFormat, o, dataOut, bs); MessageDispatchNotification info = (MessageDispatchNotification) o; tightMarshalCachedObject2(wireFormat, info.getConsumerId(), dataOut, bs); tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs); tightMarshalLong2(wireFormat, info.getDeliverySequenceId(), dataOut, bs); tightMarshalNestedObject2(wireFormat, info.getMessageId(), dataOut, bs); } /** * Un-marshal an object instance from the data input stream * * @param o * the object to un-marshal * @param dataIn * the data input stream to build the object from * @throws IOException */ @Override public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { super.looseUnmarshal(wireFormat, o, dataIn); MessageDispatchNotification info = (MessageDispatchNotification) o; info.setConsumerId((ConsumerId) looseUnmarsalCachedObject(wireFormat, dataIn)); info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn)); info.setDeliverySequenceId(looseUnmarshalLong(wireFormat, dataIn)); info.setMessageId((MessageId) looseUnmarsalNestedObject(wireFormat, dataIn)); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { MessageDispatchNotification info = (MessageDispatchNotification) o; super.looseMarshal(wireFormat, o, dataOut); looseMarshalCachedObject(wireFormat, info.getConsumerId(), dataOut); looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut); looseMarshalLong(wireFormat, info.getDeliverySequenceId(), dataOut); looseMarshalNestedObject(wireFormat, info.getMessageId(), dataOut); } }
1,302
0
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v11/MessageDispatchMarshaller.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.codec.v11; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import org.apache.activemq.openwire.codec.BooleanStream; import org.apache.activemq.openwire.codec.OpenWireFormat; import org.apache.activemq.openwire.commands.ConsumerId; import org.apache.activemq.openwire.commands.DataStructure; import org.apache.activemq.openwire.commands.Message; import org.apache.activemq.openwire.commands.MessageDispatch; import org.apache.activemq.openwire.commands.OpenWireDestination; public class MessageDispatchMarshaller extends BaseCommandMarshaller { /** * Return the type of Data Structure we marshal * * @return short representation of the type data structure */ @Override public byte getDataStructureType() { return MessageDispatch.DATA_STRUCTURE_TYPE; } /** * @return a new object instance */ @Override public DataStructure createObject() { return new MessageDispatch(); } /** * 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 */ @Override public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException { super.tightUnmarshal(wireFormat, o, dataIn, bs); MessageDispatch info = (MessageDispatch) o; info.setConsumerId((ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs)); info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs)); info.setMessage((Message) tightUnmarsalNestedObject(wireFormat, dataIn, bs)); info.setRedeliveryCounter(dataIn.readInt()); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { MessageDispatch info = (MessageDispatch) o; int rc = super.tightMarshal1(wireFormat, o, bs); rc += tightMarshalCachedObject1(wireFormat, info.getConsumerId(), bs); rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs); rc += tightMarshalNestedObject1(wireFormat, info.getMessage(), 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 */ @Override public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { super.tightMarshal2(wireFormat, o, dataOut, bs); MessageDispatch info = (MessageDispatch) o; tightMarshalCachedObject2(wireFormat, info.getConsumerId(), dataOut, bs); tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs); tightMarshalNestedObject2(wireFormat, info.getMessage(), dataOut, bs); dataOut.writeInt(info.getRedeliveryCounter()); } /** * 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 */ @Override public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { super.looseUnmarshal(wireFormat, o, dataIn); MessageDispatch info = (MessageDispatch) o; info.setConsumerId((ConsumerId) looseUnmarsalCachedObject(wireFormat, dataIn)); info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn)); info.setMessage((Message) looseUnmarsalNestedObject(wireFormat, dataIn)); info.setRedeliveryCounter(dataIn.readInt()); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { MessageDispatch info = (MessageDispatch) o; super.looseMarshal(wireFormat, o, dataOut); looseMarshalCachedObject(wireFormat, info.getConsumerId(), dataOut); looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut); looseMarshalNestedObject(wireFormat, info.getMessage(), dataOut); dataOut.writeInt(info.getRedeliveryCounter()); } }
1,303
0
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v11/MessageMarshaller.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.codec.v11; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import org.apache.activemq.openwire.codec.BooleanStream; import org.apache.activemq.openwire.codec.OpenWireFormat; import org.apache.activemq.openwire.commands.BrokerId; import org.apache.activemq.openwire.commands.ConsumerId; import org.apache.activemq.openwire.commands.Message; import org.apache.activemq.openwire.commands.MessageId; import org.apache.activemq.openwire.commands.OpenWireDestination; import org.apache.activemq.openwire.commands.ProducerId; import org.apache.activemq.openwire.commands.TransactionId; public abstract class MessageMarshaller extends BaseCommandMarshaller { /** * 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 */ @Override public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException { super.tightUnmarshal(wireFormat, o, dataIn, bs); Message info = (Message) o; info.beforeUnmarshall(wireFormat); info.setProducerId((ProducerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs)); info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs)); info.setTransactionId((TransactionId) tightUnmarsalCachedObject(wireFormat, dataIn, bs)); info.setOriginalDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs)); info.setMessageId((MessageId) tightUnmarsalNestedObject(wireFormat, dataIn, bs)); info.setOriginalTransactionId((TransactionId) tightUnmarsalCachedObject(wireFormat, dataIn, bs)); info.setGroupID(tightUnmarshalString(dataIn, bs)); info.setGroupSequence(dataIn.readInt()); info.setCorrelationId(tightUnmarshalString(dataIn, bs)); info.setPersistent(bs.readBoolean()); info.setExpiration(tightUnmarshalLong(wireFormat, dataIn, bs)); info.setPriority(dataIn.readByte()); info.setReplyTo((OpenWireDestination) tightUnmarsalNestedObject(wireFormat, dataIn, bs)); info.setTimestamp(tightUnmarshalLong(wireFormat, dataIn, bs)); info.setType(tightUnmarshalString(dataIn, bs)); info.setContent(tightUnmarshalByteSequence(dataIn, bs)); info.setMarshalledProperties(tightUnmarshalByteSequence(dataIn, bs)); info.setDataStructure(tightUnmarsalNestedObject(wireFormat, dataIn, bs)); info.setTargetConsumerId((ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs)); info.setCompressed(bs.readBoolean()); info.setRedeliveryCounter(dataIn.readInt()); if (bs.readBoolean()) { short size = dataIn.readShort(); BrokerId value[] = new BrokerId[size]; for (int i = 0; i < size; i++) { value[i] = (BrokerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs); } info.setBrokerPath(value); } else { info.setBrokerPath(null); } info.setArrival(tightUnmarshalLong(wireFormat, dataIn, bs)); info.setUserId(tightUnmarshalString(dataIn, bs)); info.setRecievedByDFBridge(bs.readBoolean()); info.setDroppable(bs.readBoolean()); if (bs.readBoolean()) { short size = dataIn.readShort(); BrokerId value[] = new BrokerId[size]; for (int i = 0; i < size; i++) { value[i] = (BrokerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs); } info.setCluster(value); } else { info.setCluster(null); } info.setBrokerInTime(tightUnmarshalLong(wireFormat, dataIn, bs)); info.setBrokerOutTime(tightUnmarshalLong(wireFormat, dataIn, bs)); info.setJMSXGroupFirstForConsumer(bs.readBoolean()); info.afterUnmarshall(wireFormat); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { Message info = (Message) o; info.beforeMarshall(wireFormat); int rc = super.tightMarshal1(wireFormat, o, bs); rc += tightMarshalCachedObject1(wireFormat, info.getProducerId(), bs); rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs); rc += tightMarshalCachedObject1(wireFormat, info.getTransactionId(), bs); rc += tightMarshalCachedObject1(wireFormat, info.getOriginalDestination(), bs); rc += tightMarshalNestedObject1(wireFormat, info.getMessageId(), bs); rc += tightMarshalCachedObject1(wireFormat, info.getOriginalTransactionId(), bs); rc += tightMarshalString1(info.getGroupId(), bs); rc += tightMarshalString1(info.getCorrelationId(), bs); bs.writeBoolean(info.isPersistent()); rc += tightMarshalLong1(wireFormat, info.getExpiration(), bs); rc += tightMarshalNestedObject1(wireFormat, info.getReplyTo(), bs); rc += tightMarshalLong1(wireFormat, info.getTimestamp(), bs); rc += tightMarshalString1(info.getType(), bs); rc += tightMarshalByteSequence1(info.getContent(), bs); rc += tightMarshalByteSequence1(info.getMarshalledProperties(), bs); rc += tightMarshalNestedObject1(wireFormat, info.getDataStructure(), bs); rc += tightMarshalCachedObject1(wireFormat, info.getTargetConsumerId(), bs); bs.writeBoolean(info.isCompressed()); rc += tightMarshalObjectArray1(wireFormat, info.getBrokerPath(), bs); rc += tightMarshalLong1(wireFormat, info.getArrival(), bs); rc += tightMarshalString1(info.getUserId(), bs); bs.writeBoolean(info.isRecievedByDFBridge()); bs.writeBoolean(info.isDroppable()); rc += tightMarshalObjectArray1(wireFormat, info.getCluster(), bs); rc += tightMarshalLong1(wireFormat, info.getBrokerInTime(), bs); rc += tightMarshalLong1(wireFormat, info.getBrokerOutTime(), bs); bs.writeBoolean(info.isJMSXGroupFirstForConsumer()); return rc + 9; } /** * Write a object instance to data output stream * * @param o * the instance to be marshaled * @param dataOut * the output stream * @throws IOException * thrown if an error occurs */ @Override public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { super.tightMarshal2(wireFormat, o, dataOut, bs); Message info = (Message) o; tightMarshalCachedObject2(wireFormat, info.getProducerId(), dataOut, bs); tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs); tightMarshalCachedObject2(wireFormat, info.getTransactionId(), dataOut, bs); tightMarshalCachedObject2(wireFormat, info.getOriginalDestination(), dataOut, bs); tightMarshalNestedObject2(wireFormat, info.getMessageId(), dataOut, bs); tightMarshalCachedObject2(wireFormat, info.getOriginalTransactionId(), dataOut, bs); tightMarshalString2(info.getGroupId(), dataOut, bs); dataOut.writeInt(info.getGroupSequence()); tightMarshalString2(info.getCorrelationId(), dataOut, bs); bs.readBoolean(); tightMarshalLong2(wireFormat, info.getExpiration(), dataOut, bs); dataOut.writeByte(info.getPriority()); tightMarshalNestedObject2(wireFormat, info.getReplyTo(), dataOut, bs); tightMarshalLong2(wireFormat, info.getTimestamp(), dataOut, bs); tightMarshalString2(info.getType(), dataOut, bs); tightMarshalByteSequence2(info.getContent(), dataOut, bs); tightMarshalByteSequence2(info.getMarshalledProperties(), dataOut, bs); tightMarshalNestedObject2(wireFormat, info.getDataStructure(), dataOut, bs); tightMarshalCachedObject2(wireFormat, info.getTargetConsumerId(), dataOut, bs); bs.readBoolean(); dataOut.writeInt(info.getRedeliveryCounter()); tightMarshalObjectArray2(wireFormat, info.getBrokerPath(), dataOut, bs); tightMarshalLong2(wireFormat, info.getArrival(), dataOut, bs); tightMarshalString2(info.getUserId(), dataOut, bs); bs.readBoolean(); bs.readBoolean(); tightMarshalObjectArray2(wireFormat, info.getCluster(), dataOut, bs); tightMarshalLong2(wireFormat, info.getBrokerInTime(), dataOut, bs); tightMarshalLong2(wireFormat, info.getBrokerOutTime(), dataOut, bs); bs.readBoolean(); info.afterMarshall(wireFormat); } /** * 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 */ @Override public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { super.looseUnmarshal(wireFormat, o, dataIn); Message info = (Message) o; info.beforeUnmarshall(wireFormat); info.setProducerId((ProducerId) looseUnmarsalCachedObject(wireFormat, dataIn)); info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn)); info.setTransactionId((TransactionId) looseUnmarsalCachedObject(wireFormat, dataIn)); info.setOriginalDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn)); info.setMessageId((MessageId) looseUnmarsalNestedObject(wireFormat, dataIn)); info.setOriginalTransactionId((TransactionId) looseUnmarsalCachedObject(wireFormat, dataIn)); info.setGroupID(looseUnmarshalString(dataIn)); info.setGroupSequence(dataIn.readInt()); info.setCorrelationId(looseUnmarshalString(dataIn)); info.setPersistent(dataIn.readBoolean()); info.setExpiration(looseUnmarshalLong(wireFormat, dataIn)); info.setPriority(dataIn.readByte()); info.setReplyTo((OpenWireDestination) looseUnmarsalNestedObject(wireFormat, dataIn)); info.setTimestamp(looseUnmarshalLong(wireFormat, dataIn)); info.setType(looseUnmarshalString(dataIn)); info.setContent(looseUnmarshalByteSequence(dataIn)); info.setMarshalledProperties(looseUnmarshalByteSequence(dataIn)); info.setDataStructure(looseUnmarsalNestedObject(wireFormat, dataIn)); info.setTargetConsumerId((ConsumerId) looseUnmarsalCachedObject(wireFormat, dataIn)); info.setCompressed(dataIn.readBoolean()); info.setRedeliveryCounter(dataIn.readInt()); if (dataIn.readBoolean()) { short size = dataIn.readShort(); BrokerId value[] = new BrokerId[size]; for (int i = 0; i < size; i++) { value[i] = (BrokerId) looseUnmarsalNestedObject(wireFormat, dataIn); } info.setBrokerPath(value); } else { info.setBrokerPath(null); } info.setArrival(looseUnmarshalLong(wireFormat, dataIn)); info.setUserId(looseUnmarshalString(dataIn)); info.setRecievedByDFBridge(dataIn.readBoolean()); info.setDroppable(dataIn.readBoolean()); if (dataIn.readBoolean()) { short size = dataIn.readShort(); BrokerId value[] = new BrokerId[size]; for (int i = 0; i < size; i++) { value[i] = (BrokerId) looseUnmarsalNestedObject(wireFormat, dataIn); } info.setCluster(value); } else { info.setCluster(null); } info.setBrokerInTime(looseUnmarshalLong(wireFormat, dataIn)); info.setBrokerOutTime(looseUnmarshalLong(wireFormat, dataIn)); info.setJMSXGroupFirstForConsumer(dataIn.readBoolean()); info.afterUnmarshall(wireFormat); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { Message info = (Message) o; info.beforeMarshall(wireFormat); super.looseMarshal(wireFormat, o, dataOut); looseMarshalCachedObject(wireFormat, info.getProducerId(), dataOut); looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut); looseMarshalCachedObject(wireFormat, info.getTransactionId(), dataOut); looseMarshalCachedObject(wireFormat, info.getOriginalDestination(), dataOut); looseMarshalNestedObject(wireFormat, info.getMessageId(), dataOut); looseMarshalCachedObject(wireFormat, info.getOriginalTransactionId(), dataOut); looseMarshalString(info.getGroupId(), dataOut); dataOut.writeInt(info.getGroupSequence()); looseMarshalString(info.getCorrelationId(), dataOut); dataOut.writeBoolean(info.isPersistent()); looseMarshalLong(wireFormat, info.getExpiration(), dataOut); dataOut.writeByte(info.getPriority()); looseMarshalNestedObject(wireFormat, info.getReplyTo(), dataOut); looseMarshalLong(wireFormat, info.getTimestamp(), dataOut); looseMarshalString(info.getType(), dataOut); looseMarshalByteSequence(wireFormat, info.getContent(), dataOut); looseMarshalByteSequence(wireFormat, info.getMarshalledProperties(), dataOut); looseMarshalNestedObject(wireFormat, info.getDataStructure(), dataOut); looseMarshalCachedObject(wireFormat, info.getTargetConsumerId(), dataOut); dataOut.writeBoolean(info.isCompressed()); dataOut.writeInt(info.getRedeliveryCounter()); looseMarshalObjectArray(wireFormat, info.getBrokerPath(), dataOut); looseMarshalLong(wireFormat, info.getArrival(), dataOut); looseMarshalString(info.getUserId(), dataOut); dataOut.writeBoolean(info.isRecievedByDFBridge()); dataOut.writeBoolean(info.isDroppable()); looseMarshalObjectArray(wireFormat, info.getCluster(), dataOut); looseMarshalLong(wireFormat, info.getBrokerInTime(), dataOut); looseMarshalLong(wireFormat, info.getBrokerOutTime(), dataOut); dataOut.writeBoolean(info.isJMSXGroupFirstForConsumer()); } }
1,304
0
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v11/TransactionIdMarshaller.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.codec.v11; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import org.apache.activemq.openwire.codec.BaseDataStreamMarshaller; import org.apache.activemq.openwire.codec.BooleanStream; import org.apache.activemq.openwire.codec.OpenWireFormat; public abstract class TransactionIdMarshaller extends BaseDataStreamMarshaller { /** * Un-marshal an object instance from the data input stream * * @param o * the object to un-marshal * @param dataIn * the data input stream to build the object from * @throws IOException */ @Override public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException { super.tightUnmarshal(wireFormat, o, dataIn, bs); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { int rc = super.tightMarshal1(wireFormat, o, bs); return rc + 0; } /** * Write a object instance to data output stream * * @param o * the instance to be marshaled * @param dataOut * the output stream * @throws IOException * thrown if an error occurs */ @Override public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { super.tightMarshal2(wireFormat, o, dataOut, bs); } /** * Un-marshal an object instance from the data input stream * * @param o * the object to un-marshal * @param dataIn * the data input stream to build the object from * @throws IOException */ @Override public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { super.looseUnmarshal(wireFormat, o, dataIn); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { super.looseMarshal(wireFormat, o, dataOut); } }
1,305
0
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v11/SubscriptionInfoMarshaller.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.codec.v11; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import org.apache.activemq.openwire.codec.BaseDataStreamMarshaller; import org.apache.activemq.openwire.codec.BooleanStream; import org.apache.activemq.openwire.codec.OpenWireFormat; import org.apache.activemq.openwire.commands.DataStructure; import org.apache.activemq.openwire.commands.OpenWireDestination; import org.apache.activemq.openwire.commands.SubscriptionInfo; public class SubscriptionInfoMarshaller extends BaseDataStreamMarshaller { /** * Return the type of Data Structure we marshal * * @return short representation of the type data structure */ @Override public byte getDataStructureType() { return SubscriptionInfo.DATA_STRUCTURE_TYPE; } /** * @return a new object instance */ @Override public DataStructure createObject() { return new SubscriptionInfo(); } /** * 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 */ @Override public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException { super.tightUnmarshal(wireFormat, o, dataIn, bs); SubscriptionInfo info = (SubscriptionInfo) o; info.setClientId(tightUnmarshalString(dataIn, bs)); info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs)); info.setSelector(tightUnmarshalString(dataIn, bs)); info.setSubcriptionName(tightUnmarshalString(dataIn, bs)); info.setSubscribedDestination((OpenWireDestination) tightUnmarsalNestedObject(wireFormat, dataIn, bs)); info.setNoLocal(bs.readBoolean()); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { SubscriptionInfo info = (SubscriptionInfo) o; int rc = super.tightMarshal1(wireFormat, o, bs); rc += tightMarshalString1(info.getClientId(), bs); rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs); rc += tightMarshalString1(info.getSelector(), bs); rc += tightMarshalString1(info.getSubcriptionName(), bs); rc += tightMarshalNestedObject1(wireFormat, info.getSubscribedDestination(), bs); bs.writeBoolean(info.isNoLocal()); 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 */ @Override public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { super.tightMarshal2(wireFormat, o, dataOut, bs); SubscriptionInfo info = (SubscriptionInfo) o; tightMarshalString2(info.getClientId(), dataOut, bs); tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs); tightMarshalString2(info.getSelector(), dataOut, bs); tightMarshalString2(info.getSubcriptionName(), dataOut, bs); tightMarshalNestedObject2(wireFormat, info.getSubscribedDestination(), dataOut, bs); 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 */ @Override public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { super.looseUnmarshal(wireFormat, o, dataIn); SubscriptionInfo info = (SubscriptionInfo) o; info.setClientId(looseUnmarshalString(dataIn)); info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn)); info.setSelector(looseUnmarshalString(dataIn)); info.setSubcriptionName(looseUnmarshalString(dataIn)); info.setSubscribedDestination((OpenWireDestination) looseUnmarsalNestedObject(wireFormat, dataIn)); info.setNoLocal(dataIn.readBoolean()); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { SubscriptionInfo info = (SubscriptionInfo) o; super.looseMarshal(wireFormat, o, dataOut); looseMarshalString(info.getClientId(), dataOut); looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut); looseMarshalString(info.getSelector(), dataOut); looseMarshalString(info.getSubcriptionName(), dataOut); looseMarshalNestedObject(wireFormat, info.getSubscribedDestination(), dataOut); dataOut.writeBoolean(info.isNoLocal()); } }
1,306
0
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v11/ConnectionIdMarshaller.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.codec.v11; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import org.apache.activemq.openwire.codec.BaseDataStreamMarshaller; import org.apache.activemq.openwire.codec.BooleanStream; import org.apache.activemq.openwire.codec.OpenWireFormat; import org.apache.activemq.openwire.commands.ConnectionId; import org.apache.activemq.openwire.commands.DataStructure; public class ConnectionIdMarshaller extends BaseDataStreamMarshaller { /** * Return the type of Data Structure we marshal * * @return short representation of the type data structure */ @Override public byte getDataStructureType() { return ConnectionId.DATA_STRUCTURE_TYPE; } /** * @return a new object instance */ @Override public DataStructure createObject() { return new ConnectionId(); } /** * Un-marshal an object instance from the data input stream * * @param o * the object to un-marshal * @param dataIn * the data input stream to build the object from * @throws IOException */ @Override public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException { super.tightUnmarshal(wireFormat, o, dataIn, bs); ConnectionId info = (ConnectionId) o; info.setValue(tightUnmarshalString(dataIn, bs)); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { ConnectionId info = (ConnectionId) o; int rc = super.tightMarshal1(wireFormat, o, bs); rc += tightMarshalString1(info.getValue(), bs); return rc + 0; } /** * Write a object instance to data output stream * * @param o * the instance to be marshaled * @param dataOut * the output stream * @throws IOException * thrown if an error occurs */ @Override public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { super.tightMarshal2(wireFormat, o, dataOut, bs); ConnectionId info = (ConnectionId) o; tightMarshalString2(info.getValue(), dataOut, bs); } /** * Un-marshal an object instance from the data input stream * * @param o * the object to un-marshal * @param dataIn * the data input stream to build the object from * @throws IOException */ @Override public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { super.looseUnmarshal(wireFormat, o, dataIn); ConnectionId info = (ConnectionId) o; info.setValue(looseUnmarshalString(dataIn)); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { ConnectionId info = (ConnectionId) o; super.looseMarshal(wireFormat, o, dataOut); looseMarshalString(info.getValue(), dataOut); } }
1,307
0
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v11/JournalTransactionMarshaller.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.codec.v11; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import org.apache.activemq.openwire.codec.BaseDataStreamMarshaller; import org.apache.activemq.openwire.codec.BooleanStream; import org.apache.activemq.openwire.codec.OpenWireFormat; import org.apache.activemq.openwire.commands.DataStructure; import org.apache.activemq.openwire.commands.JournalTransaction; import org.apache.activemq.openwire.commands.TransactionId; public class JournalTransactionMarshaller extends BaseDataStreamMarshaller { /** * Return the type of Data Structure we marshal * * @return short representation of the type data structure */ @Override public byte getDataStructureType() { return JournalTransaction.DATA_STRUCTURE_TYPE; } /** * @return a new object instance */ @Override public DataStructure createObject() { return new JournalTransaction(); } /** * 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 */ @Override public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException { super.tightUnmarshal(wireFormat, o, dataIn, bs); JournalTransaction info = (JournalTransaction) o; info.setTransactionId((TransactionId) tightUnmarsalNestedObject(wireFormat, dataIn, bs)); info.setType(dataIn.readByte()); info.setWasPrepared(bs.readBoolean()); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { JournalTransaction info = (JournalTransaction) o; int rc = super.tightMarshal1(wireFormat, o, bs); rc += tightMarshalNestedObject1(wireFormat, info.getTransactionId(), bs); bs.writeBoolean(info.getWasPrepared()); return rc + 1; } /** * Write a object instance to data output stream * * @param o * the instance to be marshaled * @param dataOut * the output stream * @throws IOException * thrown if an error occurs */ @Override public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { super.tightMarshal2(wireFormat, o, dataOut, bs); JournalTransaction info = (JournalTransaction) o; tightMarshalNestedObject2(wireFormat, info.getTransactionId(), dataOut, bs); dataOut.writeByte(info.getType()); 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 */ @Override public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { super.looseUnmarshal(wireFormat, o, dataIn); JournalTransaction info = (JournalTransaction) o; info.setTransactionId((TransactionId) looseUnmarsalNestedObject(wireFormat, dataIn)); info.setType(dataIn.readByte()); info.setWasPrepared(dataIn.readBoolean()); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { JournalTransaction info = (JournalTransaction) o; super.looseMarshal(wireFormat, o, dataOut); looseMarshalNestedObject(wireFormat, info.getTransactionId(), dataOut); dataOut.writeByte(info.getType()); dataOut.writeBoolean(info.getWasPrepared()); } }
1,308
0
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v10/SessionInfoMarshaller.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.codec.v10; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import org.apache.activemq.openwire.codec.BooleanStream; import org.apache.activemq.openwire.codec.OpenWireFormat; import org.apache.activemq.openwire.commands.DataStructure; import org.apache.activemq.openwire.commands.SessionId; import org.apache.activemq.openwire.commands.SessionInfo; public class SessionInfoMarshaller extends BaseCommandMarshaller { /** * Return the type of Data Structure we marshal * * @return short representation of the type data structure */ @Override public byte getDataStructureType() { return SessionInfo.DATA_STRUCTURE_TYPE; } /** * @return a new object instance */ @Override public DataStructure createObject() { return new SessionInfo(); } /** * 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 */ @Override public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException { super.tightUnmarshal(wireFormat, o, dataIn, bs); SessionInfo info = (SessionInfo) o; info.setSessionId((SessionId) tightUnmarsalCachedObject(wireFormat, dataIn, bs)); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { SessionInfo info = (SessionInfo) o; int rc = super.tightMarshal1(wireFormat, o, bs); rc += tightMarshalCachedObject1(wireFormat, info.getSessionId(), bs); return rc + 0; } /** * Write a object instance to data output stream * * @param o * the instance to be marshaled * @param dataOut * the output stream * @throws IOException * thrown if an error occurs */ @Override public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { super.tightMarshal2(wireFormat, o, dataOut, bs); SessionInfo info = (SessionInfo) o; tightMarshalCachedObject2(wireFormat, info.getSessionId(), dataOut, bs); } /** * Un-marshal an object instance from the data input stream * * @param o * the object to un-marshal * @param dataIn * the data input stream to build the object from * @throws IOException */ @Override public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { super.looseUnmarshal(wireFormat, o, dataIn); SessionInfo info = (SessionInfo) o; info.setSessionId((SessionId) looseUnmarsalCachedObject(wireFormat, dataIn)); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { SessionInfo info = (SessionInfo) o; super.looseMarshal(wireFormat, o, dataOut); looseMarshalCachedObject(wireFormat, info.getSessionId(), dataOut); } }
1,309
0
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v10/BrokerInfoMarshaller.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.codec.v10; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import org.apache.activemq.openwire.codec.BooleanStream; import org.apache.activemq.openwire.codec.OpenWireFormat; import org.apache.activemq.openwire.commands.BrokerId; import org.apache.activemq.openwire.commands.BrokerInfo; import org.apache.activemq.openwire.commands.DataStructure; public class BrokerInfoMarshaller extends BaseCommandMarshaller { /** * Return the type of Data Structure we marshal * * @return short representation of the type data structure */ @Override public byte getDataStructureType() { return BrokerInfo.DATA_STRUCTURE_TYPE; } /** * @return a new object instance */ @Override public DataStructure createObject() { return new BrokerInfo(); } /** * Un-marshal an object instance from the data input stream * * @param o * the object to un-marshal * @param dataIn * the data input stream to build the object from * @throws IOException */ @Override public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException { super.tightUnmarshal(wireFormat, o, dataIn, bs); BrokerInfo info = (BrokerInfo) o; info.setBrokerId((BrokerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs)); info.setBrokerURL(tightUnmarshalString(dataIn, bs)); if (bs.readBoolean()) { short size = dataIn.readShort(); BrokerInfo value[] = new BrokerInfo[size]; for (int i = 0; i < size; i++) { value[i] = (BrokerInfo) tightUnmarsalNestedObject(wireFormat, dataIn, bs); } info.setPeerBrokerInfos(value); } else { info.setPeerBrokerInfos(null); } info.setBrokerName(tightUnmarshalString(dataIn, bs)); info.setSlaveBroker(bs.readBoolean()); info.setMasterBroker(bs.readBoolean()); info.setFaultTolerantConfiguration(bs.readBoolean()); info.setDuplexConnection(bs.readBoolean()); info.setNetworkConnection(bs.readBoolean()); info.setConnectionId(tightUnmarshalLong(wireFormat, dataIn, bs)); info.setBrokerUploadUrl(tightUnmarshalString(dataIn, bs)); info.setNetworkProperties(tightUnmarshalString(dataIn, bs)); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { BrokerInfo info = (BrokerInfo) o; int rc = super.tightMarshal1(wireFormat, o, bs); rc += tightMarshalCachedObject1(wireFormat, info.getBrokerId(), bs); rc += tightMarshalString1(info.getBrokerURL(), bs); rc += tightMarshalObjectArray1(wireFormat, info.getPeerBrokerInfos(), bs); rc += tightMarshalString1(info.getBrokerName(), bs); bs.writeBoolean(info.isSlaveBroker()); bs.writeBoolean(info.isMasterBroker()); bs.writeBoolean(info.isFaultTolerantConfiguration()); bs.writeBoolean(info.isDuplexConnection()); bs.writeBoolean(info.isNetworkConnection()); rc += tightMarshalLong1(wireFormat, info.getConnectionId(), bs); rc += tightMarshalString1(info.getBrokerUploadUrl(), bs); rc += tightMarshalString1(info.getNetworkProperties(), bs); return rc + 0; } /** * Write a object instance to data output stream * * @param o * the instance to be marshaled * @param dataOut * the output stream * @throws IOException * thrown if an error occurs */ @Override public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { super.tightMarshal2(wireFormat, o, dataOut, bs); BrokerInfo info = (BrokerInfo) o; tightMarshalCachedObject2(wireFormat, info.getBrokerId(), dataOut, bs); tightMarshalString2(info.getBrokerURL(), dataOut, bs); tightMarshalObjectArray2(wireFormat, info.getPeerBrokerInfos(), dataOut, bs); tightMarshalString2(info.getBrokerName(), dataOut, bs); bs.readBoolean(); bs.readBoolean(); bs.readBoolean(); bs.readBoolean(); bs.readBoolean(); tightMarshalLong2(wireFormat, info.getConnectionId(), dataOut, bs); tightMarshalString2(info.getBrokerUploadUrl(), dataOut, bs); tightMarshalString2(info.getNetworkProperties(), dataOut, bs); } /** * Un-marshal an object instance from the data input stream * * @param o * the object to un-marshal * @param dataIn * the data input stream to build the object from * @throws IOException */ @Override public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { super.looseUnmarshal(wireFormat, o, dataIn); BrokerInfo info = (BrokerInfo) o; info.setBrokerId((BrokerId) looseUnmarsalCachedObject(wireFormat, dataIn)); info.setBrokerURL(looseUnmarshalString(dataIn)); if (dataIn.readBoolean()) { short size = dataIn.readShort(); BrokerInfo value[] = new BrokerInfo[size]; for (int i = 0; i < size; i++) { value[i] = (BrokerInfo) looseUnmarsalNestedObject(wireFormat, dataIn); } info.setPeerBrokerInfos(value); } else { info.setPeerBrokerInfos(null); } info.setBrokerName(looseUnmarshalString(dataIn)); info.setSlaveBroker(dataIn.readBoolean()); info.setMasterBroker(dataIn.readBoolean()); info.setFaultTolerantConfiguration(dataIn.readBoolean()); info.setDuplexConnection(dataIn.readBoolean()); info.setNetworkConnection(dataIn.readBoolean()); info.setConnectionId(looseUnmarshalLong(wireFormat, dataIn)); info.setBrokerUploadUrl(looseUnmarshalString(dataIn)); info.setNetworkProperties(looseUnmarshalString(dataIn)); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { BrokerInfo info = (BrokerInfo) o; super.looseMarshal(wireFormat, o, dataOut); looseMarshalCachedObject(wireFormat, info.getBrokerId(), dataOut); looseMarshalString(info.getBrokerURL(), dataOut); looseMarshalObjectArray(wireFormat, info.getPeerBrokerInfos(), dataOut); looseMarshalString(info.getBrokerName(), dataOut); dataOut.writeBoolean(info.isSlaveBroker()); dataOut.writeBoolean(info.isMasterBroker()); dataOut.writeBoolean(info.isFaultTolerantConfiguration()); dataOut.writeBoolean(info.isDuplexConnection()); dataOut.writeBoolean(info.isNetworkConnection()); looseMarshalLong(wireFormat, info.getConnectionId(), dataOut); looseMarshalString(info.getBrokerUploadUrl(), dataOut); looseMarshalString(info.getNetworkProperties(), dataOut); } }
1,310
0
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v10/OpenWireMapMessageMarshaller.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.codec.v10; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import org.apache.activemq.openwire.codec.BooleanStream; import org.apache.activemq.openwire.codec.OpenWireFormat; import org.apache.activemq.openwire.commands.DataStructure; import org.apache.activemq.openwire.commands.OpenWireMapMessage; public class OpenWireMapMessageMarshaller extends OpenWireMessageMarshaller { /** * Return the type of Data Structure we marshal * * @return short representation of the type data structure */ @Override public byte getDataStructureType() { return OpenWireMapMessage.DATA_STRUCTURE_TYPE; } /** * @return a new object instance */ @Override public DataStructure createObject() { return new OpenWireMapMessage(); } /** * 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 */ @Override public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException { super.tightUnmarshal(wireFormat, o, dataIn, bs); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { int rc = super.tightMarshal1(wireFormat, o, bs); return rc + 0; } /** * Write a object instance to data output stream * * @param o * the instance to be marshaled * @param dataOut * the output stream * @throws IOException * thrown if an error occurs */ @Override public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { super.tightMarshal2(wireFormat, o, dataOut, bs); } /** * Un-marshal an object instance from the data input stream * * @param o * the object to un-marshal * @param dataIn * the data input stream to build the object from * @throws IOException */ @Override public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { super.looseUnmarshal(wireFormat, o, dataIn); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { super.looseMarshal(wireFormat, o, dataOut); } }
1,311
0
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v10/MessageAckMarshaller.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.codec.v10; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import org.apache.activemq.openwire.codec.BooleanStream; import org.apache.activemq.openwire.codec.OpenWireFormat; import org.apache.activemq.openwire.commands.ConsumerId; import org.apache.activemq.openwire.commands.DataStructure; import org.apache.activemq.openwire.commands.MessageAck; import org.apache.activemq.openwire.commands.MessageId; import org.apache.activemq.openwire.commands.OpenWireDestination; import org.apache.activemq.openwire.commands.TransactionId; public class MessageAckMarshaller extends BaseCommandMarshaller { /** * Return the type of Data Structure we marshal * * @return short representation of the type data structure */ @Override public byte getDataStructureType() { return MessageAck.DATA_STRUCTURE_TYPE; } /** * @return a new object instance */ @Override public DataStructure createObject() { return new MessageAck(); } /** * 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 */ @Override public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException { super.tightUnmarshal(wireFormat, o, dataIn, bs); MessageAck info = (MessageAck) o; info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs)); info.setTransactionId((TransactionId) tightUnmarsalCachedObject(wireFormat, dataIn, bs)); info.setConsumerId((ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs)); info.setAckType(dataIn.readByte()); info.setFirstMessageId((MessageId) tightUnmarsalNestedObject(wireFormat, dataIn, bs)); info.setLastMessageId((MessageId) tightUnmarsalNestedObject(wireFormat, dataIn, bs)); info.setMessageCount(dataIn.readInt()); info.setPoisonCause(tightUnmarsalThrowable(wireFormat, dataIn, bs)); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { MessageAck info = (MessageAck) o; int rc = super.tightMarshal1(wireFormat, o, bs); rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs); rc += tightMarshalCachedObject1(wireFormat, info.getTransactionId(), bs); rc += tightMarshalCachedObject1(wireFormat, info.getConsumerId(), bs); rc += tightMarshalNestedObject1(wireFormat, info.getFirstMessageId(), bs); rc += tightMarshalNestedObject1(wireFormat, info.getLastMessageId(), bs); rc += tightMarshalThrowable1(wireFormat, info.getPoisonCause(), bs); return rc + 5; } /** * 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 */ @Override public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { super.tightMarshal2(wireFormat, o, dataOut, bs); MessageAck info = (MessageAck) o; tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs); tightMarshalCachedObject2(wireFormat, info.getTransactionId(), dataOut, bs); tightMarshalCachedObject2(wireFormat, info.getConsumerId(), dataOut, bs); dataOut.writeByte(info.getAckType()); tightMarshalNestedObject2(wireFormat, info.getFirstMessageId(), dataOut, bs); tightMarshalNestedObject2(wireFormat, info.getLastMessageId(), dataOut, bs); dataOut.writeInt(info.getMessageCount()); tightMarshalThrowable2(wireFormat, info.getPoisonCause(), dataOut, bs); } /** * Un-marshal an object instance from the data input stream * * @param o * the object to un-marshal * @param dataIn * the data input stream to build the object from * @throws IOException */ @Override public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { super.looseUnmarshal(wireFormat, o, dataIn); MessageAck info = (MessageAck) o; info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn)); info.setTransactionId((TransactionId) looseUnmarsalCachedObject(wireFormat, dataIn)); info.setConsumerId((ConsumerId) looseUnmarsalCachedObject(wireFormat, dataIn)); info.setAckType(dataIn.readByte()); info.setFirstMessageId((MessageId) looseUnmarsalNestedObject(wireFormat, dataIn)); info.setLastMessageId((MessageId) looseUnmarsalNestedObject(wireFormat, dataIn)); info.setMessageCount(dataIn.readInt()); info.setPoisonCause(looseUnmarsalThrowable(wireFormat, dataIn)); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { MessageAck info = (MessageAck) o; super.looseMarshal(wireFormat, o, dataOut); looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut); looseMarshalCachedObject(wireFormat, info.getTransactionId(), dataOut); looseMarshalCachedObject(wireFormat, info.getConsumerId(), dataOut); dataOut.writeByte(info.getAckType()); looseMarshalNestedObject(wireFormat, info.getFirstMessageId(), dataOut); looseMarshalNestedObject(wireFormat, info.getLastMessageId(), dataOut); dataOut.writeInt(info.getMessageCount()); looseMarshalThrowable(wireFormat, info.getPoisonCause(), dataOut); } }
1,312
0
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v10/OpenWireTempQueueMarshaller.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.codec.v10; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import org.apache.activemq.openwire.codec.BooleanStream; import org.apache.activemq.openwire.codec.OpenWireFormat; import org.apache.activemq.openwire.commands.DataStructure; import org.apache.activemq.openwire.commands.OpenWireTempQueue; public class OpenWireTempQueueMarshaller extends OpenWireTempDestinationMarshaller { /** * Return the type of Data Structure we marshal * * @return short representation of the type data structure */ @Override public byte getDataStructureType() { return OpenWireTempQueue.DATA_STRUCTURE_TYPE; } /** * @return a new object instance */ @Override public DataStructure createObject() { return new OpenWireTempQueue(); } /** * 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 */ @Override public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException { super.tightUnmarshal(wireFormat, o, dataIn, bs); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { int rc = super.tightMarshal1(wireFormat, o, bs); return rc + 0; } /** * Write a object instance to data output stream * * @param o * the instance to be marshaled * @param dataOut * the output stream * @throws IOException * thrown if an error occurs */ @Override public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { super.tightMarshal2(wireFormat, o, dataOut, bs); } /** * Un-marshal an object instance from the data input stream * * @param o * the object to un-marshal * @param dataIn * the data input stream to build the object from * @throws IOException */ @Override public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { super.looseUnmarshal(wireFormat, o, dataIn); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { super.looseMarshal(wireFormat, o, dataOut); } }
1,313
0
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v10/ExceptionResponseMarshaller.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.codec.v10; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import org.apache.activemq.openwire.codec.BooleanStream; import org.apache.activemq.openwire.codec.OpenWireFormat; import org.apache.activemq.openwire.commands.DataStructure; import org.apache.activemq.openwire.commands.ExceptionResponse; public class ExceptionResponseMarshaller extends ResponseMarshaller { /** * Return the type of Data Structure we marshal * * @return short representation of the type data structure */ @Override public byte getDataStructureType() { return ExceptionResponse.DATA_STRUCTURE_TYPE; } /** * @return a new object instance */ @Override public DataStructure createObject() { return new ExceptionResponse(); } /** * Un-marshal an object instance from the data input stream * * @param o * the object to un-marshal * @param dataIn * the data input stream to build the object from * @throws IOException */ @Override public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException { super.tightUnmarshal(wireFormat, o, dataIn, bs); ExceptionResponse info = (ExceptionResponse) o; info.setException(tightUnmarsalThrowable(wireFormat, dataIn, bs)); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { ExceptionResponse info = (ExceptionResponse) o; int rc = super.tightMarshal1(wireFormat, o, bs); rc += tightMarshalThrowable1(wireFormat, info.getException(), bs); return rc + 0; } /** * Write a object instance to data output stream * * @param o * the instance to be marshaled * @param dataOut * the output stream * @throws IOException * thrown if an error occurs */ @Override public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { super.tightMarshal2(wireFormat, o, dataOut, bs); ExceptionResponse info = (ExceptionResponse) o; tightMarshalThrowable2(wireFormat, info.getException(), dataOut, bs); } /** * Un-marshal an object instance from the data input stream * * @param o * the object to un-marshal * @param dataIn * the data input stream to build the object from * @throws IOException */ @Override public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { super.looseUnmarshal(wireFormat, o, dataIn); ExceptionResponse info = (ExceptionResponse) o; info.setException(looseUnmarsalThrowable(wireFormat, dataIn)); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { ExceptionResponse info = (ExceptionResponse) o; super.looseMarshal(wireFormat, o, dataOut); looseMarshalThrowable(wireFormat, info.getException(), dataOut); } }
1,314
0
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v10/BrokerIdMarshaller.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.codec.v10; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import org.apache.activemq.openwire.codec.BaseDataStreamMarshaller; import org.apache.activemq.openwire.codec.BooleanStream; import org.apache.activemq.openwire.codec.OpenWireFormat; import org.apache.activemq.openwire.commands.BrokerId; import org.apache.activemq.openwire.commands.DataStructure; public class BrokerIdMarshaller extends BaseDataStreamMarshaller { /** * Return the type of Data Structure we marshal * * @return short representation of the type data structure */ @Override public byte getDataStructureType() { return BrokerId.DATA_STRUCTURE_TYPE; } /** * @return a new object instance */ @Override public DataStructure createObject() { return new BrokerId(); } /** * Un-marshal an object instance from the data input stream * * @param o * the object to un-marshal * @param dataIn * the data input stream to build the object from * @throws IOException */ @Override public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException { super.tightUnmarshal(wireFormat, o, dataIn, bs); BrokerId info = (BrokerId) o; info.setValue(tightUnmarshalString(dataIn, bs)); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { BrokerId info = (BrokerId) o; int rc = super.tightMarshal1(wireFormat, o, bs); rc += tightMarshalString1(info.getValue(), bs); return rc + 0; } /** * Write a object instance to data output stream * * @param o * the instance to be marshaled * @param dataOut * the output stream * @throws IOException * thrown if an error occurs */ @Override public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { super.tightMarshal2(wireFormat, o, dataOut, bs); BrokerId info = (BrokerId) o; tightMarshalString2(info.getValue(), dataOut, bs); } /** * Un-marshal an object instance from the data input stream * * @param o * the object to un-marshal * @param dataIn * the data input stream to build the object from * @throws IOException */ @Override public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { super.looseUnmarshal(wireFormat, o, dataIn); BrokerId info = (BrokerId) o; info.setValue(looseUnmarshalString(dataIn)); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { BrokerId info = (BrokerId) o; super.looseMarshal(wireFormat, o, dataOut); looseMarshalString(info.getValue(), dataOut); } }
1,315
0
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v10/OpenWireObjectMessageMarshaller.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.codec.v10; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import org.apache.activemq.openwire.codec.BooleanStream; import org.apache.activemq.openwire.codec.OpenWireFormat; import org.apache.activemq.openwire.commands.DataStructure; import org.apache.activemq.openwire.commands.OpenWireObjectMessage; public class OpenWireObjectMessageMarshaller extends OpenWireMessageMarshaller { /** * Return the type of Data Structure we marshal * * @return short representation of the type data structure */ @Override public byte getDataStructureType() { return OpenWireObjectMessage.DATA_STRUCTURE_TYPE; } /** * @return a new object instance */ @Override public DataStructure createObject() { return new OpenWireObjectMessage(); } /** * 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 */ @Override public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException { super.tightUnmarshal(wireFormat, o, dataIn, bs); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { int rc = super.tightMarshal1(wireFormat, o, bs); return rc + 0; } /** * Write a object instance to data output stream * * @param o * the instance to be marshaled * @param dataOut * the output stream * @throws IOException * thrown if an error occurs */ @Override public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { super.tightMarshal2(wireFormat, o, dataOut, bs); } /** * Un-marshal an object instance from the data input stream * * @param o * the object to un-marshal * @param dataIn * the data input stream to build the object from * @throws IOException */ @Override public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { super.looseUnmarshal(wireFormat, o, dataIn); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { super.looseMarshal(wireFormat, o, dataOut); } }
1,316
0
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v10/KeepAliveInfoMarshaller.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.codec.v10; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import org.apache.activemq.openwire.codec.BooleanStream; import org.apache.activemq.openwire.codec.OpenWireFormat; import org.apache.activemq.openwire.commands.DataStructure; import org.apache.activemq.openwire.commands.KeepAliveInfo; public class KeepAliveInfoMarshaller extends BaseCommandMarshaller { /** * Return the type of Data Structure we marshal * * @return short representation of the type data structure */ @Override public byte getDataStructureType() { return KeepAliveInfo.DATA_STRUCTURE_TYPE; } /** * @return a new object instance */ @Override public DataStructure createObject() { return new KeepAliveInfo(); } /** * 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 */ @Override public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException { super.tightUnmarshal(wireFormat, o, dataIn, bs); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { int rc = super.tightMarshal1(wireFormat, o, bs); return rc + 0; } /** * Write a object instance to data output stream * * @param o * the instance to be marshaled * @param dataOut * the output stream * @throws IOException * thrown if an error occurs */ @Override public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { super.tightMarshal2(wireFormat, o, dataOut, bs); } /** * Un-marshal an object instance from the data input stream * * @param o * the object to un-marshal * @param dataIn * the data input stream to build the object from * @throws IOException */ @Override public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { super.looseUnmarshal(wireFormat, o, dataIn); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { super.looseMarshal(wireFormat, o, dataOut); } }
1,317
0
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v10/ConnectionInfoMarshaller.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.codec.v10; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import org.apache.activemq.openwire.codec.BooleanStream; import org.apache.activemq.openwire.codec.OpenWireFormat; import org.apache.activemq.openwire.commands.BrokerId; import org.apache.activemq.openwire.commands.ConnectionId; import org.apache.activemq.openwire.commands.ConnectionInfo; import org.apache.activemq.openwire.commands.DataStructure; public class ConnectionInfoMarshaller extends BaseCommandMarshaller { /** * Return the type of Data Structure we marshal * * @return short representation of the type data structure */ @Override public byte getDataStructureType() { return ConnectionInfo.DATA_STRUCTURE_TYPE; } /** * @return a new object instance */ @Override public DataStructure createObject() { return new ConnectionInfo(); } /** * Un-marshal an object instance from the data input stream * * @param o * the object to un-marshal * @param dataIn * the data input stream to build the object from * @throws IOException */ @Override public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException { super.tightUnmarshal(wireFormat, o, dataIn, bs); ConnectionInfo info = (ConnectionInfo) o; info.setConnectionId((ConnectionId) tightUnmarsalCachedObject(wireFormat, dataIn, bs)); info.setClientId(tightUnmarshalString(dataIn, bs)); info.setPassword(tightUnmarshalString(dataIn, bs)); info.setUserName(tightUnmarshalString(dataIn, bs)); if (bs.readBoolean()) { short size = dataIn.readShort(); BrokerId value[] = new BrokerId[size]; for (int i = 0; i < size; i++) { value[i] = (BrokerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs); } info.setBrokerPath(value); } else { info.setBrokerPath(null); } info.setBrokerMasterConnector(bs.readBoolean()); info.setManageable(bs.readBoolean()); info.setClientMaster(bs.readBoolean()); info.setFaultTolerant(bs.readBoolean()); info.setFailoverReconnect(bs.readBoolean()); info.setClientIp(tightUnmarshalString(dataIn, bs)); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { ConnectionInfo info = (ConnectionInfo) o; int rc = super.tightMarshal1(wireFormat, o, bs); rc += tightMarshalCachedObject1(wireFormat, info.getConnectionId(), bs); rc += tightMarshalString1(info.getClientId(), bs); rc += tightMarshalString1(info.getPassword(), bs); rc += tightMarshalString1(info.getUserName(), bs); rc += tightMarshalObjectArray1(wireFormat, info.getBrokerPath(), bs); bs.writeBoolean(info.isBrokerMasterConnector()); bs.writeBoolean(info.isManageable()); bs.writeBoolean(info.isClientMaster()); bs.writeBoolean(info.isFaultTolerant()); bs.writeBoolean(info.isFailoverReconnect()); rc += tightMarshalString1(info.getClientIp(), bs); return rc + 0; } /** * Write a object instance to data output stream * * @param o * the instance to be marshaled * @param dataOut * the output stream * @throws IOException * thrown if an error occurs */ @Override public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { super.tightMarshal2(wireFormat, o, dataOut, bs); ConnectionInfo info = (ConnectionInfo) o; tightMarshalCachedObject2(wireFormat, info.getConnectionId(), dataOut, bs); tightMarshalString2(info.getClientId(), dataOut, bs); tightMarshalString2(info.getPassword(), dataOut, bs); tightMarshalString2(info.getUserName(), dataOut, bs); tightMarshalObjectArray2(wireFormat, info.getBrokerPath(), dataOut, bs); bs.readBoolean(); bs.readBoolean(); bs.readBoolean(); bs.readBoolean(); bs.readBoolean(); tightMarshalString2(info.getClientIp(), dataOut, bs); } /** * Un-marshal an object instance from the data input stream * * @param o * the object to un-marshal * @param dataIn * the data input stream to build the object from * @throws IOException */ @Override public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { super.looseUnmarshal(wireFormat, o, dataIn); ConnectionInfo info = (ConnectionInfo) o; info.setConnectionId((ConnectionId) looseUnmarsalCachedObject(wireFormat, dataIn)); info.setClientId(looseUnmarshalString(dataIn)); info.setPassword(looseUnmarshalString(dataIn)); info.setUserName(looseUnmarshalString(dataIn)); if (dataIn.readBoolean()) { short size = dataIn.readShort(); BrokerId value[] = new BrokerId[size]; for (int i = 0; i < size; i++) { value[i] = (BrokerId) looseUnmarsalNestedObject(wireFormat, dataIn); } info.setBrokerPath(value); } else { info.setBrokerPath(null); } info.setBrokerMasterConnector(dataIn.readBoolean()); info.setManageable(dataIn.readBoolean()); info.setClientMaster(dataIn.readBoolean()); info.setFaultTolerant(dataIn.readBoolean()); info.setFailoverReconnect(dataIn.readBoolean()); info.setClientIp(looseUnmarshalString(dataIn)); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { ConnectionInfo info = (ConnectionInfo) o; super.looseMarshal(wireFormat, o, dataOut); looseMarshalCachedObject(wireFormat, info.getConnectionId(), dataOut); looseMarshalString(info.getClientId(), dataOut); looseMarshalString(info.getPassword(), dataOut); looseMarshalString(info.getUserName(), dataOut); looseMarshalObjectArray(wireFormat, info.getBrokerPath(), dataOut); dataOut.writeBoolean(info.isBrokerMasterConnector()); dataOut.writeBoolean(info.isManageable()); dataOut.writeBoolean(info.isClientMaster()); dataOut.writeBoolean(info.isFaultTolerant()); dataOut.writeBoolean(info.isFailoverReconnect()); looseMarshalString(info.getClientIp(), dataOut); } }
1,318
0
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v10/OpenWireQueueMarshaller.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.codec.v10; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import org.apache.activemq.openwire.codec.BooleanStream; import org.apache.activemq.openwire.codec.OpenWireFormat; import org.apache.activemq.openwire.commands.DataStructure; import org.apache.activemq.openwire.commands.OpenWireQueue; public class OpenWireQueueMarshaller extends OpenWireDestinationMarshaller { /** * Return the type of Data Structure we marshal * * @return short representation of the type data structure */ @Override public byte getDataStructureType() { return OpenWireQueue.DATA_STRUCTURE_TYPE; } /** * @return a new object instance */ @Override public DataStructure createObject() { return new OpenWireQueue(); } /** * 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 */ @Override public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException { super.tightUnmarshal(wireFormat, o, dataIn, bs); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { int rc = super.tightMarshal1(wireFormat, o, bs); return rc + 0; } /** * Write a object instance to data output stream * * @param o * the instance to be marshaled * @param dataOut * the output stream * @throws IOException * thrown if an error occurs */ @Override public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { super.tightMarshal2(wireFormat, o, dataOut, bs); } /** * Un-marshal an object instance from the data input stream * * @param o * the object to un-marshal * @param dataIn * the data input stream to build the object from * @throws IOException */ @Override public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { super.looseUnmarshal(wireFormat, o, dataIn); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { super.looseMarshal(wireFormat, o, dataOut); } }
1,319
0
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v10/ConnectionErrorMarshaller.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.codec.v10; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import org.apache.activemq.openwire.codec.BooleanStream; import org.apache.activemq.openwire.codec.OpenWireFormat; import org.apache.activemq.openwire.commands.ConnectionError; import org.apache.activemq.openwire.commands.ConnectionId; import org.apache.activemq.openwire.commands.DataStructure; public class ConnectionErrorMarshaller extends BaseCommandMarshaller { /** * Return the type of Data Structure we marshal * * @return short representation of the type data structure */ @Override public byte getDataStructureType() { return ConnectionError.DATA_STRUCTURE_TYPE; } /** * @return a new object instance */ @Override public DataStructure createObject() { return new ConnectionError(); } /** * Un-marshal an object instance from the data input stream * * @param o * the object to un-marshal * @param dataIn * the data input stream to build the object from * @throws IOException */ @Override public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException { super.tightUnmarshal(wireFormat, o, dataIn, bs); ConnectionError info = (ConnectionError) o; info.setException(tightUnmarsalThrowable(wireFormat, dataIn, bs)); info.setConnectionId((ConnectionId) tightUnmarsalNestedObject(wireFormat, dataIn, bs)); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { ConnectionError info = (ConnectionError) o; int rc = super.tightMarshal1(wireFormat, o, bs); rc += tightMarshalThrowable1(wireFormat, info.getException(), bs); rc += tightMarshalNestedObject1(wireFormat, info.getConnectionId(), bs); return rc + 0; } /** * Write a object instance to data output stream * * @param o * the instance to be marshaled * @param dataOut * the output stream * @throws IOException * thrown if an error occurs */ @Override public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { super.tightMarshal2(wireFormat, o, dataOut, bs); ConnectionError info = (ConnectionError) o; tightMarshalThrowable2(wireFormat, info.getException(), dataOut, bs); tightMarshalNestedObject2(wireFormat, info.getConnectionId(), dataOut, bs); } /** * Un-marshal an object instance from the data input stream * * @param o * the object to un-marshal * @param dataIn * the data input stream to build the object from * @throws IOException */ @Override public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { super.looseUnmarshal(wireFormat, o, dataIn); ConnectionError info = (ConnectionError) o; info.setException(looseUnmarsalThrowable(wireFormat, dataIn)); info.setConnectionId((ConnectionId) looseUnmarsalNestedObject(wireFormat, dataIn)); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { ConnectionError info = (ConnectionError) o; super.looseMarshal(wireFormat, o, dataOut); looseMarshalThrowable(wireFormat, info.getException(), dataOut); looseMarshalNestedObject(wireFormat, info.getConnectionId(), dataOut); } }
1,320
0
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v10/JournalQueueAckMarshaller.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.codec.v10; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import org.apache.activemq.openwire.codec.BaseDataStreamMarshaller; import org.apache.activemq.openwire.codec.BooleanStream; import org.apache.activemq.openwire.codec.OpenWireFormat; import org.apache.activemq.openwire.commands.DataStructure; import org.apache.activemq.openwire.commands.JournalQueueAck; import org.apache.activemq.openwire.commands.MessageAck; import org.apache.activemq.openwire.commands.OpenWireDestination; public class JournalQueueAckMarshaller extends BaseDataStreamMarshaller { /** * Return the type of Data Structure we marshal * * @return short representation of the type data structure */ @Override public byte getDataStructureType() { return JournalQueueAck.DATA_STRUCTURE_TYPE; } /** * @return a new object instance */ @Override public DataStructure createObject() { return new JournalQueueAck(); } /** * Un-marshal an object instance from the data input stream * * @param o * the object to un-marshal * @param dataIn * the data input stream to build the object from * @throws IOException */ @Override public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException { super.tightUnmarshal(wireFormat, o, dataIn, bs); JournalQueueAck info = (JournalQueueAck) o; info.setDestination((OpenWireDestination) tightUnmarsalNestedObject(wireFormat, dataIn, bs)); info.setMessageAck((MessageAck) tightUnmarsalNestedObject(wireFormat, dataIn, bs)); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { JournalQueueAck info = (JournalQueueAck) o; int rc = super.tightMarshal1(wireFormat, o, bs); rc += tightMarshalNestedObject1(wireFormat, info.getDestination(), bs); rc += tightMarshalNestedObject1(wireFormat, info.getMessageAck(), bs); return rc + 0; } /** * Write a object instance to data output stream * * @param o * the instance to be marshaled * @param dataOut * the output stream * @throws IOException * thrown if an error occurs */ @Override public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { super.tightMarshal2(wireFormat, o, dataOut, bs); JournalQueueAck info = (JournalQueueAck) o; tightMarshalNestedObject2(wireFormat, info.getDestination(), dataOut, bs); tightMarshalNestedObject2(wireFormat, info.getMessageAck(), dataOut, bs); } /** * Un-marshal an object instance from the data input stream * * @param o * the object to un-marshal * @param dataIn * the data input stream to build the object from * @throws IOException */ @Override public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { super.looseUnmarshal(wireFormat, o, dataIn); JournalQueueAck info = (JournalQueueAck) o; info.setDestination((OpenWireDestination) looseUnmarsalNestedObject(wireFormat, dataIn)); info.setMessageAck((MessageAck) looseUnmarsalNestedObject(wireFormat, dataIn)); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { JournalQueueAck info = (JournalQueueAck) o; super.looseMarshal(wireFormat, o, dataOut); looseMarshalNestedObject(wireFormat, info.getDestination(), dataOut); looseMarshalNestedObject(wireFormat, info.getMessageAck(), dataOut); } }
1,321
0
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v10/OpenWireDestinationMarshaller.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.codec.v10; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import org.apache.activemq.openwire.codec.BaseDataStreamMarshaller; import org.apache.activemq.openwire.codec.BooleanStream; import org.apache.activemq.openwire.codec.OpenWireFormat; import org.apache.activemq.openwire.commands.OpenWireDestination; public abstract class OpenWireDestinationMarshaller extends BaseDataStreamMarshaller { /** * Un-marshal an object instance from the data input stream * * @param o * the object to un-marshal * @param dataIn * the data input stream to build the object from * @throws IOException */ @Override public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException { super.tightUnmarshal(wireFormat, o, dataIn, bs); OpenWireDestination info = (OpenWireDestination) o; info.setPhysicalName(tightUnmarshalString(dataIn, bs)); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { OpenWireDestination info = (OpenWireDestination) o; int rc = super.tightMarshal1(wireFormat, o, bs); rc += tightMarshalString1(info.getPhysicalName(), bs); return rc + 0; } /** * Write a object instance to data output stream * * @param o * the instance to be marshaled * @param dataOut * the output stream * @throws IOException * thrown if an error occurs */ @Override public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { super.tightMarshal2(wireFormat, o, dataOut, bs); OpenWireDestination info = (OpenWireDestination) o; tightMarshalString2(info.getPhysicalName(), dataOut, bs); } /** * Un-marshal an object instance from the data input stream * * @param o * the object to un-marshal * @param dataIn * the data input stream to build the object from * @throws IOException */ @Override public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { super.looseUnmarshal(wireFormat, o, dataIn); OpenWireDestination info = (OpenWireDestination) o; info.setPhysicalName(looseUnmarshalString(dataIn)); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { OpenWireDestination info = (OpenWireDestination) o; super.looseMarshal(wireFormat, o, dataOut); looseMarshalString(info.getPhysicalName(), dataOut); } }
1,322
0
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v10/OpenWireBytesMessageMarshaller.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.codec.v10; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import org.apache.activemq.openwire.codec.BooleanStream; import org.apache.activemq.openwire.codec.OpenWireFormat; import org.apache.activemq.openwire.commands.DataStructure; import org.apache.activemq.openwire.commands.OpenWireBytesMessage; public class OpenWireBytesMessageMarshaller extends OpenWireMessageMarshaller { /** * Return the type of Data Structure we marshal * * @return short representation of the type data structure */ @Override public byte getDataStructureType() { return OpenWireBytesMessage.DATA_STRUCTURE_TYPE; } /** * @return a new object instance */ @Override public DataStructure createObject() { return new OpenWireBytesMessage(); } /** * 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 */ @Override public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException { super.tightUnmarshal(wireFormat, o, dataIn, bs); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { int rc = super.tightMarshal1(wireFormat, o, bs); return rc + 0; } /** * Write a object instance to data output stream * * @param o * the instance to be marshaled * @param dataOut * the output stream * @throws IOException * thrown if an error occurs */ @Override public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { super.tightMarshal2(wireFormat, o, dataOut, bs); } /** * Un-marshal an object instance from the data input stream * * @param o * the object to un-marshal * @param dataIn * the data input stream to build the object from * @throws IOException */ @Override public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { super.looseUnmarshal(wireFormat, o, dataIn); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { super.looseMarshal(wireFormat, o, dataOut); } }
1,323
0
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v10/ShutdownInfoMarshaller.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.codec.v10; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import org.apache.activemq.openwire.codec.BooleanStream; import org.apache.activemq.openwire.codec.OpenWireFormat; import org.apache.activemq.openwire.commands.DataStructure; import org.apache.activemq.openwire.commands.ShutdownInfo; public class ShutdownInfoMarshaller extends BaseCommandMarshaller { /** * Return the type of Data Structure we marshal * * @return short representation of the type data structure */ @Override public byte getDataStructureType() { return ShutdownInfo.DATA_STRUCTURE_TYPE; } /** * @return a new object instance */ @Override public DataStructure createObject() { return new ShutdownInfo(); } /** * 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 */ @Override public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException { super.tightUnmarshal(wireFormat, o, dataIn, bs); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { int rc = super.tightMarshal1(wireFormat, o, bs); return rc + 0; } /** * Write a object instance to data output stream * * @param o * the instance to be marshaled * @param dataOut * the output stream * @throws IOException * thrown if an error occurs */ @Override public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { super.tightMarshal2(wireFormat, o, dataOut, bs); } /** * Un-marshal an object instance from the data input stream * * @param o * the object to un-marshal * @param dataIn * the data input stream to build the object from * @throws IOException */ @Override public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { super.looseUnmarshal(wireFormat, o, dataIn); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { super.looseMarshal(wireFormat, o, dataOut); } }
1,324
0
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v10/OpenWireStreamMessageMarshaller.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.codec.v10; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import org.apache.activemq.openwire.codec.BooleanStream; import org.apache.activemq.openwire.codec.OpenWireFormat; import org.apache.activemq.openwire.commands.DataStructure; import org.apache.activemq.openwire.commands.OpenWireStreamMessage; public class OpenWireStreamMessageMarshaller extends OpenWireMessageMarshaller { /** * Return the type of Data Structure we marshal * * @return short representation of the type data structure */ @Override public byte getDataStructureType() { return OpenWireStreamMessage.DATA_STRUCTURE_TYPE; } /** * @return a new object instance */ @Override public DataStructure createObject() { return new OpenWireStreamMessage(); } /** * 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 */ @Override public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException { super.tightUnmarshal(wireFormat, o, dataIn, bs); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { int rc = super.tightMarshal1(wireFormat, o, bs); return rc + 0; } /** * Write a object instance to data output stream * * @param o * the instance to be marshaled * @param dataOut * the output stream * @throws IOException * thrown if an error occurs */ @Override public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { super.tightMarshal2(wireFormat, o, dataOut, bs); } /** * Un-marshal an object instance from the data input stream * * @param o * the object to un-marshal * @param dataIn * the data input stream to build the object from * @throws IOException */ @Override public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { super.looseUnmarshal(wireFormat, o, dataIn); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { super.looseMarshal(wireFormat, o, dataOut); } }
1,325
0
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v10/JournalTraceMarshaller.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.codec.v10; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import org.apache.activemq.openwire.codec.BaseDataStreamMarshaller; import org.apache.activemq.openwire.codec.BooleanStream; import org.apache.activemq.openwire.codec.OpenWireFormat; import org.apache.activemq.openwire.commands.DataStructure; import org.apache.activemq.openwire.commands.JournalTrace; public class JournalTraceMarshaller extends BaseDataStreamMarshaller { /** * Return the type of Data Structure we marshal * * @return short representation of the type data structure */ @Override public byte getDataStructureType() { return JournalTrace.DATA_STRUCTURE_TYPE; } /** * @return a new object instance */ @Override public DataStructure createObject() { return new JournalTrace(); } /** * 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 */ @Override public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException { super.tightUnmarshal(wireFormat, o, dataIn, bs); JournalTrace info = (JournalTrace) o; info.setMessage(tightUnmarshalString(dataIn, bs)); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { JournalTrace info = (JournalTrace) o; int rc = super.tightMarshal1(wireFormat, o, bs); rc += tightMarshalString1(info.getMessage(), bs); return rc + 0; } /** * Write a object instance to data output stream * * @param o * the instance to be marshaled * @param dataOut * the output stream * @throws IOException * thrown if an error occurs */ @Override public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { super.tightMarshal2(wireFormat, o, dataOut, bs); JournalTrace info = (JournalTrace) o; tightMarshalString2(info.getMessage(), dataOut, bs); } /** * Un-marshal an object instance from the data input stream * * @param o * the object to un-marshal * @param dataIn * the data input stream to build the object from * @throws IOException */ @Override public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { super.looseUnmarshal(wireFormat, o, dataIn); JournalTrace info = (JournalTrace) o; info.setMessage(looseUnmarshalString(dataIn)); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { JournalTrace info = (JournalTrace) o; super.looseMarshal(wireFormat, o, dataOut); looseMarshalString(info.getMessage(), dataOut); } }
1,326
0
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v10/WireFormatInfoMarshaller.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.codec.v10; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import org.apache.activemq.openwire.codec.BaseDataStreamMarshaller; import org.apache.activemq.openwire.codec.BooleanStream; import org.apache.activemq.openwire.codec.OpenWireFormat; import org.apache.activemq.openwire.commands.DataStructure; import org.apache.activemq.openwire.commands.WireFormatInfo; public class WireFormatInfoMarshaller extends BaseDataStreamMarshaller { /** * Return the type of Data Structure we marshal * * @return short representation of the type data structure */ @Override public byte getDataStructureType() { return WireFormatInfo.DATA_STRUCTURE_TYPE; } /** * @return a new object instance */ @Override public DataStructure createObject() { return new WireFormatInfo(); } /** * 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 */ @Override public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException { super.tightUnmarshal(wireFormat, o, dataIn, bs); WireFormatInfo info = (WireFormatInfo) o; info.beforeUnmarshall(wireFormat); info.setMagic(tightUnmarshalConstByteArray(dataIn, bs, 8)); info.setVersion(dataIn.readInt()); info.setMarshalledProperties(tightUnmarshalByteSequence(dataIn, bs)); info.afterUnmarshall(wireFormat); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { WireFormatInfo info = (WireFormatInfo) o; info.beforeMarshall(wireFormat); int rc = super.tightMarshal1(wireFormat, o, bs); rc += tightMarshalConstByteArray1(info.getMagic(), bs, 8); rc += tightMarshalByteSequence1(info.getMarshalledProperties(), 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 */ @Override public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { super.tightMarshal2(wireFormat, o, dataOut, bs); WireFormatInfo info = (WireFormatInfo) o; tightMarshalConstByteArray2(info.getMagic(), dataOut, bs, 8); dataOut.writeInt(info.getVersion()); tightMarshalByteSequence2(info.getMarshalledProperties(), dataOut, bs); info.afterMarshall(wireFormat); } /** * 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 */ @Override public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { super.looseUnmarshal(wireFormat, o, dataIn); WireFormatInfo info = (WireFormatInfo) o; info.beforeUnmarshall(wireFormat); info.setMagic(looseUnmarshalConstByteArray(dataIn, 8)); info.setVersion(dataIn.readInt()); info.setMarshalledProperties(looseUnmarshalByteSequence(dataIn)); info.afterUnmarshall(wireFormat); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { WireFormatInfo info = (WireFormatInfo) o; info.beforeMarshall(wireFormat); super.looseMarshal(wireFormat, o, dataOut); looseMarshalConstByteArray(wireFormat, info.getMagic(), dataOut, 8); dataOut.writeInt(info.getVersion()); looseMarshalByteSequence(wireFormat, info.getMarshalledProperties(), dataOut); } }
1,327
0
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v10/ProducerInfoMarshaller.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.codec.v10; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import org.apache.activemq.openwire.codec.BooleanStream; import org.apache.activemq.openwire.codec.OpenWireFormat; import org.apache.activemq.openwire.commands.BrokerId; import org.apache.activemq.openwire.commands.DataStructure; import org.apache.activemq.openwire.commands.OpenWireDestination; import org.apache.activemq.openwire.commands.ProducerId; import org.apache.activemq.openwire.commands.ProducerInfo; public class ProducerInfoMarshaller extends BaseCommandMarshaller { /** * Return the type of Data Structure we marshal * * @return short representation of the type data structure */ @Override public byte getDataStructureType() { return ProducerInfo.DATA_STRUCTURE_TYPE; } /** * @return a new object instance */ @Override public DataStructure createObject() { return new ProducerInfo(); } /** * 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 */ @Override public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException { super.tightUnmarshal(wireFormat, o, dataIn, bs); ProducerInfo info = (ProducerInfo) o; info.setProducerId((ProducerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs)); info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs)); if (bs.readBoolean()) { short size = dataIn.readShort(); BrokerId value[] = new BrokerId[size]; for (int i = 0; i < size; i++) { value[i] = (BrokerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs); } info.setBrokerPath(value); } else { info.setBrokerPath(null); } info.setDispatchAsync(bs.readBoolean()); info.setWindowSize(dataIn.readInt()); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { ProducerInfo info = (ProducerInfo) o; int rc = super.tightMarshal1(wireFormat, o, bs); rc += tightMarshalCachedObject1(wireFormat, info.getProducerId(), bs); rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs); rc += tightMarshalObjectArray1(wireFormat, info.getBrokerPath(), bs); bs.writeBoolean(info.isDispatchAsync()); 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 */ @Override public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { super.tightMarshal2(wireFormat, o, dataOut, bs); ProducerInfo info = (ProducerInfo) o; tightMarshalCachedObject2(wireFormat, info.getProducerId(), dataOut, bs); tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs); tightMarshalObjectArray2(wireFormat, info.getBrokerPath(), dataOut, bs); bs.readBoolean(); dataOut.writeInt(info.getWindowSize()); } /** * 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 */ @Override public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { super.looseUnmarshal(wireFormat, o, dataIn); ProducerInfo info = (ProducerInfo) o; info.setProducerId((ProducerId) looseUnmarsalCachedObject(wireFormat, dataIn)); info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn)); if (dataIn.readBoolean()) { short size = dataIn.readShort(); BrokerId value[] = new BrokerId[size]; for (int i = 0; i < size; i++) { value[i] = (BrokerId) looseUnmarsalNestedObject(wireFormat, dataIn); } info.setBrokerPath(value); } else { info.setBrokerPath(null); } info.setDispatchAsync(dataIn.readBoolean()); info.setWindowSize(dataIn.readInt()); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { ProducerInfo info = (ProducerInfo) o; super.looseMarshal(wireFormat, o, dataOut); looseMarshalCachedObject(wireFormat, info.getProducerId(), dataOut); looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut); looseMarshalObjectArray(wireFormat, info.getBrokerPath(), dataOut); dataOut.writeBoolean(info.isDispatchAsync()); dataOut.writeInt(info.getWindowSize()); } }
1,328
0
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v10/FlushCommandMarshaller.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.codec.v10; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import org.apache.activemq.openwire.codec.BooleanStream; import org.apache.activemq.openwire.codec.OpenWireFormat; import org.apache.activemq.openwire.commands.DataStructure; import org.apache.activemq.openwire.commands.FlushCommand; public class FlushCommandMarshaller extends BaseCommandMarshaller { /** * Return the type of Data Structure we marshal * * @return short representation of the type data structure */ @Override public byte getDataStructureType() { return FlushCommand.DATA_STRUCTURE_TYPE; } /** * @return a new object instance */ @Override public DataStructure createObject() { return new FlushCommand(); } /** * Un-marshal an object instance from the data input stream * * @param o * the object to un-marshal * @param dataIn * the data input stream to build the object from * @throws IOException */ @Override public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException { super.tightUnmarshal(wireFormat, o, dataIn, bs); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { int rc = super.tightMarshal1(wireFormat, o, bs); return rc + 0; } /** * Write a object instance to data output stream * * @param o * the instance to be marshaled * @param dataOut * the output stream * @throws IOException * thrown if an error occurs */ @Override public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { super.tightMarshal2(wireFormat, o, dataOut, bs); } /** * Un-marshal an object instance from the data input stream * * @param o * the object to un-marshal * @param dataIn * the data input stream to build the object from * @throws IOException */ @Override public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { super.looseUnmarshal(wireFormat, o, dataIn); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { super.looseMarshal(wireFormat, o, dataOut); } }
1,329
0
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v10/RemoveInfoMarshaller.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.codec.v10; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import org.apache.activemq.openwire.codec.BooleanStream; import org.apache.activemq.openwire.codec.OpenWireFormat; import org.apache.activemq.openwire.commands.DataStructure; import org.apache.activemq.openwire.commands.RemoveInfo; public class RemoveInfoMarshaller extends BaseCommandMarshaller { /** * Return the type of Data Structure we marshal * * @return short representation of the type data structure */ @Override public byte getDataStructureType() { return RemoveInfo.DATA_STRUCTURE_TYPE; } /** * @return a new object instance */ @Override public DataStructure createObject() { return new RemoveInfo(); } /** * 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 */ @Override public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException { super.tightUnmarshal(wireFormat, o, dataIn, bs); RemoveInfo info = (RemoveInfo) o; info.setObjectId(tightUnmarsalCachedObject(wireFormat, dataIn, bs)); info.setLastDeliveredSequenceId(tightUnmarshalLong(wireFormat, dataIn, bs)); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { RemoveInfo info = (RemoveInfo) o; int rc = super.tightMarshal1(wireFormat, o, bs); rc += tightMarshalCachedObject1(wireFormat, info.getObjectId(), bs); rc += tightMarshalLong1(wireFormat, info.getLastDeliveredSequenceId(), bs); return rc + 0; } /** * Write a object instance to data output stream * * @param o * the instance to be marshaled * @param dataOut * the output stream * @throws IOException * thrown if an error occurs */ @Override public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { super.tightMarshal2(wireFormat, o, dataOut, bs); RemoveInfo info = (RemoveInfo) o; tightMarshalCachedObject2(wireFormat, info.getObjectId(), dataOut, bs); tightMarshalLong2(wireFormat, info.getLastDeliveredSequenceId(), dataOut, bs); } /** * Un-marshal an object instance from the data input stream * * @param o * the object to un-marshal * @param dataIn * the data input stream to build the object from * @throws IOException */ @Override public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { super.looseUnmarshal(wireFormat, o, dataIn); RemoveInfo info = (RemoveInfo) o; info.setObjectId(looseUnmarsalCachedObject(wireFormat, dataIn)); info.setLastDeliveredSequenceId(looseUnmarshalLong(wireFormat, dataIn)); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { RemoveInfo info = (RemoveInfo) o; super.looseMarshal(wireFormat, o, dataOut); looseMarshalCachedObject(wireFormat, info.getObjectId(), dataOut); looseMarshalLong(wireFormat, info.getLastDeliveredSequenceId(), dataOut); } }
1,330
0
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v10/ReplayCommandMarshaller.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.codec.v10; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import org.apache.activemq.openwire.codec.BooleanStream; import org.apache.activemq.openwire.codec.OpenWireFormat; import org.apache.activemq.openwire.commands.DataStructure; import org.apache.activemq.openwire.commands.ReplayCommand; public class ReplayCommandMarshaller extends BaseCommandMarshaller { /** * Return the type of Data Structure we marshal * * @return short representation of the type data structure */ @Override public byte getDataStructureType() { return ReplayCommand.DATA_STRUCTURE_TYPE; } /** * @return a new object instance */ @Override public DataStructure createObject() { return new ReplayCommand(); } /** * 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 */ @Override public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException { super.tightUnmarshal(wireFormat, o, dataIn, bs); ReplayCommand info = (ReplayCommand) o; info.setFirstNakNumber(dataIn.readInt()); info.setLastNakNumber(dataIn.readInt()); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { int rc = super.tightMarshal1(wireFormat, o, bs); return rc + 8; } /** * 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 */ @Override public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { super.tightMarshal2(wireFormat, o, dataOut, bs); ReplayCommand info = (ReplayCommand) o; dataOut.writeInt(info.getFirstNakNumber()); dataOut.writeInt(info.getLastNakNumber()); } /** * 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 */ @Override public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { super.looseUnmarshal(wireFormat, o, dataIn); ReplayCommand info = (ReplayCommand) o; info.setFirstNakNumber(dataIn.readInt()); info.setLastNakNumber(dataIn.readInt()); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { ReplayCommand info = (ReplayCommand) o; super.looseMarshal(wireFormat, o, dataOut); dataOut.writeInt(info.getFirstNakNumber()); dataOut.writeInt(info.getLastNakNumber()); } }
1,331
0
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v10/OpenWireMessageMarshaller.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.codec.v10; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import org.apache.activemq.openwire.codec.BooleanStream; import org.apache.activemq.openwire.codec.OpenWireFormat; import org.apache.activemq.openwire.commands.DataStructure; import org.apache.activemq.openwire.commands.OpenWireMessage; public class OpenWireMessageMarshaller extends MessageMarshaller { /** * Return the type of Data Structure we marshal * * @return short representation of the type data structure */ @Override public byte getDataStructureType() { return OpenWireMessage.DATA_STRUCTURE_TYPE; } /** * @return a new object instance */ @Override public DataStructure createObject() { return new OpenWireMessage(); } /** * 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 */ @Override public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException { super.tightUnmarshal(wireFormat, o, dataIn, bs); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { int rc = super.tightMarshal1(wireFormat, o, bs); return rc + 0; } /** * Write a object instance to data output stream * * @param o * the instance to be marshaled * @param dataOut * the output stream * @throws IOException * thrown if an error occurs */ @Override public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { super.tightMarshal2(wireFormat, o, dataOut, bs); } /** * Un-marshal an object instance from the data input stream * * @param o * the object to un-marshal * @param dataIn * the data input stream to build the object from * @throws IOException */ @Override public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { super.looseUnmarshal(wireFormat, o, dataIn); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { super.looseMarshal(wireFormat, o, dataOut); } }
1,332
0
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v10/OpenWireTempTopicMarshaller.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.codec.v10; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import org.apache.activemq.openwire.codec.BooleanStream; import org.apache.activemq.openwire.codec.OpenWireFormat; import org.apache.activemq.openwire.commands.DataStructure; import org.apache.activemq.openwire.commands.OpenWireTempTopic; public class OpenWireTempTopicMarshaller extends OpenWireTempDestinationMarshaller { /** * Return the type of Data Structure we marshal * * @return short representation of the type data structure */ @Override public byte getDataStructureType() { return OpenWireTempTopic.DATA_STRUCTURE_TYPE; } /** * @return a new object instance */ @Override public DataStructure createObject() { return new OpenWireTempTopic(); } /** * 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 */ @Override public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException { super.tightUnmarshal(wireFormat, o, dataIn, bs); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { int rc = super.tightMarshal1(wireFormat, o, bs); return rc + 0; } /** * Write a object instance to data output stream * * @param o * the instance to be marshaled * @param dataOut * the output stream * @throws IOException * thrown if an error occurs */ @Override public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { super.tightMarshal2(wireFormat, o, dataOut, bs); } /** * Un-marshal an object instance from the data input stream * * @param o * the object to un-marshal * @param dataIn * the data input stream to build the object from * @throws IOException */ @Override public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { super.looseUnmarshal(wireFormat, o, dataIn); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { super.looseMarshal(wireFormat, o, dataOut); } }
1,333
0
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v10/ConsumerIdMarshaller.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.codec.v10; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import org.apache.activemq.openwire.codec.BaseDataStreamMarshaller; import org.apache.activemq.openwire.codec.BooleanStream; import org.apache.activemq.openwire.codec.OpenWireFormat; import org.apache.activemq.openwire.commands.ConsumerId; import org.apache.activemq.openwire.commands.DataStructure; public class ConsumerIdMarshaller extends BaseDataStreamMarshaller { /** * Return the type of Data Structure we marshal * * @return short representation of the type data structure */ @Override public byte getDataStructureType() { return ConsumerId.DATA_STRUCTURE_TYPE; } /** * @return a new object instance */ @Override public DataStructure createObject() { return new ConsumerId(); } /** * Un-marshal an object instance from the data input stream * * @param o * the object to un-marshal * @param dataIn * the data input stream to build the object from * @throws IOException */ @Override public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException { super.tightUnmarshal(wireFormat, o, dataIn, bs); ConsumerId info = (ConsumerId) o; info.setConnectionId(tightUnmarshalString(dataIn, bs)); info.setSessionId(tightUnmarshalLong(wireFormat, dataIn, bs)); info.setValue(tightUnmarshalLong(wireFormat, dataIn, bs)); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { ConsumerId info = (ConsumerId) o; int rc = super.tightMarshal1(wireFormat, o, bs); rc += tightMarshalString1(info.getConnectionId(), bs); rc += tightMarshalLong1(wireFormat, info.getSessionId(), bs); rc += tightMarshalLong1(wireFormat, info.getValue(), bs); return rc + 0; } /** * Write a object instance to data output stream * * @param o * the instance to be marshaled * @param dataOut * the output stream * @throws IOException * thrown if an error occurs */ @Override public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { super.tightMarshal2(wireFormat, o, dataOut, bs); ConsumerId info = (ConsumerId) o; tightMarshalString2(info.getConnectionId(), dataOut, bs); tightMarshalLong2(wireFormat, info.getSessionId(), dataOut, bs); tightMarshalLong2(wireFormat, info.getValue(), dataOut, bs); } /** * Un-marshal an object instance from the data input stream * * @param o * the object to un-marshal * @param dataIn * the data input stream to build the object from * @throws IOException */ @Override public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { super.looseUnmarshal(wireFormat, o, dataIn); ConsumerId info = (ConsumerId) o; info.setConnectionId(looseUnmarshalString(dataIn)); info.setSessionId(looseUnmarshalLong(wireFormat, dataIn)); info.setValue(looseUnmarshalLong(wireFormat, dataIn)); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { ConsumerId info = (ConsumerId) o; super.looseMarshal(wireFormat, o, dataOut); looseMarshalString(info.getConnectionId(), dataOut); looseMarshalLong(wireFormat, info.getSessionId(), dataOut); looseMarshalLong(wireFormat, info.getValue(), dataOut); } }
1,334
0
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v10/MessageIdMarshaller.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.codec.v10; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import org.apache.activemq.openwire.codec.BaseDataStreamMarshaller; import org.apache.activemq.openwire.codec.BooleanStream; import org.apache.activemq.openwire.codec.OpenWireFormat; import org.apache.activemq.openwire.commands.DataStructure; import org.apache.activemq.openwire.commands.MessageId; import org.apache.activemq.openwire.commands.ProducerId; public class MessageIdMarshaller extends BaseDataStreamMarshaller { /** * Return the type of Data Structure we marshal * * @return short representation of the type data structure */ @Override public byte getDataStructureType() { return MessageId.DATA_STRUCTURE_TYPE; } /** * @return a new object instance */ @Override public DataStructure createObject() { return new MessageId(); } /** * 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 */ @Override public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException { super.tightUnmarshal(wireFormat, o, dataIn, bs); MessageId info = (MessageId) o; info.setTextView(tightUnmarshalString(dataIn, bs)); info.setProducerId((ProducerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs)); info.setProducerSequenceId(tightUnmarshalLong(wireFormat, dataIn, bs)); info.setBrokerSequenceId(tightUnmarshalLong(wireFormat, dataIn, bs)); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { MessageId info = (MessageId) o; int rc = super.tightMarshal1(wireFormat, o, bs); rc += tightMarshalString1(info.getTextView(), bs); rc += tightMarshalCachedObject1(wireFormat, info.getProducerId(), bs); rc += tightMarshalLong1(wireFormat, info.getProducerSequenceId(), bs); rc += tightMarshalLong1(wireFormat, info.getBrokerSequenceId(), bs); return rc + 0; } /** * Write a object instance to data output stream * * @param o * the instance to be marshaled * @param dataOut * the output stream * @throws IOException * thrown if an error occurs */ @Override public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { super.tightMarshal2(wireFormat, o, dataOut, bs); MessageId info = (MessageId) o; tightMarshalString2(info.getTextView(), dataOut, bs); tightMarshalCachedObject2(wireFormat, info.getProducerId(), dataOut, bs); tightMarshalLong2(wireFormat, info.getProducerSequenceId(), dataOut, bs); tightMarshalLong2(wireFormat, info.getBrokerSequenceId(), dataOut, bs); } /** * Un-marshal an object instance from the data input stream * * @param o * the object to un-marshal * @param dataIn * the data input stream to build the object from * @throws IOException */ @Override public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { super.looseUnmarshal(wireFormat, o, dataIn); MessageId info = (MessageId) o; info.setTextView(looseUnmarshalString(dataIn)); info.setProducerId((ProducerId) looseUnmarsalCachedObject(wireFormat, dataIn)); info.setProducerSequenceId(looseUnmarshalLong(wireFormat, dataIn)); info.setBrokerSequenceId(looseUnmarshalLong(wireFormat, dataIn)); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { MessageId info = (MessageId) o; super.looseMarshal(wireFormat, o, dataOut); looseMarshalString(info.getTextView(), dataOut); looseMarshalCachedObject(wireFormat, info.getProducerId(), dataOut); looseMarshalLong(wireFormat, info.getProducerSequenceId(), dataOut); looseMarshalLong(wireFormat, info.getBrokerSequenceId(), dataOut); } }
1,335
0
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v10/XATransactionIdMarshaller.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.codec.v10; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import org.apache.activemq.openwire.codec.BooleanStream; import org.apache.activemq.openwire.codec.OpenWireFormat; import org.apache.activemq.openwire.commands.DataStructure; import org.apache.activemq.openwire.commands.XATransactionId; public class XATransactionIdMarshaller extends TransactionIdMarshaller { /** * Return the type of Data Structure we marshal * * @return short representation of the type data structure */ @Override public byte getDataStructureType() { return XATransactionId.DATA_STRUCTURE_TYPE; } /** * @return a new object instance */ @Override public DataStructure createObject() { return new XATransactionId(); } /** * 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 */ @Override public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException { super.tightUnmarshal(wireFormat, o, dataIn, bs); XATransactionId info = (XATransactionId) o; info.setFormatId(dataIn.readInt()); info.setGlobalTransactionId(tightUnmarshalByteArray(dataIn, bs)); info.setBranchQualifier(tightUnmarshalByteArray(dataIn, bs)); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { XATransactionId info = (XATransactionId) o; int rc = super.tightMarshal1(wireFormat, o, bs); rc += tightMarshalByteArray1(info.getGlobalTransactionId(), bs); rc += tightMarshalByteArray1(info.getBranchQualifier(), 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 */ @Override public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { super.tightMarshal2(wireFormat, o, dataOut, bs); XATransactionId info = (XATransactionId) o; dataOut.writeInt(info.getFormatId()); tightMarshalByteArray2(info.getGlobalTransactionId(), dataOut, bs); tightMarshalByteArray2(info.getBranchQualifier(), dataOut, bs); } /** * Un-marshal an object instance from the data input stream * * @param o * the object to un-marshal * @param dataIn * the data input stream to build the object from * @throws IOException */ @Override public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { super.looseUnmarshal(wireFormat, o, dataIn); XATransactionId info = (XATransactionId) o; info.setFormatId(dataIn.readInt()); info.setGlobalTransactionId(looseUnmarshalByteArray(dataIn)); info.setBranchQualifier(looseUnmarshalByteArray(dataIn)); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { XATransactionId info = (XATransactionId) o; super.looseMarshal(wireFormat, o, dataOut); dataOut.writeInt(info.getFormatId()); looseMarshalByteArray(wireFormat, info.getGlobalTransactionId(), dataOut); looseMarshalByteArray(wireFormat, info.getBranchQualifier(), dataOut); } }
1,336
0
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v10/SessionIdMarshaller.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.codec.v10; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import org.apache.activemq.openwire.codec.BaseDataStreamMarshaller; import org.apache.activemq.openwire.codec.BooleanStream; import org.apache.activemq.openwire.codec.OpenWireFormat; import org.apache.activemq.openwire.commands.DataStructure; import org.apache.activemq.openwire.commands.SessionId; public class SessionIdMarshaller extends BaseDataStreamMarshaller { /** * Return the type of Data Structure we marshal * * @return short representation of the type data structure */ @Override public byte getDataStructureType() { return SessionId.DATA_STRUCTURE_TYPE; } /** * @return a new object instance */ @Override public DataStructure createObject() { return new SessionId(); } /** * 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 */ @Override public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException { super.tightUnmarshal(wireFormat, o, dataIn, bs); SessionId info = (SessionId) o; info.setConnectionId(tightUnmarshalString(dataIn, bs)); info.setValue(tightUnmarshalLong(wireFormat, dataIn, bs)); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { SessionId info = (SessionId) o; int rc = super.tightMarshal1(wireFormat, o, bs); rc += tightMarshalString1(info.getConnectionId(), bs); rc += tightMarshalLong1(wireFormat, info.getValue(), bs); return rc + 0; } /** * Write a object instance to data output stream * * @param o * the instance to be marshaled * @param dataOut * the output stream * @throws IOException * thrown if an error occurs */ @Override public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { super.tightMarshal2(wireFormat, o, dataOut, bs); SessionId info = (SessionId) o; tightMarshalString2(info.getConnectionId(), dataOut, bs); tightMarshalLong2(wireFormat, info.getValue(), dataOut, bs); } /** * Un-marshal an object instance from the data input stream * * @param o * the object to un-marshal * @param dataIn * the data input stream to build the object from * @throws IOException */ @Override public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { super.looseUnmarshal(wireFormat, o, dataIn); SessionId info = (SessionId) o; info.setConnectionId(looseUnmarshalString(dataIn)); info.setValue(looseUnmarshalLong(wireFormat, dataIn)); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { SessionId info = (SessionId) o; super.looseMarshal(wireFormat, o, dataOut); looseMarshalString(info.getConnectionId(), dataOut); looseMarshalLong(wireFormat, info.getValue(), dataOut); } }
1,337
0
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v10/ProducerIdMarshaller.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.codec.v10; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import org.apache.activemq.openwire.codec.BaseDataStreamMarshaller; import org.apache.activemq.openwire.codec.BooleanStream; import org.apache.activemq.openwire.codec.OpenWireFormat; import org.apache.activemq.openwire.commands.DataStructure; import org.apache.activemq.openwire.commands.ProducerId; public class ProducerIdMarshaller extends BaseDataStreamMarshaller { /** * Return the type of Data Structure we marshal * * @return short representation of the type data structure */ @Override public byte getDataStructureType() { return ProducerId.DATA_STRUCTURE_TYPE; } /** * @return a new object instance */ @Override public DataStructure createObject() { return new ProducerId(); } /** * 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 */ @Override public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException { super.tightUnmarshal(wireFormat, o, dataIn, bs); ProducerId info = (ProducerId) o; info.setConnectionId(tightUnmarshalString(dataIn, bs)); info.setValue(tightUnmarshalLong(wireFormat, dataIn, bs)); info.setSessionId(tightUnmarshalLong(wireFormat, dataIn, bs)); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { ProducerId info = (ProducerId) o; int rc = super.tightMarshal1(wireFormat, o, bs); rc += tightMarshalString1(info.getConnectionId(), bs); rc += tightMarshalLong1(wireFormat, info.getValue(), bs); rc += tightMarshalLong1(wireFormat, info.getSessionId(), bs); return rc + 0; } /** * Write a object instance to data output stream * * @param o * the instance to be marshaled * @param dataOut * the output stream * @throws IOException * thrown if an error occurs */ @Override public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { super.tightMarshal2(wireFormat, o, dataOut, bs); ProducerId info = (ProducerId) o; tightMarshalString2(info.getConnectionId(), dataOut, bs); tightMarshalLong2(wireFormat, info.getValue(), dataOut, bs); tightMarshalLong2(wireFormat, info.getSessionId(), dataOut, bs); } /** * Un-marshal an object instance from the data input stream * * @param o * the object to un-marshal * @param dataIn * the data input stream to build the object from * @throws IOException */ @Override public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { super.looseUnmarshal(wireFormat, o, dataIn); ProducerId info = (ProducerId) o; info.setConnectionId(looseUnmarshalString(dataIn)); info.setValue(looseUnmarshalLong(wireFormat, dataIn)); info.setSessionId(looseUnmarshalLong(wireFormat, dataIn)); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { ProducerId info = (ProducerId) o; super.looseMarshal(wireFormat, o, dataOut); looseMarshalString(info.getConnectionId(), dataOut); looseMarshalLong(wireFormat, info.getValue(), dataOut); looseMarshalLong(wireFormat, info.getSessionId(), dataOut); } }
1,338
0
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v10/ConsumerInfoMarshaller.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.codec.v10; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import org.apache.activemq.openwire.codec.BooleanStream; import org.apache.activemq.openwire.codec.OpenWireFormat; import org.apache.activemq.openwire.commands.BrokerId; import org.apache.activemq.openwire.commands.ConsumerId; import org.apache.activemq.openwire.commands.ConsumerInfo; import org.apache.activemq.openwire.commands.DataStructure; import org.apache.activemq.openwire.commands.OpenWireDestination; public class ConsumerInfoMarshaller extends BaseCommandMarshaller { /** * Return the type of Data Structure we marshal * * @return short representation of the type data structure */ @Override public byte getDataStructureType() { return ConsumerInfo.DATA_STRUCTURE_TYPE; } /** * @return a new object instance */ @Override public DataStructure createObject() { return new ConsumerInfo(); } /** * Un-marshal an object instance from the data input stream * * @param o * the object to un-marshal * @param dataIn * the data input stream to build the object from * @throws IOException */ @Override public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException { super.tightUnmarshal(wireFormat, o, dataIn, bs); ConsumerInfo info = (ConsumerInfo) o; info.setConsumerId((ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs)); info.setBrowser(bs.readBoolean()); info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs)); info.setPrefetchSize(dataIn.readInt()); info.setMaximumPendingMessageLimit(dataIn.readInt()); info.setDispatchAsync(bs.readBoolean()); info.setSelector(tightUnmarshalString(dataIn, bs)); info.setClientId(tightUnmarshalString(dataIn, bs)); info.setSubscriptionName(tightUnmarshalString(dataIn, bs)); info.setNoLocal(bs.readBoolean()); info.setExclusive(bs.readBoolean()); info.setRetroactive(bs.readBoolean()); info.setPriority(dataIn.readByte()); if (bs.readBoolean()) { short size = dataIn.readShort(); BrokerId value[] = new BrokerId[size]; for (int i = 0; i < size; i++) { value[i] = (BrokerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs); } info.setBrokerPath(value); } else { info.setBrokerPath(null); } info.setAdditionalPredicate(tightUnmarsalNestedObject(wireFormat, dataIn, bs)); info.setNetworkSubscription(bs.readBoolean()); info.setOptimizedAcknowledge(bs.readBoolean()); info.setNoRangeAcks(bs.readBoolean()); if (bs.readBoolean()) { short size = dataIn.readShort(); ConsumerId value[] = new ConsumerId[size]; for (int i = 0; i < size; i++) { value[i] = (ConsumerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs); } info.setNetworkConsumerPath(value); } else { info.setNetworkConsumerPath(null); } } /** * Write the booleans that this object uses to a BooleanStream */ @Override public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { ConsumerInfo info = (ConsumerInfo) o; int rc = super.tightMarshal1(wireFormat, o, bs); rc += tightMarshalCachedObject1(wireFormat, info.getConsumerId(), bs); bs.writeBoolean(info.isBrowser()); rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs); bs.writeBoolean(info.isDispatchAsync()); rc += tightMarshalString1(info.getSelector(), bs); rc += tightMarshalString1(info.getClientId(), bs); rc += tightMarshalString1(info.getSubscriptionName(), bs); bs.writeBoolean(info.isNoLocal()); bs.writeBoolean(info.isExclusive()); bs.writeBoolean(info.isRetroactive()); rc += tightMarshalObjectArray1(wireFormat, info.getBrokerPath(), bs); rc += tightMarshalNestedObject1(wireFormat, (DataStructure) info.getAdditionalPredicate(), bs); bs.writeBoolean(info.isNetworkSubscription()); bs.writeBoolean(info.isOptimizedAcknowledge()); bs.writeBoolean(info.isNoRangeAcks()); rc += tightMarshalObjectArray1(wireFormat, info.getNetworkConsumerPath(), bs); return rc + 9; } /** * Write a object instance to data output stream * * @param o * the instance to be marshaled * @param dataOut * the output stream * @throws IOException * thrown if an error occurs */ @Override public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { super.tightMarshal2(wireFormat, o, dataOut, bs); ConsumerInfo info = (ConsumerInfo) o; tightMarshalCachedObject2(wireFormat, info.getConsumerId(), dataOut, bs); bs.readBoolean(); tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs); dataOut.writeInt(info.getPrefetchSize()); dataOut.writeInt(info.getMaximumPendingMessageLimit()); bs.readBoolean(); tightMarshalString2(info.getSelector(), dataOut, bs); tightMarshalString2(info.getClientId(), dataOut, bs); tightMarshalString2(info.getSubscriptionName(), dataOut, bs); bs.readBoolean(); bs.readBoolean(); bs.readBoolean(); dataOut.writeByte(info.getPriority()); tightMarshalObjectArray2(wireFormat, info.getBrokerPath(), dataOut, bs); tightMarshalNestedObject2(wireFormat, (DataStructure) info.getAdditionalPredicate(), dataOut, bs); bs.readBoolean(); bs.readBoolean(); bs.readBoolean(); tightMarshalObjectArray2(wireFormat, info.getNetworkConsumerPath(), dataOut, bs); } /** * Un-marshal an object instance from the data input stream * * @param o * the object to un-marshal * @param dataIn * the data input stream to build the object from * @throws IOException */ @Override public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { super.looseUnmarshal(wireFormat, o, dataIn); ConsumerInfo info = (ConsumerInfo) o; info.setConsumerId((ConsumerId) looseUnmarsalCachedObject(wireFormat, dataIn)); info.setBrowser(dataIn.readBoolean()); info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn)); info.setPrefetchSize(dataIn.readInt()); info.setMaximumPendingMessageLimit(dataIn.readInt()); info.setDispatchAsync(dataIn.readBoolean()); info.setSelector(looseUnmarshalString(dataIn)); info.setClientId(looseUnmarshalString(dataIn)); info.setSubscriptionName(looseUnmarshalString(dataIn)); info.setNoLocal(dataIn.readBoolean()); info.setExclusive(dataIn.readBoolean()); info.setRetroactive(dataIn.readBoolean()); info.setPriority(dataIn.readByte()); if (dataIn.readBoolean()) { short size = dataIn.readShort(); BrokerId value[] = new BrokerId[size]; for (int i = 0; i < size; i++) { value[i] = (BrokerId) looseUnmarsalNestedObject(wireFormat, dataIn); } info.setBrokerPath(value); } else { info.setBrokerPath(null); } info.setAdditionalPredicate(looseUnmarsalNestedObject(wireFormat, dataIn)); info.setNetworkSubscription(dataIn.readBoolean()); info.setOptimizedAcknowledge(dataIn.readBoolean()); info.setNoRangeAcks(dataIn.readBoolean()); if (dataIn.readBoolean()) { short size = dataIn.readShort(); ConsumerId value[] = new ConsumerId[size]; for (int i = 0; i < size; i++) { value[i] = (ConsumerId) looseUnmarsalNestedObject(wireFormat, dataIn); } info.setNetworkConsumerPath(value); } else { info.setNetworkConsumerPath(null); } } /** * Write the booleans that this object uses to a BooleanStream */ @Override public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { ConsumerInfo info = (ConsumerInfo) o; super.looseMarshal(wireFormat, o, dataOut); looseMarshalCachedObject(wireFormat, info.getConsumerId(), dataOut); dataOut.writeBoolean(info.isBrowser()); looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut); dataOut.writeInt(info.getPrefetchSize()); dataOut.writeInt(info.getMaximumPendingMessageLimit()); dataOut.writeBoolean(info.isDispatchAsync()); looseMarshalString(info.getSelector(), dataOut); looseMarshalString(info.getClientId(), dataOut); looseMarshalString(info.getSubscriptionName(), dataOut); dataOut.writeBoolean(info.isNoLocal()); dataOut.writeBoolean(info.isExclusive()); dataOut.writeBoolean(info.isRetroactive()); dataOut.writeByte(info.getPriority()); looseMarshalObjectArray(wireFormat, info.getBrokerPath(), dataOut); looseMarshalNestedObject(wireFormat, (DataStructure) info.getAdditionalPredicate(), dataOut); dataOut.writeBoolean(info.isNetworkSubscription()); dataOut.writeBoolean(info.isOptimizedAcknowledge()); dataOut.writeBoolean(info.isNoRangeAcks()); looseMarshalObjectArray(wireFormat, info.getNetworkConsumerPath(), dataOut); } }
1,339
0
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v10/LocalTransactionIdMarshaller.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.codec.v10; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import org.apache.activemq.openwire.codec.BooleanStream; import org.apache.activemq.openwire.codec.OpenWireFormat; import org.apache.activemq.openwire.commands.ConnectionId; import org.apache.activemq.openwire.commands.DataStructure; import org.apache.activemq.openwire.commands.LocalTransactionId; public class LocalTransactionIdMarshaller extends TransactionIdMarshaller { /** * Return the type of Data Structure we marshal * * @return short representation of the type data structure */ @Override public byte getDataStructureType() { return LocalTransactionId.DATA_STRUCTURE_TYPE; } /** * @return a new object instance */ @Override public DataStructure createObject() { return new LocalTransactionId(); } /** * 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 */ @Override public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException { super.tightUnmarshal(wireFormat, o, dataIn, bs); LocalTransactionId info = (LocalTransactionId) o; info.setValue(tightUnmarshalLong(wireFormat, dataIn, bs)); info.setConnectionId((ConnectionId) tightUnmarsalCachedObject(wireFormat, dataIn, bs)); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { LocalTransactionId info = (LocalTransactionId) o; int rc = super.tightMarshal1(wireFormat, o, bs); rc += tightMarshalLong1(wireFormat, info.getValue(), bs); rc += tightMarshalCachedObject1(wireFormat, info.getConnectionId(), bs); return rc + 0; } /** * Write a object instance to data output stream * * @param o * the instance to be marshaled * @param dataOut * the output stream * @throws IOException * thrown if an error occurs */ @Override public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { super.tightMarshal2(wireFormat, o, dataOut, bs); LocalTransactionId info = (LocalTransactionId) o; tightMarshalLong2(wireFormat, info.getValue(), dataOut, bs); tightMarshalCachedObject2(wireFormat, info.getConnectionId(), dataOut, bs); } /** * Un-marshal an object instance from the data input stream * * @param o * the object to un-marshal * @param dataIn * the data input stream to build the object from * @throws IOException */ @Override public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { super.looseUnmarshal(wireFormat, o, dataIn); LocalTransactionId info = (LocalTransactionId) o; info.setValue(looseUnmarshalLong(wireFormat, dataIn)); info.setConnectionId((ConnectionId) looseUnmarsalCachedObject(wireFormat, dataIn)); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { LocalTransactionId info = (LocalTransactionId) o; super.looseMarshal(wireFormat, o, dataOut); looseMarshalLong(wireFormat, info.getValue(), dataOut); looseMarshalCachedObject(wireFormat, info.getConnectionId(), dataOut); } }
1,340
0
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v10/ConnectionControlMarshaller.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.codec.v10; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import org.apache.activemq.openwire.codec.BooleanStream; import org.apache.activemq.openwire.codec.OpenWireFormat; import org.apache.activemq.openwire.commands.ConnectionControl; import org.apache.activemq.openwire.commands.DataStructure; public class ConnectionControlMarshaller extends BaseCommandMarshaller { /** * Return the type of Data Structure we marshal * * @return short representation of the type data structure */ @Override public byte getDataStructureType() { return ConnectionControl.DATA_STRUCTURE_TYPE; } /** * @return a new object instance */ @Override 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 */ @Override public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException { super.tightUnmarshal(wireFormat, o, dataIn, bs); ConnectionControl info = (ConnectionControl) o; info.setClose(bs.readBoolean()); info.setExit(bs.readBoolean()); info.setFaultTolerant(bs.readBoolean()); info.setResume(bs.readBoolean()); info.setSuspend(bs.readBoolean()); info.setConnectedBrokers(tightUnmarshalString(dataIn, bs)); info.setReconnectTo(tightUnmarshalString(dataIn, bs)); info.setRebalanceConnection(bs.readBoolean()); info.setToken(tightUnmarshalByteArray(dataIn, bs)); } /** * Write the booleans that this object uses to a BooleanStream */ @Override 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()); rc += tightMarshalString1(info.getConnectedBrokers(), bs); rc += tightMarshalString1(info.getReconnectTo(), bs); bs.writeBoolean(info.isRebalanceConnection()); rc += tightMarshalByteArray1(info.getToken(), bs); return rc + 0; } /** * Write a object instance to data output stream * * @param o * the instance to be marshaled * @param dataOut * the output stream * @throws IOException * thrown if an error occurs */ @Override public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { super.tightMarshal2(wireFormat, o, dataOut, bs); ConnectionControl info = (ConnectionControl) o; bs.readBoolean(); bs.readBoolean(); bs.readBoolean(); bs.readBoolean(); bs.readBoolean(); tightMarshalString2(info.getConnectedBrokers(), dataOut, bs); tightMarshalString2(info.getReconnectTo(), dataOut, bs); bs.readBoolean(); tightMarshalByteArray2(info.getToken(), dataOut, bs); } /** * Un-marshal an object instance from the data input stream * * @param o * the object to un-marshal * @param dataIn * the data input stream to build the object from * @throws IOException */ @Override public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { super.looseUnmarshal(wireFormat, o, dataIn); ConnectionControl info = (ConnectionControl) o; info.setClose(dataIn.readBoolean()); info.setExit(dataIn.readBoolean()); info.setFaultTolerant(dataIn.readBoolean()); info.setResume(dataIn.readBoolean()); info.setSuspend(dataIn.readBoolean()); info.setConnectedBrokers(looseUnmarshalString(dataIn)); info.setReconnectTo(looseUnmarshalString(dataIn)); info.setRebalanceConnection(dataIn.readBoolean()); info.setToken(looseUnmarshalByteArray(dataIn)); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { ConnectionControl info = (ConnectionControl) o; super.looseMarshal(wireFormat, o, dataOut); dataOut.writeBoolean(info.isClose()); dataOut.writeBoolean(info.isExit()); dataOut.writeBoolean(info.isFaultTolerant()); dataOut.writeBoolean(info.isResume()); dataOut.writeBoolean(info.isSuspend()); looseMarshalString(info.getConnectedBrokers(), dataOut); looseMarshalString(info.getReconnectTo(), dataOut); dataOut.writeBoolean(info.isRebalanceConnection()); looseMarshalByteArray(wireFormat, info.getToken(), dataOut); } }
1,341
0
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v10/OpenWireTopicMarshaller.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.codec.v10; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import org.apache.activemq.openwire.codec.BooleanStream; import org.apache.activemq.openwire.codec.OpenWireFormat; import org.apache.activemq.openwire.commands.DataStructure; import org.apache.activemq.openwire.commands.OpenWireTopic; public class OpenWireTopicMarshaller extends OpenWireDestinationMarshaller { /** * Return the type of Data Structure we marshal * * @return short representation of the type data structure */ @Override public byte getDataStructureType() { return OpenWireTopic.DATA_STRUCTURE_TYPE; } /** * @return a new object instance */ @Override public DataStructure createObject() { return new OpenWireTopic(); } /** * 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 */ @Override public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException { super.tightUnmarshal(wireFormat, o, dataIn, bs); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { int rc = super.tightMarshal1(wireFormat, o, bs); return rc + 0; } /** * Write a object instance to data output stream * * @param o * the instance to be marshaled * @param dataOut * the output stream * @throws IOException * thrown if an error occurs */ @Override public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { super.tightMarshal2(wireFormat, o, dataOut, bs); } /** * Un-marshal an object instance from the data input stream * * @param o * the object to un-marshal * @param dataIn * the data input stream to build the object from * @throws IOException */ @Override public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { super.looseUnmarshal(wireFormat, o, dataIn); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { super.looseMarshal(wireFormat, o, dataOut); } }
1,342
0
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v10/IntegerResponseMarshaller.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.codec.v10; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import org.apache.activemq.openwire.codec.BooleanStream; import org.apache.activemq.openwire.codec.OpenWireFormat; import org.apache.activemq.openwire.commands.DataStructure; import org.apache.activemq.openwire.commands.IntegerResponse; public class IntegerResponseMarshaller extends ResponseMarshaller { /** * Return the type of Data Structure we marshal * * @return short representation of the type data structure */ @Override public byte getDataStructureType() { return IntegerResponse.DATA_STRUCTURE_TYPE; } /** * @return a new object instance */ @Override public DataStructure createObject() { return new IntegerResponse(); } /** * Un-marshal an object instance from the data input stream * * @param o * the object to un-marshal * @param dataIn * the data input stream to build the object from * @throws IOException */ @Override public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException { super.tightUnmarshal(wireFormat, o, dataIn, bs); IntegerResponse info = (IntegerResponse) o; info.setResult(dataIn.readInt()); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { int rc = super.tightMarshal1(wireFormat, o, bs); return rc + 4; } /** * Write a object instance to data output stream * * @param o * the instance to be marshaled * @param dataOut * the output stream * @throws IOException * thrown if an error occurs */ @Override public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { super.tightMarshal2(wireFormat, o, dataOut, bs); IntegerResponse info = (IntegerResponse) o; dataOut.writeInt(info.getResult()); } /** * Un-marshal an object instance from the data input stream * * @param o * the object to un-marshal * @param dataIn * the data input stream to build the object from * @throws IOException */ @Override public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { super.looseUnmarshal(wireFormat, o, dataIn); IntegerResponse info = (IntegerResponse) o; info.setResult(dataIn.readInt()); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { IntegerResponse info = (IntegerResponse) o; super.looseMarshal(wireFormat, o, dataOut); dataOut.writeInt(info.getResult()); } }
1,343
0
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v10/ControlCommandMarshaller.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.codec.v10; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import org.apache.activemq.openwire.codec.BooleanStream; import org.apache.activemq.openwire.codec.OpenWireFormat; import org.apache.activemq.openwire.commands.ControlCommand; import org.apache.activemq.openwire.commands.DataStructure; public class ControlCommandMarshaller extends BaseCommandMarshaller { /** * Return the type of Data Structure we marshal * * @return short representation of the type data structure */ @Override public byte getDataStructureType() { return ControlCommand.DATA_STRUCTURE_TYPE; } /** * @return a new object instance */ @Override public DataStructure createObject() { return new ControlCommand(); } /** * Un-marshal an object instance from the data input stream * * @param o * the object to un-marshal * @param dataIn * the data input stream to build the object from * @throws IOException */ @Override public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException { super.tightUnmarshal(wireFormat, o, dataIn, bs); ControlCommand info = (ControlCommand) o; info.setCommand(tightUnmarshalString(dataIn, bs)); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { ControlCommand info = (ControlCommand) o; int rc = super.tightMarshal1(wireFormat, o, bs); rc += tightMarshalString1(info.getCommand(), bs); return rc + 0; } /** * Write a object instance to data output stream * * @param o * the instance to be marshaled * @param dataOut * the output stream * @throws IOException * thrown if an error occurs */ @Override public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { super.tightMarshal2(wireFormat, o, dataOut, bs); ControlCommand info = (ControlCommand) o; tightMarshalString2(info.getCommand(), dataOut, bs); } /** * Un-marshal an object instance from the data input stream * * @param o * the object to un-marshal * @param dataIn * the data input stream to build the object from * @throws IOException */ @Override public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { super.looseUnmarshal(wireFormat, o, dataIn); ControlCommand info = (ControlCommand) o; info.setCommand(looseUnmarshalString(dataIn)); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { ControlCommand info = (ControlCommand) o; super.looseMarshal(wireFormat, o, dataOut); looseMarshalString(info.getCommand(), dataOut); } }
1,344
0
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v10/NetworkBridgeFilterMarshaller.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.codec.v10; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import org.apache.activemq.openwire.codec.BaseDataStreamMarshaller; import org.apache.activemq.openwire.codec.BooleanStream; import org.apache.activemq.openwire.codec.OpenWireFormat; import org.apache.activemq.openwire.commands.BrokerId; import org.apache.activemq.openwire.commands.DataStructure; import org.apache.activemq.openwire.commands.NetworkBridgeFilter; public class NetworkBridgeFilterMarshaller extends BaseDataStreamMarshaller { /** * Return the type of Data Structure we marshal * * @return short representation of the type data structure */ @Override public byte getDataStructureType() { return NetworkBridgeFilter.DATA_STRUCTURE_TYPE; } /** * @return a new object instance */ @Override public DataStructure createObject() { return new NetworkBridgeFilter(); } /** * 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 */ @Override public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException { super.tightUnmarshal(wireFormat, o, dataIn, bs); NetworkBridgeFilter info = (NetworkBridgeFilter) o; info.setNetworkBrokerId((BrokerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs)); info.setMessageTTL(dataIn.readInt()); info.setConsumerTTL(dataIn.readInt()); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { NetworkBridgeFilter info = (NetworkBridgeFilter) o; int rc = super.tightMarshal1(wireFormat, o, bs); rc += tightMarshalCachedObject1(wireFormat, info.getNetworkBrokerId(), bs); return rc + 8; } /** * 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 */ @Override public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { super.tightMarshal2(wireFormat, o, dataOut, bs); NetworkBridgeFilter info = (NetworkBridgeFilter) o; tightMarshalCachedObject2(wireFormat, info.getNetworkBrokerId(), dataOut, bs); dataOut.writeInt(info.getMessageTTL()); dataOut.writeInt(info.getConsumerTTL()); } /** * 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 */ @Override public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { super.looseUnmarshal(wireFormat, o, dataIn); NetworkBridgeFilter info = (NetworkBridgeFilter) o; info.setNetworkBrokerId((BrokerId) looseUnmarsalCachedObject(wireFormat, dataIn)); info.setMessageTTL(dataIn.readInt()); info.setConsumerTTL(dataIn.readInt()); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { NetworkBridgeFilter info = (NetworkBridgeFilter) o; super.looseMarshal(wireFormat, o, dataOut); looseMarshalCachedObject(wireFormat, info.getNetworkBrokerId(), dataOut); dataOut.writeInt(info.getMessageTTL()); dataOut.writeInt(info.getConsumerTTL()); } }
1,345
0
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v10/PartialCommandMarshaller.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.codec.v10; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import org.apache.activemq.openwire.codec.BaseDataStreamMarshaller; import org.apache.activemq.openwire.codec.BooleanStream; import org.apache.activemq.openwire.codec.OpenWireFormat; import org.apache.activemq.openwire.commands.DataStructure; import org.apache.activemq.openwire.commands.PartialCommand; public class PartialCommandMarshaller extends BaseDataStreamMarshaller { /** * Return the type of Data Structure we marshal * * @return short representation of the type data structure */ @Override public byte getDataStructureType() { return PartialCommand.DATA_STRUCTURE_TYPE; } /** * @return a new object instance */ @Override public DataStructure createObject() { return new PartialCommand(); } /** * 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 */ @Override public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException { super.tightUnmarshal(wireFormat, o, dataIn, bs); PartialCommand info = (PartialCommand) o; info.setCommandId(dataIn.readInt()); info.setData(tightUnmarshalByteArray(dataIn, bs)); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { PartialCommand info = (PartialCommand) o; int rc = super.tightMarshal1(wireFormat, o, bs); rc += tightMarshalByteArray1(info.getData(), 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 */ @Override public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { super.tightMarshal2(wireFormat, o, dataOut, bs); PartialCommand info = (PartialCommand) o; dataOut.writeInt(info.getCommandId()); tightMarshalByteArray2(info.getData(), dataOut, bs); } /** * Un-marshal an object instance from the data input stream * * @param o * the object to un-marshal * @param dataIn * the data input stream to build the object from * @throws IOException */ @Override public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { super.looseUnmarshal(wireFormat, o, dataIn); PartialCommand info = (PartialCommand) o; info.setCommandId(dataIn.readInt()); info.setData(looseUnmarshalByteArray(dataIn)); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { PartialCommand info = (PartialCommand) o; super.looseMarshal(wireFormat, o, dataOut); dataOut.writeInt(info.getCommandId()); looseMarshalByteArray(wireFormat, info.getData(), dataOut); } }
1,346
0
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v10/RemoveSubscriptionInfoMarshaller.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.codec.v10; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import org.apache.activemq.openwire.codec.BooleanStream; import org.apache.activemq.openwire.codec.OpenWireFormat; import org.apache.activemq.openwire.commands.ConnectionId; import org.apache.activemq.openwire.commands.DataStructure; import org.apache.activemq.openwire.commands.RemoveSubscriptionInfo; public class RemoveSubscriptionInfoMarshaller extends BaseCommandMarshaller { /** * Return the type of Data Structure we marshal * * @return short representation of the type data structure */ @Override public byte getDataStructureType() { return RemoveSubscriptionInfo.DATA_STRUCTURE_TYPE; } /** * @return a new object instance */ @Override public DataStructure createObject() { return new RemoveSubscriptionInfo(); } /** * 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 */ @Override public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException { super.tightUnmarshal(wireFormat, o, dataIn, bs); RemoveSubscriptionInfo info = (RemoveSubscriptionInfo) o; info.setConnectionId((ConnectionId) tightUnmarsalCachedObject(wireFormat, dataIn, bs)); info.setSubcriptionName(tightUnmarshalString(dataIn, bs)); info.setClientId(tightUnmarshalString(dataIn, bs)); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { RemoveSubscriptionInfo info = (RemoveSubscriptionInfo) o; int rc = super.tightMarshal1(wireFormat, o, bs); rc += tightMarshalCachedObject1(wireFormat, info.getConnectionId(), bs); rc += tightMarshalString1(info.getSubcriptionName(), bs); rc += tightMarshalString1(info.getClientId(), bs); return rc + 0; } /** * Write a object instance to data output stream * * @param o * the instance to be marshaled * @param dataOut * the output stream * @throws IOException * thrown if an error occurs */ @Override public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { super.tightMarshal2(wireFormat, o, dataOut, bs); RemoveSubscriptionInfo info = (RemoveSubscriptionInfo) o; tightMarshalCachedObject2(wireFormat, info.getConnectionId(), dataOut, bs); tightMarshalString2(info.getSubcriptionName(), dataOut, bs); tightMarshalString2(info.getClientId(), dataOut, bs); } /** * Un-marshal an object instance from the data input stream * * @param o * the object to un-marshal * @param dataIn * the data input stream to build the object from * @throws IOException */ @Override public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { super.looseUnmarshal(wireFormat, o, dataIn); RemoveSubscriptionInfo info = (RemoveSubscriptionInfo) o; info.setConnectionId((ConnectionId) looseUnmarsalCachedObject(wireFormat, dataIn)); info.setSubcriptionName(looseUnmarshalString(dataIn)); info.setClientId(looseUnmarshalString(dataIn)); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { RemoveSubscriptionInfo info = (RemoveSubscriptionInfo) o; super.looseMarshal(wireFormat, o, dataOut); looseMarshalCachedObject(wireFormat, info.getConnectionId(), dataOut); looseMarshalString(info.getSubcriptionName(), dataOut); looseMarshalString(info.getClientId(), dataOut); } }
1,347
0
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v10/MessagePullMarshaller.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.codec.v10; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import org.apache.activemq.openwire.codec.BooleanStream; import org.apache.activemq.openwire.codec.OpenWireFormat; import org.apache.activemq.openwire.commands.ConsumerId; import org.apache.activemq.openwire.commands.DataStructure; import org.apache.activemq.openwire.commands.MessageId; import org.apache.activemq.openwire.commands.MessagePull; import org.apache.activemq.openwire.commands.OpenWireDestination; public class MessagePullMarshaller extends BaseCommandMarshaller { /** * Return the type of Data Structure we marshal * * @return short representation of the type data structure */ @Override public byte getDataStructureType() { return MessagePull.DATA_STRUCTURE_TYPE; } /** * @return a new object instance */ @Override public DataStructure createObject() { return new MessagePull(); } /** * 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 */ @Override public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException { super.tightUnmarshal(wireFormat, o, dataIn, bs); MessagePull info = (MessagePull) o; info.setConsumerId((ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs)); info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs)); info.setTimeout(tightUnmarshalLong(wireFormat, dataIn, bs)); info.setCorrelationId(tightUnmarshalString(dataIn, bs)); info.setMessageId((MessageId) tightUnmarsalNestedObject(wireFormat, dataIn, bs)); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { MessagePull info = (MessagePull) o; int rc = super.tightMarshal1(wireFormat, o, bs); rc += tightMarshalCachedObject1(wireFormat, info.getConsumerId(), bs); rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs); rc += tightMarshalLong1(wireFormat, info.getTimeout(), bs); rc += tightMarshalString1(info.getCorrelationId(), bs); rc += tightMarshalNestedObject1(wireFormat, info.getMessageId(), bs); return rc + 0; } /** * Write a object instance to data output stream * * @param o * the instance to be marshaled * @param dataOut * the output stream * @throws IOException * thrown if an error occurs */ @Override public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { super.tightMarshal2(wireFormat, o, dataOut, bs); MessagePull info = (MessagePull) o; tightMarshalCachedObject2(wireFormat, info.getConsumerId(), dataOut, bs); tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs); tightMarshalLong2(wireFormat, info.getTimeout(), dataOut, bs); tightMarshalString2(info.getCorrelationId(), dataOut, bs); tightMarshalNestedObject2(wireFormat, info.getMessageId(), dataOut, bs); } /** * Un-marshal an object instance from the data input stream * * @param o * the object to un-marshal * @param dataIn * the data input stream to build the object from * @throws IOException */ @Override public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { super.looseUnmarshal(wireFormat, o, dataIn); MessagePull info = (MessagePull) o; info.setConsumerId((ConsumerId) looseUnmarsalCachedObject(wireFormat, dataIn)); info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn)); info.setTimeout(looseUnmarshalLong(wireFormat, dataIn)); info.setCorrelationId(looseUnmarshalString(dataIn)); info.setMessageId((MessageId) looseUnmarsalNestedObject(wireFormat, dataIn)); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { MessagePull info = (MessagePull) o; super.looseMarshal(wireFormat, o, dataOut); looseMarshalCachedObject(wireFormat, info.getConsumerId(), dataOut); looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut); looseMarshalLong(wireFormat, info.getTimeout(), dataOut); looseMarshalString(info.getCorrelationId(), dataOut); looseMarshalNestedObject(wireFormat, info.getMessageId(), dataOut); } }
1,348
0
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v10/JournalTopicAckMarshaller.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.codec.v10; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import org.apache.activemq.openwire.codec.BaseDataStreamMarshaller; import org.apache.activemq.openwire.codec.BooleanStream; import org.apache.activemq.openwire.codec.OpenWireFormat; import org.apache.activemq.openwire.commands.DataStructure; import org.apache.activemq.openwire.commands.JournalTopicAck; import org.apache.activemq.openwire.commands.MessageId; import org.apache.activemq.openwire.commands.OpenWireDestination; import org.apache.activemq.openwire.commands.TransactionId; public class JournalTopicAckMarshaller extends BaseDataStreamMarshaller { /** * Return the type of Data Structure we marshal * * @return short representation of the type data structure */ @Override public byte getDataStructureType() { return JournalTopicAck.DATA_STRUCTURE_TYPE; } /** * @return a new object instance */ @Override public DataStructure createObject() { return new JournalTopicAck(); } /** * Un-marshal an object instance from the data input stream * * @param o * the object to un-marshal * @param dataIn * the data input stream to build the object from * @throws IOException */ @Override public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException { super.tightUnmarshal(wireFormat, o, dataIn, bs); JournalTopicAck info = (JournalTopicAck) o; info.setDestination((OpenWireDestination) tightUnmarsalNestedObject(wireFormat, dataIn, bs)); info.setMessageId((MessageId) tightUnmarsalNestedObject(wireFormat, dataIn, bs)); info.setMessageSequenceId(tightUnmarshalLong(wireFormat, dataIn, bs)); info.setSubscritionName(tightUnmarshalString(dataIn, bs)); info.setClientId(tightUnmarshalString(dataIn, bs)); info.setTransactionId((TransactionId) tightUnmarsalNestedObject(wireFormat, dataIn, bs)); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { JournalTopicAck info = (JournalTopicAck) o; int rc = super.tightMarshal1(wireFormat, o, bs); rc += tightMarshalNestedObject1(wireFormat, info.getDestination(), bs); rc += tightMarshalNestedObject1(wireFormat, info.getMessageId(), bs); rc += tightMarshalLong1(wireFormat, info.getMessageSequenceId(), bs); rc += tightMarshalString1(info.getSubscritionName(), bs); rc += tightMarshalString1(info.getClientId(), bs); rc += tightMarshalNestedObject1(wireFormat, info.getTransactionId(), bs); return rc + 0; } /** * Write a object instance to data output stream * * @param o * the instance to be marshaled * @param dataOut * the output stream * @throws IOException * thrown if an error occurs */ @Override public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { super.tightMarshal2(wireFormat, o, dataOut, bs); JournalTopicAck info = (JournalTopicAck) o; tightMarshalNestedObject2(wireFormat, info.getDestination(), dataOut, bs); tightMarshalNestedObject2(wireFormat, info.getMessageId(), dataOut, bs); tightMarshalLong2(wireFormat, info.getMessageSequenceId(), dataOut, bs); tightMarshalString2(info.getSubscritionName(), dataOut, bs); tightMarshalString2(info.getClientId(), dataOut, bs); tightMarshalNestedObject2(wireFormat, info.getTransactionId(), dataOut, bs); } /** * Un-marshal an object instance from the data input stream * * @param o * the object to un-marshal * @param dataIn * the data input stream to build the object from * @throws IOException */ @Override public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { super.looseUnmarshal(wireFormat, o, dataIn); JournalTopicAck info = (JournalTopicAck) o; info.setDestination((OpenWireDestination) looseUnmarsalNestedObject(wireFormat, dataIn)); info.setMessageId((MessageId) looseUnmarsalNestedObject(wireFormat, dataIn)); info.setMessageSequenceId(looseUnmarshalLong(wireFormat, dataIn)); info.setSubscritionName(looseUnmarshalString(dataIn)); info.setClientId(looseUnmarshalString(dataIn)); info.setTransactionId((TransactionId) looseUnmarsalNestedObject(wireFormat, dataIn)); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { JournalTopicAck info = (JournalTopicAck) o; super.looseMarshal(wireFormat, o, dataOut); looseMarshalNestedObject(wireFormat, info.getDestination(), dataOut); looseMarshalNestedObject(wireFormat, info.getMessageId(), dataOut); looseMarshalLong(wireFormat, info.getMessageSequenceId(), dataOut); looseMarshalString(info.getSubscritionName(), dataOut); looseMarshalString(info.getClientId(), dataOut); looseMarshalNestedObject(wireFormat, info.getTransactionId(), dataOut); } }
1,349
0
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v10/DestinationInfoMarshaller.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.codec.v10; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import org.apache.activemq.openwire.codec.BooleanStream; import org.apache.activemq.openwire.codec.OpenWireFormat; import org.apache.activemq.openwire.commands.BrokerId; import org.apache.activemq.openwire.commands.ConnectionId; import org.apache.activemq.openwire.commands.DataStructure; import org.apache.activemq.openwire.commands.DestinationInfo; import org.apache.activemq.openwire.commands.OpenWireDestination; public class DestinationInfoMarshaller extends BaseCommandMarshaller { /** * Return the type of Data Structure we marshal * * @return short representation of the type data structure */ @Override public byte getDataStructureType() { return DestinationInfo.DATA_STRUCTURE_TYPE; } /** * @return a new object instance */ @Override public DataStructure createObject() { return new DestinationInfo(); } /** * Un-marshal an object instance from the data input stream * * @param o * the object to un-marshal * @param dataIn * the data input stream to build the object from * @throws IOException */ @Override public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException { super.tightUnmarshal(wireFormat, o, dataIn, bs); DestinationInfo info = (DestinationInfo) o; info.setConnectionId((ConnectionId) tightUnmarsalCachedObject(wireFormat, dataIn, bs)); info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs)); info.setOperationType(dataIn.readByte()); info.setTimeout(tightUnmarshalLong(wireFormat, dataIn, bs)); if (bs.readBoolean()) { short size = dataIn.readShort(); BrokerId value[] = new BrokerId[size]; for (int i = 0; i < size; i++) { value[i] = (BrokerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs); } info.setBrokerPath(value); } else { info.setBrokerPath(null); } } /** * Write the booleans that this object uses to a BooleanStream */ @Override public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { DestinationInfo info = (DestinationInfo) o; int rc = super.tightMarshal1(wireFormat, o, bs); rc += tightMarshalCachedObject1(wireFormat, info.getConnectionId(), bs); rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs); rc += tightMarshalLong1(wireFormat, info.getTimeout(), bs); rc += tightMarshalObjectArray1(wireFormat, info.getBrokerPath(), bs); return rc + 1; } /** * Write a object instance to data output stream * * @param o * the instance to be marshaled * @param dataOut * the output stream * @throws IOException * thrown if an error occurs */ @Override public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { super.tightMarshal2(wireFormat, o, dataOut, bs); DestinationInfo info = (DestinationInfo) o; tightMarshalCachedObject2(wireFormat, info.getConnectionId(), dataOut, bs); tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs); dataOut.writeByte(info.getOperationType()); tightMarshalLong2(wireFormat, info.getTimeout(), dataOut, bs); tightMarshalObjectArray2(wireFormat, info.getBrokerPath(), dataOut, bs); } /** * Un-marshal an object instance from the data input stream * * @param o * the object to un-marshal * @param dataIn * the data input stream to build the object from * @throws IOException */ @Override public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { super.looseUnmarshal(wireFormat, o, dataIn); DestinationInfo info = (DestinationInfo) o; info.setConnectionId((ConnectionId) looseUnmarsalCachedObject(wireFormat, dataIn)); info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn)); info.setOperationType(dataIn.readByte()); info.setTimeout(looseUnmarshalLong(wireFormat, dataIn)); if (dataIn.readBoolean()) { short size = dataIn.readShort(); BrokerId value[] = new BrokerId[size]; for (int i = 0; i < size; i++) { value[i] = (BrokerId) looseUnmarsalNestedObject(wireFormat, dataIn); } info.setBrokerPath(value); } else { info.setBrokerPath(null); } } /** * Write the booleans that this object uses to a BooleanStream */ @Override public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { DestinationInfo info = (DestinationInfo) o; super.looseMarshal(wireFormat, o, dataOut); looseMarshalCachedObject(wireFormat, info.getConnectionId(), dataOut); looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut); dataOut.writeByte(info.getOperationType()); looseMarshalLong(wireFormat, info.getTimeout(), dataOut); looseMarshalObjectArray(wireFormat, info.getBrokerPath(), dataOut); } }
1,350
0
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v10/OpenWireBlobMessageMarshaller.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.codec.v10; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import org.apache.activemq.openwire.codec.BooleanStream; import org.apache.activemq.openwire.codec.OpenWireFormat; import org.apache.activemq.openwire.commands.DataStructure; import org.apache.activemq.openwire.commands.OpenWireBlobMessage; public class OpenWireBlobMessageMarshaller extends OpenWireMessageMarshaller { /** * Return the type of Data Structure we marshal * * @return short representation of the type data structure */ @Override public byte getDataStructureType() { return OpenWireBlobMessage.DATA_STRUCTURE_TYPE; } /** * @return a new object instance */ @Override public DataStructure createObject() { return new OpenWireBlobMessage(); } /** * 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 */ @Override public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException { super.tightUnmarshal(wireFormat, o, dataIn, bs); OpenWireBlobMessage info = (OpenWireBlobMessage) o; info.setRemoteBlobUrl(tightUnmarshalString(dataIn, bs)); info.setMimeType(tightUnmarshalString(dataIn, bs)); info.setDeletedByBroker(bs.readBoolean()); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { OpenWireBlobMessage info = (OpenWireBlobMessage) o; int rc = super.tightMarshal1(wireFormat, o, bs); rc += tightMarshalString1(info.getRemoteBlobUrl(), bs); rc += tightMarshalString1(info.getMimeType(), bs); bs.writeBoolean(info.isDeletedByBroker()); 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 */ @Override public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { super.tightMarshal2(wireFormat, o, dataOut, bs); OpenWireBlobMessage info = (OpenWireBlobMessage) o; tightMarshalString2(info.getRemoteBlobUrl(), dataOut, bs); tightMarshalString2(info.getMimeType(), dataOut, bs); 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 */ @Override public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { super.looseUnmarshal(wireFormat, o, dataIn); OpenWireBlobMessage info = (OpenWireBlobMessage) o; info.setRemoteBlobUrl(looseUnmarshalString(dataIn)); info.setMimeType(looseUnmarshalString(dataIn)); info.setDeletedByBroker(dataIn.readBoolean()); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { OpenWireBlobMessage info = (OpenWireBlobMessage) o; super.looseMarshal(wireFormat, o, dataOut); looseMarshalString(info.getRemoteBlobUrl(), dataOut); looseMarshalString(info.getMimeType(), dataOut); dataOut.writeBoolean(info.isDeletedByBroker()); } }
1,351
0
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v10/DiscoveryEventMarshaller.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.codec.v10; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import org.apache.activemq.openwire.codec.BaseDataStreamMarshaller; import org.apache.activemq.openwire.codec.BooleanStream; import org.apache.activemq.openwire.codec.OpenWireFormat; import org.apache.activemq.openwire.commands.DataStructure; import org.apache.activemq.openwire.commands.DiscoveryEvent; public class DiscoveryEventMarshaller extends BaseDataStreamMarshaller { /** * Return the type of Data Structure we marshal * * @return short representation of the type data structure */ @Override public byte getDataStructureType() { return DiscoveryEvent.DATA_STRUCTURE_TYPE; } /** * @return a new object instance */ @Override public DataStructure createObject() { return new DiscoveryEvent(); } /** * Un-marshal an object instance from the data input stream * * @param o * the object to un-marshal * @param dataIn * the data input stream to build the object from * @throws IOException */ @Override public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException { super.tightUnmarshal(wireFormat, o, dataIn, bs); DiscoveryEvent info = (DiscoveryEvent) o; info.setServiceName(tightUnmarshalString(dataIn, bs)); info.setBrokerName(tightUnmarshalString(dataIn, bs)); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { DiscoveryEvent info = (DiscoveryEvent) o; int rc = super.tightMarshal1(wireFormat, o, bs); rc += tightMarshalString1(info.getServiceName(), bs); rc += tightMarshalString1(info.getBrokerName(), bs); return rc + 0; } /** * Write a object instance to data output stream * * @param o * the instance to be marshaled * @param dataOut * the output stream * @throws IOException * thrown if an error occurs */ @Override public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { super.tightMarshal2(wireFormat, o, dataOut, bs); DiscoveryEvent info = (DiscoveryEvent) o; tightMarshalString2(info.getServiceName(), dataOut, bs); tightMarshalString2(info.getBrokerName(), dataOut, bs); } /** * Un-marshal an object instance from the data input stream * * @param o * the object to un-marshal * @param dataIn * the data input stream to build the object from * @throws IOException */ @Override public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { super.looseUnmarshal(wireFormat, o, dataIn); DiscoveryEvent info = (DiscoveryEvent) o; info.setServiceName(looseUnmarshalString(dataIn)); info.setBrokerName(looseUnmarshalString(dataIn)); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { DiscoveryEvent info = (DiscoveryEvent) o; super.looseMarshal(wireFormat, o, dataOut); looseMarshalString(info.getServiceName(), dataOut); looseMarshalString(info.getBrokerName(), dataOut); } }
1,352
0
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v10/ResponseMarshaller.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.codec.v10; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import org.apache.activemq.openwire.codec.BooleanStream; import org.apache.activemq.openwire.codec.OpenWireFormat; import org.apache.activemq.openwire.commands.DataStructure; import org.apache.activemq.openwire.commands.Response; public class ResponseMarshaller extends BaseCommandMarshaller { /** * Return the type of Data Structure we marshal * * @return short representation of the type data structure */ @Override public byte getDataStructureType() { return Response.DATA_STRUCTURE_TYPE; } /** * @return a new object instance */ @Override public DataStructure createObject() { return new Response(); } /** * 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 */ @Override public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException { super.tightUnmarshal(wireFormat, o, dataIn, bs); Response info = (Response) o; info.setCorrelationId(dataIn.readInt()); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { int rc = super.tightMarshal1(wireFormat, o, bs); return rc + 4; } /** * Write a object instance to data output stream * * @param o * the instance to be marshaled * @param dataOut * the output stream * @throws IOException * thrown if an error occurs */ @Override public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { super.tightMarshal2(wireFormat, o, dataOut, bs); Response info = (Response) o; dataOut.writeInt(info.getCorrelationId()); } /** * 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 */ @Override public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { super.looseUnmarshal(wireFormat, o, dataIn); Response info = (Response) o; info.setCorrelationId(dataIn.readInt()); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { Response info = (Response) o; super.looseMarshal(wireFormat, o, dataOut); dataOut.writeInt(info.getCorrelationId()); } }
1,353
0
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v10/LastPartialCommandMarshaller.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.codec.v10; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import org.apache.activemq.openwire.codec.BooleanStream; import org.apache.activemq.openwire.codec.OpenWireFormat; import org.apache.activemq.openwire.commands.DataStructure; import org.apache.activemq.openwire.commands.LastPartialCommand; public class LastPartialCommandMarshaller extends PartialCommandMarshaller { /** * Return the type of Data Structure we marshal * * @return short representation of the type data structure */ @Override public byte getDataStructureType() { return LastPartialCommand.DATA_STRUCTURE_TYPE; } /** * @return a new object instance */ @Override public DataStructure createObject() { return new LastPartialCommand(); } /** * 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 */ @Override public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException { super.tightUnmarshal(wireFormat, o, dataIn, bs); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { int rc = super.tightMarshal1(wireFormat, o, bs); return rc + 0; } /** * Write a object instance to data output stream * * @param o * the instance to be marshaled * @param dataOut * the output stream * @throws IOException * thrown if an error occurs */ @Override public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { super.tightMarshal2(wireFormat, o, dataOut, bs); } /** * Un-marshal an object instance from the data input stream * * @param o * the object to un-marshal * @param dataIn * the data input stream to build the object from * @throws IOException */ @Override public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { super.looseUnmarshal(wireFormat, o, dataIn); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { super.looseMarshal(wireFormat, o, dataOut); } }
1,354
0
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v10/DataArrayResponseMarshaller.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.codec.v10; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import org.apache.activemq.openwire.codec.BooleanStream; import org.apache.activemq.openwire.codec.OpenWireFormat; import org.apache.activemq.openwire.commands.DataArrayResponse; import org.apache.activemq.openwire.commands.DataStructure; public class DataArrayResponseMarshaller extends ResponseMarshaller { /** * Return the type of Data Structure we marshal * * @return short representation of the type data structure */ @Override public byte getDataStructureType() { return DataArrayResponse.DATA_STRUCTURE_TYPE; } /** * @return a new object instance */ @Override public DataStructure createObject() { return new DataArrayResponse(); } /** * Un-marshal an object instance from the data input stream * * @param o * the object to un-marshal * @param dataIn * the data input stream to build the object from * @throws IOException */ @Override public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException { super.tightUnmarshal(wireFormat, o, dataIn, bs); DataArrayResponse info = (DataArrayResponse) o; if (bs.readBoolean()) { short size = dataIn.readShort(); DataStructure value[] = new DataStructure[size]; for (int i = 0; i < size; i++) { value[i] = tightUnmarsalNestedObject(wireFormat, dataIn, bs); } info.setData(value); } else { info.setData(null); } } /** * Write the booleans that this object uses to a BooleanStream */ @Override public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { DataArrayResponse info = (DataArrayResponse) o; int rc = super.tightMarshal1(wireFormat, o, bs); rc += tightMarshalObjectArray1(wireFormat, info.getData(), bs); return rc + 0; } /** * Write a object instance to data output stream * * @param o * the instance to be marshaled * @param dataOut * the output stream * @throws IOException * thrown if an error occurs */ @Override public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { super.tightMarshal2(wireFormat, o, dataOut, bs); DataArrayResponse info = (DataArrayResponse) o; tightMarshalObjectArray2(wireFormat, info.getData(), dataOut, bs); } /** * Un-marshal an object instance from the data input stream * * @param o * the object to un-marshal * @param dataIn * the data input stream to build the object from * @throws IOException */ @Override public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { super.looseUnmarshal(wireFormat, o, dataIn); DataArrayResponse info = (DataArrayResponse) o; if (dataIn.readBoolean()) { short size = dataIn.readShort(); DataStructure value[] = new DataStructure[size]; for (int i = 0; i < size; i++) { value[i] = looseUnmarsalNestedObject(wireFormat, dataIn); } info.setData(value); } else { info.setData(null); } } /** * Write the booleans that this object uses to a BooleanStream */ @Override public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { DataArrayResponse info = (DataArrayResponse) o; super.looseMarshal(wireFormat, o, dataOut); looseMarshalObjectArray(wireFormat, info.getData(), dataOut); } }
1,355
0
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v10/TransactionInfoMarshaller.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.codec.v10; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import org.apache.activemq.openwire.codec.BooleanStream; import org.apache.activemq.openwire.codec.OpenWireFormat; import org.apache.activemq.openwire.commands.ConnectionId; import org.apache.activemq.openwire.commands.DataStructure; import org.apache.activemq.openwire.commands.TransactionId; import org.apache.activemq.openwire.commands.TransactionInfo; public class TransactionInfoMarshaller extends BaseCommandMarshaller { /** * Return the type of Data Structure we marshal * * @return short representation of the type data structure */ @Override public byte getDataStructureType() { return TransactionInfo.DATA_STRUCTURE_TYPE; } /** * @return a new object instance */ @Override public DataStructure createObject() { return new TransactionInfo(); } /** * 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 */ @Override public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException { super.tightUnmarshal(wireFormat, o, dataIn, bs); TransactionInfo info = (TransactionInfo) o; info.setConnectionId((ConnectionId) tightUnmarsalCachedObject(wireFormat, dataIn, bs)); info.setTransactionId((TransactionId) tightUnmarsalCachedObject(wireFormat, dataIn, bs)); info.setType(dataIn.readByte()); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { TransactionInfo info = (TransactionInfo) o; int rc = super.tightMarshal1(wireFormat, o, bs); rc += tightMarshalCachedObject1(wireFormat, info.getConnectionId(), bs); rc += tightMarshalCachedObject1(wireFormat, info.getTransactionId(), bs); return rc + 1; } /** * Write a object instance to data output stream * * @param o * the instance to be marshaled * @param dataOut * the output stream * @throws IOException * thrown if an error occurs */ @Override public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { super.tightMarshal2(wireFormat, o, dataOut, bs); TransactionInfo info = (TransactionInfo) o; tightMarshalCachedObject2(wireFormat, info.getConnectionId(), dataOut, bs); tightMarshalCachedObject2(wireFormat, info.getTransactionId(), dataOut, bs); dataOut.writeByte(info.getType()); } /** * 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 */ @Override public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { super.looseUnmarshal(wireFormat, o, dataIn); TransactionInfo info = (TransactionInfo) o; info.setConnectionId((ConnectionId) looseUnmarsalCachedObject(wireFormat, dataIn)); info.setTransactionId((TransactionId) looseUnmarsalCachedObject(wireFormat, dataIn)); info.setType(dataIn.readByte()); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { TransactionInfo info = (TransactionInfo) o; super.looseMarshal(wireFormat, o, dataOut); looseMarshalCachedObject(wireFormat, info.getConnectionId(), dataOut); looseMarshalCachedObject(wireFormat, info.getTransactionId(), dataOut); dataOut.writeByte(info.getType()); } }
1,356
0
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v10/ProducerAckMarshaller.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.codec.v10; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import org.apache.activemq.openwire.codec.BooleanStream; import org.apache.activemq.openwire.codec.OpenWireFormat; import org.apache.activemq.openwire.commands.DataStructure; import org.apache.activemq.openwire.commands.ProducerAck; import org.apache.activemq.openwire.commands.ProducerId; public class ProducerAckMarshaller extends BaseCommandMarshaller { /** * Return the type of Data Structure we marshal * * @return short representation of the type data structure */ @Override public byte getDataStructureType() { return ProducerAck.DATA_STRUCTURE_TYPE; } /** * @return a new object instance */ @Override public DataStructure createObject() { return new ProducerAck(); } /** * 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 */ @Override public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException { super.tightUnmarshal(wireFormat, o, dataIn, bs); ProducerAck info = (ProducerAck) o; info.setProducerId((ProducerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs)); info.setSize(dataIn.readInt()); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { ProducerAck info = (ProducerAck) o; int rc = super.tightMarshal1(wireFormat, o, bs); rc += tightMarshalNestedObject1(wireFormat, info.getProducerId(), 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 */ @Override public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { super.tightMarshal2(wireFormat, o, dataOut, bs); ProducerAck info = (ProducerAck) o; tightMarshalNestedObject2(wireFormat, info.getProducerId(), dataOut, bs); dataOut.writeInt(info.getSize()); } /** * 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 */ @Override public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { super.looseUnmarshal(wireFormat, o, dataIn); ProducerAck info = (ProducerAck) o; info.setProducerId((ProducerId) looseUnmarsalNestedObject(wireFormat, dataIn)); info.setSize(dataIn.readInt()); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { ProducerAck info = (ProducerAck) o; super.looseMarshal(wireFormat, o, dataOut); looseMarshalNestedObject(wireFormat, info.getProducerId(), dataOut); dataOut.writeInt(info.getSize()); } }
1,357
0
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v10/OpenWireTempDestinationMarshaller.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.codec.v10; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import org.apache.activemq.openwire.codec.BooleanStream; import org.apache.activemq.openwire.codec.OpenWireFormat; public abstract class OpenWireTempDestinationMarshaller extends OpenWireDestinationMarshaller { /** * 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 */ @Override public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException { super.tightUnmarshal(wireFormat, o, dataIn, bs); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { int rc = super.tightMarshal1(wireFormat, o, bs); return rc + 0; } /** * Write a object instance to data output stream * * @param o * the instance to be marshaled * @param dataOut * the output stream * @throws IOException * thrown if an error occurs */ @Override public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { super.tightMarshal2(wireFormat, o, dataOut, bs); } /** * Un-marshal an object instance from the data input stream * * @param o * the object to un-marshal * @param dataIn * the data input stream to build the object from * @throws IOException */ @Override public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { super.looseUnmarshal(wireFormat, o, dataIn); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { super.looseMarshal(wireFormat, o, dataOut); } }
1,358
0
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v10/ConsumerControlMarshaller.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.codec.v10; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import org.apache.activemq.openwire.codec.BooleanStream; import org.apache.activemq.openwire.codec.OpenWireFormat; import org.apache.activemq.openwire.commands.ConsumerControl; import org.apache.activemq.openwire.commands.ConsumerId; import org.apache.activemq.openwire.commands.DataStructure; import org.apache.activemq.openwire.commands.OpenWireDestination; public class ConsumerControlMarshaller extends BaseCommandMarshaller { /** * Return the type of Data Structure we marshal * * @return short representation of the type data structure */ @Override public byte getDataStructureType() { return ConsumerControl.DATA_STRUCTURE_TYPE; } /** * @return a new object instance */ @Override 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 */ @Override public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException { super.tightUnmarshal(wireFormat, o, dataIn, bs); ConsumerControl info = (ConsumerControl) o; info.setDestination((OpenWireDestination) tightUnmarsalNestedObject(wireFormat, dataIn, bs)); info.setClose(bs.readBoolean()); info.setConsumerId((ConsumerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs)); info.setPrefetch(dataIn.readInt()); info.setFlush(bs.readBoolean()); info.setStart(bs.readBoolean()); info.setStop(bs.readBoolean()); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { ConsumerControl info = (ConsumerControl) o; int rc = super.tightMarshal1(wireFormat, o, bs); rc += tightMarshalNestedObject1(wireFormat, info.getDestination(), bs); bs.writeBoolean(info.isClose()); rc += tightMarshalNestedObject1(wireFormat, info.getConsumerId(), bs); bs.writeBoolean(info.isFlush()); bs.writeBoolean(info.isStart()); bs.writeBoolean(info.isStop()); 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 */ @Override public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { super.tightMarshal2(wireFormat, o, dataOut, bs); ConsumerControl info = (ConsumerControl) o; tightMarshalNestedObject2(wireFormat, info.getDestination(), dataOut, bs); bs.readBoolean(); tightMarshalNestedObject2(wireFormat, info.getConsumerId(), dataOut, bs); dataOut.writeInt(info.getPrefetch()); 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 */ @Override public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { super.looseUnmarshal(wireFormat, o, dataIn); ConsumerControl info = (ConsumerControl) o; info.setDestination((OpenWireDestination) looseUnmarsalNestedObject(wireFormat, dataIn)); info.setClose(dataIn.readBoolean()); info.setConsumerId((ConsumerId) looseUnmarsalNestedObject(wireFormat, dataIn)); info.setPrefetch(dataIn.readInt()); info.setFlush(dataIn.readBoolean()); info.setStart(dataIn.readBoolean()); info.setStop(dataIn.readBoolean()); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { ConsumerControl info = (ConsumerControl) o; super.looseMarshal(wireFormat, o, dataOut); looseMarshalNestedObject(wireFormat, info.getDestination(), dataOut); dataOut.writeBoolean(info.isClose()); looseMarshalNestedObject(wireFormat, info.getConsumerId(), dataOut); dataOut.writeInt(info.getPrefetch()); dataOut.writeBoolean(info.isFlush()); dataOut.writeBoolean(info.isStart()); dataOut.writeBoolean(info.isStop()); } }
1,359
0
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v10/OpenWireTextMessageMarshaller.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.codec.v10; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import org.apache.activemq.openwire.codec.BooleanStream; import org.apache.activemq.openwire.codec.OpenWireFormat; import org.apache.activemq.openwire.commands.DataStructure; import org.apache.activemq.openwire.commands.OpenWireTextMessage; public class OpenWireTextMessageMarshaller extends OpenWireMessageMarshaller { /** * Return the type of Data Structure we marshal * * @return short representation of the type data structure */ @Override public byte getDataStructureType() { return OpenWireTextMessage.DATA_STRUCTURE_TYPE; } /** * @return a new object instance */ @Override public DataStructure createObject() { return new OpenWireTextMessage(); } /** * 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 */ @Override public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException { super.tightUnmarshal(wireFormat, o, dataIn, bs); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { int rc = super.tightMarshal1(wireFormat, o, bs); return rc + 0; } /** * Write a object instance to data output stream * * @param o * the instance to be marshaled * @param dataOut * the output stream * @throws IOException * thrown if an error occurs */ @Override public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { super.tightMarshal2(wireFormat, o, dataOut, bs); } /** * Un-marshal an object instance from the data input stream * * @param o * the object to un-marshal * @param dataIn * the data input stream to build the object from * @throws IOException */ @Override public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { super.looseUnmarshal(wireFormat, o, dataIn); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { super.looseMarshal(wireFormat, o, dataOut); } }
1,360
0
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v10/BaseCommandMarshaller.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.codec.v10; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import org.apache.activemq.openwire.codec.BaseDataStreamMarshaller; import org.apache.activemq.openwire.codec.BooleanStream; import org.apache.activemq.openwire.codec.OpenWireFormat; import org.apache.activemq.openwire.commands.BaseCommand; public abstract class BaseCommandMarshaller extends BaseDataStreamMarshaller { /** * Un-marshal an object instance from the data input stream * * @param o * the object to un-marshal * @param dataIn * the data input stream to build the object from * @throws IOException */ @Override public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException { super.tightUnmarshal(wireFormat, o, dataIn, bs); BaseCommand info = (BaseCommand) o; info.setCommandId(dataIn.readInt()); info.setResponseRequired(bs.readBoolean()); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { BaseCommand info = (BaseCommand) o; int rc = super.tightMarshal1(wireFormat, o, bs); bs.writeBoolean(info.isResponseRequired()); return rc + 4; } /** * Write a object instance to data output stream * * @param o * the instance to be marshaled * @param dataOut * the output stream * @throws IOException * thrown if an error occurs */ @Override public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { super.tightMarshal2(wireFormat, o, dataOut, bs); BaseCommand info = (BaseCommand) o; dataOut.writeInt(info.getCommandId()); bs.readBoolean(); } /** * Un-marshal an object instance from the data input stream * * @param o * the object to un-marshal * @param dataIn * the data input stream to build the object from * @throws IOException */ @Override public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { super.looseUnmarshal(wireFormat, o, dataIn); BaseCommand info = (BaseCommand) o; info.setCommandId(dataIn.readInt()); info.setResponseRequired(dataIn.readBoolean()); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { BaseCommand info = (BaseCommand) o; super.looseMarshal(wireFormat, o, dataOut); dataOut.writeInt(info.getCommandId()); dataOut.writeBoolean(info.isResponseRequired()); } }
1,361
0
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v10/MarshallerFactory.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.codec.v10; import org.apache.activemq.openwire.codec.DataStreamMarshaller; import org.apache.activemq.openwire.codec.OpenWireFormat; public class MarshallerFactory { /** * Creates a Map of command type -> Marshallers */ static final private DataStreamMarshaller marshaller[] = new DataStreamMarshaller[256]; static { add(new OpenWireBlobMessageMarshaller()); add(new OpenWireBytesMessageMarshaller()); add(new OpenWireMapMessageMarshaller()); add(new OpenWireMessageMarshaller()); add(new OpenWireObjectMessageMarshaller()); add(new OpenWireQueueMarshaller()); add(new OpenWireStreamMessageMarshaller()); add(new OpenWireTempQueueMarshaller()); add(new OpenWireTempTopicMarshaller()); add(new OpenWireTextMessageMarshaller()); add(new OpenWireTopicMarshaller()); add(new BrokerIdMarshaller()); add(new BrokerInfoMarshaller()); add(new ConnectionControlMarshaller()); add(new ConnectionErrorMarshaller()); add(new ConnectionIdMarshaller()); add(new ConnectionInfoMarshaller()); add(new ConsumerControlMarshaller()); add(new ConsumerIdMarshaller()); add(new ConsumerInfoMarshaller()); add(new ControlCommandMarshaller()); add(new DataArrayResponseMarshaller()); add(new DataResponseMarshaller()); add(new DestinationInfoMarshaller()); add(new DiscoveryEventMarshaller()); add(new ExceptionResponseMarshaller()); add(new FlushCommandMarshaller()); add(new IntegerResponseMarshaller()); add(new JournalQueueAckMarshaller()); add(new JournalTopicAckMarshaller()); add(new JournalTraceMarshaller()); add(new JournalTransactionMarshaller()); add(new KeepAliveInfoMarshaller()); add(new LastPartialCommandMarshaller()); add(new LocalTransactionIdMarshaller()); add(new MessageAckMarshaller()); add(new MessageDispatchMarshaller()); add(new MessageDispatchNotificationMarshaller()); add(new MessageIdMarshaller()); add(new MessagePullMarshaller()); add(new NetworkBridgeFilterMarshaller()); add(new PartialCommandMarshaller()); add(new ProducerAckMarshaller()); add(new ProducerIdMarshaller()); add(new ProducerInfoMarshaller()); add(new RemoveInfoMarshaller()); add(new RemoveSubscriptionInfoMarshaller()); add(new ReplayCommandMarshaller()); add(new ResponseMarshaller()); add(new SessionIdMarshaller()); add(new SessionInfoMarshaller()); add(new ShutdownInfoMarshaller()); add(new SubscriptionInfoMarshaller()); add(new TransactionInfoMarshaller()); add(new WireFormatInfoMarshaller()); add(new XATransactionIdMarshaller()); } static private void add(DataStreamMarshaller dsm) { marshaller[dsm.getDataStructureType()] = dsm; } static public DataStreamMarshaller[] createMarshallerMap(OpenWireFormat wireFormat) { return marshaller; } }
1,362
0
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v10/DataResponseMarshaller.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.codec.v10; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import org.apache.activemq.openwire.codec.BooleanStream; import org.apache.activemq.openwire.codec.OpenWireFormat; import org.apache.activemq.openwire.commands.DataResponse; import org.apache.activemq.openwire.commands.DataStructure; public class DataResponseMarshaller extends ResponseMarshaller { /** * Return the type of Data Structure we marshal * * @return short representation of the type data structure */ @Override public byte getDataStructureType() { return DataResponse.DATA_STRUCTURE_TYPE; } /** * @return a new object instance */ @Override public DataStructure createObject() { return new DataResponse(); } /** * Un-marshal an object instance from the data input stream * * @param o * the object to un-marshal * @param dataIn * the data input stream to build the object from * @throws IOException */ @Override public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException { super.tightUnmarshal(wireFormat, o, dataIn, bs); DataResponse info = (DataResponse) o; info.setData(tightUnmarsalNestedObject(wireFormat, dataIn, bs)); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { DataResponse info = (DataResponse) o; int rc = super.tightMarshal1(wireFormat, o, bs); rc += tightMarshalNestedObject1(wireFormat, info.getData(), bs); return rc + 0; } /** * Write a object instance to data output stream * * @param o * the instance to be marshaled * @param dataOut * the output stream * @throws IOException * thrown if an error occurs */ @Override public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { super.tightMarshal2(wireFormat, o, dataOut, bs); DataResponse info = (DataResponse) o; tightMarshalNestedObject2(wireFormat, info.getData(), dataOut, bs); } /** * Un-marshal an object instance from the data input stream * * @param o * the object to un-marshal * @param dataIn * the data input stream to build the object from * @throws IOException */ @Override public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { super.looseUnmarshal(wireFormat, o, dataIn); DataResponse info = (DataResponse) o; info.setData(looseUnmarsalNestedObject(wireFormat, dataIn)); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { DataResponse info = (DataResponse) o; super.looseMarshal(wireFormat, o, dataOut); looseMarshalNestedObject(wireFormat, info.getData(), dataOut); } }
1,363
0
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v10/MessageDispatchNotificationMarshaller.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.codec.v10; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import org.apache.activemq.openwire.codec.BooleanStream; import org.apache.activemq.openwire.codec.OpenWireFormat; import org.apache.activemq.openwire.commands.ConsumerId; import org.apache.activemq.openwire.commands.DataStructure; import org.apache.activemq.openwire.commands.MessageDispatchNotification; import org.apache.activemq.openwire.commands.MessageId; import org.apache.activemq.openwire.commands.OpenWireDestination; public class MessageDispatchNotificationMarshaller extends BaseCommandMarshaller { /** * Return the type of Data Structure we marshal * * @return short representation of the type data structure */ @Override public byte getDataStructureType() { return MessageDispatchNotification.DATA_STRUCTURE_TYPE; } /** * @return a new object instance */ @Override public DataStructure createObject() { return new MessageDispatchNotification(); } /** * 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 */ @Override public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException { super.tightUnmarshal(wireFormat, o, dataIn, bs); MessageDispatchNotification info = (MessageDispatchNotification) o; info.setConsumerId((ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs)); info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs)); info.setDeliverySequenceId(tightUnmarshalLong(wireFormat, dataIn, bs)); info.setMessageId((MessageId) tightUnmarsalNestedObject(wireFormat, dataIn, bs)); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { MessageDispatchNotification info = (MessageDispatchNotification) o; int rc = super.tightMarshal1(wireFormat, o, bs); rc += tightMarshalCachedObject1(wireFormat, info.getConsumerId(), bs); rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs); rc += tightMarshalLong1(wireFormat, info.getDeliverySequenceId(), bs); rc += tightMarshalNestedObject1(wireFormat, info.getMessageId(), bs); return rc + 0; } /** * Write a object instance to data output stream * * @param o * the instance to be marshaled * @param dataOut * the output stream * @throws IOException * thrown if an error occurs */ @Override public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { super.tightMarshal2(wireFormat, o, dataOut, bs); MessageDispatchNotification info = (MessageDispatchNotification) o; tightMarshalCachedObject2(wireFormat, info.getConsumerId(), dataOut, bs); tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs); tightMarshalLong2(wireFormat, info.getDeliverySequenceId(), dataOut, bs); tightMarshalNestedObject2(wireFormat, info.getMessageId(), dataOut, bs); } /** * Un-marshal an object instance from the data input stream * * @param o * the object to un-marshal * @param dataIn * the data input stream to build the object from * @throws IOException */ @Override public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { super.looseUnmarshal(wireFormat, o, dataIn); MessageDispatchNotification info = (MessageDispatchNotification) o; info.setConsumerId((ConsumerId) looseUnmarsalCachedObject(wireFormat, dataIn)); info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn)); info.setDeliverySequenceId(looseUnmarshalLong(wireFormat, dataIn)); info.setMessageId((MessageId) looseUnmarsalNestedObject(wireFormat, dataIn)); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { MessageDispatchNotification info = (MessageDispatchNotification) o; super.looseMarshal(wireFormat, o, dataOut); looseMarshalCachedObject(wireFormat, info.getConsumerId(), dataOut); looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut); looseMarshalLong(wireFormat, info.getDeliverySequenceId(), dataOut); looseMarshalNestedObject(wireFormat, info.getMessageId(), dataOut); } }
1,364
0
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v10/MessageDispatchMarshaller.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.codec.v10; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import org.apache.activemq.openwire.codec.BooleanStream; import org.apache.activemq.openwire.codec.OpenWireFormat; import org.apache.activemq.openwire.commands.ConsumerId; import org.apache.activemq.openwire.commands.DataStructure; import org.apache.activemq.openwire.commands.Message; import org.apache.activemq.openwire.commands.MessageDispatch; import org.apache.activemq.openwire.commands.OpenWireDestination; public class MessageDispatchMarshaller extends BaseCommandMarshaller { /** * Return the type of Data Structure we marshal * * @return short representation of the type data structure */ @Override public byte getDataStructureType() { return MessageDispatch.DATA_STRUCTURE_TYPE; } /** * @return a new object instance */ @Override public DataStructure createObject() { return new MessageDispatch(); } /** * 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 */ @Override public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException { super.tightUnmarshal(wireFormat, o, dataIn, bs); MessageDispatch info = (MessageDispatch) o; info.setConsumerId((ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs)); info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs)); info.setMessage((Message) tightUnmarsalNestedObject(wireFormat, dataIn, bs)); info.setRedeliveryCounter(dataIn.readInt()); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { MessageDispatch info = (MessageDispatch) o; int rc = super.tightMarshal1(wireFormat, o, bs); rc += tightMarshalCachedObject1(wireFormat, info.getConsumerId(), bs); rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs); rc += tightMarshalNestedObject1(wireFormat, info.getMessage(), 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 */ @Override public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { super.tightMarshal2(wireFormat, o, dataOut, bs); MessageDispatch info = (MessageDispatch) o; tightMarshalCachedObject2(wireFormat, info.getConsumerId(), dataOut, bs); tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs); tightMarshalNestedObject2(wireFormat, info.getMessage(), dataOut, bs); dataOut.writeInt(info.getRedeliveryCounter()); } /** * 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 */ @Override public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { super.looseUnmarshal(wireFormat, o, dataIn); MessageDispatch info = (MessageDispatch) o; info.setConsumerId((ConsumerId) looseUnmarsalCachedObject(wireFormat, dataIn)); info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn)); info.setMessage((Message) looseUnmarsalNestedObject(wireFormat, dataIn)); info.setRedeliveryCounter(dataIn.readInt()); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { MessageDispatch info = (MessageDispatch) o; super.looseMarshal(wireFormat, o, dataOut); looseMarshalCachedObject(wireFormat, info.getConsumerId(), dataOut); looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut); looseMarshalNestedObject(wireFormat, info.getMessage(), dataOut); dataOut.writeInt(info.getRedeliveryCounter()); } }
1,365
0
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v10/MessageMarshaller.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.codec.v10; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import org.apache.activemq.openwire.codec.BooleanStream; import org.apache.activemq.openwire.codec.OpenWireFormat; import org.apache.activemq.openwire.commands.BrokerId; import org.apache.activemq.openwire.commands.ConsumerId; import org.apache.activemq.openwire.commands.Message; import org.apache.activemq.openwire.commands.MessageId; import org.apache.activemq.openwire.commands.OpenWireDestination; import org.apache.activemq.openwire.commands.ProducerId; import org.apache.activemq.openwire.commands.TransactionId; public abstract class MessageMarshaller extends BaseCommandMarshaller { /** * 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 */ @Override public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException { super.tightUnmarshal(wireFormat, o, dataIn, bs); Message info = (Message) o; info.beforeUnmarshall(wireFormat); info.setProducerId((ProducerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs)); info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs)); info.setTransactionId((TransactionId) tightUnmarsalCachedObject(wireFormat, dataIn, bs)); info.setOriginalDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs)); info.setMessageId((MessageId) tightUnmarsalNestedObject(wireFormat, dataIn, bs)); info.setOriginalTransactionId((TransactionId) tightUnmarsalCachedObject(wireFormat, dataIn, bs)); info.setGroupID(tightUnmarshalString(dataIn, bs)); info.setGroupSequence(dataIn.readInt()); info.setCorrelationId(tightUnmarshalString(dataIn, bs)); info.setPersistent(bs.readBoolean()); info.setExpiration(tightUnmarshalLong(wireFormat, dataIn, bs)); info.setPriority(dataIn.readByte()); info.setReplyTo((OpenWireDestination) tightUnmarsalNestedObject(wireFormat, dataIn, bs)); info.setTimestamp(tightUnmarshalLong(wireFormat, dataIn, bs)); info.setType(tightUnmarshalString(dataIn, bs)); info.setContent(tightUnmarshalByteSequence(dataIn, bs)); info.setMarshalledProperties(tightUnmarshalByteSequence(dataIn, bs)); info.setDataStructure(tightUnmarsalNestedObject(wireFormat, dataIn, bs)); info.setTargetConsumerId((ConsumerId) tightUnmarsalCachedObject(wireFormat, dataIn, bs)); info.setCompressed(bs.readBoolean()); info.setRedeliveryCounter(dataIn.readInt()); if (bs.readBoolean()) { short size = dataIn.readShort(); BrokerId value[] = new BrokerId[size]; for (int i = 0; i < size; i++) { value[i] = (BrokerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs); } info.setBrokerPath(value); } else { info.setBrokerPath(null); } info.setArrival(tightUnmarshalLong(wireFormat, dataIn, bs)); info.setUserId(tightUnmarshalString(dataIn, bs)); info.setRecievedByDFBridge(bs.readBoolean()); info.setDroppable(bs.readBoolean()); if (bs.readBoolean()) { short size = dataIn.readShort(); BrokerId value[] = new BrokerId[size]; for (int i = 0; i < size; i++) { value[i] = (BrokerId) tightUnmarsalNestedObject(wireFormat, dataIn, bs); } info.setCluster(value); } else { info.setCluster(null); } info.setBrokerInTime(tightUnmarshalLong(wireFormat, dataIn, bs)); info.setBrokerOutTime(tightUnmarshalLong(wireFormat, dataIn, bs)); info.setJMSXGroupFirstForConsumer(bs.readBoolean()); info.afterUnmarshall(wireFormat); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { Message info = (Message) o; info.beforeMarshall(wireFormat); int rc = super.tightMarshal1(wireFormat, o, bs); rc += tightMarshalCachedObject1(wireFormat, info.getProducerId(), bs); rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs); rc += tightMarshalCachedObject1(wireFormat, info.getTransactionId(), bs); rc += tightMarshalCachedObject1(wireFormat, info.getOriginalDestination(), bs); rc += tightMarshalNestedObject1(wireFormat, info.getMessageId(), bs); rc += tightMarshalCachedObject1(wireFormat, info.getOriginalTransactionId(), bs); rc += tightMarshalString1(info.getGroupId(), bs); rc += tightMarshalString1(info.getCorrelationId(), bs); bs.writeBoolean(info.isPersistent()); rc += tightMarshalLong1(wireFormat, info.getExpiration(), bs); rc += tightMarshalNestedObject1(wireFormat, info.getReplyTo(), bs); rc += tightMarshalLong1(wireFormat, info.getTimestamp(), bs); rc += tightMarshalString1(info.getType(), bs); rc += tightMarshalByteSequence1(info.getContent(), bs); rc += tightMarshalByteSequence1(info.getMarshalledProperties(), bs); rc += tightMarshalNestedObject1(wireFormat, info.getDataStructure(), bs); rc += tightMarshalCachedObject1(wireFormat, info.getTargetConsumerId(), bs); bs.writeBoolean(info.isCompressed()); rc += tightMarshalObjectArray1(wireFormat, info.getBrokerPath(), bs); rc += tightMarshalLong1(wireFormat, info.getArrival(), bs); rc += tightMarshalString1(info.getUserId(), bs); bs.writeBoolean(info.isRecievedByDFBridge()); bs.writeBoolean(info.isDroppable()); rc += tightMarshalObjectArray1(wireFormat, info.getCluster(), bs); rc += tightMarshalLong1(wireFormat, info.getBrokerInTime(), bs); rc += tightMarshalLong1(wireFormat, info.getBrokerOutTime(), bs); bs.writeBoolean(info.isJMSXGroupFirstForConsumer()); return rc + 9; } /** * Write a object instance to data output stream * * @param o * the instance to be marshaled * @param dataOut * the output stream * @throws IOException * thrown if an error occurs */ @Override public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { super.tightMarshal2(wireFormat, o, dataOut, bs); Message info = (Message) o; tightMarshalCachedObject2(wireFormat, info.getProducerId(), dataOut, bs); tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs); tightMarshalCachedObject2(wireFormat, info.getTransactionId(), dataOut, bs); tightMarshalCachedObject2(wireFormat, info.getOriginalDestination(), dataOut, bs); tightMarshalNestedObject2(wireFormat, info.getMessageId(), dataOut, bs); tightMarshalCachedObject2(wireFormat, info.getOriginalTransactionId(), dataOut, bs); tightMarshalString2(info.getGroupId(), dataOut, bs); dataOut.writeInt(info.getGroupSequence()); tightMarshalString2(info.getCorrelationId(), dataOut, bs); bs.readBoolean(); tightMarshalLong2(wireFormat, info.getExpiration(), dataOut, bs); dataOut.writeByte(info.getPriority()); tightMarshalNestedObject2(wireFormat, info.getReplyTo(), dataOut, bs); tightMarshalLong2(wireFormat, info.getTimestamp(), dataOut, bs); tightMarshalString2(info.getType(), dataOut, bs); tightMarshalByteSequence2(info.getContent(), dataOut, bs); tightMarshalByteSequence2(info.getMarshalledProperties(), dataOut, bs); tightMarshalNestedObject2(wireFormat, info.getDataStructure(), dataOut, bs); tightMarshalCachedObject2(wireFormat, info.getTargetConsumerId(), dataOut, bs); bs.readBoolean(); dataOut.writeInt(info.getRedeliveryCounter()); tightMarshalObjectArray2(wireFormat, info.getBrokerPath(), dataOut, bs); tightMarshalLong2(wireFormat, info.getArrival(), dataOut, bs); tightMarshalString2(info.getUserId(), dataOut, bs); bs.readBoolean(); bs.readBoolean(); tightMarshalObjectArray2(wireFormat, info.getCluster(), dataOut, bs); tightMarshalLong2(wireFormat, info.getBrokerInTime(), dataOut, bs); tightMarshalLong2(wireFormat, info.getBrokerOutTime(), dataOut, bs); bs.readBoolean(); info.afterMarshall(wireFormat); } /** * 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 */ @Override public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { super.looseUnmarshal(wireFormat, o, dataIn); Message info = (Message) o; info.beforeUnmarshall(wireFormat); info.setProducerId((ProducerId) looseUnmarsalCachedObject(wireFormat, dataIn)); info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn)); info.setTransactionId((TransactionId) looseUnmarsalCachedObject(wireFormat, dataIn)); info.setOriginalDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn)); info.setMessageId((MessageId) looseUnmarsalNestedObject(wireFormat, dataIn)); info.setOriginalTransactionId((TransactionId) looseUnmarsalCachedObject(wireFormat, dataIn)); info.setGroupID(looseUnmarshalString(dataIn)); info.setGroupSequence(dataIn.readInt()); info.setCorrelationId(looseUnmarshalString(dataIn)); info.setPersistent(dataIn.readBoolean()); info.setExpiration(looseUnmarshalLong(wireFormat, dataIn)); info.setPriority(dataIn.readByte()); info.setReplyTo((OpenWireDestination) looseUnmarsalNestedObject(wireFormat, dataIn)); info.setTimestamp(looseUnmarshalLong(wireFormat, dataIn)); info.setType(looseUnmarshalString(dataIn)); info.setContent(looseUnmarshalByteSequence(dataIn)); info.setMarshalledProperties(looseUnmarshalByteSequence(dataIn)); info.setDataStructure(looseUnmarsalNestedObject(wireFormat, dataIn)); info.setTargetConsumerId((ConsumerId) looseUnmarsalCachedObject(wireFormat, dataIn)); info.setCompressed(dataIn.readBoolean()); info.setRedeliveryCounter(dataIn.readInt()); if (dataIn.readBoolean()) { short size = dataIn.readShort(); BrokerId value[] = new BrokerId[size]; for (int i = 0; i < size; i++) { value[i] = (BrokerId) looseUnmarsalNestedObject(wireFormat, dataIn); } info.setBrokerPath(value); } else { info.setBrokerPath(null); } info.setArrival(looseUnmarshalLong(wireFormat, dataIn)); info.setUserId(looseUnmarshalString(dataIn)); info.setRecievedByDFBridge(dataIn.readBoolean()); info.setDroppable(dataIn.readBoolean()); if (dataIn.readBoolean()) { short size = dataIn.readShort(); BrokerId value[] = new BrokerId[size]; for (int i = 0; i < size; i++) { value[i] = (BrokerId) looseUnmarsalNestedObject(wireFormat, dataIn); } info.setCluster(value); } else { info.setCluster(null); } info.setBrokerInTime(looseUnmarshalLong(wireFormat, dataIn)); info.setBrokerOutTime(looseUnmarshalLong(wireFormat, dataIn)); info.setJMSXGroupFirstForConsumer(dataIn.readBoolean()); info.afterUnmarshall(wireFormat); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { Message info = (Message) o; info.beforeMarshall(wireFormat); super.looseMarshal(wireFormat, o, dataOut); looseMarshalCachedObject(wireFormat, info.getProducerId(), dataOut); looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut); looseMarshalCachedObject(wireFormat, info.getTransactionId(), dataOut); looseMarshalCachedObject(wireFormat, info.getOriginalDestination(), dataOut); looseMarshalNestedObject(wireFormat, info.getMessageId(), dataOut); looseMarshalCachedObject(wireFormat, info.getOriginalTransactionId(), dataOut); looseMarshalString(info.getGroupId(), dataOut); dataOut.writeInt(info.getGroupSequence()); looseMarshalString(info.getCorrelationId(), dataOut); dataOut.writeBoolean(info.isPersistent()); looseMarshalLong(wireFormat, info.getExpiration(), dataOut); dataOut.writeByte(info.getPriority()); looseMarshalNestedObject(wireFormat, info.getReplyTo(), dataOut); looseMarshalLong(wireFormat, info.getTimestamp(), dataOut); looseMarshalString(info.getType(), dataOut); looseMarshalByteSequence(wireFormat, info.getContent(), dataOut); looseMarshalByteSequence(wireFormat, info.getMarshalledProperties(), dataOut); looseMarshalNestedObject(wireFormat, info.getDataStructure(), dataOut); looseMarshalCachedObject(wireFormat, info.getTargetConsumerId(), dataOut); dataOut.writeBoolean(info.isCompressed()); dataOut.writeInt(info.getRedeliveryCounter()); looseMarshalObjectArray(wireFormat, info.getBrokerPath(), dataOut); looseMarshalLong(wireFormat, info.getArrival(), dataOut); looseMarshalString(info.getUserId(), dataOut); dataOut.writeBoolean(info.isRecievedByDFBridge()); dataOut.writeBoolean(info.isDroppable()); looseMarshalObjectArray(wireFormat, info.getCluster(), dataOut); looseMarshalLong(wireFormat, info.getBrokerInTime(), dataOut); looseMarshalLong(wireFormat, info.getBrokerOutTime(), dataOut); dataOut.writeBoolean(info.isJMSXGroupFirstForConsumer()); } }
1,366
0
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v10/TransactionIdMarshaller.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.codec.v10; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import org.apache.activemq.openwire.codec.BaseDataStreamMarshaller; import org.apache.activemq.openwire.codec.BooleanStream; import org.apache.activemq.openwire.codec.OpenWireFormat; public abstract class TransactionIdMarshaller extends BaseDataStreamMarshaller { /** * Un-marshal an object instance from the data input stream * * @param o * the object to un-marshal * @param dataIn * the data input stream to build the object from * @throws IOException */ @Override public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException { super.tightUnmarshal(wireFormat, o, dataIn, bs); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { int rc = super.tightMarshal1(wireFormat, o, bs); return rc + 0; } /** * Write a object instance to data output stream * * @param o * the instance to be marshaled * @param dataOut * the output stream * @throws IOException * thrown if an error occurs */ @Override public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { super.tightMarshal2(wireFormat, o, dataOut, bs); } /** * Un-marshal an object instance from the data input stream * * @param o * the object to un-marshal * @param dataIn * the data input stream to build the object from * @throws IOException */ @Override public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { super.looseUnmarshal(wireFormat, o, dataIn); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { super.looseMarshal(wireFormat, o, dataOut); } }
1,367
0
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v10/SubscriptionInfoMarshaller.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.codec.v10; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import org.apache.activemq.openwire.codec.BaseDataStreamMarshaller; import org.apache.activemq.openwire.codec.BooleanStream; import org.apache.activemq.openwire.codec.OpenWireFormat; import org.apache.activemq.openwire.commands.DataStructure; import org.apache.activemq.openwire.commands.OpenWireDestination; import org.apache.activemq.openwire.commands.SubscriptionInfo; public class SubscriptionInfoMarshaller extends BaseDataStreamMarshaller { /** * Return the type of Data Structure we marshal * * @return short representation of the type data structure */ @Override public byte getDataStructureType() { return SubscriptionInfo.DATA_STRUCTURE_TYPE; } /** * @return a new object instance */ @Override public DataStructure createObject() { return new SubscriptionInfo(); } /** * 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 */ @Override public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException { super.tightUnmarshal(wireFormat, o, dataIn, bs); SubscriptionInfo info = (SubscriptionInfo) o; info.setClientId(tightUnmarshalString(dataIn, bs)); info.setDestination((OpenWireDestination) tightUnmarsalCachedObject(wireFormat, dataIn, bs)); info.setSelector(tightUnmarshalString(dataIn, bs)); info.setSubcriptionName(tightUnmarshalString(dataIn, bs)); info.setSubscribedDestination((OpenWireDestination) tightUnmarsalNestedObject(wireFormat, dataIn, bs)); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { SubscriptionInfo info = (SubscriptionInfo) o; int rc = super.tightMarshal1(wireFormat, o, bs); rc += tightMarshalString1(info.getClientId(), bs); rc += tightMarshalCachedObject1(wireFormat, info.getDestination(), bs); rc += tightMarshalString1(info.getSelector(), bs); rc += tightMarshalString1(info.getSubcriptionName(), bs); rc += tightMarshalNestedObject1(wireFormat, info.getSubscribedDestination(), bs); return rc + 0; } /** * Write a object instance to data output stream * * @param o * the instance to be marshaled * @param dataOut * the output stream * @throws IOException * thrown if an error occurs */ @Override public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { super.tightMarshal2(wireFormat, o, dataOut, bs); SubscriptionInfo info = (SubscriptionInfo) o; tightMarshalString2(info.getClientId(), dataOut, bs); tightMarshalCachedObject2(wireFormat, info.getDestination(), dataOut, bs); tightMarshalString2(info.getSelector(), dataOut, bs); tightMarshalString2(info.getSubcriptionName(), dataOut, bs); tightMarshalNestedObject2(wireFormat, info.getSubscribedDestination(), dataOut, bs); } /** * Un-marshal an object instance from the data input stream * * @param o * the object to un-marshal * @param dataIn * the data input stream to build the object from * @throws IOException */ @Override public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { super.looseUnmarshal(wireFormat, o, dataIn); SubscriptionInfo info = (SubscriptionInfo) o; info.setClientId(looseUnmarshalString(dataIn)); info.setDestination((OpenWireDestination) looseUnmarsalCachedObject(wireFormat, dataIn)); info.setSelector(looseUnmarshalString(dataIn)); info.setSubcriptionName(looseUnmarshalString(dataIn)); info.setSubscribedDestination((OpenWireDestination) looseUnmarsalNestedObject(wireFormat, dataIn)); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { SubscriptionInfo info = (SubscriptionInfo) o; super.looseMarshal(wireFormat, o, dataOut); looseMarshalString(info.getClientId(), dataOut); looseMarshalCachedObject(wireFormat, info.getDestination(), dataOut); looseMarshalString(info.getSelector(), dataOut); looseMarshalString(info.getSubcriptionName(), dataOut); looseMarshalNestedObject(wireFormat, info.getSubscribedDestination(), dataOut); } }
1,368
0
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v10/ConnectionIdMarshaller.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.codec.v10; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import org.apache.activemq.openwire.codec.BaseDataStreamMarshaller; import org.apache.activemq.openwire.codec.BooleanStream; import org.apache.activemq.openwire.codec.OpenWireFormat; import org.apache.activemq.openwire.commands.ConnectionId; import org.apache.activemq.openwire.commands.DataStructure; public class ConnectionIdMarshaller extends BaseDataStreamMarshaller { /** * Return the type of Data Structure we marshal * * @return short representation of the type data structure */ @Override public byte getDataStructureType() { return ConnectionId.DATA_STRUCTURE_TYPE; } /** * @return a new object instance */ @Override public DataStructure createObject() { return new ConnectionId(); } /** * Un-marshal an object instance from the data input stream * * @param o * the object to un-marshal * @param dataIn * the data input stream to build the object from * @throws IOException */ @Override public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException { super.tightUnmarshal(wireFormat, o, dataIn, bs); ConnectionId info = (ConnectionId) o; info.setValue(tightUnmarshalString(dataIn, bs)); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { ConnectionId info = (ConnectionId) o; int rc = super.tightMarshal1(wireFormat, o, bs); rc += tightMarshalString1(info.getValue(), bs); return rc + 0; } /** * Write a object instance to data output stream * * @param o * the instance to be marshaled * @param dataOut * the output stream * @throws IOException * thrown if an error occurs */ @Override public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { super.tightMarshal2(wireFormat, o, dataOut, bs); ConnectionId info = (ConnectionId) o; tightMarshalString2(info.getValue(), dataOut, bs); } /** * Un-marshal an object instance from the data input stream * * @param o * the object to un-marshal * @param dataIn * the data input stream to build the object from * @throws IOException */ @Override public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { super.looseUnmarshal(wireFormat, o, dataIn); ConnectionId info = (ConnectionId) o; info.setValue(looseUnmarshalString(dataIn)); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { ConnectionId info = (ConnectionId) o; super.looseMarshal(wireFormat, o, dataOut); looseMarshalString(info.getValue(), dataOut); } }
1,369
0
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec
Create_ds/activemq-openwire/openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v10/JournalTransactionMarshaller.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.codec.v10; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import org.apache.activemq.openwire.codec.BaseDataStreamMarshaller; import org.apache.activemq.openwire.codec.BooleanStream; import org.apache.activemq.openwire.codec.OpenWireFormat; import org.apache.activemq.openwire.commands.DataStructure; import org.apache.activemq.openwire.commands.JournalTransaction; import org.apache.activemq.openwire.commands.TransactionId; public class JournalTransactionMarshaller extends BaseDataStreamMarshaller { /** * Return the type of Data Structure we marshal * * @return short representation of the type data structure */ @Override public byte getDataStructureType() { return JournalTransaction.DATA_STRUCTURE_TYPE; } /** * @return a new object instance */ @Override public DataStructure createObject() { return new JournalTransaction(); } /** * 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 */ @Override public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException { super.tightUnmarshal(wireFormat, o, dataIn, bs); JournalTransaction info = (JournalTransaction) o; info.setTransactionId((TransactionId) tightUnmarsalNestedObject(wireFormat, dataIn, bs)); info.setType(dataIn.readByte()); info.setWasPrepared(bs.readBoolean()); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public int tightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs) throws IOException { JournalTransaction info = (JournalTransaction) o; int rc = super.tightMarshal1(wireFormat, o, bs); rc += tightMarshalNestedObject1(wireFormat, info.getTransactionId(), bs); bs.writeBoolean(info.getWasPrepared()); return rc + 1; } /** * Write a object instance to data output stream * * @param o * the instance to be marshaled * @param dataOut * the output stream * @throws IOException * thrown if an error occurs */ @Override public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataOutput dataOut, BooleanStream bs) throws IOException { super.tightMarshal2(wireFormat, o, dataOut, bs); JournalTransaction info = (JournalTransaction) o; tightMarshalNestedObject2(wireFormat, info.getTransactionId(), dataOut, bs); dataOut.writeByte(info.getType()); 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 */ @Override public void looseUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn) throws IOException { super.looseUnmarshal(wireFormat, o, dataIn); JournalTransaction info = (JournalTransaction) o; info.setTransactionId((TransactionId) looseUnmarsalNestedObject(wireFormat, dataIn)); info.setType(dataIn.readByte()); info.setWasPrepared(dataIn.readBoolean()); } /** * Write the booleans that this object uses to a BooleanStream */ @Override public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { JournalTransaction info = (JournalTransaction) o; super.looseMarshal(wireFormat, o, dataOut); looseMarshalNestedObject(wireFormat, info.getTransactionId(), dataOut); dataOut.writeByte(info.getType()); dataOut.writeBoolean(info.getWasPrepared()); } }
1,370
0
Create_ds/activemq-openwire/openwire-generator/src/test/java/org/apache/activenq/openwire
Create_ds/activemq-openwire/openwire-generator/src/test/java/org/apache/activenq/openwire/generator/IDERunner.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activenq.openwire.generator; import org.apache.activemq.openwire.generator.GeneratorTask; /** * Runs the Generator Task from the IDE, output to target. */ public class IDERunner { public static void main(String[] args) throws Exception { GeneratorTask task = new GeneratorTask(); task.setBaseDir("./target/generated-sources/openwire"); task.execute(); } }
1,371
0
Create_ds/activemq-openwire/openwire-generator/src/main/java/org/apache/activemq/openwire
Create_ds/activemq-openwire/openwire-generator/src/main/java/org/apache/activemq/openwire/generator/AbstractGenerator.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.generator; import java.io.PrintWriter; /** * Base class that provides useful default implementations if Generator * related tasks. */ public abstract class AbstractGenerator implements Generator { private String baseDir; /** * @return the baseDir where the generator should operate. */ @Override public String getBaseDir() { return baseDir; } /** * @param baseDir * the base directory to use as the root of the generation process. */ @Override public void setBaseDir(String baseDir) { this.baseDir = baseDir; } /** * Writes the common Apache 2.0 license used in all generated source content. * * @param out * A PrintWriter instance to write the license to. */ public static void writeApacheLicense(PrintWriter out) { out.println("/*"); out.println(" * Licensed to the Apache Software Foundation (ASF) under one or more"); out.println(" * contributor license agreements. See the NOTICE file distributed with"); out.println(" * this work for additional information regarding copyright ownership."); out.println(" * The ASF licenses this file to You under the Apache License, Version 2.0"); out.println(" * (the \"License\"); you may not use this file except in compliance with"); out.println(" * the License. You may obtain a copy of the License at"); out.println(" *"); out.println(" * http://www.apache.org/licenses/LICENSE-2.0"); out.println(" *"); out.println(" * Unless required by applicable law or agreed to in writing, software"); out.println(" * distributed under the License is distributed on an \"AS IS\" BASIS,"); out.println(" * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied."); out.println(" * See the License for the specific language governing permissions and"); out.println(" * limitations under the License."); out.println(" */"); } }
1,372
0
Create_ds/activemq-openwire/openwire-generator/src/main/java/org/apache/activemq/openwire
Create_ds/activemq-openwire/openwire-generator/src/main/java/org/apache/activemq/openwire/generator/GeneratorUtils.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.generator; import static org.reflections.ReflectionUtils.getAllMethods; import static org.reflections.ReflectionUtils.withModifier; import static org.reflections.ReflectionUtils.withParametersCount; import static org.reflections.ReflectionUtils.withPrefix; import java.io.File; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.util.Set; import org.apache.activemq.openwire.annotations.OpenWireProperty; import org.apache.activemq.openwire.annotations.OpenWireType; import org.reflections.ReflectionUtils; import org.reflections.Reflections; import com.google.common.base.Predicates; /** * Collection of useful methods when generating OpenWire types. */ public class GeneratorUtils { public static final String OPENWIRE_TYPES_PACKAGE = "org.apache.activemq.openwire.commands"; public static final Reflections REFLECTIONS = new Reflections(OPENWIRE_TYPES_PACKAGE); /** * Returns the set of OpenWire types annotated with the OpenWireType marker. * * @return a set of class objects representing all the annotated OpenWire types. * * @throws Exception if an error occurs reading the types. */ public static Set<Class<?>> findOpenWireTypes() throws Exception { final Reflections reflections = new Reflections(OPENWIRE_TYPES_PACKAGE); final Set<Class<?>> protocolTypes = reflections.getTypesAnnotatedWith(OpenWireType.class); return protocolTypes; } /** * Given an OpenWire protocol object, find and return all the fields in the object * that are annotated with the OpenWireProperty marker. * * @param openWireType * the OpenWire protocol object to query for property values. * * @return a {@code Set<Field>} containing the annotated properties from the given object. * * @throws Exception if an error occurs while scanning for properties. */ public static Set<Field> finalOpenWireProperties(Class<?> openWireType) throws Exception { @SuppressWarnings("unchecked") final Set<Field> properties = ReflectionUtils.getAllFields(openWireType, ReflectionUtils.withAnnotation(OpenWireProperty.class)); return properties; } /** * Attempt to locate the get method for the given property contained in the target OpenWire * type. * * @param openWireType * The OpenWire type to search. * @param property * The property whose get method must be located. * * @return the name of the get method for the given property. * * @throws Exception if an error occurs finding the get method. */ @SuppressWarnings("unchecked") public static Method findGetMethodForProperty(Class<?> openWireType, OpenWirePropertyDescriptor property) throws Exception { if (property.getType().equals(boolean.class)) { Set<Method> getters = getAllMethods(openWireType, Predicates.and( withModifier(Modifier.PUBLIC), withPrefix("is"), withParametersCount(0))); // Found an isX method, use that. if (!getters.isEmpty()) { for (Method method : getters) { if (method.getName().equalsIgnoreCase("is" + property.getPropertyName())) { return method; } } } } Set<Method> getters = getAllMethods(openWireType, Predicates.and( withModifier(Modifier.PUBLIC), withPrefix("get"), withParametersCount(0))); // Found an getX method, use that. if (!getters.isEmpty()) { for (Method method : getters) { if (method.getName().equalsIgnoreCase("get" + property.getPropertyName())) { return method; } } } throw new IllegalArgumentException("Property class has invalid bean method names."); } /** * Attempt to locate the set method for the given property contained in the target OpenWire * type. * * @param openWireType * The OpenWire type to search. * @param property * The property whose set method must be located. * * @return the name of the set method for the given property. * * @throws Exception if an error occurs finding the set method. */ @SuppressWarnings("unchecked") public static Method findSetMethodForProperty(Class<?> openWireType, OpenWirePropertyDescriptor property) throws Exception { Set<Method> setters = getAllMethods(openWireType, Predicates.and( withModifier(Modifier.PUBLIC), withPrefix("set"), withParametersCount(1))); // Found an getX method, use that. if (!setters.isEmpty()) { for (Method method : setters) { if (method.getName().equalsIgnoreCase("set" + property.getPropertyName())) { return method; } } } throw new IllegalArgumentException("Property class has invalid bean method names."); } /** * Construct a File instance that points to the targeted output folder * * @param base * The base directory to start from. * @param targetPackage * The name of the java package where the generated code will go. * * @return a new File object that points to the output folder. * * @throws Exception if an error occurs. */ public static File createDestination(String base, String targetPackage) throws Exception { targetPackage = targetPackage.replace(".", File.separator); final File outputFolder = new File(base, targetPackage); if (!outputFolder.exists()) { outputFolder.mkdirs(); } return outputFolder; } /** * Returns the capitalize version of the given string. If the string is empty, does * not start with a letter, or is the first letter is already upper case then the * original String is returned. * * @param value * The String value to capitalize. * * @return the given value with the first letter capitalized. */ public static String capitalize(final String value) { if (value == null || value.isEmpty()) { return value; } char entry = value.charAt(0); if (!Character.isLetter(entry) || Character.isUpperCase(entry)) { return value; } return Character.toUpperCase(entry) + value.substring(1); } }
1,373
0
Create_ds/activemq-openwire/openwire-generator/src/main/java/org/apache/activemq/openwire
Create_ds/activemq-openwire/openwire-generator/src/main/java/org/apache/activemq/openwire/generator/GeneratorTask.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.generator; import java.util.ArrayList; import java.util.List; import java.util.Set; import org.apache.tools.ant.BuildException; import org.apache.tools.ant.Project; import org.apache.tools.ant.Task; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * The main task that controls the OpenWire code generation routines. */ public class GeneratorTask extends Task { private static final Logger LOG = LoggerFactory.getLogger(GeneratorTask.class); private String baseDir = "./src/main/java"; public static void main(String[] args) { Project project = new Project(); project.init(); GeneratorTask generator = new GeneratorTask(); generator.setProject(project); try { if (args.length >= 1) { generator.setBaseDir(args[1]); } generator.execute(); } catch (Exception e) { System.out.println("Error generating source:"); e.printStackTrace(); } } //----- Perform the generation by finding generators ---------------------// @Override public void execute() throws BuildException { LOG.info("==========================================================="); LOG.info("Running OpenWire Generator"); LOG.info("==========================================================="); LOG.info("Base Diractory = {}", getBaseDir()); try { List<OpenWireTypeDescriptor> descriptors = new ArrayList<OpenWireTypeDescriptor>(); Set<Class<?>> openWireTypes = GeneratorUtils.findOpenWireTypes(); for (Class<?> openWireType : openWireTypes) { LOG.info("Found OpenWire Type: {}", openWireType.getSimpleName()); descriptors.add(new OpenWireTypeDescriptor(openWireType)); } List<Generator> generators = getOpenWireGenerators(); for (Generator generator : generators) { generator.setBaseDir(getBaseDir()); generator.run(descriptors); } } catch (Exception ex) { throw new BuildException(ex); } finally { LOG.info("==========================================================="); } } /** * Returns the active generators to run with. Can be overridden by an extension. * * @return list of generators to use. */ protected List<Generator> getOpenWireGenerators() { return Generators.BUILTIN; } /** * @return the baseDir */ public String getBaseDir() { return baseDir; } /** * @param baseDir the baseDir to set */ public void setBaseDir(String baseDir) { this.baseDir = baseDir; } }
1,374
0
Create_ds/activemq-openwire/openwire-generator/src/main/java/org/apache/activemq/openwire
Create_ds/activemq-openwire/openwire-generator/src/main/java/org/apache/activemq/openwire/generator/OpenWireTypeDescriptor.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.generator; import java.lang.reflect.Field; import java.lang.reflect.Modifier; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Set; import org.apache.activemq.openwire.annotations.OpenWireType; /** * Wrapper used to describe all the elements of an OpenWire type. */ public class OpenWireTypeDescriptor { private final Class<?> openWireType; private final OpenWireType typeAnnotation; private final List<OpenWirePropertyDescriptor> properties; public OpenWireTypeDescriptor(Class<?> openWireType) throws Exception { this.openWireType = openWireType; this.typeAnnotation = openWireType.getAnnotation(OpenWireType.class); List<OpenWirePropertyDescriptor> properties = new ArrayList<OpenWirePropertyDescriptor>(); Set<Field> fields = GeneratorUtils.finalOpenWireProperties(openWireType); for (Field field : fields) { // Only track fields from the given type and not its super types. if (field.getDeclaringClass().equals(openWireType)) { properties.add(new OpenWirePropertyDescriptor(openWireType, field)); } } // Ensure ordering my marshaler sequence. Collections.sort(properties); this.properties = Collections.unmodifiableList(properties); } /** * @return the name of the OpenWire protocol type being wrapped. */ public String getTypeName() { return openWireType.getSimpleName(); } /** * @return the name of the package this type is contained in. */ public String getPackageName() { return openWireType.getPackage().getName(); } /** * @return the name of the super class of this object. */ public String getSuperClass() { Class<?> superClass = openWireType.getSuperclass(); if (superClass == null) { superClass = Object.class; } return superClass.getSimpleName(); } /** * @return the first version this type was introduced in. */ public int getVersion() { return typeAnnotation.version(); } /** * @return true if the type requires awareness of the marshaling process. */ public boolean isMarshalAware() { return typeAnnotation.marshalAware(); } /** * @return the unique OpenWire type code of this instance. */ public int getTypeCode() { return typeAnnotation.typeCode(); } /** * @return true if the OpenWire type is an abstract base of other types. */ public boolean isAbstract() { return Modifier.isAbstract(openWireType.getModifiers()); } /** * @return true if this type has properties to marshal and unmarshal. */ public boolean hasProperties() { return !properties.isEmpty(); } /** * @return the properties of this described OpenWire type. */ public List<OpenWirePropertyDescriptor> getProperties() { return properties; } }
1,375
0
Create_ds/activemq-openwire/openwire-generator/src/main/java/org/apache/activemq/openwire
Create_ds/activemq-openwire/openwire-generator/src/main/java/org/apache/activemq/openwire/generator/Generators.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.generator; import java.util.ArrayList; import java.util.List; import org.apache.activemq.openwire.generator.builtin.UniversalMarshallerFactoryGenerator; import org.apache.activemq.openwire.generator.builtin.UniversalMarshallerGenerator; /** * Directory of all generators in this library. */ public class Generators { public static List<Generator> BUILTIN = new ArrayList<Generator>(); static { BUILTIN.add(new UniversalMarshallerGenerator()); BUILTIN.add(new UniversalMarshallerFactoryGenerator()); } }
1,376
0
Create_ds/activemq-openwire/openwire-generator/src/main/java/org/apache/activemq/openwire
Create_ds/activemq-openwire/openwire-generator/src/main/java/org/apache/activemq/openwire/generator/OpenWirePropertyDescriptor.java
/* if (getType().equals(boolean.class)) { return "is" + capitalize(getPropertyName()); } else { return "get" + capitalize(getPropertyName()); } * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.generator; import java.lang.reflect.Field; import org.apache.activemq.openwire.annotations.OpenWireProperty; /** * Wraps a property of an OpenWire protocol type to provide support * for generating code to handle that property. */ public class OpenWirePropertyDescriptor implements Comparable<OpenWirePropertyDescriptor> { private final Class<?> openWireType; private final Field openWireProperty; private final OpenWireProperty propertyAnnotation; private final String getterName; private final String setterName; public OpenWirePropertyDescriptor(Class<?> openWireType, Field openWireProperty) throws Exception { this.openWireType = openWireType; this.openWireProperty = openWireProperty; this.propertyAnnotation = openWireProperty.getAnnotation(OpenWireProperty.class); this.setterName = GeneratorUtils.findSetMethodForProperty(this.openWireType, this).getName(); this.getterName = GeneratorUtils.findGetMethodForProperty(this.openWireType, this).getName(); } /** * @return the declared name of this property. */ public String getPropertyName() { return openWireProperty.getName(); } /** * @return the first OpenWire version this property appeared in */ public int getVersion() { return propertyAnnotation.version(); } /** * @return the position in the marshaling process this type should occupy. */ public int getMarshalingSequence() { return propertyAnnotation.sequence(); } /** * @return the defined size attribute for this property. */ public int getSize() { return propertyAnnotation.size(); } /** * @return */ public boolean isCached() { return propertyAnnotation.cached(); } /** * @return true if the field is an array type. */ public boolean isArray() { return openWireProperty.getType().isArray(); } /** * @return true if this property is {@link Throwable} or a descendant of {@link Throwable}. */ public boolean isThrowable() { return isThrowable(getType()); } /** * @return the Class that represents this properties type. */ public Class<?> getType() { return openWireProperty.getType(); } /** * @return the name of this property */ public String getTypeName() { return openWireProperty.getType().getSimpleName(); } /** * @return the name of the set method in the OpenWireType that handles this property. */ public String getSetterName() { return setterName; } /** * @return the name of the get method in the OpenWireType that handles this property. */ public String getGetterName() { return getterName; } private static boolean isThrowable(Class<?> type) { if (type.getCanonicalName().equals(Throwable.class.getName())) { return true; } return type.getSuperclass() != null && isThrowable(type.getSuperclass()); } @Override public int compareTo(OpenWirePropertyDescriptor other) { return Integer.compare(getMarshalingSequence(), other.getMarshalingSequence()); } }
1,377
0
Create_ds/activemq-openwire/openwire-generator/src/main/java/org/apache/activemq/openwire
Create_ds/activemq-openwire/openwire-generator/src/main/java/org/apache/activemq/openwire/generator/Generator.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.generator; import java.util.List; /** * Interface used for all Generator types. */ public interface Generator { public void run(List<OpenWireTypeDescriptor> typeDescriptors) throws Exception; public void setBaseDir(String baseDir); public String getBaseDir(); }
1,378
0
Create_ds/activemq-openwire/openwire-generator/src/main/java/org/apache/activemq/openwire/generator
Create_ds/activemq-openwire/openwire-generator/src/main/java/org/apache/activemq/openwire/generator/builtin/UniversalMarshallerGenerator.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.generator.builtin; import java.io.File; import java.io.FileWriter; import java.io.PrintWriter; import java.util.HashSet; import java.util.List; import java.util.Set; import org.apache.activemq.openwire.generator.AbstractGenerator; import org.apache.activemq.openwire.generator.GeneratorUtils; import org.apache.activemq.openwire.generator.OpenWirePropertyDescriptor; import org.apache.activemq.openwire.generator.OpenWireTypeDescriptor; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * Generator that create a set of OpenWire command marshalers that can * handle all OpenWire versions. */ public class UniversalMarshallerGenerator extends AbstractGenerator { private static final Logger LOG = LoggerFactory.getLogger(UniversalMarshallerGenerator.class); private final String codecBase = "org.apache.activemq.openwire.codec"; private final String codecPackage = codecBase + ".universal"; @Override public void run(List<OpenWireTypeDescriptor> typeDescriptors) throws Exception { final File outputFolder = GeneratorUtils.createDestination(getBaseDir(), codecPackage); LOG.info("Output location for generated marshalers is: {}", outputFolder.getAbsolutePath()); for (final OpenWireTypeDescriptor openWireType : typeDescriptors) { LOG.debug("Generating marshaller for type: {}", openWireType.getTypeName()); processClass(openWireType, outputFolder); } } /** * @return the base codec package name where the OpenWire marshalers support code lives. */ public String getCodecPackageBase() { return codecBase; } /** * @return the package name where the OpenWire marshalers are written. */ public String getCodecPackage() { return codecPackage; } //----- Implementation ---------------------------------------------------// protected void processClass(OpenWireTypeDescriptor openWireType, File outputFolder) throws Exception { final File marshalerFile = new File(outputFolder, getClassName(openWireType) + ".java"); try (PrintWriter out = new PrintWriter(new FileWriter(marshalerFile));) { LOG.debug("Output file: {}", marshalerFile.getAbsolutePath()); writeApacheLicense(out); writePreamble(out, openWireType); writeClassDefinition(out, openWireType); writeTypeSupportMethods(out, openWireType); writeTightUnmarshal(out, openWireType); writeTightMarshal1(out, openWireType); writeTightMarshal2(out, openWireType); writeLooseMarshal(out, openWireType); writeLooseUnmarshal(out, openWireType); writeClassClosure(out, openWireType); } catch (final Exception e) { throw new RuntimeException(e); } } private void writePreamble(PrintWriter out, OpenWireTypeDescriptor openWireType) { out.println("package " + getCodecPackage() + ";"); out.println(""); Set<String> languageTypes = new HashSet<String>(); for (final OpenWirePropertyDescriptor property : openWireType.getProperties()) { final Class<?> type = property.getType(); if (type.getCanonicalName().startsWith("java.util")) { languageTypes.add(type.getCanonicalName()); } // } else if (type.getCanonicalName().startsWith("org.fusesource.")) { // languageTypes.add(type.getCanonicalName()); // } } for (String languageType : languageTypes) { out.println("import " + languageType + ";"); } out.println("import java.io.DataInput;"); out.println("import java.io.DataOutput;"); out.println("import java.io.IOException;"); out.println(""); out.println("import " + getCodecPackageBase() + ".*;"); out.println("import " + openWireType.getPackageName() + ".*;"); out.println(""); } private void writeClassDefinition(PrintWriter out, OpenWireTypeDescriptor openWireType) { final String abstractModifier = openWireType.isAbstract() ? "abstract " : ""; final String className = getClassName(openWireType); final String baseClassName = getBaseClassName(openWireType); out.println("/**"); out.println(" * Marshalling code for Open Wire for " + openWireType.getTypeName() + ""); out.println(" *"); out.println(" * NOTE!: This file is auto generated - do not modify!"); out.println(" *"); out.println(" */"); out.println("public " + abstractModifier + "class " + className + " extends " + baseClassName + " {"); out.println(""); } private void writeTypeSupportMethods(PrintWriter out, OpenWireTypeDescriptor openWireType) { if (!openWireType.isAbstract()) { out.println(" /**"); out.println(" * Return the type of Data Structure handled by this Marshaler"); out.println(" *"); out.println(" * @return short representation of the type data structure"); out.println(" */"); out.println(" public byte getDataStructureType() {"); out.println(" return " + openWireType.getTypeName() + ".DATA_STRUCTURE_TYPE;"); out.println(" }"); out.println(" "); out.println(" /**"); out.println(" * @return a new instance of the managed type."); out.println(" */"); out.println(" public DataStructure createObject() {"); out.println(" return new " + openWireType.getTypeName() + "();"); out.println(" }"); out.println(""); } } private void writeTightUnmarshal(PrintWriter out, OpenWireTypeDescriptor openWireType) { out.println(" /**"); out.println(" * Un-marshal an object instance from the data input stream"); out.println(" *"); out.println(" * @param wireFormat the OpenWireFormat instance to use"); out.println(" * @param target the object to un-marshal"); out.println(" * @param dataIn the data input stream to build the object from"); out.println(" * @param bs the boolean stream where the type's booleans were marshaled"); out.println(" *"); out.println(" * @throws IOException if an error occurs while reading the data"); out.println(" */"); out.println(" public void tightUnmarshal(OpenWireFormat wireFormat, Object target, DataInput dataIn, BooleanStream bs) throws IOException {"); out.println(" super.tightUnmarshal(wireFormat, target, dataIn, bs);"); if (openWireType.hasProperties()) { out.println(""); out.println(" " + openWireType.getTypeName() + " info = (" + openWireType.getTypeName() + ") target;"); if (isOpenWireVersionNeeded(openWireType)) { out.println(" int version = wireFormat.getVersion();"); } out.println(""); } if (openWireType.isMarshalAware()) { out.println(" info.beforeUnmarshall(wireFormat);"); } for (final OpenWirePropertyDescriptor property : openWireType.getProperties()) { final int size = property.getSize(); final String typeName = property.getTypeName(); final String setter = property.getSetterName(); String indent = " "; if (property.getVersion() > 1) { indent = indent + " "; out.println(" if (version >= " + property.getVersion() + ") {"); } if (property.isArray() && !typeName.equals("byte[]")) { final String arrayType = property.getType().getComponentType().getSimpleName(); if (size > 0) { out.println(indent + "{"); out.println(indent + " " + arrayType + " value[] = new " + arrayType + "[" + size + "];"); out.println(indent + " " + "for (int i = 0; i < " + size + "; i++) {"); out.println(indent + " value[i] = (" + arrayType + ") tightUnmarsalNestedObject(wireFormat,dataIn, bs);"); out.println(indent + " }"); out.println(indent + " info." + setter + "(value);"); out.println(indent + "}"); } else { out.println(indent + "if (bs.readBoolean()) {"); out.println(indent + " short size = dataIn.readShort();"); out.println(indent + " " + arrayType + " value[] = new " + arrayType + "[size];"); out.println(indent + " for (int i = 0; i < size; i++) {"); out.println(indent + " value[i] = (" + arrayType + ") tightUnmarsalNestedObject(wireFormat,dataIn, bs);"); out.println(indent + " }"); out.println(indent + " info." + setter + "(value);"); out.println(indent + "} else {"); out.println(indent + " info." + setter + "(null);"); out.println(indent + "}"); } } else { if (typeName.equals("boolean")) { out.println(indent + "info." + setter + "(bs.readBoolean());"); } else if (typeName.equals("byte")) { out.println(indent + "info." + setter + "(dataIn.readByte());"); } else if (typeName.equals("char")) { out.println(indent + "info." + setter + "(dataIn.readChar());"); } else if (typeName.equals("short")) { out.println(indent + "info." + setter + "(dataIn.readShort());"); } else if (typeName.equals("int")) { out.println(indent + "info." + setter + "(dataIn.readInt());"); } else if (typeName.equals("long")) { out.println(indent + "info." + setter + "(tightUnmarshalLong(wireFormat, dataIn, bs));"); } else if (typeName.equals("String")) { out.println(indent + "info." + setter + "(tightUnmarshalString(dataIn, bs));"); } else if (typeName.equals("byte[]")) { if (size >= 0) { out.println(indent + "info." + setter + "(tightUnmarshalConstByteArray(dataIn, bs, " + size + "));"); } else { out.println(indent + "info." + setter + "(tightUnmarshalByteArray(dataIn, bs));"); } } else if (typeName.equals("Buffer")) { out.println(indent + "info." + setter + "(tightUnmarshalByteSequence(dataIn, bs));"); } else if (property.isThrowable()) { out.println(indent + "info." + setter + "((" + property.getTypeName() + ") tightUnmarsalThrowable(wireFormat, dataIn, bs));"); } else if (property.isCached()) { out.println(indent + "info." + setter + "((" + property.getTypeName() + ") tightUnmarsalCachedObject(wireFormat, dataIn, bs));"); } else { out.println(indent + "info." + setter + "((" + property.getTypeName() + ") tightUnmarsalNestedObject(wireFormat, dataIn, bs));"); } } if (property.getVersion() > 1) { out.println(" }"); } } if (openWireType.isMarshalAware()) { out.println(""); out.println(" info.afterUnmarshall(wireFormat);"); } out.println(" }"); out.println(""); } private void writeTightMarshal1(PrintWriter out, OpenWireTypeDescriptor openWireType) { out.println(" /**"); out.println(" * Write the booleans that this object uses to a BooleanStream"); out.println(" *"); out.println(" * @param wireFormat the OpenWireFormat instance to use"); out.println(" * @param source the object to marshal"); out.println(" * @param bs the boolean stream where the type's booleans are written"); out.println(" *"); out.println(" * @throws IOException if an error occurs while writing the data"); out.println(" */"); out.println(" public int tightMarshal1(OpenWireFormat wireFormat, Object source, BooleanStream bs) throws IOException {"); if (openWireType.hasProperties()) { out.println(" " + openWireType.getTypeName() + " info = (" + openWireType.getTypeName() + ") source;"); if (isOpenWireVersionNeeded(openWireType)) { out.println(" int version = wireFormat.getVersion();"); } } if (openWireType.isMarshalAware()) { out.println(""); out.println(" info.beforeMarshall(wireFormat);"); } out.println(""); out.println(" int rc = super.tightMarshal1(wireFormat, source, bs);"); int baseSize = 0; for (final OpenWirePropertyDescriptor property : openWireType.getProperties()) { final int size = property.getSize(); final String typeName = property.getTypeName(); final String getter = "info." + property.getGetterName() + "()"; String indent = " "; if (property.getVersion() > 1) { indent = indent + " "; out.println(" if (version >= " + property.getVersion() + ") {"); } if (typeName.equals("boolean")) { out.println(indent + "bs.writeBoolean(" + getter + ");"); } else if (typeName.equals("byte")) { baseSize += 1; } else if (typeName.equals("char")) { baseSize += 2; } else if (typeName.equals("short")) { baseSize += 2; } else if (typeName.equals("int")) { baseSize += 4; } else if (typeName.equals("long")) { out.println(indent + "rc += tightMarshalLong1(wireFormat, " + getter + ", bs);"); } else if (typeName.equals("String")) { out.println(indent + "rc += tightMarshalString1(" + getter + ", bs);"); } else if (typeName.equals("byte[]")) { if (size > 0) { out.println(indent + "rc += tightMarshalConstByteArray1(" + getter + ", bs, " + size + ");"); } else { out.println(indent + "rc += tightMarshalByteArray1(" + getter + ", bs);"); } } else if (typeName.equals("Buffer")) { out.println(indent + "rc += tightMarshalByteSequence1(" + getter + ", bs);"); } else if (property.isArray()) { if (size > 0) { out.println(indent + "rc += tightMarshalObjectArrayConstSize1(wireFormat, " + getter + ", bs, " + size + ");"); } else { out.println(indent + "rc += tightMarshalObjectArray1(wireFormat, " + getter + ", bs);"); } } else if (property.isThrowable()) { out.println(indent + "rc += tightMarshalThrowable1(wireFormat, " + getter + ", bs);"); } else { if (property.isCached()) { out.println(indent + "rc += tightMarshalCachedObject1(wireFormat, (DataStructure)" + getter + ", bs);"); } else { out.println(indent + "rc += tightMarshalNestedObject1(wireFormat, (DataStructure)" + getter + ", bs);"); } } if (property.getVersion() > 1) { out.println(" }"); } } out.println(""); out.println(" return rc + " + baseSize + ";"); out.println(" }"); out.println(""); } private void writeTightMarshal2(PrintWriter out, OpenWireTypeDescriptor openWireType) { out.println(" /**"); out.println(" * Write a object instance to data output stream"); out.println(" *"); out.println(" * @param wireFormat the OpenWireFormat instance to use"); out.println(" * @param source the object to marshal"); out.println(" * @param dataOut the DataOut where the properties are written"); out.println(" * @param bs the boolean stream where the type's booleans are written"); out.println(" *"); out.println(" * @throws IOException if an error occurs while writing the data"); out.println(" */"); out.println(" public void tightMarshal2(OpenWireFormat wireFormat, Object source, DataOutput dataOut, BooleanStream bs) throws IOException {"); out.println(" super.tightMarshal2(wireFormat, source, dataOut, bs);"); if (openWireType.hasProperties()) { out.println(""); out.println(" " + openWireType.getTypeName() + " info = (" + openWireType.getTypeName() + ") source;"); if (isOpenWireVersionNeeded(openWireType)) { out.println(" int version = wireFormat.getVersion();"); } out.println(""); } for (final OpenWirePropertyDescriptor property : openWireType.getProperties()) { final int size = property.getSize(); final String typeName = property.getTypeName(); final String getter = "info." + property.getGetterName() + "()"; String indent = " "; if (property.getVersion() > 1) { indent = indent + " "; out.println(" if (version >= " + property.getVersion() + ") {"); } if (typeName.equals("boolean")) { out.println(indent + "bs.readBoolean();"); } else if (typeName.equals("byte")) { out.println(indent + "dataOut.writeByte(" + getter + ");"); } else if (typeName.equals("char")) { out.println(indent + "dataOut.writeChar(" + getter + ");"); } else if (typeName.equals("short")) { out.println(indent + "dataOut.writeShort(" + getter + ");"); } else if (typeName.equals("int")) { out.println(indent + "dataOut.writeInt(" + getter + ");"); } else if (typeName.equals("long")) { out.println(indent + "tightMarshalLong2(wireFormat, " + getter + ", dataOut, bs);"); } else if (typeName.equals("String")) { out.println(indent + "tightMarshalString2(" + getter + ", dataOut, bs);"); } else if (typeName.equals("byte[]")) { if (size > 0) { out.println(indent + "tightMarshalConstByteArray2(" + getter + ", dataOut, bs, " + size + ");"); } else { out.println(indent + "tightMarshalByteArray2(" + getter + ", dataOut, bs);"); } } else if (typeName.equals("Buffer")) { out.println(indent + "tightMarshalByteSequence2(" + getter + ", dataOut, bs);"); } else if (property.isArray()) { if (size > 0) { out.println(indent + "tightMarshalObjectArrayConstSize2(wireFormat, " + getter + ", dataOut, bs, " + size + ");"); } else { out.println(indent + "tightMarshalObjectArray2(wireFormat, " + getter + ", dataOut, bs);"); } } else if (property.isThrowable()) { out.println(indent + "tightMarshalThrowable2(wireFormat, " + getter + ", dataOut, bs);"); } else { if (property.isCached()) { out.println(indent + "tightMarshalCachedObject2(wireFormat, (DataStructure)" + getter + ", dataOut, bs);"); } else { out.println(indent + "tightMarshalNestedObject2(wireFormat, (DataStructure)" + getter + ", dataOut, bs);"); } } if (property.getVersion() > 1) { out.println(" }"); } } if (openWireType.isMarshalAware()) { out.println(""); out.println(" info.afterMarshall(wireFormat);"); } out.println(" }"); out.println(""); } private void writeLooseUnmarshal(PrintWriter out, OpenWireTypeDescriptor openWireType) { out.println(" /**"); out.println(" * Un-marshal an object instance from the data input stream"); out.println(" *"); out.println(" * @param target the object to un-marshal"); out.println(" * @param dataIn the data input stream to build the object from"); out.println(" *"); out.println(" * @throws IOException if an error occurs while writing the data"); out.println(" */"); out.println(" public void looseUnmarshal(OpenWireFormat wireFormat, Object target, DataInput dataIn) throws IOException {"); out.println(" super.looseUnmarshal(wireFormat, target, dataIn);"); if (openWireType.hasProperties()) { out.println(""); out.println(" " + openWireType.getTypeName() + " info = (" + openWireType.getTypeName() + ") target;"); if (isOpenWireVersionNeeded(openWireType)) { out.println(" int version = wireFormat.getVersion();"); } out.println(""); } if (openWireType.isMarshalAware()) { out.println(" info.beforeUnmarshall(wireFormat);"); } for (final OpenWirePropertyDescriptor property : openWireType.getProperties()) { final int size = property.getSize(); final String typeName = property.getTypeName(); final String setter = property.getSetterName(); String indent = " "; if (property.getVersion() > 1) { indent = indent + " "; out.println(" if (version >= " + property.getVersion() + ") {"); } if (property.isArray() && !typeName.equals("byte[]")) { final String arrayType = property.getType().getComponentType().getSimpleName(); if (size > 0) { out.println(indent + "{"); out.println(indent + " " + arrayType + " value[] = new " + arrayType + "[" + size + "];"); out.println(indent + " " + "for (int i = 0; i < " + size + "; i++) {"); out.println(indent + " value[i] = (" + arrayType + ") looseUnmarsalNestedObject(wireFormat,dataIn);"); out.println(indent + " }"); out.println(indent + " info." + setter + "(value);"); out.println(indent + "}"); } else { out.println(indent + "if (dataIn.readBoolean()) {"); out.println(indent + " short size = dataIn.readShort();"); out.println(indent + " " + arrayType + " value[] = new " + arrayType + "[size];"); out.println(indent + " for (int i = 0; i < size; i++) {"); out.println(indent + " value[i] = (" + arrayType + ") looseUnmarsalNestedObject(wireFormat,dataIn);"); out.println(indent + " }"); out.println(indent + " info." + setter + "(value);"); out.println(indent + "} else {"); out.println(indent + " info." + setter + "(null);"); out.println(indent + "}"); } } else { if (typeName.equals("boolean")) { out.println(indent + "info." + setter + "(dataIn.readBoolean());"); } else if (typeName.equals("byte")) { out.println(indent + "info." + setter + "(dataIn.readByte());"); } else if (typeName.equals("char")) { out.println(indent + "info." + setter + "(dataIn.readChar());"); } else if (typeName.equals("short")) { out.println(indent + "info." + setter + "(dataIn.readShort());"); } else if (typeName.equals("int")) { out.println(indent + "info." + setter + "(dataIn.readInt());"); } else if (typeName.equals("long")) { out.println(indent + "info." + setter + "(looseUnmarshalLong(wireFormat, dataIn));"); } else if (typeName.equals("String")) { out.println(indent + "info." + setter + "(looseUnmarshalString(dataIn));"); } else if (typeName.equals("byte[]")) { if (size > 0) { out.println(indent + "info." + setter + "(looseUnmarshalConstByteArray(dataIn, " + size + "));"); } else { out.println(indent + "info." + setter + "(looseUnmarshalByteArray(dataIn));"); } } else if (typeName.equals("Buffer")) { out.println(indent + "info." + setter + "(looseUnmarshalByteSequence(dataIn));"); } else if (property.isThrowable()) { out.println(indent + "info." + setter + "((" + typeName + ") looseUnmarsalThrowable(wireFormat, dataIn));"); } else if (property.isCached()) { out.println(indent + "info." + setter + "((" + typeName + ") looseUnmarsalCachedObject(wireFormat, dataIn));"); } else { out.println(indent + "info." + setter + "((" + typeName + ") looseUnmarsalNestedObject(wireFormat, dataIn));"); } } if (property.getVersion() > 1) { out.println(" }"); } } if (openWireType.isMarshalAware()) { out.println(""); out.println(" info.afterUnmarshall(wireFormat);"); } out.println(" }"); } private void writeLooseMarshal(PrintWriter out, OpenWireTypeDescriptor openWireType) { out.println(" /**"); out.println(" * Write the object to the output using loose marshaling."); out.println(" *"); out.println(" * @throws IOException if an error occurs while writing the data"); out.println(" */"); out.println(" public void looseMarshal(OpenWireFormat wireFormat, Object source, DataOutput dataOut) throws IOException {"); if (openWireType.hasProperties()) { out.println(" " + openWireType.getTypeName() + " info = (" + openWireType.getTypeName() + ") source;"); if (isOpenWireVersionNeeded(openWireType)) { out.println(" int version = wireFormat.getVersion();"); } out.println(""); } if (openWireType.isMarshalAware()) { out.println(" info.beforeMarshall(wireFormat);"); } out.println(" super.looseMarshal(wireFormat, source, dataOut);"); for (final OpenWirePropertyDescriptor property : openWireType.getProperties()) { final int size = property.getSize(); final String typeName = property.getTypeName(); final String getter = "info." + property.getGetterName() + "()"; String indent = " "; if (property.getVersion() > 1) { indent = indent + " "; out.println(" if (version >= " + property.getVersion() + ") {"); } if (typeName.equals("boolean")) { out.println(indent + "dataOut.writeBoolean(" + getter + ");"); } else if (typeName.equals("byte")) { out.println(indent + "dataOut.writeByte(" + getter + ");"); } else if (typeName.equals("char")) { out.println(indent + "dataOut.writeChar(" + getter + ");"); } else if (typeName.equals("short")) { out.println(indent + "dataOut.writeShort(" + getter + ");"); } else if (typeName.equals("int")) { out.println(indent + "dataOut.writeInt(" + getter + ");"); } else if (typeName.equals("long")) { out.println(indent + "looseMarshalLong(wireFormat, " + getter + ", dataOut);"); } else if (typeName.equals("String")) { out.println(indent + "looseMarshalString(" + getter + ", dataOut);"); } else if (typeName.equals("byte[]")) { if (size > 0) { out.println(indent + "looseMarshalConstByteArray(wireFormat, " + getter + ", dataOut, " + size + ");"); } else { out.println(indent + "looseMarshalByteArray(wireFormat, " + getter + ", dataOut);"); } } else if (typeName.equals("Buffer")) { out.println(indent + "looseMarshalByteSequence(wireFormat, " + getter + ", dataOut);"); } else if (property.isArray()) { if (size > 0) { out.println(indent + "looseMarshalObjectArrayConstSize(wireFormat, " + getter + ", dataOut, " + size + ");"); } else { out.println(indent + "looseMarshalObjectArray(wireFormat, " + getter + ", dataOut);"); } } else if (property.isThrowable()) { out.println(indent + "looseMarshalThrowable(wireFormat, " + getter + ", dataOut);"); } else { if (property.isCached()) { out.println(indent + "looseMarshalCachedObject(wireFormat, (DataStructure)" + getter + ", dataOut);"); } else { out.println(indent + "looseMarshalNestedObject(wireFormat, (DataStructure)" + getter + ", dataOut);"); } } if (property.getVersion() > 1) { out.println(" }"); } } if (openWireType.isMarshalAware()) { out.println(""); out.println(" info.afterMarshall(wireFormat);"); } out.println(" }"); out.println(""); } private void writeClassClosure(PrintWriter out, OpenWireTypeDescriptor openWireType) { out.println("}"); } //----- Helper Methods for Code Generation -------------------------------// private boolean isOpenWireVersionNeeded(OpenWireTypeDescriptor openWireType) { for (final OpenWirePropertyDescriptor property : openWireType.getProperties()) { if (property.getVersion() > 1) { return true; } } return false; } private String getClassName(OpenWireTypeDescriptor openWireType) { return openWireType.getTypeName() + "Marshaller"; } private String getBaseClassName(OpenWireTypeDescriptor openWireType) { String answer = "BaseDataStreamMarshaller"; final String superName = openWireType.getSuperClass(); if (!superName.equals("Object") && !superName.equals("JNDIBaseStorable") && !superName.equals("DataStructureSupport")) { answer = superName + "Marshaller"; } return answer; } }
1,379
0
Create_ds/activemq-openwire/openwire-generator/src/main/java/org/apache/activemq/openwire/generator
Create_ds/activemq-openwire/openwire-generator/src/main/java/org/apache/activemq/openwire/generator/builtin/UniversalMarshallerFactoryGenerator.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.generator.builtin; import java.io.File; import java.io.FileWriter; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.List; import org.apache.activemq.openwire.generator.AbstractGenerator; import org.apache.activemq.openwire.generator.GeneratorUtils; import org.apache.activemq.openwire.generator.OpenWireTypeDescriptor; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * Generates a MarshallerFactory instance that can be used to create the * codec configuration in the OpenWireFormat object. */ public class UniversalMarshallerFactoryGenerator extends AbstractGenerator { private static final Logger LOG = LoggerFactory.getLogger(UniversalMarshallerFactoryGenerator.class); private final String codecBase = "org.apache.activemq.openwire.codec"; private final String codecPackage = codecBase + ".universal"; private String factoryFileName = "MarshallerFactory"; @Override public void run(List<OpenWireTypeDescriptor> typeDescriptors) throws Exception { final File outputFolder = GeneratorUtils.createDestination(getBaseDir(), codecPackage); LOG.info("Output location for generated marshaler factory is: {}", outputFolder.getAbsolutePath()); final File factoryFile = new File(outputFolder, getFactoryFileName() + ".java"); LOG.debug("Generating marshaller Factory: {}", factoryFile); try (PrintWriter out = new PrintWriter(new FileWriter(factoryFile));) { writeApacheLicense(out); writePreamble(out); writeClassDefinition(out); writeFactoryImplementation(out, typeDescriptors); writeClassClosure(out); } catch (final Exception e) { throw new RuntimeException(e); } } //----- Factory creation methods -----------------------------------------// private void writePreamble(PrintWriter out) { out.println("package " + getCodecPackage() + ";"); out.println(""); out.println("import " + getCodecPackageBase() + ".DataStreamMarshaller;"); out.println("import " + getCodecPackageBase() + ".OpenWireFormat;"); out.println(""); } private void writeClassDefinition(PrintWriter out) { out.println("/**"); out.println(" * Marshalling Factory for the Universal OpenWire Codec package."); out.println(" *"); out.println(" * NOTE!: This file is auto generated - do not modify!"); out.println(" *"); out.println(" */"); out.println("public class " + getFactoryFileName() + "{"); out.println(""); } private void writeFactoryImplementation(PrintWriter out, List<OpenWireTypeDescriptor> typeDescriptors) { out.println(" /**"); out.println(" * Creates a Map of command type -> Marshallers"); out.println(" */"); out.println(" static final private DataStreamMarshaller marshaller[] = new DataStreamMarshaller[256];"); out.println(" static {"); out.println(""); List<OpenWireTypeDescriptor> sorted = new ArrayList<OpenWireTypeDescriptor>(typeDescriptors); Collections.sort(sorted, new Comparator<OpenWireTypeDescriptor>() { @Override public int compare(OpenWireTypeDescriptor o1, OpenWireTypeDescriptor o2) { return o1.getTypeName().compareTo(o2.getTypeName()); } }); for (final OpenWireTypeDescriptor openWireType : sorted) { if (!openWireType.isAbstract()) { out.println(" add(new " + openWireType.getTypeName() + "Marshaller());"); } } out.println(" }"); out.println(""); out.println(" static private void add(DataStreamMarshaller dsm) {"); out.println(" marshaller[dsm.getDataStructureType()] = dsm;"); out.println(" }"); out.println(""); out.println(" static public DataStreamMarshaller[] createMarshallerMap(OpenWireFormat wireFormat) {"); out.println(" return marshaller;"); out.println(" }"); } private void writeClassClosure(PrintWriter out) { out.println("}"); } //----- Public Property access methods -----------------------------------// /** * @return the base codec package name where the OpenWire marshalers support code lives. */ public String getCodecPackageBase() { return codecBase; } /** * @return the package name where the OpenWire marshalers are written. */ public String getCodecPackage() { return codecPackage; } public String getFactoryFileName() { return factoryFileName; } public void setFactoryFileName(String factoryFileName) { this.factoryFileName = factoryFileName; } }
1,380
0
Create_ds/activemq-openwire/openwire-annotations/src/main/java/org/apache/activemq/openwire
Create_ds/activemq-openwire/openwire-annotations/src/main/java/org/apache/activemq/openwire/annotations/OpenWireType.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.TYPE}) public @interface OpenWireType { int typeCode(); int version() default 1; boolean marshalAware() default false; }
1,381
0
Create_ds/activemq-openwire/openwire-annotations/src/main/java/org/apache/activemq/openwire
Create_ds/activemq-openwire/openwire-annotations/src/main/java/org/apache/activemq/openwire/annotations/OpenWireProperty.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Defines the annotation value for the properties of an OpenWire data type. */ @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.FIELD}) public @interface OpenWireProperty { int version(); int sequence(); boolean cached() default false; boolean serialized() default true; boolean mandatory() default false; int size() default 0; }
1,382
0
Create_ds/activemq-openwire/openwire-annotations/src/main/java/org/apache/activemq/openwire
Create_ds/activemq-openwire/openwire-annotations/src/main/java/org/apache/activemq/openwire/annotations/OpenWireExtension.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Defines the annotation value to use to describes any extensions * to a given OpenWire data type that is not part of the marshaled * data for that type. */ @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.FIELD}) public @interface OpenWireExtension { /** * Defines if the extension is transient or not. * * @return true if the value should not be marked as transient. */ boolean serialized() default false; }
1,383
0
Create_ds/activemq-openwire/openwire-annotations/src/main/java/org/apache/activemq/openwire
Create_ds/activemq-openwire/openwire-annotations/src/main/java/org/apache/activemq/openwire/annotations/OpenWireDocumentation.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.annotations; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; /** * Used to add documentation notes to an OpenWire command or one its properties. */ @Retention(RetentionPolicy.RUNTIME) public @interface OpenWireDocumentation { /** * @return a quick one sentence description of the element. */ String shortDescription(); /** * @return a longer more thorough description of the element. */ String longDescription() default ""; }
1,384
0
Create_ds/activemq-openwire/openwire-core/src/test/java/org/apache/activemq/openwire
Create_ds/activemq-openwire/openwire-core/src/test/java/org/apache/activemq/openwire/codec/BooleanStreamTest.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.codec; import static org.junit.Assert.assertEquals; import static org.junit.Assert.fail; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; import junit.framework.AssertionFailedError; import org.apache.activemq.openwire.codec.BooleanStream; import org.apache.activemq.openwire.codec.OpenWireFormat; import org.apache.activemq.openwire.commands.CommandTypes; import org.junit.Before; import org.junit.Test; /** * Test for the OpenWire BooleanStream class. */ public class BooleanStreamTest { protected OpenWireFormat openWireformat; protected int endOfStreamMarker = 0x12345678; int numberOfBytes = 8 * 200; interface BooleanValueSet { boolean getBooleanValueFor(int index, int count); } @Test public void testBooleanMarshallingUsingAllTrue() throws Exception { testBooleanStream(numberOfBytes, new BooleanValueSet() { @Override public boolean getBooleanValueFor(int index, int count) { return true; } }); } @Test public void testBooleanMarshallingUsingAllFalse() throws Exception { testBooleanStream(numberOfBytes, new BooleanValueSet() { @Override public boolean getBooleanValueFor(int index, int count) { return false; } }); } @Test public void testBooleanMarshallingUsingOddAlternateTrueFalse() throws Exception { testBooleanStream(numberOfBytes, new BooleanValueSet() { @Override public boolean getBooleanValueFor(int index, int count) { return (index & 1) == 0; } }); } @Test public void testBooleanMarshallingUsingEvenAlternateTrueFalse() throws Exception { testBooleanStream(numberOfBytes, new BooleanValueSet() { @Override public boolean getBooleanValueFor(int index, int count) { return (index & 1) != 0; } }); } protected void testBooleanStream(int numberOfBytes, BooleanValueSet valueSet) throws Exception { for (int i = 0; i < numberOfBytes; i++) { try { assertMarshalBooleans(i, valueSet); } catch (Throwable e) { throw (AssertionFailedError) new AssertionFailedError("Iteration failed at: " + i).initCause(e); } } } protected void assertMarshalBooleans(int count, BooleanValueSet valueSet) throws Exception { BooleanStream bs = new BooleanStream(); for (int i = 0; i < count; i++) { bs.writeBoolean(valueSet.getBooleanValueFor(i, count)); } ByteArrayOutputStream buffer = new ByteArrayOutputStream(); DataOutputStream ds = new DataOutputStream(buffer); bs.marshal(ds); ds.writeInt(endOfStreamMarker); // now lets read from the stream ds.close(); ByteArrayInputStream in = new ByteArrayInputStream(buffer.toByteArray()); DataInputStream dis = new DataInputStream(in); bs = new BooleanStream(); try { bs.unmarshal(dis); } catch (Exception e) { e.printStackTrace(); fail("Failed to unmarshal: " + count + " booleans: " + e); } for (int i = 0; i < count; i++) { boolean expected = valueSet.getBooleanValueFor(i, count); try { boolean actual = bs.readBoolean(); assertEquals("value of object: " + i + " was: " + actual, expected, actual); } catch (IOException e) { e.printStackTrace(); fail("Failed to parse boolean: " + i + " out of: " + count + " due to: " + e); } } int marker = dis.readInt(); assertEquals("Marker int when unmarshalling: " + count + " booleans", Integer.toHexString(endOfStreamMarker), Integer.toHexString(marker)); // lets try read and we should get an exception try { dis.readByte(); fail("Should have reached the end of the stream"); } catch (IOException e) { // worked! } } @Before public void setUp() throws Exception { openWireformat = createOpenWireFormat(); } protected OpenWireFormat createOpenWireFormat() { OpenWireFormat wf = new OpenWireFormat(CommandTypes.PROTOCOL_VERSION); wf.setCacheEnabled(true); wf.setStackTraceEnabled(false); wf.setVersion(1); return wf; } }
1,385
0
Create_ds/activemq-openwire/openwire-core/src/test/java/org/apache/activemq/openwire
Create_ds/activemq-openwire/openwire-core/src/test/java/org/apache/activemq/openwire/codec/NumberRangesWhileMarshallingTest.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.codec; import static org.junit.Assert.assertEquals; import static org.junit.Assert.fail; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; import org.apache.activemq.openwire.codec.OpenWireFormat; import org.apache.activemq.openwire.commands.CommandTypes; import org.apache.activemq.openwire.commands.OpenWireTextMessage; import org.apache.activemq.openwire.commands.SessionId; import org.junit.Before; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class NumberRangesWhileMarshallingTest { private static final Logger LOG = LoggerFactory.getLogger(NumberRangesWhileMarshallingTest.class); protected String connectionId = "Cheese"; protected ByteArrayOutputStream buffer = new ByteArrayOutputStream(); protected DataOutputStream ds = new DataOutputStream(buffer); protected OpenWireFormat openWireformat; protected int endOfStreamMarker = 0x12345678; @Test public void testLongNumberRanges() throws Exception { long[] numberValues = { // bytes 0, 1, 0x7e, 0x7f, 0x80, 0x81, 0xf0, 0xff, // shorts 0x7eff, 0x7fffL, 0x8001L, 0x8000L, 0xe000L, 0xe0001L, 0xff00L, 0xffffL, // ints 0x10000L, 0x700000L, 0x12345678L, 0x72345678L, 0x7fffffffL, 0x80000000L, 0x80000001L, 0xE0000001L, 0xFFFFFFFFL, // 3 byte longs 0x123456781L, 0x1234567812L, 0x12345678123L, 0x123456781234L, 0x1234567812345L, 0x12345678123456L, 0x7e345678123456L, 0x7fffffffffffffL, 0x80000000000000L, 0x80000000000001L, 0xe0000000000001L, 0xffffffffffffffL, // 4 byte longs 0x1234567812345678L, 0x7fffffffffffffffL, 0x8000000000000000L, 0x8000000000000001L, 0xe000000000000001L, 0xffffffffffffffffL, 1 }; for (int i = 0; i < numberValues.length; i++) { long value = numberValues[i]; SessionId object = new SessionId(); object.setConnectionId(connectionId); object.setValue(value); writeObject(object); } ds.writeInt(endOfStreamMarker); // now lets read from the stream ds.close(); ByteArrayInputStream in = new ByteArrayInputStream(buffer.toByteArray()); DataInputStream dis = new DataInputStream(in); for (int i = 0; i < numberValues.length; i++) { long value = numberValues[i]; String expected = Long.toHexString(value); LOG.info("Unmarshaling value: " + i + " = " + expected); SessionId command = (SessionId) openWireformat.unmarshal(dis); assertEquals("connection ID in object: " + i, connectionId, command.getConnectionId()); String actual = Long.toHexString(command.getValue()); assertEquals("value of object: " + i + " was: " + actual, expected, actual); } int marker = dis.readInt(); assertEquals("Marker int", Integer.toHexString(endOfStreamMarker), Integer.toHexString(marker)); // lets try read and we should get an exception try { byte value = dis.readByte(); fail("Should have reached the end of the stream: " + value); } catch (IOException e) { // worked! } } @Test public void testMaxFrameSize() throws Exception { OpenWireFormat wf = new OpenWireFormat(CommandTypes.PROTOCOL_VERSION); wf.setMaxFrameSize(10); OpenWireTextMessage msg = new OpenWireTextMessage(); msg.setText("This is a test"); writeObject(msg); ds.writeInt(endOfStreamMarker); // now lets read from the stream ds.close(); ByteArrayInputStream in = new ByteArrayInputStream(buffer.toByteArray()); DataInputStream dis = new DataInputStream(in); try { wf.unmarshal(dis); } catch (IOException ioe) { return; } fail("Should fail because of the large frame size"); } @Test public void testDefaultMaxFrameSizeUnlimited() { OpenWireFormat wf = new OpenWireFormat(CommandTypes.PROTOCOL_VERSION); assertEquals(Long.MAX_VALUE, wf.getMaxFrameSize()); } @Before public void setUp() throws Exception { openWireformat = createOpenWireFormat(); } protected OpenWireFormat createOpenWireFormat() { OpenWireFormat wf = new OpenWireFormat(CommandTypes.PROTOCOL_VERSION); wf.setCacheEnabled(true); wf.setStackTraceEnabled(false); wf.setVersion(1); return wf; } private void writeObject(Object object) throws IOException { openWireformat.marshal(object, ds); } }
1,386
0
Create_ds/activemq-openwire/openwire-core/src/test/java/org/apache/activemq/openwire
Create_ds/activemq-openwire/openwire-core/src/test/java/org/apache/activemq/openwire/utils/OpenWireMarshallingSupportTest.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.utils; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import java.io.DataInputStream; import org.apache.activemq.openwire.buffer.DataByteArrayInputStream; import org.apache.activemq.openwire.buffer.DataByteArrayOutputStream; import org.junit.Test; public class OpenWireMarshallingSupportTest { @Test public void testMarshalBoolean() throws Exception { DataByteArrayOutputStream dataOut = new DataByteArrayOutputStream(); OpenWireMarshallingSupport.marshalBoolean(dataOut, false); OpenWireMarshallingSupport.marshalBoolean(dataOut, true); DataByteArrayInputStream input = new DataByteArrayInputStream(dataOut.toBuffer()); DataInputStream dataIn = new DataInputStream(input); Boolean result = (Boolean) OpenWireMarshallingSupport.unmarshalPrimitive(dataIn); assertFalse(result); result = (Boolean) OpenWireMarshallingSupport.unmarshalPrimitive(dataIn); assertTrue(result); } }
1,387
0
Create_ds/activemq-openwire/openwire-core/src/test/java/org/apache/activemq/openwire
Create_ds/activemq-openwire/openwire-core/src/test/java/org/apache/activemq/openwire/utils/MarshallingSupport.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.utils; import java.io.DataOutput; import java.io.IOException; /** * Support functions for dealing with data in OpenWire. */ public class MarshallingSupport { public static void writeUTF8(DataOutput dataOut, String text) throws IOException { if (text != null) { int strlen = text.length(); int utflen = 0; char[] charr = new char[strlen]; int c = 0; int count = 0; text.getChars(0, strlen, charr, 0); for (int i = 0; i < strlen; i++) { c = charr[i]; if ((c >= 0x0001) && (c <= 0x007F)) { utflen++; } else if (c > 0x07FF) { utflen += 3; } else { utflen += 2; } } // TODO diff: Sun code - removed byte[] bytearr = new byte[utflen + 4]; // TODO diff: Sun code bytearr[count++] = (byte) ((utflen >>> 24) & 0xFF); // TODO diff: // Sun code bytearr[count++] = (byte) ((utflen >>> 16) & 0xFF); // TODO diff: // Sun code bytearr[count++] = (byte) ((utflen >>> 8) & 0xFF); bytearr[count++] = (byte) ((utflen >>> 0) & 0xFF); for (int i = 0; i < strlen; i++) { c = charr[i]; if ((c >= 0x0001) && (c <= 0x007F)) { bytearr[count++] = (byte) c; } else if (c > 0x07FF) { bytearr[count++] = (byte) (0xE0 | ((c >> 12) & 0x0F)); bytearr[count++] = (byte) (0x80 | ((c >> 6) & 0x3F)); bytearr[count++] = (byte) (0x80 | ((c >> 0) & 0x3F)); } else { bytearr[count++] = (byte) (0xC0 | ((c >> 6) & 0x1F)); bytearr[count++] = (byte) (0x80 | ((c >> 0) & 0x3F)); } } dataOut.write(bytearr); } else { dataOut.writeInt(-1); } } }
1,388
0
Create_ds/activemq-openwire/openwire-core/src/test/java/org/apache/activemq/openwire
Create_ds/activemq-openwire/openwire-core/src/test/java/org/apache/activemq/openwire/commands/OpenWireBytesMessageTest.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.commands; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import org.apache.activemq.openwire.commands.CommandTypes; import org.apache.activemq.openwire.commands.OpenWireBytesMessage; import org.junit.Test; public class OpenWireBytesMessageTest { // The following text should compress well private static final String TEXT = "The quick red fox jumped over the lazy brown dog. " + "The quick red fox jumped over the lazy brown dog. " + "The quick red fox jumped over the lazy brown dog. " + "The quick red fox jumped over the lazy brown dog. " + "The quick red fox jumped over the lazy brown dog. " + "The quick red fox jumped over the lazy brown dog. " + "The quick red fox jumped over the lazy brown dog. " + "The quick red fox jumped over the lazy brown dog. " + "The quick red fox jumped over the lazy brown dog. " + "The quick red fox jumped over the lazy brown dog. " + "The quick red fox jumped over the lazy brown dog. " + "The quick red fox jumped over the lazy brown dog. " + "The quick red fox jumped over the lazy brown dog. " + "The quick red fox jumped over the lazy brown dog. " + "The quick red fox jumped over the lazy brown dog. " + "The quick red fox jumped over the lazy brown dog. " + "The quick red fox jumped over the lazy brown dog. "; @Test public void testGetDataStructureType() { OpenWireBytesMessage msg = new OpenWireBytesMessage(); assertEquals(msg.getDataStructureType(), CommandTypes.OPENWIRE_BYTES_MESSAGE); } @Test public void testGetBodyLength() throws Exception { OpenWireBytesMessage msg = new OpenWireBytesMessage(); byte[] data = new byte[80]; for (byte i = 0; i < data.length; i++) { data[i] = i; } msg.setBodyBytes(data); assertTrue(msg.getBodyLength() == 80); } @Test public void testBodyCompression() throws Exception { OpenWireBytesMessage message = new OpenWireBytesMessage(); message.setUseCompression(true); message.setBodyBytes(TEXT.getBytes("UTF8")); int compressedSize = message.getContent().getLength(); byte[] bytes = message.getBodyBytes(); assertTrue(compressedSize < bytes.length); String rcvString = new String(bytes, "UTF8"); assertEquals(TEXT.length(), rcvString.length()); assertEquals(TEXT, rcvString); assertTrue(message.isCompressed()); } }
1,389
0
Create_ds/activemq-openwire/openwire-core/src/test/java/org/apache/activemq/openwire
Create_ds/activemq-openwire/openwire-core/src/test/java/org/apache/activemq/openwire/commands/OpenWireMapMessageTest.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.commands; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import java.io.IOException; import java.util.Collections; import java.util.Enumeration; import java.util.List; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TestName; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class OpenWireMapMessageTest { private static final Logger LOG = LoggerFactory.getLogger(OpenWireMapMessageTest.class); @Rule public TestName name = new TestName(); @Test public void testBytesConversion() throws Exception { OpenWireMapMessage msg = new OpenWireMapMessage(); msg.setObject("boolean", true); msg.setObject("byte", (byte) 1); msg.setObject("bytes", new byte[1]); msg.setObject("char", 'a'); msg.setObject("double", 1.5); msg.setObject("float", 1.5f); msg.setObject("int", 1); msg.setObject("long", 1L); msg.setObject("object", "stringObj"); msg.setObject("short", (short) 1); msg.setObject("string", "string"); // Test with a 1Meg String StringBuffer bigSB = new StringBuffer(1024 * 1024); for (int i = 0; i < 1024 * 1024; i++) { bigSB.append('a' + i % 26); } String bigString = bigSB.toString(); msg.setObject("bigString", bigString); msg = msg.copy(); assertEquals(msg.getObject("boolean"), true); assertEquals(msg.getObject("byte"), (byte) 1); assertEquals(((byte[]) msg.getObject("bytes")).length, 1); assertEquals(msg.getObject("char"), 'a'); assertEquals((Double) msg.getObject("double"), 1.5, 0); assertEquals((Float) msg.getObject("float"), 1.5f, 0); assertEquals(msg.getObject("int"), 1); assertEquals(msg.getObject("long"), 1L); assertEquals(msg.getObject("object"), "stringObj"); assertEquals(msg.getObject("short"), (short) 1); assertEquals(msg.getObject("string"), "string"); assertEquals(msg.getObject("bigString"), bigString); } @Test public void testGetObject() throws Exception { OpenWireMapMessage msg = new OpenWireMapMessage(); Boolean booleanValue = Boolean.TRUE; Byte byteValue = Byte.valueOf("1"); byte[] bytesValue = new byte[3]; Character charValue = new Character('a'); Double doubleValue = Double.valueOf("1.5"); Float floatValue = Float.valueOf("1.5"); Integer intValue = Integer.valueOf("1"); Long longValue = Long.valueOf("1"); Short shortValue = Short.valueOf("1"); String stringValue = "string"; try { msg.setObject("boolean", booleanValue); msg.setObject("byte", byteValue); msg.setObject("bytes", bytesValue); msg.setObject("char", charValue); msg.setObject("double", doubleValue); msg.setObject("float", floatValue); msg.setObject("int", intValue); msg.setObject("long", longValue); msg.setObject("short", shortValue); msg.setObject("string", stringValue); } catch (IOException ioe) { LOG.warn("Caught: " + ioe); ioe.printStackTrace(); fail("object formats should be correct"); } msg = msg.copy(); assertTrue(msg.getObject("boolean") instanceof Boolean); assertEquals(msg.getObject("boolean"), booleanValue); assertTrue(msg.getObject("byte") instanceof Byte); assertEquals(msg.getObject("byte"), byteValue); assertTrue(msg.getObject("bytes") instanceof byte[]); assertEquals(((byte[]) msg.getObject("bytes")).length, bytesValue.length); assertEquals(((byte[])msg.getObject("bytes")).length, bytesValue.length); assertTrue(msg.getObject("char") instanceof Character); assertEquals(msg.getObject("char"), charValue); assertTrue(msg.getObject("double") instanceof Double); assertEquals(msg.getObject("double"), doubleValue); assertTrue(msg.getObject("float") instanceof Float); assertEquals(msg.getObject("float"), floatValue); assertTrue(msg.getObject("int") instanceof Integer); assertEquals(msg.getObject("int"), intValue); assertTrue(msg.getObject("long") instanceof Long); assertEquals(msg.getObject("long"), longValue); assertTrue(msg.getObject("short") instanceof Short); assertEquals(msg.getObject("short"), shortValue); assertTrue(msg.getObject("string") instanceof String); assertEquals(msg.getObject("string"), stringValue); msg.clearBody(); try { msg.setObject("object", new Object()); fail("should have thrown exception"); } catch (IllegalArgumentException e) { } } @Test public void testGetMapNames() throws Exception { OpenWireMapMessage msg = new OpenWireMapMessage(); msg.setObject("boolean", true); msg.setObject("byte", (byte) 1); msg.setObject("bytes1", new byte[1]); msg.setObject("char", 'a'); msg.setObject("double", 1.5); msg.setObject("float", 1.5f); msg.setObject("int", 1); msg.setObject("long", 1); msg.setObject("object", "stringObj"); msg.setObject("short", (short) 1); msg.setObject("string", "string"); msg = msg.copy(); Enumeration<String> mapNamesEnum = msg.getMapNames(); List<String> mapNamesList = Collections.list(mapNamesEnum); assertEquals(mapNamesList.size(), 11); assertTrue(mapNamesList.contains("boolean")); assertTrue(mapNamesList.contains("byte")); assertTrue(mapNamesList.contains("bytes1")); assertTrue(mapNamesList.contains("char")); assertTrue(mapNamesList.contains("double")); assertTrue(mapNamesList.contains("float")); assertTrue(mapNamesList.contains("int")); assertTrue(mapNamesList.contains("long")); assertTrue(mapNamesList.contains("object")); assertTrue(mapNamesList.contains("short")); assertTrue(mapNamesList.contains("string")); } @Test public void testItemExists() throws Exception { OpenWireMapMessage mapMessage = new OpenWireMapMessage(); mapMessage.setObject("exists", "test"); mapMessage = mapMessage.copy(); assertTrue(mapMessage.itemExists("exists")); assertFalse(mapMessage.itemExists("doesntExist")); } @Test public void testClearBody() throws Exception { OpenWireMapMessage mapMessage = new OpenWireMapMessage(); mapMessage.setObject("String", "String"); mapMessage.clearBody(); mapMessage.setContent(mapMessage.getContent()); assertNull(mapMessage.getObject("String")); mapMessage.clearBody(); mapMessage.setObject("String", "String"); mapMessage = mapMessage.copy(); mapMessage.getObject("String"); } }
1,390
0
Create_ds/activemq-openwire/openwire-core/src/test/java/org/apache/activemq/openwire
Create_ds/activemq-openwire/openwire-core/src/test/java/org/apache/activemq/openwire/commands/DataStructureTestSupport.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.commands; import static org.junit.Assert.assertNotNull; import java.io.IOException; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.Arrays; import junit.framework.AssertionFailedError; import org.apache.activemq.openwire.buffer.Buffer; import org.apache.activemq.openwire.codec.OpenWireFormat; import org.junit.Before; public abstract class DataStructureTestSupport { protected boolean cacheEnabled; protected OpenWireFormat wireFormat; public void assertBeanMarshalls(Object original) throws IOException { Object o = marshalAndUnmarshall(original, wireFormat); assertNotNull(o); assertEquals(original, o); } public static void assertEquals(Object expect, Object was) { if (expect == null ^ was == null) { throw new AssertionFailedError("Not equals, expected: " + expect + ", was: " + was); } if (expect == null) { return; } if (expect.getClass() != was.getClass()) { throw new AssertionFailedError("Not equals, classes don't match. expected: " + expect.getClass() + ", was: " + was.getClass()); } if (expect.getClass().isArray()) { Class<?> componentType = expect.getClass().getComponentType(); if (componentType.isPrimitive()) { boolean ok = false; if (componentType == byte.class) { ok = Arrays.equals((byte[]) expect, (byte[]) was); } if (componentType == char.class) { ok = Arrays.equals((char[]) expect, (char[]) was); } if (componentType == short.class) { ok = Arrays.equals((short[]) expect, (short[]) was); } if (componentType == int.class) { ok = Arrays.equals((int[]) expect, (int[]) was); } if (componentType == long.class) { ok = Arrays.equals((long[]) expect, (long[]) was); } if (componentType == double.class) { ok = Arrays.equals((double[]) expect, (double[]) was); } if (componentType == float.class) { ok = Arrays.equals((float[]) expect, (float[]) was); } if (!ok) { throw new AssertionFailedError("Arrays not equal"); } } else { Object expectArray[] = (Object[]) expect; Object wasArray[] = (Object[]) was; if (expectArray.length != wasArray.length) { throw new AssertionFailedError("Not equals, array lengths don't match. expected: " + expectArray.length + ", was: " + wasArray.length); } for (int i = 0; i < wasArray.length; i++) { assertEquals(expectArray[i], wasArray[i]); } } } else if (expect instanceof Command) { assertEquals(expect.getClass(), was.getClass()); Method[] methods = expect.getClass().getMethods(); for (int i = 0; i < methods.length; i++) { Method method = methods[i]; if ((method.getName().startsWith("get") || method.getName().startsWith("is")) && method.getParameterTypes().length == 0 && method.getReturnType() != null) { // Check to see if there is a setter for the method. try { if (method.getName().startsWith("get")) { expect.getClass().getMethod(method.getName().replaceFirst("get", "set"), new Class[] { method.getReturnType() }); } else { expect.getClass().getMethod(method.getName().replaceFirst("is", "set"), new Class[] { method.getReturnType() }); } } catch (Throwable ignore) { continue; } try { assertEquals(method.invoke(expect, (Object) null), method.invoke(was, (Object) null)); } catch (IllegalArgumentException e) { } catch (IllegalAccessException e) { } catch (InvocationTargetException e) { } } } } else { org.junit.Assert.assertEquals(expect, was); } } @Before public void setUp() throws Exception { wireFormat = createWireFormat(); } protected OpenWireFormat createWireFormat() { OpenWireFormat answer = new OpenWireFormat(10); answer.setCacheEnabled(cacheEnabled); return answer; } protected Object marshalAndUnmarshall(Object original, OpenWireFormat wireFormat) throws IOException { Buffer packet = wireFormat.marshal(original); return wireFormat.unmarshal(packet); } }
1,391
0
Create_ds/activemq-openwire/openwire-core/src/test/java/org/apache/activemq/openwire
Create_ds/activemq-openwire/openwire-core/src/test/java/org/apache/activemq/openwire/commands/OpenWireDestinationTest.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.commands; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.fail; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Map; import java.util.SortedSet; import java.util.TreeSet; import org.junit.Test; /** * Test various usages of the OpenWireDestination and its subclasses. */ public class OpenWireDestinationTest { @Test public void testSorting() throws Exception { SortedSet<OpenWireDestination> set = new TreeSet<OpenWireDestination>(); OpenWireDestination[] destinations = {new OpenWireQueue("A"), new OpenWireQueue("B"), new OpenWireTopic("A"), new OpenWireTopic("B")}; List<OpenWireDestination> expected = Arrays.asList(destinations); set.addAll(expected); List<OpenWireDestination> actual = new ArrayList<OpenWireDestination>(set); assertEquals("Sorted order", expected, actual); } class CombyDest { private final String qName; private final String topicName; public CombyDest(String qName, String topicName) { this.qName = qName; this.topicName = topicName; } public String getTopicName() { return topicName; } public String getQueueName() { return qName; } } @Test public void testEmptyQueueName() { try { new OpenWireQueue(""); fail("Should have thrown IllegalArgumentException"); } catch (IllegalArgumentException e) { } } @Test public void testEmptyTopicName() { try { new OpenWireTopic(""); fail("Should have thrown IllegalArgumentException"); } catch (IllegalArgumentException e) { } } @Test public void testDestinationOptions() throws Exception { doTestDestinationOptions(new OpenWireQueue("TEST?k1=v1&k2=v2")); doTestDestinationOptions(new OpenWireTopic("TEST?k1=v1&k2=v2")); doTestDestinationOptions(new OpenWireTempQueue("TEST:1?k1=v1&k2=v2")); doTestDestinationOptions(new OpenWireTempTopic("TEST:1?k1=v1&k2=v2")); } private void doTestDestinationOptions(OpenWireDestination destination) throws IOException { Map<String, String> options = destination.getOptions(); assertNotNull(options); assertEquals("v1", options.get("k1")); assertEquals("v2", options.get("k2")); } }
1,392
0
Create_ds/activemq-openwire/openwire-core/src/test/java/org/apache/activemq/openwire
Create_ds/activemq-openwire/openwire-core/src/test/java/org/apache/activemq/openwire/commands/MessageTest.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.commands; import static org.junit.Assert.assertNull; import java.io.IOException; import java.util.Arrays; import java.util.Collection; import org.apache.activemq.openwire.commands.MessageId; import org.apache.activemq.openwire.commands.OpenWireMessage; import org.apache.activemq.openwire.commands.OpenWireQueue; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.Parameters; @RunWith(value = Parameterized.class) public class MessageTest extends DataStructureTestSupport { public MessageTest(Boolean cacheEnabled) { this.cacheEnabled = cacheEnabled; } @Parameters public static Collection<Object[]> data() { Object[][] data = new Object[][] { { Boolean.TRUE }, { Boolean.FALSE } }; return Arrays.asList(data); } @Test public void testOpenWireMessageMarshaling() throws IOException { OpenWireMessage message = new OpenWireMessage(); message.setCommandId((short)1); message.setOriginalDestination(new OpenWireQueue("queue")); message.setGroupID("group"); message.setGroupSequence(4); message.setCorrelationId("correlation"); message.setMessageId(new MessageId("c1:1:1", 1)); assertBeanMarshalls(message); } @Test public void testOpenWireMessageMarshalingBigMessageId() throws IOException { OpenWireMessage message = new OpenWireMessage(); message.setCommandId((short)1); message.setOriginalDestination(new OpenWireQueue("queue")); message.setGroupID("group"); message.setGroupSequence(4); message.setCorrelationId("correlation"); message.setMessageId(new MessageId("c1:1:1", Short.MAX_VALUE)); assertBeanMarshalls(message); } @Test public void testOpenWireMessageMarshalingBiggerMessageId() throws IOException { OpenWireMessage message = new OpenWireMessage(); message.setCommandId((short)1); message.setOriginalDestination(new OpenWireQueue("queue")); message.setGroupID("group"); message.setGroupSequence(4); message.setCorrelationId("correlation"); message.setMessageId(new MessageId("c1:1:1", Integer.MAX_VALUE)); assertBeanMarshalls(message); } @Test public void testOpenWireMessageMarshalingBiggestMessageId() throws IOException { OpenWireMessage message = new OpenWireMessage(); message.setCommandId((short)1); message.setOriginalDestination(new OpenWireQueue("queue")); message.setGroupID("group"); message.setGroupSequence(4); message.setCorrelationId("correlation"); message.setMessageId(new MessageId("c1:1:1", Long.MAX_VALUE)); assertBeanMarshalls(message); } @Test public void testMessageIdMarshaling() throws IOException { assertBeanMarshalls(new MessageId("c1:1:1", 1)); } @Test public void testPropRemove() throws Exception { OpenWireMessage message = new OpenWireMessage(); message.setProperty("RM","RM"); OpenWireMessage unMarshalled = (OpenWireMessage) marshalAndUnmarshall(message, wireFormat); unMarshalled.getProperty("NA"); unMarshalled.removeProperty("RM"); OpenWireMessage unMarshalledAgain = (OpenWireMessage) marshalAndUnmarshall(unMarshalled, wireFormat); assertNull("Prop is gone", unMarshalledAgain.getProperty("RM")); } }
1,393
0
Create_ds/activemq-openwire/openwire-core/src/test/java/org/apache/activemq/openwire
Create_ds/activemq-openwire/openwire-core/src/test/java/org/apache/activemq/openwire/commands/OpenWireTextMessageTest.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.commands; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import java.io.IOException; import org.apache.activemq.openwire.buffer.Buffer; import org.apache.activemq.openwire.buffer.DataByteArrayOutputStream; import org.apache.activemq.openwire.utils.MarshallingSupport; import org.junit.Test; public class OpenWireTextMessageTest { @Test public void testGetDataStructureType() { OpenWireTextMessage msg = new OpenWireTextMessage(); assertEquals(msg.getDataStructureType(), CommandTypes.OPENWIRE_TEXT_MESSAGE); } @Test public void testShallowCopy() throws Exception { OpenWireTextMessage msg = new OpenWireTextMessage(); String string = "str"; msg.setText(string); Message copy = msg.copy(); assertTrue(msg.getText() == ((OpenWireTextMessage) copy).getText()); } @Test public void testSetText() { OpenWireTextMessage msg = new OpenWireTextMessage(); String str = "testText"; try { msg.setText(str); assertEquals(msg.getText(), str); } catch (Exception e) { e.printStackTrace(); } } @Test public void testGetBytes() throws Exception, IOException { OpenWireTextMessage msg = new OpenWireTextMessage(); String str = "testText"; msg.setText(str); msg.beforeMarshall(null); Buffer bytes = msg.getContent(); msg = new OpenWireTextMessage(); msg.setContent(bytes); assertEquals(msg.getText(), str); } @Test public void testClearBody() throws Exception, IOException { OpenWireTextMessage textMessage = new OpenWireTextMessage(); textMessage.setText("string"); textMessage.clearBody(); assertNull(textMessage.getText()); textMessage.setText("String"); textMessage.getText(); } @Test public void testShortText() throws Exception { String shortText = "Content"; OpenWireTextMessage shortMessage = new OpenWireTextMessage(); setContent(shortMessage, shortText); assertTrue(shortMessage.toString().contains("text = " + shortText)); assertTrue(shortMessage.getText().equals(shortText)); String longText = "Very very very very veeeeeeery loooooooooooooooooooooooooooooooooong text"; String longExpectedText = "Very very very very veeeeeeery looooooooooooo...ooooong text"; OpenWireTextMessage longMessage = new OpenWireTextMessage(); setContent(longMessage, longText); assertTrue(longMessage.toString().contains("text = " + longExpectedText)); assertTrue(longMessage.getText().equals(longText)); } @Test public void testNullText() throws Exception { OpenWireTextMessage nullMessage = new OpenWireTextMessage(); setContent(nullMessage, null); assertTrue(nullMessage.toString().contains("text = null")); } void setContent(Message message, String text) throws Exception { DataByteArrayOutputStream baos = new DataByteArrayOutputStream(); MarshallingSupport.writeUTF8(baos, text); baos.close(); message.setContent(baos.toBuffer()); } }
1,394
0
Create_ds/activemq-openwire/openwire-core/src/test/java/org/apache/activemq/openwire
Create_ds/activemq-openwire/openwire-core/src/test/java/org/apache/activemq/openwire/commands/OpenWireObjectMessageTest.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.commands; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import java.io.IOException; import org.junit.Test; public class OpenWireObjectMessageTest { @Test public void testBytes() throws Exception, IOException { OpenWireObjectMessage msg = new OpenWireObjectMessage(); String str = "testText"; msg.setObject(str); msg = msg.copy(); assertEquals(msg.getObject(), str); } @Test public void testSetObject() throws Exception { OpenWireObjectMessage msg = new OpenWireObjectMessage(); String str = "testText"; msg.setObject(str); assertTrue(msg.getObject() == str); } @Test public void testClearBody() throws Exception { OpenWireObjectMessage objectMessage = new OpenWireObjectMessage(); objectMessage.setObject("String"); objectMessage.clearBody(); assertNull(objectMessage.getObject()); objectMessage.setObject("String"); objectMessage.getObject(); } }
1,395
0
Create_ds/activemq-openwire/openwire-core/src/test/java/org/apache/activemq/openwire
Create_ds/activemq-openwire/openwire-core/src/test/java/org/apache/activemq/openwire/commands/OpenWireMessageTest.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.commands; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import java.io.IOException; import java.util.Map; import org.apache.activemq.openwire.buffer.Buffer; import org.apache.activemq.openwire.codec.OpenWireFormat; import org.junit.Before; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class OpenWireMessageTest { private static final Logger LOG = LoggerFactory.getLogger(OpenWireMessageTest.class); protected boolean readOnlyMessage; private MessageId myMessageID; private String jmsCorrelationID; private OpenWireDestination jmsDestination; private OpenWireDestination jmsReplyTo; private int jmsDeliveryMode; private boolean jmsRedelivered; private String jmsType; private long jmsExpiration; private int jmsPriority; private long jmsTimestamp; private long[] consumerIDs; @Before public void setUp() throws Exception { this.myMessageID = new MessageId("ID:TEST-ID:0:0:0:1"); this.jmsCorrelationID = "testcorrelationid"; this.jmsDestination = new OpenWireTopic("test.topic"); this.jmsReplyTo = new OpenWireTempTopic("test.replyto.topic:001"); this.jmsDeliveryMode = 1; this.jmsRedelivered = true; this.jmsType = "test type"; this.jmsExpiration = 100000; this.jmsPriority = 5; this.jmsTimestamp = System.currentTimeMillis(); this.readOnlyMessage = false; this.consumerIDs = new long[3]; for (int i = 0; i < this.consumerIDs.length; i++) { this.consumerIDs[i] = i; } } @Test public void testGetDataStructureType() { OpenWireMessage msg = new OpenWireMessage(); assertEquals(msg.getDataStructureType(), CommandTypes.OPENWIRE_MESSAGE); } @Test public void testHashCode() throws Exception { OpenWireMessage msg = new OpenWireMessage(); msg.setMessageId(this.myMessageID); assertEquals(msg.getMessageId().hashCode(), myMessageID.hashCode()); } @Test public void testSetToForeignJMSID() throws Exception { OpenWireMessage msg = new OpenWireMessage(); msg.setMessageId("ID:EMS-SERVER.8B443C380083:429"); } @Test public void testEqualsObject() throws Exception { OpenWireMessage msg1 = new OpenWireMessage(); OpenWireMessage msg2 = new OpenWireMessage(); msg1.setMessageId(this.myMessageID); assertTrue(!msg1.equals(msg2)); msg2.setMessageId(this.myMessageID); assertTrue(msg1.equals(msg2)); } @Test public void testShallowCopy() throws Exception { OpenWireMessage msg1 = new OpenWireMessage(); msg1.setMessageId(myMessageID); OpenWireMessage msg2 = msg1.copy(); assertTrue(msg1 != msg2 && msg1.equals(msg2)); } @Test public void testCopy() throws Exception { this.myMessageID = new MessageId("ID:TEST-ID:0:0:0:2"); this.jmsCorrelationID = "testcorrelationid"; this.jmsDestination = new OpenWireTopic("test.topic"); this.jmsReplyTo = new OpenWireTempTopic("test.replyto.topic:001"); this.jmsDeliveryMode = 1; this.jmsRedelivered = true; this.jmsType = "test type"; this.jmsExpiration = 100000; this.jmsPriority = 5; this.jmsTimestamp = System.currentTimeMillis(); this.readOnlyMessage = false; OpenWireMessage msg1 = new OpenWireMessage(); msg1.setMessageId(this.myMessageID); msg1.setCorrelationId(this.jmsCorrelationID); msg1.setDestination(this.jmsDestination); msg1.setReplyTo(this.jmsReplyTo); msg1.setPersistent(this.jmsDeliveryMode == 1); msg1.setRedelivered(this.jmsRedelivered); msg1.setType(this.jmsType); msg1.setExpiration(this.jmsExpiration); msg1.setPriority((byte) this.jmsPriority); msg1.setTimestamp(this.jmsTimestamp); OpenWireMessage msg2 = new OpenWireMessage(); msg1.copy(msg2); assertEquals(msg1.getMessageId(), msg2.getMessageId()); assertTrue(msg1.getCorrelationId().equals(msg2.getCorrelationId())); assertTrue(msg1.getDestination().equals(msg2.getDestination())); assertTrue(msg1.getReplyTo().equals(msg2.getReplyTo())); assertTrue(msg1.isPersistent() == msg2.isPersistent()); assertTrue(msg1.isRedelivered() == msg2.isRedelivered()); assertTrue(msg1.getType().equals(msg2.getType())); assertTrue(msg1.getExpiration() == msg2.getExpiration()); assertTrue(msg1.getPriority() == msg2.getPriority()); assertTrue(msg1.getTimestamp() == msg2.getTimestamp()); LOG.info("Message is: " + msg1); } @Test public void testGetAndSetMessageId() throws Exception { OpenWireMessage msg = new OpenWireMessage(); msg.setMessageId(this.myMessageID); assertEquals(msg.getMessageId().toString(), this.myMessageID.toString()); } @Test public void testGetAndSetTimestamp() { OpenWireMessage msg = new OpenWireMessage(); msg.setTimestamp(this.jmsTimestamp); assertTrue(msg.getTimestamp() == this.jmsTimestamp); } @Test public void testGetCorrelationIDAsBytes() throws Exception { OpenWireMessage msg = new OpenWireMessage(); msg.setCorrelationId(this.jmsCorrelationID); byte[] testbytes = msg.getCorrelationIdAsBytes(); String str2 = new String(testbytes); assertTrue(this.jmsCorrelationID.equals(str2)); } @Test public void testSetCorrelationIDAsBytes() throws Exception { OpenWireMessage msg = new OpenWireMessage(); byte[] testbytes = this.jmsCorrelationID.getBytes(); msg.setCorrelationIdAsBytes(testbytes); testbytes = msg.getCorrelationIdAsBytes(); String str2 = new String(testbytes); assertTrue(this.jmsCorrelationID.equals(str2)); } @Test public void testGetAndSetCorrelationID() { OpenWireMessage msg = new OpenWireMessage(); msg.setCorrelationId(this.jmsCorrelationID); assertTrue(msg.getCorrelationId().equals(this.jmsCorrelationID)); } @Test public void testGetAndSetJMSReplyTo() throws Exception { OpenWireMessage msg = new OpenWireMessage(); msg.setReplyTo(this.jmsReplyTo); assertTrue(msg.getReplyTo().equals(this.jmsReplyTo)); } @Test public void testGetAndSetJMSDestination() throws Exception { OpenWireMessage msg = new OpenWireMessage(); msg.setDestination(this.jmsDestination); assertTrue(msg.getDestination().equals(this.jmsDestination)); } @Test public void testGetAndSetPersistentFlag() { OpenWireMessage msg = new OpenWireMessage(); boolean persistent = this.jmsDeliveryMode == 1; msg.setPersistent(persistent); assertTrue(msg.isPersistent() == persistent); } @Test public void testGetAndSetRedelivered() { OpenWireMessage msg = new OpenWireMessage(); msg.setRedelivered(this.jmsRedelivered); assertTrue(msg.isRedelivered() == this.jmsRedelivered); } @Test public void testGetAndSetType() { OpenWireMessage msg = new OpenWireMessage(); msg.setType(this.jmsType); assertTrue(msg.getType().equals(this.jmsType)); } @Test public void testGetAndSetExpiration() { OpenWireMessage msg = new OpenWireMessage(); msg.setExpiration(this.jmsExpiration); assertTrue(msg.getExpiration() == this.jmsExpiration); } @Test public void testGetAndSetPriority() { OpenWireMessage msg = new OpenWireMessage(); msg.setPriority((byte) this.jmsPriority); assertTrue(msg.getPriority() == this.jmsPriority); msg.setPriority((byte) -90); assertEquals(0, msg.getPriority()); msg.setPriority((byte) 90); assertEquals(9, msg.getPriority()); } @Test public void testClearProperties() throws Exception { OpenWireMessage msg = new OpenWireMessage(); msg.setProperty("test", "test"); msg.setContent(new Buffer(new byte[1], 0, 0)); msg.setMessageId(this.myMessageID); msg.clearProperties(); assertNull(msg.getProperty("test")); assertNotNull(msg.getMessageId()); assertNotNull(msg.getContent()); } @Test public void testPropertyExists() throws Exception { OpenWireMessage msg = new OpenWireMessage(); msg.setProperty("test", "test"); assertTrue(msg.propertyExists("test")); msg.setProperty("JMSXDeliveryCount", 1); assertTrue(msg.propertyExists("JMSXDeliveryCount")); } @Test public void testGetBooleanProperty() throws Exception { OpenWireMessage msg = new OpenWireMessage(); String name = "booleanProperty"; msg.setProperty(name, true); assertTrue((Boolean) msg.getProperty(name)); } @Test public void testGetByteProperty() throws Exception { OpenWireMessage msg = new OpenWireMessage(); String name = "byteProperty"; msg.setProperty(name, (byte) 1); assertTrue((Byte) msg.getProperty(name) == 1); } @Test public void testGetShortProperty() throws Exception { OpenWireMessage msg = new OpenWireMessage(); String name = "shortProperty"; msg.setProperty(name, (short) 1); assertTrue((Short) msg.getProperty(name) == 1); } @Test public void testGetIntProperty() throws Exception { OpenWireMessage msg = new OpenWireMessage(); String name = "intProperty"; msg.setProperty(name, 1); assertTrue((Integer) msg.getProperty(name) == 1); } @Test public void testGetLongProperty() throws Exception { OpenWireMessage msg = new OpenWireMessage(); String name = "longProperty"; msg.setProperty(name, 1L); assertTrue((Long) msg.getProperty(name) == 1L); } @Test public void testGetFloatProperty() throws Exception { OpenWireMessage msg = new OpenWireMessage(); String name = "floatProperty"; msg.setProperty(name, 1.3f); assertTrue((Float) msg.getProperty(name) == 1.3f); } @Test public void testGetDoubleProperty() throws Exception { OpenWireMessage msg = new OpenWireMessage(); String name = "doubleProperty"; msg.setProperty(name, 1.3d); assertTrue((Double) msg.getProperty(name) == 1.3); } @Test public void testGetStringProperty() throws Exception { OpenWireMessage msg = new OpenWireMessage(); String name = "stringProperty"; msg.setProperty(name, name); assertTrue(msg.getProperty(name).equals(name)); } @Test public void testgetProperty() throws Exception { OpenWireMessage msg = new OpenWireMessage(); String name = "floatProperty"; msg.setProperty(name, 1.3f); assertTrue(msg.getProperty(name) instanceof Float); assertTrue(((Float) msg.getProperty(name)).floatValue() == 1.3f); } @Test public void testPropertiesInt() throws Exception { OpenWireObjectMessage message = new OpenWireObjectMessage(); message.setProperty("TestProp", 333); fakeUnmarshal(message); roundTripProperties(message); } @Test public void testPropertiesString() throws Exception { OpenWireObjectMessage message = new OpenWireObjectMessage(); message.setProperty("TestProp", "Value"); fakeUnmarshal(message); roundTripProperties(message); } @Test public void testPropertiesObject() throws Exception { OpenWireObjectMessage message = new OpenWireObjectMessage(); message.setProperty("TestProp", "Value"); fakeUnmarshal(message); roundTripProperties(message); } @Test public void testPropertiesObjectNoMarshalling() throws Exception { OpenWireObjectMessage message = new OpenWireObjectMessage(); message.setProperty("TestProp", "Value"); roundTripProperties(message); } private void roundTripProperties(OpenWireObjectMessage message) throws IOException, Exception { OpenWireObjectMessage copy = new OpenWireObjectMessage(); for (Map.Entry<String, Object> prop : message.getProperties().entrySet()) { LOG.debug("{} -> {}", prop.getKey(), prop.getValue().getClass()); copy.setProperty(prop.getKey(), prop.getValue()); } } private void fakeUnmarshal(OpenWireObjectMessage message) throws Exception { OpenWireFormat format = new OpenWireFormat(OpenWireFormat.DEFAULT_WIRE_VERSION); message.beforeMarshall(format); message.afterMarshall(format); Buffer seq = message.getMarshalledProperties(); message.clearProperties(); message.setMarshalledProperties(seq); } @Test public void testSetNullProperty() throws Exception { OpenWireMessage msg = new OpenWireMessage(); String name = "cheese"; msg.setProperty(name, "Cheddar"); assertEquals("Cheddar", msg.getProperty(name)); msg.setProperty(name, null); assertEquals(null, msg.getProperty(name)); } @Test public void testSetNullPropertyName() throws Exception { OpenWireMessage msg = new OpenWireMessage(); try { msg.setProperty(null, "Cheese"); fail("Should have thrown exception"); } catch (IllegalArgumentException e) { LOG.info("Worked, caught: " + e); } } @Test public void testSetEmptyPropertyName() throws Exception { OpenWireMessage msg = new OpenWireMessage(); try { msg.setProperty("", "Cheese"); fail("Should have thrown exception"); } catch (IllegalArgumentException e) { LOG.info("Worked, caught: " + e); } } @Test public void testGetAndSetDeliveryCount() throws Exception { OpenWireMessage msg = new OpenWireMessage(); msg.setRedeliveryCounter(1); int count = msg.getRedeliveryCounter(); assertTrue("expected delivery count = 1 - got: " + count, count == 1); } @Test public void testClearBody() throws Exception { OpenWireBytesMessage message = new OpenWireBytesMessage(); message.clearBody(); assertNull(message.getContent()); } @Test public void testIsExpired() { OpenWireMessage msg = new OpenWireMessage(); msg.setExpiration(System.currentTimeMillis() - 1); assertTrue(msg.isExpired()); msg.setExpiration(System.currentTimeMillis() + 10000); assertFalse(msg.isExpired()); } }
1,396
0
Create_ds/activemq-openwire/openwire-core/src/test/java/org/apache/activemq/openwire
Create_ds/activemq-openwire/openwire-core/src/test/java/org/apache/activemq/openwire/commands/OpenWireStreamMessageTest.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.commands; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; import org.apache.activemq.openwire.buffer.Buffer; import org.junit.Before; import org.junit.Test; public class OpenWireStreamMessageTest { private final List<Object> elements = new ArrayList<Object>(); @Before public void setUp() throws Exception { elements.add(Boolean.TRUE); elements.add(Byte.valueOf(Byte.MAX_VALUE)); elements.add(Character.valueOf('a')); elements.add(Short.valueOf(Short.MAX_VALUE)); elements.add(Integer.valueOf(Integer.MAX_VALUE)); elements.add(Long.valueOf(Long.MAX_VALUE)); elements.add(Float.valueOf(Float.MAX_VALUE)); elements.add(Double.valueOf(Double.MAX_VALUE)); elements.add("Test-String"); elements.add(new byte[] { 1, 2, 3, 4, 5, 6 }); } @Test public void testGetDataStructureType() { OpenWireStreamMessage msg = new OpenWireStreamMessage(); assertEquals(msg.getDataStructureType(), CommandTypes.OPENWIRE_STREAM_MESSAGE); } @Test public void testWriteListToStream() throws Exception { OpenWireStreamMessage message = new OpenWireStreamMessage(); message.writeListToStream(Collections.emptyList()); assertNull(message.getContent()); message.writeListToStream(elements); assertNotNull(message.getContent()); } @Test public void testWriteListToStreamCompressed() throws Exception { OpenWireStreamMessage message = new OpenWireStreamMessage(); message.setUseCompression(true); // Add something that should compress well. elements.add("Repeating String" + "Repeating String" + "Repeating String" + "Repeating String" + "Repeating String" + "Repeating String" + "Repeating String" + "Repeating String" + "Repeating String" + "Repeating String" + "Repeating String" + "Repeating String"); message.writeListToStream(Collections.emptyList()); assertNull(message.getContent()); message.writeListToStream(elements); assertNotNull(message.getContent()); Buffer rawContent = message.getContent(); Buffer processedContent = message.getPayload(); assertTrue(rawContent.getLength() < processedContent.getLength()); } @Test public void testReadStreamToList() throws Exception { OpenWireStreamMessage message = new OpenWireStreamMessage(); message.writeListToStream(elements); assertNotNull(message.getContent()); List<Object> results = message.readStreamToList(); assertEquals(elements.size(), results.size()); for (int i = 0; i < results.size(); ++i) { Object element = elements.get(i); Object result = results.get(i); if (result instanceof byte[]) { assertTrue(Arrays.equals((byte[]) result, (byte[]) element)); } else { assertEquals(element, result); } } } }
1,397
0
Create_ds/activemq-openwire/openwire-core/src/main/java/org/apache/activemq/openwire
Create_ds/activemq-openwire/openwire-core/src/main/java/org/apache/activemq/openwire/codec/OpenWireFormatFactory.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.codec; import org.apache.activemq.openwire.commands.WireFormatInfo; /** * Creates a new instance of the OpenWireFormat codec. */ public class OpenWireFormatFactory { // // The default values here are what the wire format changes to after a // default negotiation. // private int version = OpenWireFormat.DEFAULT_WIRE_VERSION; private boolean stackTraceEnabled = true; private boolean tcpNoDelayEnabled = true; private boolean cacheEnabled = true; private boolean tightEncodingEnabled = true; private boolean sizePrefixDisabled; private long maxInactivityDuration = 30 * 1000; private long maxInactivityDurationInitalDelay = 10 * 1000; private int cacheSize = 1024; private long maxFrameSize = OpenWireFormat.DEFAULT_MAX_FRAME_SIZE; private String host = null; public OpenWireFormat createWireFormat() { WireFormatInfo info = new WireFormatInfo(); info.setVersion(version); try { info.setStackTraceEnabled(stackTraceEnabled); info.setCacheEnabled(cacheEnabled); info.setTcpNoDelayEnabled(tcpNoDelayEnabled); info.setTightEncodingEnabled(tightEncodingEnabled); info.setSizePrefixDisabled(sizePrefixDisabled); info.setMaxInactivityDuration(maxInactivityDuration); info.setMaxInactivityDurationInitalDelay(maxInactivityDurationInitalDelay); info.setCacheSize(cacheSize); info.setMaxFrameSize(maxFrameSize); if (host != null) { info.setHost(host); } } catch (Exception e) { IllegalStateException ise = new IllegalStateException("Could not configure WireFormatInfo"); ise.initCause(e); throw ise; } OpenWireFormat f = new OpenWireFormat(version); f.setMaxFrameSize(maxFrameSize); f.setPreferedWireFormatInfo(info); return f; } public boolean isStackTraceEnabled() { return stackTraceEnabled; } public void setStackTraceEnabled(boolean stackTraceEnabled) { this.stackTraceEnabled = stackTraceEnabled; } public boolean isTcpNoDelayEnabled() { return tcpNoDelayEnabled; } public void setTcpNoDelayEnabled(boolean tcpNoDelayEnabled) { this.tcpNoDelayEnabled = tcpNoDelayEnabled; } public int getVersion() { return version; } public void setVersion(int version) { this.version = version; } public boolean isCacheEnabled() { return cacheEnabled; } public void setCacheEnabled(boolean cacheEnabled) { this.cacheEnabled = cacheEnabled; } public boolean isTightEncodingEnabled() { return tightEncodingEnabled; } public void setTightEncodingEnabled(boolean tightEncodingEnabled) { this.tightEncodingEnabled = tightEncodingEnabled; } public boolean isSizePrefixDisabled() { return sizePrefixDisabled; } public void setSizePrefixDisabled(boolean sizePrefixDisabled) { this.sizePrefixDisabled = sizePrefixDisabled; } public long getMaxInactivityDuration() { return maxInactivityDuration; } public void setMaxInactivityDuration(long maxInactivityDuration) { this.maxInactivityDuration = maxInactivityDuration; } public int getCacheSize() { return cacheSize; } public void setCacheSize(int cacheSize) { this.cacheSize = cacheSize; } public long getMaxInactivityDurationInitalDelay() { return maxInactivityDurationInitalDelay; } public void setMaxInactivityDurationInitalDelay(long maxInactivityDurationInitalDelay) { this.maxInactivityDurationInitalDelay = maxInactivityDurationInitalDelay; } public long getMaxFrameSize() { return maxFrameSize; } public void setMaxFrameSize(long maxFrameSize) { this.maxFrameSize = maxFrameSize; } public String getHost() { return host; } public void setHost(String host) { this.host = host; } }
1,398
0
Create_ds/activemq-openwire/openwire-core/src/main/java/org/apache/activemq/openwire
Create_ds/activemq-openwire/openwire-core/src/main/java/org/apache/activemq/openwire/codec/OpenWireConstants.java
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.openwire.codec; /** * Set of Constant values used by various OpenWire Brokers. */ public class OpenWireConstants { //---------- ActiveMQ Message Extended Property Values -------------------// public static final String DLQ_DELIVERY_FAILURE_CAUSE_PROPERTY = "dlqDeliveryFailureCause"; public static final String BROKER_PATH_PROPERTY = "JMSActiveMQBrokerPath"; //---------- ActiveMQ Advisory Message Identifiers -----------------------// public static final String ADIVSORY_MESSAGE_TYPE = "Advisory"; //---------- ActiveMQ Scheduled Message Value ----------------------------// /** * The time in milliseconds that a message will wait before being scheduled to be * delivered by the broker */ public static final String AMQ_SCHEDULED_DELAY = "AMQ_SCHEDULED_DELAY"; /** * The time in milliseconds to wait after the start time to wait before scheduling the message again */ public static final String AMQ_SCHEDULED_PERIOD = "AMQ_SCHEDULED_PERIOD"; /** * The number of times to repeat scheduling a message for delivery */ public static final String AMQ_SCHEDULED_REPEAT = "AMQ_SCHEDULED_REPEAT"; /** * Use a Cron tab entry to set the schedule */ public static final String AMQ_SCHEDULED_CRON = "AMQ_SCHEDULED_CRON"; /** * An Id that is assigned to a Scheduled Message, this value is only available once the * Message is scheduled, Messages sent to the Browse Destination or delivered to the * assigned Destination will have this value set. */ public static final String AMQ_SCHEDULED_ID = "scheduledJobId"; /** * Special destination to send Message's to with an assigned "action" that the Scheduler * should perform such as removing a message. */ public static final String AMQ_SCHEDULER_MANAGEMENT_DESTINATION = "ActiveMQ.Scheduler.Management"; /** * Used to specify that a some operation should be performed on the Scheduled Message, * the Message must have an assigned Id for this action to be taken. */ public static final String AMQ_SCHEDULER_ACTION = "AMQ_SCHEDULER_ACTION"; /** * Indicates that a browse of the Scheduled Messages is being requested. */ public static final String AMQ_SCHEDULER_ACTION_BROWSE = "BROWSE"; /** * Indicates that a Scheduled Message is to be remove from the Scheduler, the Id of * the scheduled message must be set as a property in order for this action to have * any effect. */ public static final String AMQ_SCHEDULER_ACTION_REMOVE = "REMOVE"; /** * Indicates that all scheduled Messages should be removed. */ public static final String AMQ_SCHEDULER_ACTION_REMOVEALL = "REMOVEALL"; /** * A property that holds the beginning of the time interval that the specified action should * be applied within. Maps to a long value that specified time in milliseconds since UTC. */ public static final String AMQ_SCHEDULER_ACTION_START_TIME = "ACTION_START_TIME"; /** * A property that holds the end of the time interval that the specified action should be * applied within. Maps to a long value that specified time in milliseconds since UTC. */ public static final String AMQ_SCHEDULER_ACTION_END_TIME = "ACTION_END_TIME"; }
1,399