Skip to content
Snippets Groups Projects
Commit ab621ff6 authored by Ramin Yaghoubzadeh Torky's avatar Ramin Yaghoubzadeh Torky
Browse files

Java: fixed wire format for Messages

parent 76d1b6b3
No related branches found
No related tags found
No related merge requests found
/* /*
* This file is part of IPAACA, the * This file is part of IPAACA, the
* "Incremental Processing Architecture * "Incremental Processing Architecture
* for Artificial Conversational Agents". * for Artificial Conversational Agents".
* *
* Copyright (c) 2009-2013 Sociable Agents Group * Copyright (c) 2009-2013 Sociable Agents Group
* CITEC, Bielefeld University * CITEC, Bielefeld University
* *
* http://opensource.cit-ec.de/projects/ipaaca/ * http://opensource.cit-ec.de/projects/ipaaca/
* http://purl.org/net/ipaaca * http://purl.org/net/ipaaca
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
* You should have received a copy of the LGPL along with this * You should have received a copy of the LGPL along with this
* program. If not, go to http://www.gnu.org/licenses/lgpl.html * program. If not, go to http://www.gnu.org/licenses/lgpl.html
* or write to the Free Software Foundation, Inc., * or write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* The development of this software was supported by the * The development of this software was supported by the
* Excellence Cluster EXC 277 Cognitive Interaction Technology. * Excellence Cluster EXC 277 Cognitive Interaction Technology.
...@@ -55,7 +55,7 @@ import com.google.protobuf.InvalidProtocolBufferException; ...@@ -55,7 +55,7 @@ import com.google.protobuf.InvalidProtocolBufferException;
/** /**
* Serializes AbstractIUs into protocolbuffer IUs and vice versa. * Serializes AbstractIUs into protocolbuffer IUs and vice versa.
* @author hvanwelbergen * @author hvanwelbergen
* *
*/ */
public class IUConverter implements Converter<ByteBuffer> public class IUConverter implements Converter<ByteBuffer>
{ {
...@@ -96,10 +96,11 @@ public class IUConverter implements Converter<ByteBuffer> ...@@ -96,10 +96,11 @@ public class IUConverter implements Converter<ByteBuffer>
IU iu = IU.newBuilder().setUid(iua.getUid()).setRevision(iua.getRevision()).setCategory(iua.getCategory()) IU iu = IU.newBuilder().setUid(iua.getUid()).setRevision(iua.getRevision()).setCategory(iua.getCategory())
.setOwnerName(iua.getOwnerName()).setCommitted(iua.isCommitted()).setAccessMode(accessMode) .setOwnerName(iua.getOwnerName()).setCommitted(iua.isCommitted()).setAccessMode(accessMode)
.setReadOnly(iua.isReadOnly()).setPayloadType("STR").addAllPayload(payloadItems).addAllLinks(links).build(); .setReadOnly(iua.isReadOnly()).setPayloadType("STR").addAllPayload(payloadItems).addAllLinks(links).build();
return new WireContents<ByteBuffer>(ByteBuffer.wrap(iu.toByteArray()), "ipaaca-iu"); String wireFormat = (accessMode == IU.AccessMode.MESSAGE) ? "ipaaca-messageiu" : "ipaaca-iu";
return new WireContents<ByteBuffer>(ByteBuffer.wrap(iu.toByteArray()), wireFormat);
} }
@Override @Override
public UserData<?> deserialize(String wireSchema, ByteBuffer buffer) throws ConversionException public UserData<?> deserialize(String wireSchema, ByteBuffer buffer) throws ConversionException
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment