ServerConfiguration.setURLSite(urlServer.substring(0, urlServer.lastIndexOf("/")));
while(line!=null && !operationDone) {
LOGGER.debug("Line read: " + line);
for (int i = 0; i < ClientPrimitives.values().length; i++) {
ClientPrimitives primitive = ClientPrimitives.values()[i];
if(line.substring(0, line.indexOf(" ")).equals(primitive.toString())){ //primitive found
switch (primitive) {
case OE_PASSPHRASE:
response = oePassPhraseRequest(request);
break;
case OE_DHKEYPAIRS:
response = oeDHKeyPairs(request);
break;
case OE_UPLOAD_USER:
response = oeUploadUserPerms(request,webDAVrequest);
break;
case OE_UPLOAD_PERMS:
response = oeUploadPerms(request, webDAVrequest);
break;
case OE_UPLOAD_ALL_PERMS:
response = ServerUpdatePermissionsManager.receiveUploadPermissions(request);
break;
case OE_UPLMANAGER_FOLDER:
response = oeSetUploadManager(request);
break;
case OE_FIRST_STEP_JSON:
response = oeFirstStepCreateJson(request);
break;
case OE_JSON_UPLOAD:
response = oeCreateJsonUpload(request);
break;
case OE_FINISHED_UPLOAD_TOKEN:
response = oeFinishedULToken(request);
break;
case OE_PUT_TOKEN_DB:
response = oePutULToken(request);
break;
case OE_MORE_USERS_ACL:
response = oeMoreUsersAcl(request);
break;
case OE_CURRENT_NOTE:
response = oeCurrentNote(request);
break;
case OE_PUT_NOTE:
response = oePutNote(request);
break;
case OE_PUT_FOLDER:
response = oePutFolder(request);
break;
case OE_VIEW_INFO:
response = oeGetViewInfo(request);
break;
case OE_SET_VIEW:
response = oeSetView(request);
break;
case OE_PUT_ACL:
response = oePutAcl(request);
break;
case OE_START_UPDATE:
response = oeStartUpdate(request);
break;
case OE_NOTE:
response = oeCreateJsonNote(request);
break;
case OE_CURR:
response = oeGetCurrent(request);
break;
case OE_JSON_UPDATE:
response = oeCreateJsonUpdate(request);
break;
case OE_PUT_UPDATE_TOKEN:
response = oePutUpdateToken(request);
break;
case OE_TOKEN:
response = oePutUDToken(request);
break;
case OE_EMPTY_NOTE:
response = oeNoteIsEmpty(request);
break;
case OE_DELETE_NOTES:
response = oeDeleteNotes(request);
break;
case OE_COMMIT:
response = oeCommit(request);
break;
case OE_GET_VIEW_INFOS:
// checks whether user is logged in a previous session
if(OverEncryptGenericManager.verifyUserInSession(request)) {
response = OverEncryptGenericManager.returnViewInformations(request);
} else {
response = OverEncryptResponse.generateResponse(ServerPrimitives.OE_FORBIDDEN, request.getParent(), "Session expired");
}
break;
case OE_GET_INFO:
response = ServerDownloadManager.getInfo(request);
break;
case OE_CREATE_JSON_DL:
response = ServerDownloadManager.createJSONDl(request);
break;
case OE_FINISHED_DL_TOKEN:
response = ServerDownloadManager.finishedDLToken(request);
break;
case OE_GET_DSA_JSON:
response = DSAManager.getDSAJSON(request);
break;
case OE_UPLMANAGER_FILE:
response = oeSetUploadManagerFile(request);
break;
case OE_ENCRYPT_SEL:
response = oeEncryptSEL(request);
break;
case OE_GET_FRIENDS:
// checks whether user is logged in a previous session
if(OverEncryptGenericManager.verifyUserInSession(request)) {
response = oeGetFriends(request);
} else {
response = OverEncryptResponse.generateResponse(ServerPrimitives.OE_FORBIDDEN, request.getParent(), "Session expired");
}
break;
case OE_UPDATE_PERMS_AFT_FOLDER:
response = oeUpdatePermsAfterFolderCreation(request);
break;
case OE_FIND_USER:
response = oeFindUser(request);
break;
case OE_EDITPERM:
response = oeEditPermission(request);
break;
case OE_GET_TOKEN_INFO:
response = oeGetTokenInfo(request);
break;
case OE_CREATE_JSON_HBEL:
response = oeCreateJsonHBEL(request);
break;
case OE_PUT_TOKEN_HBEL:
response = oePutTokenHBEL(request);
break;
case OE_SEL_REQ:
response = oeSELRequest(request);
break;
case OE_SAVE_NEW_SEL:
response = oeSaveNewCryptedSEL(request);
break;
case OE_DELETE_FOLDER:
response = oeDeleteFolder(request);
break;
case OE_GET_USERNAMES:
response = oeGetUsernames(request);
break;
case OE_LOGOUT:
response = oeLogout(request, shared);
break;
default:
LOGGER.warn("primitive: "+ primitive.toString() + " don't recognise");
break;
}
operationDone = true;
break;
}