Commit f5cc2615 authored by melvinfonda's avatar melvinfonda
Browse files

bukan ACCEPT tapi FETCHITEM Done

parent d597c5f4
......@@ -3,20 +3,9 @@
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
<group>
<<<<<<< HEAD
<file>file:/C:/Users/Stephen/Documents/NetBeansProjects/TubesSister/src/client/src/tcpclient/MainPage.java</file>
<file>file:/C:/Users/Stephen/Documents/NetBeansProjects/TubesSister/src/client/src/tcpclient/TCPClient.java</file>
<file>file:/C:/Users/Stephen/Documents/NetBeansProjects/TubesSister/src/client/src/tcpclient/LoginPage.java</file>
=======
<<<<<<< HEAD
<file>file:/E:/semester%206/Sistem%20Paralel%20dan%20Terdistribusi/SISTER/IF3230-Tugas-Besar-Sister-2015/src/client/src/tcpclient/TCPClient.java</file>
<file>file:/E:/semester%206/Sistem%20Paralel%20dan%20Terdistribusi/SISTER/IF3230-Tugas-Besar-Sister-2015/src/client/src/tcpclient/MainPage.java</file>
=======
<file>file:/D:/IF3230-Tugas-Besar-Sister-2015/src/client/src/tcpclient/MainPage.java</file>
<file>file:/D:/IF3230-Tugas-Besar-Sister-2015/src/client/src/tcpclient/TCPClient.java</file>
<file>file:/D:/IF3230-Tugas-Besar-Sister-2015/src/client/src/tcpclient/LoginPage.java</file>
>>>>>>> bc4556fff5c99bc4b898c7dd8720e7cf066d81a5
>>>>>>> 3c69b2b796de9bf56585767f5594f0a0341a48ac
</group>
</open-files>
</project-private>
......@@ -188,11 +188,11 @@ public class TCPClient {
return obj;
}
public JSONObject acceptJSON(String token, String offer_token) {
public JSONObject fetchitemJSON(String token, String offer_token) {
JSONObject obj = new JSONObject();
try {
obj.put("method", "accept");
obj.put("method", "fetchitem");
obj.put("token", token);
obj.put("offer_token", offer_token);
} catch(Exception e) {
......@@ -496,10 +496,10 @@ public class TCPClient {
return responseJSON;
}
public JSONObject accept(String token, String offer_token) throws Exception
public JSONObject fetchitem(String token, String offer_token) throws Exception
{
System.out.println("Accept");
String toSend = acceptJSON(token, offer_token).toString();
System.out.println("Fetch item");
String toSend = fetchitemJSON(token, offer_token).toString();
//throw ioexception
DataOutputStream outToServer;
......@@ -508,7 +508,7 @@ public class TCPClient {
outToServer.writeBytes(toSend + '\n');
} catch (IOException ex) {
Logger.getLogger(TCPClient.class.getName()).log(Level.SEVERE, null, ex);
throw new Exception("outtoserver accept exception");
throw new Exception("outtoserver fetch item exception");
}
......
......@@ -3,19 +3,9 @@
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
<group>
<<<<<<< HEAD
<file>file:/C:/Users/Stephen/Documents/NetBeansProjects/TubesSister/src/server/src/tcpserver/TCPServer.java</file>
<file>file:/C:/Users/Stephen/Documents/NetBeansProjects/TubesSister/src/server/src/tcpserver/Host.java</file>
<file>file:/C:/Users/Stephen/Documents/NetBeansProjects/TubesSister/src/server/src/tcpserver/MySQLAccess.java</file>
=======
<<<<<<< HEAD
<file>file:/E:/semester%206/Sistem%20Paralel%20dan%20Terdistribusi/SISTER/IF3230-Tugas-Besar-Sister-2015/src/server/src/tcpserver/TCPServer.java</file>
=======
<file>file:/D:/IF3230-Tugas-Besar-Sister-2015/src/server/map.txt</file>
<file>file:/D:/IF3230-Tugas-Besar-Sister-2015/src/server/src/tcpserver/MySQLAccess.java</file>
<file>file:/D:/IF3230-Tugas-Besar-Sister-2015/src/server/src/tcpserver/TCPServer.java</file>
>>>>>>> bc4556fff5c99bc4b898c7dd8720e7cf066d81a5
>>>>>>> 3c69b2b796de9bf56585767f5594f0a0341a48ac
</group>
</open-files>
</project-private>
......@@ -396,7 +396,7 @@ public class MySQLAccess {
return response;
}
public JSONObject accept(int userID, String offer_token) throws JSONException
public JSONObject fetchitem(int userID, String offer_token) throws JSONException
{
open();
JSONObject response = new JSONObject();
......
......@@ -189,9 +189,9 @@ public class TCPServer implements Runnable {
}
}
public JSONObject accept(JSONObject clientObject) throws JSONException {
public JSONObject fetchitem(JSONObject clientObject) throws JSONException {
if(clientObject.getString("token").equalsIgnoreCase(token)) {
return sql.accept(userID, clientObject.getString("offer_token"));
return sql.fetchitem(userID, clientObject.getString("offer_token"));
} else {
JSONObject responseJSON = new JSONObject();
responseJSON.put("status", "error");
......@@ -351,8 +351,8 @@ public class TCPServer implements Runnable {
JSONObject responseJSON = server.tradebox(clientObject);
System.out.println(responseJSON.toString());
outToClient.writeBytes(responseJSON.toString() + "\n");
} else if(method.equalsIgnoreCase("accept")) {
JSONObject responseJSON = server.accept(clientObject);
} else if(method.equalsIgnoreCase("fetchitem")) {
JSONObject responseJSON = server.fetchitem(clientObject);
System.out.println(responseJSON.toString());
outToClient.writeBytes(responseJSON.toString() + "\n");
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment