Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

model interface

  • Loading branch information...
commit 7b00ba2331a8d225e084764a5e131d2c5be1dd04 1 parent 0ed32d5
@leonlee authored
View
8 common/src/main/groovy/org/riderzen/ogs/common/BaseModel.groovy
@@ -0,0 +1,8 @@
+package org.riderzen.ogs.common
+
+/**
+ * User: Leon Lee <mail.lgq@gmail.com>
+ * Date: 12-12-7
+ */
+class BaseModel implements IModel{
+}
View
4 ...src/main/groovy/org/riderzen/ogs/common/AE.groovy → .../src/main/groovy/org/riderzen/ogs/common/E.groovy
@@ -4,11 +4,11 @@ package org.riderzen.ogs.common
* User: Leon Lee <mail.lgq@gmail.com>
* Date: 12-12-16
*/
-enum AE {
+enum E {
appProtocol("org.riderzen.ogs.protocol")
public String val;
- AE(String val) {
+ E(String val) {
this.val = val
}
View
15 common/src/main/groovy/org/riderzen/ogs/common/IModel.groovy
@@ -0,0 +1,15 @@
+package org.riderzen.ogs.common
+
+/**
+ * User: Leon Lee <mail.lgq@gmail.com>
+ * Date: 12-12-17
+ */
+public interface IModel {
+ void save()
+
+ IModel get(id)
+
+ void update()
+
+ void delete()
+}
View
8 protocol/src/main/groovy/org/riderzen/ogs/protocol/ProtocolParser.groovy
@@ -1,18 +1,14 @@
package org.riderzen.ogs.protocol
-import org.json.simple.JSONArray
-import org.json.simple.JSONObject
-import org.json.simple.parser.JSONParser
import org.msgpack.MessagePack
import org.msgpack.unpacker.Unpacker
-import org.msgpack.util.json.JSON
import org.vertx.java.busmods.BusModBase
import org.vertx.java.core.Handler
import org.vertx.java.core.buffer.Buffer
import org.vertx.java.core.eventbus.Message
import org.vertx.java.core.parsetools.RecordParser
import com.google.gson.Gson
-import org.riderzen.ogs.common.AE
+import org.riderzen.ogs.common.E
/**
* User: Leon Lee <mail.lgq@gmail.com>
@@ -30,7 +26,7 @@ class ProtocolParser extends BusModBase {
}
def init() {
- address = getOptionalStringConfig("address", AE.appProtocol.val)
+ address = getOptionalStringConfig("address", E.appProtocol.val)
def msgHandler = { Buffer message ->
View
4 tcp-server/src/main/groovy/org/riderzen/ogs/tcp/TcpServer.groovy
@@ -1,7 +1,7 @@
package org.riderzen.ogs.tcp
import org.vertx.java.busmods.BusModBase
-import org.riderzen.ogs.common.AE
+import org.riderzen.ogs.common.E
/**
* User: Leon Lee <mail.lgq@gmail.com>
* Date: 12-12-7
@@ -22,7 +22,7 @@ class TcpServer extends BusModBase {
def onConnected = { sock ->
sock.dataHandler { buffer ->
logger.debug("received ${buffer.lenght} bytes of data")
- eb.send(AE.appProtocol.val, buffer) { message ->
+ eb.send(E.appProtocol.val, buffer) { message ->
sock << message
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.