public AllTypeBean getAllTypeBean(bool aboolean, byte abyte, short ashort, char achar, int aint, long along, float afloat, double adouble, DateTime adate, String astring) { StandardTransferObject to = transferObjectFactory.createTransferObject(); to.setCalleeClass("com.qileyuan.tatala.example.proxy.TestServerProxy"); to.setCalleeMethod("getAllTypeBean"); to.registerReturnType(TransferObject.DATATYPE_WRAPPER); to.putBoolean("aboolean", aboolean); to.putByte("abyte", abyte); to.putShort("ashort", ashort); to.putChar("achar", achar); to.putInt("aint", aint); to.putLong("along", along); to.putFloat("afloat", afloat); to.putDouble("adouble", adouble); to.putDate("adate", adate); to.putString("astring", astring); AllTypeBeanWrapper allTypeBeanWrapper = (AllTypeBeanWrapper)ServerExecutor.execute(to); if (allTypeBeanWrapper != null) { return(allTypeBeanWrapper.getAllTypeBean()); } else { return(null); } }
public TestAccount getAccountCompress(TestAccount account) { StandardTransferObject to = transferObjectFactory.createTransferObject(); to.setCalleeClass("com.qileyuan.tatala.example.proxy.TestServerProxy"); to.setCalleeMethod("getAccount"); to.registerReturnType(TransferObject.DATATYPE_WRAPPER); TestAccountWrapper accountWrapper = new TestAccountWrapper(account); to.putWrapper("account", accountWrapper); to.setCompress(true); accountWrapper = (TestAccountWrapper)ServerExecutor.execute(to); if (accountWrapper != null) { TestAccount returnAccount = accountWrapper.getAccount(); return(returnAccount); } else { return(null); } }
public static TransferObject byteArrayToTransferObject(byte[] byteArray) { //TransferObject to = new TransferObject(); int receiveLength = byteArray.Length; byte[] toByteArray = new byte[receiveLength - 1]; Array.Copy(byteArray, 1, toByteArray, 0, receiveLength - 1); byte flagbyte = byteArray[0]; TransferObject to = null; //check if new version of transfer object if (TransferUtil.isNewVersion(flagbyte)) { to = new NewTransferObject(); } else { to = new StandardTransferObject(); } if (TransferUtil.isCompress(flagbyte)) { toByteArray = TransferUtil.getInputByCompress(toByteArray); } else { toByteArray = TransferUtil.getInputByNormal(toByteArray); } to.setByteData(toByteArray); return(to); }
public void sendMessage(String message) { StandardTransferObject to = transferObjectFactory.createTransferObject(); to.setCalleeClass("com.qileyuan.tatala.example.proxy.ChatRoomServerProxy"); to.setCalleeMethod("receiveMessage"); to.putString("message", message); to.registerReturnType(TransferObject.DATATYPE_VOID); ServerExecutor.execute(to); }
public void login(String username) { StandardTransferObject to = transferObjectFactory.createTransferObject(); to.setCalleeClass("com.qileyuan.tatala.example.proxy.ChatRoomServerProxy"); to.setCalleeMethod("login"); to.putString("username", username); to.registerReturnType(TransferObject.DATATYPE_VOID); ServerExecutor.execute(to); }
public override Object execute(TransferObject baseto) { StandardTransferObject to = (StandardTransferObject)baseto; String calleeMethod = to.getCalleeMethod(); if (calleeMethod.Equals("receiveMessage")) { String message = to.getString("message"); ChatRoomClient.getInstance().receiveMessage(message); } return(null); }
private void handleServerCall(object receiveObj) { byte[] receiveData = (byte[])receiveObj; TransferObject to = new StandardTransferObject(); try { to = TransferUtil.byteArrayToTransferObject(receiveData); execute(to); } catch (Exception e) { Logging.LogError("Callee Class and Method: [" + to.getCalleeClass() + "." + to.getCalleeMethod() + "]"); Logging.LogError("Handle Receive Data error: " + e); Close(mStateObject); } }
public TestAccount getAccountAsynchronous(TestAccount account) { StandardTransferObject to = transferObjectFactory.createTransferObject(); to.setCalleeClass("com.qileyuan.tatala.example.proxy.TestServerProxy"); to.setCalleeMethod("getAccount"); to.registerReturnType(TransferObject.DATATYPE_WRAPPER); TestAccountWrapper accountWrapper = new TestAccountWrapper(account); to.putWrapper("account", accountWrapper); to.setAsynchronous(true); Future future = (Future)ServerExecutor.execute(to); accountWrapper = (TestAccountWrapper)future.Get(); TestAccount returnAccount = accountWrapper.getAccount(); return(returnAccount); }