[infinispan-commits] Infinispan SVN: r1562 - in trunk/server: hotrod/src/main/scala/org/infinispan/server/hotrod and 1 other directory.
infinispan-commits at lists.jboss.org
infinispan-commits at lists.jboss.org
Wed Mar 3 07:02:37 EST 2010
Author: galder.zamarreno at jboss.com
Date: 2010-03-03 07:02:36 -0500 (Wed, 03 Mar 2010)
New Revision: 1562
Added:
trunk/server/core/src/main/java/org/infinispan/server/core/transport/Encoder.java
trunk/server/hotrod/src/main/scala/org/infinispan/server/hotrod/Encoder410.scala
trunk/server/hotrod/src/main/scala/org/infinispan/server/hotrod/ErrorResponse.scala
trunk/server/hotrod/src/main/scala/org/infinispan/server/hotrod/OpCodes.scala
trunk/server/hotrod/src/main/scala/org/infinispan/server/hotrod/Response.scala
trunk/server/hotrod/src/main/scala/org/infinispan/server/hotrod/Status.scala
Log:
[ISPN-171] (Build a server module based on the HotRod protocol) Forgot to add some classes.
Added: trunk/server/core/src/main/java/org/infinispan/server/core/transport/Encoder.java
===================================================================
--- trunk/server/core/src/main/java/org/infinispan/server/core/transport/Encoder.java (rev 0)
+++ trunk/server/core/src/main/java/org/infinispan/server/core/transport/Encoder.java 2010-03-03 12:02:36 UTC (rev 1562)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat, Inc. and/or its affiliates, and
+ * individual contributors as indicated by the @author tags. See the
+ * copyright.txt file in the distribution for a full listing of
+ * individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.infinispan.server.core.transport;
+
+/**
+ * // TODO: Document this
+ *
+ * @author Galder Zamarreño
+ * @since 4.1
+ */
+public interface Encoder {
+ Object encode(ChannelHandlerContext ctx, Channel channel, Object msg) throws Exception;
+}
Added: trunk/server/hotrod/src/main/scala/org/infinispan/server/hotrod/Encoder410.scala
===================================================================
--- trunk/server/hotrod/src/main/scala/org/infinispan/server/hotrod/Encoder410.scala (rev 0)
+++ trunk/server/hotrod/src/main/scala/org/infinispan/server/hotrod/Encoder410.scala 2010-03-03 12:02:36 UTC (rev 1562)
@@ -0,0 +1,33 @@
+package org.infinispan.server.hotrod
+
+import org.infinispan.server.core.transport.{ChannelBuffer, ChannelHandlerContext, Channel, Encoder}
+
+/**
+ * // TODO: Document this
+ * @author Galder Zamarreño
+ * @since 4.1
+ */
+
+class Encoder410 extends Encoder {
+ import Encoder410._
+
+ private val Magic = 0xA1
+
+ override def encode(ctx: ChannelHandlerContext, ch: Channel, msg: Object) = {
+ val buffer: ChannelBuffer =
+ msg match {
+ case r: Response => {
+ val buff = ctx.getChannelBuffers.dynamicBuffer
+ buff.writeByte(Magic.byteValue)
+ buff.writeByte(r.opCode.id.byteValue)
+ VLong.write(buff, r.id)
+ buff.writeByte(r.status.id.byteValue)
+ buff
+ }
+ }
+ buffer
+ }
+
+}
+
+object Encoder410 extends Logging
\ No newline at end of file
Added: trunk/server/hotrod/src/main/scala/org/infinispan/server/hotrod/ErrorResponse.scala
===================================================================
--- trunk/server/hotrod/src/main/scala/org/infinispan/server/hotrod/ErrorResponse.scala (rev 0)
+++ trunk/server/hotrod/src/main/scala/org/infinispan/server/hotrod/ErrorResponse.scala 2010-03-03 12:02:36 UTC (rev 1562)
@@ -0,0 +1,12 @@
+package org.infinispan.server.hotrod
+
+/**
+ * // TODO: Document this
+ * @author Galder Zamarreño
+ * @since 4.1
+ */
+
+class ErrorResponse(override val opCode: OpCodes.OpCode,
+ override val id: Long,
+ override val status: Status.Status,
+ val msg: String) extends Response(opCode, id, status)
\ No newline at end of file
Added: trunk/server/hotrod/src/main/scala/org/infinispan/server/hotrod/OpCodes.scala
===================================================================
--- trunk/server/hotrod/src/main/scala/org/infinispan/server/hotrod/OpCodes.scala (rev 0)
+++ trunk/server/hotrod/src/main/scala/org/infinispan/server/hotrod/OpCodes.scala 2010-03-03 12:02:36 UTC (rev 1562)
@@ -0,0 +1,15 @@
+package org.infinispan.server.hotrod
+
+/**
+ * // TODO: Document this
+ * @author Galder Zamarreño
+ * @since 4.1
+ */
+
+object OpCodes extends Enumeration {
+ type OpCode = Value
+
+ val PutRequest = Value(0x01)
+ val PutResponse = Value(0x02)
+
+}
\ No newline at end of file
Added: trunk/server/hotrod/src/main/scala/org/infinispan/server/hotrod/Response.scala
===================================================================
--- trunk/server/hotrod/src/main/scala/org/infinispan/server/hotrod/Response.scala (rev 0)
+++ trunk/server/hotrod/src/main/scala/org/infinispan/server/hotrod/Response.scala 2010-03-03 12:02:36 UTC (rev 1562)
@@ -0,0 +1,11 @@
+package org.infinispan.server.hotrod
+
+/**
+ * // TODO: Document this
+ * @author Galder Zamarreño
+ * @since 4.1
+ */
+
+class Response(val opCode: OpCodes.OpCode,
+ val id: Long,
+ val status: Status.Status)
\ No newline at end of file
Added: trunk/server/hotrod/src/main/scala/org/infinispan/server/hotrod/Status.scala
===================================================================
--- trunk/server/hotrod/src/main/scala/org/infinispan/server/hotrod/Status.scala (rev 0)
+++ trunk/server/hotrod/src/main/scala/org/infinispan/server/hotrod/Status.scala 2010-03-03 12:02:36 UTC (rev 1562)
@@ -0,0 +1,13 @@
+package org.infinispan.server.hotrod
+
+/**
+ * // TODO: Document this
+ * @author Galder Zamarreño
+ * @since 4.1
+ */
+
+object Status extends Enumeration {
+ type Status = Value
+
+ val Success = Value(0x00)
+}
\ No newline at end of file
More information about the infinispan-commits
mailing list