Merge branch 'master' of https://code.grnet.gr/git/pithos-web-client
authorKostas Papadimitriou <kpap@grnet.gr>
Tue, 12 Feb 2013 14:11:40 +0000 (16:11 +0200)
committerKostas Papadimitriou <kpap@grnet.gr>
Tue, 12 Feb 2013 14:11:40 +0000 (16:11 +0200)
98 files changed:
src/gr/grnet/pithos/web/Pithos.gwt.xml
src/gr/grnet/pithos/web/client/AbstractPropertiesDialog.java
src/gr/grnet/pithos/web/client/AddUserDialog.java
src/gr/grnet/pithos/web/client/Clipboard.java
src/gr/grnet/pithos/web/client/Configuration.java
src/gr/grnet/pithos/web/client/Configuration.properties
src/gr/grnet/pithos/web/client/ConfirmationDialog.java
src/gr/grnet/pithos/web/client/Const.java
src/gr/grnet/pithos/web/client/CredentialsDialog.java
src/gr/grnet/pithos/web/client/DeleteFileDialog.java
src/gr/grnet/pithos/web/client/DeleteFolderDialog.java
src/gr/grnet/pithos/web/client/FeedbackDialog.java
src/gr/grnet/pithos/web/client/FileContextMenu.java
src/gr/grnet/pithos/web/client/FileList.java
src/gr/grnet/pithos/web/client/FilePermissionsDialog.java
src/gr/grnet/pithos/web/client/FilePropertiesDialog.java
src/gr/grnet/pithos/web/client/FilePublishDialog.java
src/gr/grnet/pithos/web/client/FileUploadDialog.java
src/gr/grnet/pithos/web/client/FileVersionsDialog.java
src/gr/grnet/pithos/web/client/FilesPropertiesDialog.java
src/gr/grnet/pithos/web/client/FolderContextMenu.java
src/gr/grnet/pithos/web/client/FolderPermissionsDialog.java
src/gr/grnet/pithos/web/client/FolderPropertiesDialog.java
src/gr/grnet/pithos/web/client/GroupCreateDialog.java
src/gr/grnet/pithos/web/client/Invitation.java
src/gr/grnet/pithos/web/client/Invitations.java
src/gr/grnet/pithos/web/client/MessagePanel.java
src/gr/grnet/pithos/web/client/PermissionsAddDialog.java
src/gr/grnet/pithos/web/client/PermissionsList.java
src/gr/grnet/pithos/web/client/Pithos.css
src/gr/grnet/pithos/web/client/Pithos.java
src/gr/grnet/pithos/web/client/PithosDisclosurePanel.css
src/gr/grnet/pithos/web/client/PithosDisclosurePanel.java
src/gr/grnet/pithos/web/client/PithosSelectionEventManager.java
src/gr/grnet/pithos/web/client/PleaseWaitPopup.java
src/gr/grnet/pithos/web/client/Resource.java
src/gr/grnet/pithos/web/client/SessionExpiredDialog.java
src/gr/grnet/pithos/web/client/SharingUsers.java
src/gr/grnet/pithos/web/client/SortableHeader.java
src/gr/grnet/pithos/web/client/StatusPanel.java
src/gr/grnet/pithos/web/client/Toolbar.java
src/gr/grnet/pithos/web/client/ToolsMenu.java
src/gr/grnet/pithos/web/client/TopPanel.java
src/gr/grnet/pithos/web/client/TreeView.java
src/gr/grnet/pithos/web/client/UploadAlert.java
src/gr/grnet/pithos/web/client/VersionsList.java
src/gr/grnet/pithos/web/client/catalog/GetUserCatalogs.java
src/gr/grnet/pithos/web/client/catalog/UpdateUserCatalogs.java
src/gr/grnet/pithos/web/client/catalog/UserCatalogs.java
src/gr/grnet/pithos/web/client/commands/AddUserCommand.java
src/gr/grnet/pithos/web/client/commands/CopyCommand.java
src/gr/grnet/pithos/web/client/commands/CreateGroupCommand.java
src/gr/grnet/pithos/web/client/commands/CutCommand.java
src/gr/grnet/pithos/web/client/commands/DeleteCommand.java
src/gr/grnet/pithos/web/client/commands/DeleteGroupCommand.java
src/gr/grnet/pithos/web/client/commands/EmptyContainerCommand.java
src/gr/grnet/pithos/web/client/commands/NewFolderCommand.java
src/gr/grnet/pithos/web/client/commands/PasteCommand.java
src/gr/grnet/pithos/web/client/commands/PropertiesCommand.java
src/gr/grnet/pithos/web/client/commands/RefreshCommand.java
src/gr/grnet/pithos/web/client/commands/RemoveUserCommand.java
src/gr/grnet/pithos/web/client/commands/RestoreTrashCommand.java
src/gr/grnet/pithos/web/client/commands/ToTrashCommand.java
src/gr/grnet/pithos/web/client/commands/UploadFileCommand.java
src/gr/grnet/pithos/web/client/foldertree/AccountResource.java
src/gr/grnet/pithos/web/client/foldertree/File.java
src/gr/grnet/pithos/web/client/foldertree/FileVersions.java
src/gr/grnet/pithos/web/client/foldertree/Folder.java
src/gr/grnet/pithos/web/client/foldertree/FolderTreeView.java
src/gr/grnet/pithos/web/client/foldertree/FolderTreeViewModel.java
src/gr/grnet/pithos/web/client/foldertree/ObjectResource.java
src/gr/grnet/pithos/web/client/foldertree/SubDirResource.java
src/gr/grnet/pithos/web/client/foldertree/Version.java
src/gr/grnet/pithos/web/client/grouptree/Group.java
src/gr/grnet/pithos/web/client/grouptree/GroupContextMenu.java
src/gr/grnet/pithos/web/client/grouptree/GroupTreeView.java
src/gr/grnet/pithos/web/client/grouptree/GroupTreeViewModel.java
src/gr/grnet/pithos/web/client/grouptree/PithosGroupDisclosurePanel.css
src/gr/grnet/pithos/web/client/grouptree/User.java
src/gr/grnet/pithos/web/client/grouptree/UserContextMenu.java
src/gr/grnet/pithos/web/client/mysharedtree/MysharedTreeView.java
src/gr/grnet/pithos/web/client/mysharedtree/MysharedTreeViewModel.java
src/gr/grnet/pithos/web/client/mysharedtree/PithosMySharedDisclosurePanel.css
src/gr/grnet/pithos/web/client/othersharedtree/OtherSharedTreeView.java
src/gr/grnet/pithos/web/client/othersharedtree/OtherSharedTreeViewModel.java
src/gr/grnet/pithos/web/client/othersharedtree/PithosOtherSharedDisclosurePanel.css
src/gr/grnet/pithos/web/client/rest/DeleteRequest.java
src/gr/grnet/pithos/web/client/rest/GetRequest.java
src/gr/grnet/pithos/web/client/rest/HeadRequest.java
src/gr/grnet/pithos/web/client/rest/PostRequest.java
src/gr/grnet/pithos/web/client/rest/PutRequest.java
src/gr/grnet/pithos/web/client/rest/RestException.java
src/gr/grnet/pithos/web/client/rest/RestRequestCallback.java
src/gr/grnet/pithos/web/client/tagtree/Tag.java
src/gr/grnet/pithos/web/client/tagtree/TagTreeView.java
src/gr/grnet/pithos/web/client/tagtree/TagTreeViewModel.java
src/gr/grnet/pithos/web/public/index.html
src/gr/grnet/pithos/web/public/pithos.css

index bbe984a..57e0eff 100644 (file)
@@ -1,5 +1,5 @@
 <!--
-  ~ Copyright 2011-2012 GRNET S.A. All rights reserved.
+  ~ Copyright 2011-2013 GRNET S.A. All rights reserved.
   ~
   ~ Redistribution and use in source and binary forms, with or
   ~ without modification, are permitted provided that the following
index 9bc9475..38d1b95 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
- * Copyright 2011-2012 GRNET S.A. All rights reserved.\r
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.\r
  *\r
  * Redistribution and use in source and binary forms, with or\r
  * without modification, are permitted provided that the following\r
index 9dcffd1..759039f 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
- * Copyright 2011-2012 GRNET S.A. All rights reserved.\r
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.\r
  *\r
  * Redistribution and use in source and binary forms, with or\r
  * without modification, are permitted provided that the following\r
@@ -48,10 +48,11 @@ import com.google.gwt.user.client.ui.*;
 import gr.grnet.pithos.web.client.catalog.UpdateUserCatalogs;\r
 import gr.grnet.pithos.web.client.catalog.UserCatalogs;\r
 import gr.grnet.pithos.web.client.grouptree.Group;\r
-import gr.grnet.pithos.web.client.grouptree.User;\r
 import gr.grnet.pithos.web.client.rest.PostRequest;\r
 import gr.grnet.pithos.web.client.rest.RestException;\r
 \r
+import java.util.Arrays;\r
+\r
 /**\r
  * The 'Folder properties' dialog box implementation.\r
  */\r
@@ -63,7 +64,7 @@ public class AddUserDialog extends DialogBox {
     /**\r
      * The widget that holds the folderName of the folder.\r
      */\r
-    TextBox userDisplayNameTextBox = new TextBox();\r
+    TextBox userNameInput = new TextBox();\r
 \r
     final VerticalPanel inner;\r
 \r
@@ -104,7 +105,7 @@ public class AddUserDialog extends DialogBox {
         FlexTable generalTable = new FlexTable();\r
         generalTable.setText(0, 0, "Username");\r
 \r
-        generalTable.setWidget(0, 1, userDisplayNameTextBox);\r
+        generalTable.setWidget(0, 1, userNameInput);\r
 \r
         generalTable.getFlexCellFormatter().setStyleName(0, 0, "props-labels");\r
         generalTable.getFlexCellFormatter().setStyleName(0, 1, "props-values");\r
@@ -134,7 +135,7 @@ public class AddUserDialog extends DialogBox {
     @Override\r
     public void center() {\r
         super.center();\r
-        userDisplayNameTextBox.setFocus(true);\r
+        userNameInput.setFocus(true);\r
     }\r
 \r
     @Override\r
@@ -168,47 +169,12 @@ public class AddUserDialog extends DialogBox {
         hide();\r
     }\r
 \r
-    /**\r
-     * Generate an RPC request to create a new folder.\r
-     */\r
-    void addUser() {\r
-        final String userDisplayName = userDisplayNameTextBox.getText().trim();\r
-        if(userDisplayName.length() == 0) {\r
-            return;\r
-        }\r
-        if(!Const.EMAIL_REGEX.test(userDisplayName)) {\r
-            app.displayWarning("Username must be a valid email address");\r
-            return;\r
-        }\r
-\r
-        // Now get the userID\r
-        final String userID = app.getUserIDForDisplayName(userDisplayName);\r
-        if(userID != null) {\r
-            doAddUser(userID, userDisplayName);\r
-        }\r
-        else {\r
-            // Must call server to obtain userID\r
-            new UpdateUserCatalogs(app, null, Helpers.toList(userDisplayName)) {\r
-                @Override\r
-                public void onSuccess(UserCatalogs requestedUserCatalogs, UserCatalogs updatedUserCatalogs) {\r
-                    final String userID = updatedUserCatalogs.getUserID(userDisplayName);\r
-                    if(userID != null) {\r
-                        doAddUser(userID, userDisplayName);\r
-                    }\r
-                    else {\r
-                        app.displayError("Unknown user " + userDisplayName);\r
-                    }\r
-                }\r
-            }.scheduleDeferred();\r
-        }\r
-    }\r
+    private void doAddUserByName(final String userDisplayName) {\r
+        final String userID = app.getIDForUserDisplayName(userDisplayName);\r
+        group.addMemberID(userID);\r
+        String path = "?update=";\r
+        PostRequest updateGroup = new PostRequest(app.getApiPath(), app.getUserID(), path) {\r
 \r
-    private void doAddUser(String userID, String userDisplayName) {\r
-        final User newUser = new User(userID, userDisplayName, group.getName());\r
-        app.LOG("doAddUser() ", newUser);\r
-        group.addUser(newUser);\r
-        final String path = "?update=";\r
-        PostRequest updateGroup = new PostRequest(app, app.getApiPath(), app.getUserID(), path) {\r
             @Override\r
             public void onSuccess(Resource result) {\r
                 app.updateGroupNode(group);\r
@@ -232,8 +198,38 @@ public class AddUserDialog extends DialogBox {
             }\r
         };\r
         updateGroup.setHeader(Const.X_AUTH_TOKEN, app.getUserToken());\r
-        final String groupMembers = group.encodeUserIDsForXAccountGroup();\r
+        String groupMembers = "";\r
+        for(String u : group.getMemberIDs()) {\r
+            groupMembers += (URL.encodePathSegment(u) + ",");\r
+        }\r
         updateGroup.setHeader(Const.X_ACCOUNT_GROUP_ + URL.encodePathSegment(group.getName()), groupMembers);\r
         Scheduler.get().scheduleDeferred(updateGroup);\r
     }\r
+    /**\r
+     * Generate an RPC request to create a new folder.\r
+     */\r
+    void addUser() {\r
+        final String userDisplayName = userNameInput.getText().trim();\r
+        if(userDisplayName.length() == 0) {\r
+            return;\r
+        }\r
+        if(!Const.EMAIL_REGEX.test(userDisplayName)) {\r
+            app.displayWarning("Username must be a valid email address");\r
+            return;\r
+        }\r
+\r
+        if(app.hasIDForUserDisplayName(userDisplayName)) {\r
+            doAddUserByName(userDisplayName);\r
+        }\r
+        else {\r
+            new UpdateUserCatalogs(app, null, Arrays.asList(userDisplayName)) {\r
+                @Override\r
+                public void onSuccess(UserCatalogs requestedUserCatalogs, UserCatalogs updatedUserCatalogs) {\r
+                    doAddUserByName(userDisplayName);\r
+                }\r
+            }.scheduleDeferred();\r
+        }\r
+\r
+\r
+    }\r
 }\r
index ac43876..0fad1da 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011-2012 GRNET S.A. All rights reserved.
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
index 8fcb5a5..3342c80 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011-2012 GRNET S.A. All rights reserved.
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
index 17be15f..3200342 100644 (file)
@@ -1,5 +1,5 @@
 #
-# Copyright 2011-2012 GRNET S.A. All rights reserved.
+# Copyright 2011-2013 GRNET S.A. All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or
 # without modification, are permitted provided that the following
index 25ef864..17135a7 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011-2012 GRNET S.A. All rights reserved.
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
index 11589cc..710546a 100644 (file)
@@ -23,13 +23,7 @@ public class Const {
     public static final String TRASH_CONTAINER = "trash";
     public static final RegExp EMAIL_REGEX = RegExp.compile("^[A-Z0-9._%+-]+@[A-Z0-9.-]+[.][A-Z]{2,4}$", "i");
     public static final String X_ACCOUNT_GROUP_ = "X-Account-Group-";
-    public static final String X_ACCOUNT_CONTAINER_COUNT = "X-Account-Container-Count";
-    public static final String X_ACCOUNT_OBJECT_COUNT = "X-Account-Object-Count";
-    public static final String X_ACCOUNT_BYTES_USED = "X-Account-Bytes-Used";
-    public static final String X_ACCOUNT_POLICY_QUOTA = "X-Account-Policy-Quota";
-    public static final String X_ACCOUNT_LAST_LOGIN = "X-Account-Last-Login";
-    public static final String LAST_MODIFIED = "Last-Modified";
-    public static final String NUMBER_FORMAT_1 = "######.#";
+    public static final String NL = "\n";
 
     private Const() {}
 
index fd56799..a706eaf 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011-2012 GRNET S.A. All rights reserved.
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
index dfecfab..d53a546 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
- * Copyright 2011-2012 GRNET S.A. All rights reserved.\r
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.\r
  *\r
  * Redistribution and use in source and binary forms, with or\r
  * without modification, are permitted provided that the following\r
@@ -135,7 +135,7 @@ public class DeleteFileDialog extends DialogBox {
         if (iter.hasNext()) {\r
             File f = iter.next();\r
             String path = f.getUri();\r
-            DeleteRequest deleteFile = new DeleteRequest(app, app.getApiPath(), f.getOwnerID(), URL.encode(path)) {\r
+            DeleteRequest deleteFile = new DeleteRequest(app.getApiPath(), f.getOwnerID(), URL.encode(path)) {\r
                 @Override\r
                 public void onSuccess(Resource result) {\r
                     deleteFile(iter);\r
index 7355697..6f5464d 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
- * Copyright 2011-2012 GRNET S.A. All rights reserved.\r
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.\r
  *\r
  * Redistribution and use in source and binary forms, with or\r
  * without modification, are permitted provided that the following\r
index 5c85235..82cb421 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011-2012 GRNET S.A. All rights reserved.
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
@@ -140,7 +140,7 @@ public class FeedbackDialog extends DialogBox {
      */
     void sendFeedback() {
         final String feedbackURL = otherProperties.get("feedbackUrl");
-        PostRequest sendFeedback = new PostRequest(app, "", "", feedbackURL, "feedback_msg=" + msg.getText() + "&feedback_data=" + appData + "&auth=" + app.getUserToken()) {
+        PostRequest sendFeedback = new PostRequest("", "", feedbackURL, "feedback_msg=" + msg.getText() + "&feedback_data=" + appData + "&auth=" + app.getUserToken()) {
 
             @Override
             protected void onUnauthorized(Response response) {
index 1459f6f..82a108b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011-2012 GRNET S.A. All rights reserved.
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
index 5384d11..cdafa27 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011-2012 GRNET S.A. All rights reserved.
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
index dac21b9..64663dd 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
- * Copyright 2011-2012 GRNET S.A. All rights reserved.\r
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.\r
  *\r
  * Redistribution and use in source and binary forms, with or\r
  * without modification, are permitted provided that the following\r
@@ -262,10 +262,10 @@ public class FilePermissionsDialog extends AbstractPropertiesDialog {
 \r
        protected void updateMetaData(String api, String owner, final String path, final Map<String, Boolean[]> newPermissions) {\r
         if (newPermissions != null) {\r
-            PostRequest updateFile = new PostRequest(app, api, owner, path) {\r
+            PostRequest updateFile = new PostRequest(api, owner, path) {\r
                 @Override\r
                 public void onSuccess(Resource result) {\r
-                       HeadRequest<File> headFile = new HeadRequest<File>(app, File.class, app.getApiPath(), file.getOwnerID(), path, file) {\r
+                       HeadRequest<File> headFile = new HeadRequest<File>(File.class, app.getApiPath(), file.getOwnerID(), path, file) {\r
 \r
                                                @Override\r
                                                public void onSuccess(File _result) {\r
index 6bb542f..d33cd27 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
- * Copyright 2011-2012 GRNET S.A. All rights reserved.\r
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.\r
  *\r
  * Redistribution and use in source and binary forms, with or\r
  * without modification, are permitted provided that the following\r
@@ -141,7 +141,7 @@ public class FilePropertiesDialog extends AbstractPropertiesDialog {
         }\r
 \r
         final String ownerID = file.getOwnerID();\r
-        final String displayName = app.getUserDisplayNameForID(ownerID);\r
+        final String displayName = app.getDisplayNameForUserID(ownerID);\r
         final String ownerDisplayName;\r
         if(displayName == null) {\r
             // FIXME: Get the actual display name and do not use the id\r
@@ -261,7 +261,7 @@ public class FilePropertiesDialog extends AbstractPropertiesDialog {
 \r
         if (newFilename != null) {\r
             final String path = file.getParent().getUri() + "/" + newFilename;\r
-            PutRequest updateFile = new PutRequest(app, app.getApiPath(), app.getUserID(), path) {\r
+            PutRequest updateFile = new PutRequest(app.getApiPath(), app.getUserID(), path) {\r
                 @Override\r
                 public void onSuccess(Resource result) {\r
                     updateMetaData(app.getApiPath(), file.getOwnerID(), path, newMeta);\r
@@ -319,7 +319,7 @@ public class FilePropertiesDialog extends AbstractPropertiesDialog {
 \r
        protected void updateMetaData(final String api, final String owner, final String path, Map<String, String> newMeta) {\r
         if (newMeta != null) {\r
-            PostRequest updateFile = new PostRequest(app, api, owner, path + "?update=") {\r
+            PostRequest updateFile = new PostRequest(api, owner, path + "?update=") {\r
                 @Override\r
                 public void onSuccess(Resource result) {\r
                        if (!app.isMySharedSelected())\r
index eca3581..1a01bdc 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
- * Copyright 2011-2012 GRNET S.A. All rights reserved.\r
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.\r
  *\r
  * Redistribution and use in source and binary forms, with or\r
  * without modification, are permitted provided that the following\r
@@ -230,10 +230,10 @@ public class FilePublishDialog extends AbstractPropertiesDialog {
 \r
        protected void updateMetaData(String api, String owner, final String path, final Boolean published) {\r
         if (published != null) {\r
-            PostRequest updateFile = new PostRequest(app, api, owner, path) {\r
+            PostRequest updateFile = new PostRequest(api, owner, path) {\r
                 @Override\r
                 public void onSuccess(Resource result) {\r
-                       HeadRequest<File> headFile = new HeadRequest<File>(app, File.class, app.getApiPath(), file.getOwnerID(), path, file) {\r
+                       HeadRequest<File> headFile = new HeadRequest<File>(File.class, app.getApiPath(), file.getOwnerID(), path, file) {\r
 \r
                                                @Override\r
                                                public void onSuccess(File _result) {\r
index 32be778..04071ef 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011-2012 GRNET S.A. All rights reserved.
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
index ea5569f..43afb5d 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
- * Copyright 2011-2012 GRNET S.A. All rights reserved.\r
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.\r
  *\r
  * Redistribution and use in source and binary forms, with or\r
  * without modification, are permitted provided that the following\r
@@ -146,7 +146,7 @@ public class FileVersionsDialog extends AbstractPropertiesDialog {
 \r
     protected void fetchVersions() {\r
        String path = file.getUri() + "?format=json&version=list";\r
-       GetRequest<FileVersions> getVersions = new GetRequest<FileVersions>(app, FileVersions.class, app.getApiPath(), file.getOwnerID(), path) {\r
+       GetRequest<FileVersions> getVersions = new GetRequest<FileVersions>(FileVersions.class, app.getApiPath(), file.getOwnerID(), path) {\r
 \r
                        @Override\r
                        public void onSuccess(FileVersions _result) {\r
index 72d31e8..9f8a1b8 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
- * Copyright 2011-2012 GRNET S.A. All rights reserved.\r
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.\r
  *\r
  * Redistribution and use in source and binary forms, with or\r
  * without modification, are permitted provided that the following\r
index 464a43a..217ca1f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011-2012 GRNET S.A. All rights reserved.
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
index 18dfb24..b93d14f 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
- * Copyright 2011-2012 GRNET S.A. All rights reserved.\r
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.\r
  *\r
  * Redistribution and use in source and binary forms, with or\r
  * without modification, are permitted provided that the following\r
@@ -215,7 +215,7 @@ public class FolderPermissionsDialog extends DialogBox {
 \r
        protected void updateMetadata(final String path, final Map<String, Boolean[]> newPermissions) {\r
         if (newPermissions != null) {\r
-            PostRequest updateFolder = new PostRequest(app, app.getApiPath(), folder.getOwnerID(), path) {\r
+            PostRequest updateFolder = new PostRequest(app.getApiPath(), folder.getOwnerID(), path) {\r
                 @Override\r
                 public void onSuccess(Resource result) {\r
                     app.updateFolder(folder.getParent(), false, new Command() {\r
@@ -234,7 +234,7 @@ public class FolderPermissionsDialog extends DialogBox {
                     if (t instanceof RestException) {\r
                        if (((RestException) t).getHttpStatusCode() == Response.SC_NOT_FOUND) { //Probably a virtual folder\r
                             final String path1 = folder.getUri();\r
-                            PutRequest newFolder = new PutRequest(app, app.getApiPath(), folder.getOwnerID(), path1) {\r
+                            PutRequest newFolder = new PutRequest(app.getApiPath(), folder.getOwnerID(), path1) {\r
                                 @Override\r
                                 public void onSuccess(Resource result) {\r
                                        updateMetadata(path, newPermissions);\r
index 9847b46..9531dcf 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
- * Copyright 2011-2012 GRNET S.A. All rights reserved.\r
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.\r
  *\r
  * Redistribution and use in source and binary forms, with or\r
  * without modification, are permitted provided that the following\r
@@ -136,7 +136,7 @@ public class FolderPropertiesDialog extends DialogBox {
         }\r
         else {\r
             final String ownerID = folder.getOwnerID();\r
-            final String displayName = app.getUserDisplayNameForID(ownerID);\r
+            final String displayName = app.getDisplayNameForUserID(ownerID);\r
             final String ownerDisplayName;\r
             if(displayName == null) {\r
                 // FIXME: Get the actual display name and do not use the id\r
@@ -249,7 +249,7 @@ public class FolderPropertiesDialog extends DialogBox {
             return;\r
         }\r
         String path = folder.getUri() + "/" + name;\r
-        PutRequest createFolder = new PutRequest(app, app.getApiPath(), folder.getOwnerID(), path) {\r
+        PutRequest createFolder = new PutRequest(app.getApiPath(), folder.getOwnerID(), path) {\r
             @Override\r
             public void onSuccess(Resource result) {\r
                 app.updateFolder(folder, true, new Command() {\r
index b598679..bce8364 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
- * Copyright 2011-2012 GRNET S.A. All rights reserved.\r
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.\r
  *\r
  * Redistribution and use in source and binary forms, with or\r
  * without modification, are permitted provided that the following\r
  */\r
 package gr.grnet.pithos.web.client;\r
 \r
+import gr.grnet.pithos.web.client.commands.AddUserCommand;\r
+import gr.grnet.pithos.web.client.foldertree.Folder;\r
+import gr.grnet.pithos.web.client.grouptree.Group;\r
+\r
 import com.google.gwt.dom.client.NativeEvent;\r
 import com.google.gwt.event.dom.client.ClickEvent;\r
 import com.google.gwt.event.dom.client.ClickHandler;\r
@@ -41,9 +45,13 @@ import com.google.gwt.event.dom.client.KeyCodes;
 import com.google.gwt.event.dom.client.KeyDownEvent;\r
 import com.google.gwt.user.client.Command;\r
 import com.google.gwt.user.client.Event.NativePreviewEvent;\r
-import com.google.gwt.user.client.ui.*;\r
-import gr.grnet.pithos.web.client.commands.AddUserCommand;\r
-import gr.grnet.pithos.web.client.grouptree.Group;\r
+import com.google.gwt.user.client.ui.Anchor;\r
+import com.google.gwt.user.client.ui.Button;\r
+import com.google.gwt.user.client.ui.DialogBox;\r
+import com.google.gwt.user.client.ui.FlexTable;\r
+import com.google.gwt.user.client.ui.HasHorizontalAlignment;\r
+import com.google.gwt.user.client.ui.TextBox;\r
+import com.google.gwt.user.client.ui.VerticalPanel;\r
 \r
 /**\r
  * The 'Folder properties' dialog box implementation.\r
@@ -53,56 +61,56 @@ public class GroupCreateDialog extends DialogBox {
     protected Pithos app;\r
 \r
     private Command callback;\r
-\r
-    /**\r
-     * The widget that holds the folderName of the folder.\r
-     */\r
-    TextBox groupNameTextBox = new TextBox();\r
-\r
-    final VerticalPanel inner;\r
-\r
-    public GroupCreateDialog(final Pithos app) {\r
-        this(app, null);\r
-    }\r
-\r
-    /**\r
-     * The widget's constructor.\r
-     */\r
-    public GroupCreateDialog(final Pithos app, Command callback) {\r
+    \r
+       /**\r
+        * The widget that holds the folderName of the folder.\r
+        */\r
+       TextBox groupName = new TextBox();\r
+\r
+       final VerticalPanel inner;\r
+\r
+       public GroupCreateDialog(final Pithos app) {\r
+               this(app, null);\r
+       }\r
+       \r
+       /**\r
+        * The widget's constructor.\r
+        */\r
+       public GroupCreateDialog(final Pithos app, Command callback) {\r
         this.app = app;\r
         this.callback = callback;\r
-\r
-        Anchor close = new Anchor("close");\r
-        close.addStyleName("close");\r
-        close.addClickHandler(new ClickHandler() {\r
-\r
-            @Override\r
-            public void onClick(ClickEvent event) {\r
-                hide();\r
-            }\r
-        });\r
-\r
-        setGlassEnabled(true);\r
-        setStyleName("pithos-DialogBox");\r
-\r
-        // Enable IE selection for the dialog (must disable it upon closing it)\r
-        Pithos.enableIESelection();\r
-\r
-        // Use this opportunity to set the dialog's caption.\r
-        setText("Create group");\r
-\r
-        // Outer contains inner and buttons\r
-        VerticalPanel outer = new VerticalPanel();\r
-        outer.add(close);\r
-        // Inner contains generalPanel and permPanel\r
-        inner = new VerticalPanel();\r
-        inner.addStyleName("inner");\r
-\r
-        VerticalPanel generalPanel = new VerticalPanel();\r
+        \r
+               Anchor close = new Anchor("close");\r
+               close.addStyleName("close");\r
+               close.addClickHandler(new ClickHandler() {\r
+                       \r
+                       @Override\r
+                       public void onClick(ClickEvent event) {\r
+                               hide();\r
+                       }\r
+               });\r
+\r
+               setGlassEnabled(true);\r
+               setStyleName("pithos-DialogBox");\r
+\r
+               // Enable IE selection for the dialog (must disable it upon closing it)\r
+               Pithos.enableIESelection();\r
+\r
+               // Use this opportunity to set the dialog's caption.\r
+               setText("Create group");\r
+\r
+               // Outer contains inner and buttons\r
+               VerticalPanel outer = new VerticalPanel();\r
+               outer.add(close);\r
+               // Inner contains generalPanel and permPanel\r
+               inner = new VerticalPanel();\r
+               inner.addStyleName("inner");\r
+\r
+               VerticalPanel generalPanel = new VerticalPanel();\r
         FlexTable generalTable = new FlexTable();\r
         generalTable.setText(0, 0, "Name");\r
 \r
-        generalTable.setWidget(0, 1, groupNameTextBox);\r
+        generalTable.setWidget(0, 1, groupName);\r
 \r
         generalTable.getFlexCellFormatter().setStyleName(0, 0, "props-labels");\r
         generalTable.getFlexCellFormatter().setStyleName(0, 1, "props-values");\r
@@ -112,73 +120,69 @@ public class GroupCreateDialog extends DialogBox {
 \r
         outer.add(inner);\r
 \r
-        // Create the 'Create/Update' button, along with a listener that hides the dialog\r
-        // when the button is clicked and quits the application.\r
-        String okLabel = "Create";\r
-        final Button ok = new Button(okLabel, new ClickHandler() {\r
-            @Override\r
-            public void onClick(ClickEvent event) {\r
-                createGroup();\r
-                closeDialog();\r
-            }\r
-        });\r
-        ok.addStyleName("button");\r
-        outer.add(ok);\r
+               // Create the 'Create/Update' button, along with a listener that hides the dialog\r
+               // when the button is clicked and quits the application.\r
+               String okLabel = "Create";\r
+               final Button ok = new Button(okLabel, new ClickHandler() {\r
+                       @Override\r
+                       public void onClick(ClickEvent event) {\r
+                               createGroup();\r
+                               closeDialog();\r
+                       }\r
+               });\r
+               ok.addStyleName("button");\r
+               outer.add(ok);\r
         outer.setCellHorizontalAlignment(inner, HasHorizontalAlignment.ALIGN_CENTER);\r
 \r
         setWidget(outer);\r
-    }\r
-\r
-    @Override\r
-    public void center() {\r
-        super.center();\r
-        groupNameTextBox.setFocus(true);\r
-    }\r
-\r
-    @Override\r
-    protected void onPreviewNativeEvent(NativePreviewEvent preview) {\r
-        super.onPreviewNativeEvent(preview);\r
-\r
-        NativeEvent evt = preview.getNativeEvent();\r
-        if(evt.getType().equals(KeyDownEvent.getType().getName()))\r
-        // Use the popup's key preview hooks to close the dialog when either\r
-        // enter or escape is pressed.\r
-        {\r
-            switch(evt.getKeyCode()) {\r
-                case KeyCodes.KEY_ENTER:\r
-                    createGroup();\r
-                    closeDialog();\r
-                    break;\r
-                case KeyCodes.KEY_ESCAPE:\r
+       }\r
+\r
+       @Override\r
+       public void center() {\r
+               super.center();\r
+               groupName.setFocus(true);\r
+       }\r
+\r
+       @Override\r
+       protected void onPreviewNativeEvent(NativePreviewEvent preview) {\r
+               super.onPreviewNativeEvent(preview);\r
+\r
+               NativeEvent evt = preview.getNativeEvent();\r
+               if (evt.getType().equals(KeyDownEvent.getType().getName()))\r
+                       // Use the popup's key preview hooks to close the dialog when either\r
+                       // enter or escape is pressed.\r
+                       switch (evt.getKeyCode()) {\r
+                               case KeyCodes.KEY_ENTER:\r
+                                       createGroup();\r
                     closeDialog();\r
-                    break;\r
-            }\r
-        }\r
-    }\r
-\r
-\r
-    /**\r
-     * Enables IE selection prevention and hides the dialog\r
-     * (we disable the prevention on creation of the dialog)\r
-     */\r
-    public void closeDialog() {\r
-        Pithos.preventIESelection();\r
-        hide();\r
-        if(callback != null) {\r
-            callback.execute();\r
-        }\r
-    }\r
-\r
-    /**\r
-     * Generate an RPC request to create a new folder.\r
-     */\r
-    void createGroup() {\r
-        final String groupName = groupNameTextBox.getText().trim();\r
-        if(groupName.length() == 0) {\r
-            return;\r
-        }\r
-        Group group = app.addGroup(groupName);\r
-\r
-        new AddUserCommand(app, null, group).execute();\r
-    }\r
+                                       break;\r
+                               case KeyCodes.KEY_ESCAPE:\r
+                                       closeDialog();\r
+                                       break;\r
+                       }\r
+       }\r
+\r
+\r
+       /**\r
+        * Enables IE selection prevention and hides the dialog\r
+        * (we disable the prevention on creation of the dialog)\r
+        */\r
+       public void closeDialog() {\r
+               Pithos.preventIESelection();\r
+               hide();\r
+               if (callback != null)\r
+                       callback.execute();\r
+       }\r
+\r
+       /**\r
+        * Generate an RPC request to create a new folder.\r
+        */\r
+       void createGroup() {\r
+               String name = groupName.getText().trim();\r
+               if (name.length() == 0)\r
+                       return;\r
+               Group group = app.addGroup(name);\r
+               \r
+               new AddUserCommand(app, null, group).execute();\r
+       }\r
 }\r
index a8e2de6..02af5a5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011-2012 GRNET S.A. All rights reserved.
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
index d6b5954..dc9b9a4 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011-2012 GRNET S.A. All rights reserved.
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
index 55f60b8..0cc44e5 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
- * Copyright 2011-2012 GRNET S.A. All rights reserved.\r
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.\r
  *\r
  * Redistribution and use in source and binary forms, with or\r
  * without modification, are permitted provided that the following\r
index ffd3701..cc143f2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011-2012 GRNET S.A. All rights reserved.
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
  */
 package gr.grnet.pithos.web.client;
 
-import com.google.gwt.http.client.Request;
-import com.google.gwt.http.client.Response;
-import com.google.gwt.json.client.JSONObject;
-import gr.grnet.pithos.web.client.catalog.GetUserCatalogs;
 import gr.grnet.pithos.web.client.catalog.UpdateUserCatalogs;
 import gr.grnet.pithos.web.client.catalog.UserCatalogs;
 import gr.grnet.pithos.web.client.grouptree.Group;
@@ -179,7 +175,7 @@ public class PermissionsAddDialog extends DialogBox {
         }
 
         // Now get the userID
-        final String userID = app.getUserIDForDisplayName(userDisplayName);
+        final String userID = app.getIDForUserDisplayName(userDisplayName);
         if(userID != null) {
             // Check if already have the permission
             if(!alreadyHasPermission(userID)) {
@@ -191,7 +187,7 @@ public class PermissionsAddDialog extends DialogBox {
             new UpdateUserCatalogs(app, null, Helpers.toList(userDisplayName)) {
                 @Override
                 public void onSuccess(UserCatalogs requestedUserCatalogs, UserCatalogs updatedUserCatalogs) {
-                    final String userID = updatedUserCatalogs.getUserID(userDisplayName);
+                    final String userID = updatedUserCatalogs.getID(userDisplayName);
                     if(userID == null) {
                         app.displayWarning("Unknown user " + userDisplayName);
                     }
index 4f3a26f..fe1aed0 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011-2012 GRNET S.A. All rights reserved.
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
@@ -128,7 +128,7 @@ public class PermissionsList extends Composite {
                for(final String userID : permissions.keySet()) {
             if (!userID.contains(":")) {
                  //not a group
-                final String displayName = app.getUserDisplayNameForID(userID);
+                final String displayName = app.getDisplayNameForUserID(userID);
                 if(displayName != null) {
                     permTable.setHTML(
                         i,
@@ -140,7 +140,7 @@ public class PermissionsList extends Composite {
                     new UpdateUserCatalogs(app, userID) {
                         @Override
                         public void onSuccess(UserCatalogs requestedUserCatalogs, UserCatalogs updatedUserCatalogs) {
-                            final String displayName = updatedUserCatalogs.getUserDisplayName(userID);
+                            final String displayName = updatedUserCatalogs.getDisplayName(userID);
                             permTable.setHTML(
                                 ii,
                                 0,
index 391e198..f5d6437 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011-2012 GRNET S.A. All rights reserved.
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
index bec05d5..5e29ee0 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011-2012 GRNET S.A. All rights reserved.
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
@@ -125,33 +125,33 @@ public class Pithos implements EntryPoint, ResizeHandler {
     }
 
     public String getCurrentUserDisplayNameOrID() {
-        final String displayName = userCatalogs.getUserDisplayName(getUserID());
+        final String displayName = userCatalogs.getDisplayName(getUserID());
         return displayName == null ? getUserID() : displayName;
     }
 
-    public boolean hasUserDisplayNameForID(String userID) {
-        return userCatalogs.getUserDisplayName(userID) != null;
+    public boolean hasDisplayNameForUserID(String userID) {
+        return userCatalogs.getDisplayName(userID) != null;
     }
 
-    public boolean hasUserIDForDisplayName(String displayName) {
-        return userCatalogs.getUserID(displayName) != null;
+    public boolean hasIDForUserDisplayName(String userDisplayName) {
+        return userCatalogs.getID(userDisplayName) != null;
     }
 
-    public String getUserDisplayNameForID(String userID) {
-        return userCatalogs.getUserDisplayName(userID);
+    public String getDisplayNameForUserID(String userID) {
+        return userCatalogs.getDisplayName(userID);
     }
 
-    public String getUserIDForDisplayName(String displayName) {
-        return userCatalogs.getUserID(displayName);
+    public String getIDForUserDisplayName(String userDisplayName) {
+        return userCatalogs.getID(userDisplayName);
     }
 
-    public List<String> getUserDisplayNamesForIDs(List<String> userIDs) {
+    public List<String> getDisplayNamesForUserIDs(List<String> userIDs) {
         if(userIDs == null) {
             userIDs = new ArrayList<String>();
         }
         final List<String> userDisplayNames = new ArrayList<String>();
         for(String userID : userIDs) {
-            final String displayName = getUserDisplayNameForID(userID);
+            final String displayName = getDisplayNameForUserID(userID);
             userDisplayNames.add(displayName);
         }
 
@@ -164,7 +164,7 @@ public class Pithos implements EntryPoint, ResizeHandler {
         }
         final List<String> filtered = new ArrayList<String>();
         for(String userID : userIDs) {
-            if(!this.userCatalogs.hasUserID(userID)) {
+            if(!this.userCatalogs.hasID(userID)) {
                 filtered.add(userID);
             }
         }
@@ -337,12 +337,14 @@ public class Pithos implements EntryPoint, ResizeHandler {
     }-*/;
 
     public static void LOG(Object ...args) {
-        final StringBuilder sb = new StringBuilder();
-        for(Object arg : args) {
-            sb.append(arg);
-        }
-        if(sb.length() > 0) {
-            __ConsoleLog(sb.toString());
+        if(false) {
+            final StringBuilder sb = new StringBuilder();
+            for(Object arg : args) {
+                sb.append(arg);
+            }
+            if(sb.length() > 0) {
+                __ConsoleLog(sb.toString());
+            }
         }
     }
 
@@ -500,6 +502,7 @@ public class Pithos implements EntryPoint, ResizeHandler {
         Scheduler.get().scheduleDeferred(new ScheduledCommand() {
             @Override
             public void execute() {
+                LOG("Pithos::initialize() Calling Pithos::fetchAccount()");
                 fetchAccount(new Command() {
 
                     @Override
@@ -553,7 +556,7 @@ public class Pithos implements EntryPoint, ResizeHandler {
                     return true;
                 }
 
-                HeadRequest<Folder> head = new HeadRequest<Folder>(Pithos.this, Folder.class, getApiPath(), f.getOwnerID(), "/" + f.getContainer()) {
+                HeadRequest<Folder> head = new HeadRequest<Folder>(Folder.class, getApiPath(), f.getOwnerID(), "/" + f.getContainer()) {
 
                     @Override
                     public void onSuccess(Folder _result) {
@@ -710,18 +713,27 @@ public class Pithos implements EntryPoint, ResizeHandler {
     }
 
     public void fetchAccount(final Command callback) {
-        LOG("Pithos::fetchAccount(), callback = ", callback);
         String path = "?format=json";
 
-        GetRequest<AccountResource> getAccount = new GetRequest<AccountResource>(this, AccountResource.class, getApiPath(), userID, path) {
+        GetRequest<AccountResource> getAccount = new GetRequest<AccountResource>(AccountResource.class, getApiPath(), userID, path) {
             @Override
-            public void onSuccess(AccountResource _result) {
-                account = _result;
+            public void onSuccess(AccountResource accountResource) {
+                account = accountResource;
                 if(callback != null) {
                     callback.execute();
                 }
+
+                final List<String> memberIDs = new ArrayList<String>();
+                final List<Group> groups = account.getGroups();
+                for(Group group : groups) {
+                    memberIDs.addAll(group.getMemberIDs());
+                }
+                memberIDs.add(Pithos.this.getUserID());
+
+                final List<String> theUnknown = Pithos.this.filterUserIDsWithUnknownDisplayName(memberIDs);
                 // Initialize the user catalog
-                new UpdateUserCatalogs(Pithos.this, Pithos.this.getUserID()).scheduleDeferred();
+                new UpdateUserCatalogs(Pithos.this, theUnknown).scheduleDeferred();
+                LOG("Called new UpdateUserCatalogs(Pithos.this, theUnknown).scheduleDeferred();");
             }
 
             @Override
@@ -746,7 +758,7 @@ public class Pithos implements EntryPoint, ResizeHandler {
     }
 
     public void updateStatistics() {
-        HeadRequest<AccountResource> headAccount = new HeadRequest<AccountResource>(this, AccountResource.class, getApiPath(), userID, "", account) {
+        HeadRequest<AccountResource> headAccount = new HeadRequest<AccountResource>(AccountResource.class, getApiPath(), userID, "", account) {
 
             @Override
             public void onSuccess(AccountResource _result) {
@@ -776,7 +788,7 @@ public class Pithos implements EntryPoint, ResizeHandler {
 
     protected void createHomeContainer(final AccountResource _account, final Command callback) {
         String path = "/" + Const.HOME_CONTAINER;
-        PutRequest createPithos = new PutRequest(this, getApiPath(), getUserID(), path) {
+        PutRequest createPithos = new PutRequest(getApiPath(), getUserID(), path) {
             @Override
             public void onSuccess(Resource result) {
                 if(!_account.hasTrashContainer()) {
@@ -810,7 +822,7 @@ public class Pithos implements EntryPoint, ResizeHandler {
 
     protected void createTrashContainer(final Command callback) {
         String path = "/" + Const.TRASH_CONTAINER;
-        PutRequest createPithos = new PutRequest(this, getApiPath(), getUserID(), path) {
+        PutRequest createPithos = new PutRequest(getApiPath(), getUserID(), path) {
             @Override
             public void onSuccess(Resource result) {
                 fetchAccount(callback);
@@ -977,7 +989,7 @@ public class Pithos implements EntryPoint, ResizeHandler {
         final PleaseWaitPopup pwp = new PleaseWaitPopup();
         pwp.center();
         String path = "/" + folder.getContainer() + "/" + folder.getPrefix() + "?delimiter=/" + "&t=" + System.currentTimeMillis();
-        DeleteRequest deleteFolder = new DeleteRequest(this, getApiPath(), folder.getOwnerID(), path) {
+        DeleteRequest deleteFolder = new DeleteRequest(getApiPath(), folder.getOwnerID(), path) {
 
             @Override
             protected void onUnauthorized(Response response) {
@@ -1031,7 +1043,7 @@ public class Pithos implements EntryPoint, ResizeHandler {
         if(iter.hasNext()) {
             File file = iter.next();
             String path = targetUri + "/" + file.getName();
-            PutRequest copyFile = new PutRequest(this, getApiPath(), targetUsername, path) {
+            PutRequest copyFile = new PutRequest(getApiPath(), targetUsername, path) {
                 @Override
                 public void onSuccess(Resource result) {
                     copyFiles(iter, targetUsername, targetUri, callback);
@@ -1069,7 +1081,7 @@ public class Pithos implements EntryPoint, ResizeHandler {
 
     public void copyFolder(final Folder f, final String targetUsername, final String targetUri, boolean move, final Command callback) {
         String path = targetUri + "?delimiter=/";
-        PutRequest copyFolder = new PutRequest(this, getApiPath(), targetUsername, path) {
+        PutRequest copyFolder = new PutRequest(getApiPath(), targetUsername, path) {
             @Override
             public void onSuccess(Resource result) {
                 if(callback != null) {
@@ -1126,11 +1138,11 @@ public class Pithos implements EntryPoint, ResizeHandler {
         groupTreeView.updateGroupNode(null);
     }
 
-    public Group addGroup(String groupName) {
-        final Group group = new Group(groupName);
-        account.addGroup(group);
+    public Group addGroup(String groupname) {
+        Group newGroup = new Group(groupname);
+        account.addGroup(newGroup);
         groupTreeView.updateGroupNode(null);
-        return group;
+        return newGroup;
     }
 
     public void removeGroup(Group group) {
@@ -1170,6 +1182,7 @@ public class Pithos implements EntryPoint, ResizeHandler {
     }
 
     void createMySharedTree() {
+        LOG("Pithos::createMySharedTree()");
         mysharedTreeSelectionModel = new SingleSelectionModel<Folder>();
         mysharedTreeSelectionModel.addSelectionChangeHandler(new Handler() {
             @Override
@@ -1206,6 +1219,7 @@ public class Pithos implements EntryPoint, ResizeHandler {
     }
 
     void createOtherSharedTree() {
+        LOG("Pithos::createOtherSharedTree()");
         otherSharedTreeSelectionModel = new SingleSelectionModel<Folder>();
         otherSharedTreeSelectionModel.addSelectionChangeHandler(new Handler() {
             @Override
@@ -1228,8 +1242,8 @@ public class Pithos implements EntryPoint, ResizeHandler {
         });
         selectionModels.add(otherSharedTreeSelectionModel);
         otherSharedTreeViewModel = new OtherSharedTreeViewModel(Pithos.this, otherSharedTreeSelectionModel);
+        LOG("Pithos::createOtherSharedTree(), initializing otherSharedTreeViewModel with a callback");
         otherSharedTreeViewModel.initialize(new Command() {
-
             @Override
             public void execute() {
                 otherSharedTreeView = new OtherSharedTreeView(otherSharedTreeViewModel);
@@ -1240,15 +1254,30 @@ public class Pithos implements EntryPoint, ResizeHandler {
         });
     }
 
-    public native void log1(String message)/*-{
-      $wnd.console.log(message);
-    }-*/;
-
     public String getErrorData() {
-        if(error != null) {
-            return error.toString();
+        final StringBuilder sb = new StringBuilder();
+        final String NL = Const.NL;
+        Throwable t = this.error;
+        while(t != null) {
+            sb.append(t.toString());
+            sb.append(NL);
+            StackTraceElement[] traces = t.getStackTrace();
+            for(StackTraceElement trace : traces) {
+                sb.append("  [");
+                sb.append(trace.getClassName());
+                sb.append("::");
+                sb.append(trace.getMethodName());
+                sb.append("() at ");
+                sb.append(trace.getFileName());
+                sb.append(":");
+                sb.append(trace.getLineNumber());
+                sb.append("]");
+                sb.append(NL);
+            }
+            t = t.getCause();
         }
-        return "";
+
+        return sb.toString();
     }
 
     public void setError(Throwable t) {
@@ -1283,7 +1312,7 @@ public class Pithos implements EntryPoint, ResizeHandler {
             }
         }
         else {
-            HeadRequest<Folder> headFolder = new HeadRequest<Folder>(this, Folder.class, getApiPath(), folder.getOwnerID(), folder.getUri(), folder) {
+            HeadRequest<Folder> headFolder = new HeadRequest<Folder>(Folder.class, getApiPath(), folder.getOwnerID(), folder.getUri(), folder) {
 
                 @Override
                 public void onSuccess(Folder _result) {
@@ -1297,7 +1326,7 @@ public class Pithos implements EntryPoint, ResizeHandler {
                     if(t instanceof RestException) {
                         if(((RestException) t).getHttpStatusCode() == Response.SC_NOT_FOUND) {
                             final String path = folder.getUri();
-                            PutRequest newFolder = new PutRequest(Pithos.this, getApiPath(), folder.getOwnerID(), path) {
+                            PutRequest newFolder = new PutRequest(getApiPath(), folder.getOwnerID(), path) {
                                 @Override
                                 public void onSuccess(Resource _result) {
                                     scheduleFolderHeadCommand(folder, callback);
@@ -1352,7 +1381,7 @@ public class Pithos implements EntryPoint, ResizeHandler {
     }
 
     public void scheduleFileHeadCommand(File f, final Command callback) {
-        HeadRequest<File> headFile = new HeadRequest<File>(this, File.class, getApiPath(), f.getOwnerID(), f.getUri(), f) {
+        HeadRequest<File> headFile = new HeadRequest<File>(File.class, getApiPath(), f.getOwnerID(), f.getUri(), f) {
 
             @Override
             public void onSuccess(File _result) {
@@ -1466,7 +1495,7 @@ public class Pithos implements EntryPoint, ResizeHandler {
 
     public void emptyContainer(final Folder container) {
         String path = "/" + container.getName() + "?delimiter=/";
-        DeleteRequest delete = new DeleteRequest(this, getApiPath(), getUserID(), path) {
+        DeleteRequest delete = new DeleteRequest(getApiPath(), getUserID(), path) {
 
             @Override
             protected void onUnauthorized(Response response) {
index fd4e044..b4db0ba 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2012 GRNET S.A. All rights reserved.
+ * Copyright 2012-2013 GRNET S.A. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
index 7853302..5dd2425 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2012 GRNET S.A. All rights reserved.
+ * Copyright 2012-2013 GRNET S.A. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
index 1f6018a..8c2da14 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011-2012 GRNET S.A. All rights reserved.
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
index 78bdac1..02f1553 100644 (file)
@@ -1,3 +1,38 @@
+/*
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ *   1. Redistributions of source code must retain the above
+ *      copyright notice, this list of conditions and the following
+ *      disclaimer.
+ *
+ *   2. Redistributions in binary form must reproduce the above
+ *      copyright notice, this list of conditions and the following
+ *      disclaimer in the documentation and/or other materials
+ *      provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and
+ * documentation are those of the authors and should not be
+ * interpreted as representing official policies, either expressed
+ * or implied, of GRNET S.A.
+ */
+
 package gr.grnet.pithos.web.client;
 
 import com.google.gwt.user.client.ui.Label;
index fd013eb..1e603dc 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011-2012 GRNET S.A. All rights reserved.
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
@@ -116,10 +116,10 @@ public abstract class Resource {
     }-*/;
 
     @SuppressWarnings("unchecked")
-    public static <T> T createFromResponse(Pithos app, Class<T> aClass, String owner, Response response, T result) {
+    public static <T> T createFromResponse(Class<T> aClass, String owner, Response response, T result) {
         T result1 = null;
         if(aClass.equals(AccountResource.class)) {
-            result1 = (T) AccountResource.createFromResponse(app, owner, response, (AccountResource) result);
+            result1 = (T) AccountResource.createFromResponse(owner, response, (AccountResource) result);
         }
         else if(aClass.equals(Folder.class)) {
             result1 = (T) Folder.createFromResponse(owner, response, (Folder) result);
index 0e99374..46f6928 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011-2012 GRNET S.A. All rights reserved.
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
index 575928b..d0f1a75 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011-2012 GRNET S.A. All rights reserved.
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
index 7872572..4373d06 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011-2012 GRNET S.A. All rights reserved.
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
index 86d669c..97cee7b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011-2012 GRNET S.A. All rights reserved.
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
@@ -74,7 +74,7 @@ public class StatusPanel extends Composite {
                inner.add(firstLine);
 
         HorizontalPanel secondLine = new HorizontalPanel();
-        secondLine.add(new HTML("Pithos Web Client v" + otherProperties.get("version") + " <a class='grnet-sign' href='http://www.grnet.gr'>Copyright (C) 2011-2012 Greek Research and Technology Network</a>"));
+        secondLine.add(new HTML("Pithos Web Client v" + otherProperties.get("version") + " <a class='grnet-sign' href='http://www.grnet.gr'>Copyright (C) 2011-2013 Greek Research and Technology Network</a>"));
         secondLine.addStyleName("grnet-sign");
         inner.add(secondLine);
         outer.add(inner);
index 6d1b695..558237c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2012 GRNET S.A. All rights reserved.
+ * Copyright 2012-2013 GRNET S.A. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
index 79a2b08..39729bf 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011-2012 GRNET S.A. All rights reserved.
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
index b755e7f..05e6a3e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011-2012 GRNET S.A. All rights reserved.
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
index bc15fe3..36c834d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011-2012 GRNET S.A. All rights reserved.
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
index 5490dea..82fbc6b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011-2012 GRNET S.A. All rights reserved.
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
index 66d4e6b..b5cee94 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011-2012 GRNET S.A. All rights reserved.
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
@@ -132,7 +132,7 @@ public class VersionsList extends Composite {
 
        void restoreVersion(int version) {
                String path = file.getUri() + "?update=";
-               PostRequest restoreVersion = new PostRequest(app, app.getApiPath(), file.getOwnerID(), path) {
+               PostRequest restoreVersion = new PostRequest(app.getApiPath(), file.getOwnerID(), path) {
                        
                        @Override
                        public void onSuccess(Resource result) {
index e234304..f006764 100644 (file)
@@ -1,3 +1,38 @@
+/*
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ *   1. Redistributions of source code must retain the above
+ *      copyright notice, this list of conditions and the following
+ *      disclaimer.
+ *
+ *   2. Redistributions in binary form must reproduce the above
+ *      copyright notice, this list of conditions and the following
+ *      disclaimer in the documentation and/or other materials
+ *      provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and
+ * documentation are those of the authors and should not be
+ * interpreted as representing official policies, either expressed
+ * or implied, of GRNET S.A.
+ */
+
 package gr.grnet.pithos.web.client.catalog;
 
 import com.google.gwt.core.client.GWT;
index 645905e..175e4ee 100644 (file)
@@ -1,3 +1,38 @@
+/*
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ *   1. Redistributions of source code must retain the above
+ *      copyright notice, this list of conditions and the following
+ *      disclaimer.
+ *
+ *   2. Redistributions in binary form must reproduce the above
+ *      copyright notice, this list of conditions and the following
+ *      disclaimer in the documentation and/or other materials
+ *      provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and
+ * documentation are those of the authors and should not be
+ * interpreted as representing official policies, either expressed
+ * or implied, of GRNET S.A.
+ */
+
 package gr.grnet.pithos.web.client.catalog;
 
 import com.google.gwt.core.client.Scheduler;
@@ -7,7 +42,9 @@ import com.google.gwt.json.client.JSONObject;
 import gr.grnet.pithos.web.client.Helpers;
 import gr.grnet.pithos.web.client.Pithos;
 
+import java.util.Iterator;
 import java.util.List;
+import java.util.Map;
 
 /**
  * This is a wrapper around GetUserCatalogs that takes care of updating
@@ -30,6 +67,9 @@ public class UpdateUserCatalogs implements Scheduler.ScheduledCommand {
     }
 
     public void onSuccess(UserCatalogs requestedUserCatalogs, UserCatalogs updatedUserCatalogs) {
+        for(Map.Entry<String, String> uc : requestedUserCatalogs) {
+//            app.LOG("New displayName ", uc.getValue());
+        }
     }
 
     public void onError(Request request, Throwable t) {
index 4fb2a6a..7b3734c 100644 (file)
@@ -1,3 +1,38 @@
+/*
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ *   1. Redistributions of source code must retain the above
+ *      copyright notice, this list of conditions and the following
+ *      disclaimer.
+ *
+ *   2. Redistributions in binary form must reproduce the above
+ *      copyright notice, this list of conditions and the following
+ *      disclaimer in the documentation and/or other materials
+ *      provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and
+ * documentation are those of the authors and should not be
+ * interpreted as representing official policies, either expressed
+ * or implied, of GRNET S.A.
+ */
+
 package gr.grnet.pithos.web.client.catalog;
 
 import gr.grnet.pithos.web.client.Helpers;
@@ -45,22 +80,25 @@ public class UserCatalogs implements Iterable<Map.Entry<String, String>>{
         );
     }
 
-    public boolean hasUserID(String id) {
-        return id2name.containsKey(id);
+    public boolean hasID(String userID) {
+        return id2name.containsKey(userID);
     }
 
-    public boolean hasUserDisplayName(String displayName) {
+    public boolean hasDisplayName(String displayName) {
         return name2id.containsKey(displayName);
     }
 
-    public String getUserDisplayName(String userID) {
+    public String getDisplayName(String userID) {
         return id2name.get(userID);
     }
 
-    public String getUserID(String displayName) {
+    public String getID(String displayName) {
         return name2id.get(displayName);
     }
 
+    /**
+     * Returns an iterator of <code>(UUID, DisplayName)</code> pairs.
+     */
     @Override
     public Iterator<Map.Entry<String, String>> iterator() {
         return id2name.entrySet().iterator();
index 264e5c7..8643494 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011-2012 GRNET S.A. All rights reserved.
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
index 5796a5b..167d9bf 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011-2012 GRNET S.A. All rights reserved.
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
index 95dc5e6..dcf7e49 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011-2012 GRNET S.A. All rights reserved.
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
index 19f49ad..11c081b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011-2012 GRNET S.A. All rights reserved.
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
index 4159405..7dd38b8 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011-2012 GRNET S.A. All rights reserved.
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
index 456cc06..0d979ba 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011-2012 GRNET S.A. All rights reserved.
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
@@ -34,7 +34,6 @@
  */
 package gr.grnet.pithos.web.client.commands;
 
-import gr.grnet.pithos.web.client.Const;
 import gr.grnet.pithos.web.client.Pithos;
 import gr.grnet.pithos.web.client.Resource;
 import gr.grnet.pithos.web.client.grouptree.Group;
@@ -76,7 +75,7 @@ public class DeleteGroupCommand implements Command {
                containerPanel.hide();
         if (Window.confirm("Are you sure you want to delete group " + group.getName())) {
                String path = "?update=";
-               PostRequest updateGroup = new PostRequest(app, app.getApiPath(), app.getUserID(), path) {
+               PostRequest updateGroup = new PostRequest(app.getApiPath(), app.getUserID(), path) {
                                
                                @Override
                                public void onSuccess(Resource result) {
@@ -99,8 +98,8 @@ public class DeleteGroupCommand implements Command {
                                        app.sessionExpired();
                                }
                        };
-                       updateGroup.setHeader(Const.X_AUTH_TOKEN, app.getUserToken());
-                       updateGroup.setHeader(Const.X_ACCOUNT_GROUP_ + URL.encodePathSegment(group.getName()), "~");
+                       updateGroup.setHeader("X-Auth-Token", app.getUserToken());
+                       updateGroup.setHeader("X-Account-Group-" + URL.encodePathSegment(group.getName()), "~");
                        Scheduler.get().scheduleDeferred(updateGroup);
         }
        }
index 8aa805a..9d78c94 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011-2012 GRNET S.A. All rights reserved.
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
index 89f7bc7..5ea308e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011-2012 GRNET S.A. All rights reserved.
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
index ccbcda8..6261090 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011-2012 GRNET S.A. All rights reserved.
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
@@ -137,7 +137,7 @@ public class PasteCommand implements Command {
         if (iter.hasNext()) {
             File file = iter.next();
             String path = folder.getUri() + "/" + file.getName();
-            PutRequest copyFile = new PutRequest(app, app.getApiPath(), folder.getOwnerID(), path) {
+            PutRequest copyFile = new PutRequest(app.getApiPath(), folder.getOwnerID(), path) {
                 @Override
                 public void onSuccess(Resource result) {
                     moveFiles(iter, callback);
index 7e40560..f1b3fdd 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011-2012 GRNET S.A. All rights reserved.
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
index 01f6acd..90e606a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011-2012 GRNET S.A. All rights reserved.
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
index d39a3ab..9fba21e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011-2012 GRNET S.A. All rights reserved.
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
  */
 package gr.grnet.pithos.web.client.commands;
 
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.core.client.Scheduler;
-import com.google.gwt.http.client.Response;
-import com.google.gwt.http.client.URL;
-import com.google.gwt.user.client.Command;
-import com.google.gwt.user.client.ui.PopupPanel;
-import gr.grnet.pithos.web.client.Const;
 import gr.grnet.pithos.web.client.Pithos;
 import gr.grnet.pithos.web.client.Resource;
 import gr.grnet.pithos.web.client.grouptree.Group;
@@ -48,82 +41,86 @@ import gr.grnet.pithos.web.client.grouptree.User;
 import gr.grnet.pithos.web.client.rest.PostRequest;
 import gr.grnet.pithos.web.client.rest.RestException;
 
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.core.client.Scheduler;
+import com.google.gwt.http.client.Response;
+import com.google.gwt.http.client.URL;
+import com.google.gwt.user.client.Command;
+import com.google.gwt.user.client.ui.PopupPanel;
+
 /**
  * Display the 'new folder' dialog for creating a new folder.
+ *
  */
 public class RemoveUserCommand implements Command {
-    private PopupPanel containerPanel;
+       private PopupPanel containerPanel;
 
     User user;
 
     Pithos app;
 
-    /**
-     * @param aContainerPanel
-     */
-    public RemoveUserCommand(Pithos _app, PopupPanel aContainerPanel, User _user) {
+       /**
+        * @param aContainerPanel
+        */
+       public RemoveUserCommand(Pithos _app, PopupPanel aContainerPanel, User _user){
         app = _app;
-        containerPanel = aContainerPanel;
-        user = _user;
-    }
-
-    @Override
-    public void execute() {
-        if(containerPanel != null) {
-            containerPanel.hide();
-        }
-        final String groupName = user.getGroup();
-        final Group group = app.getAccount().getGroup(groupName);
-        if(group == null) {
-            return;
-        }
-        group.removeUser(user);
-        String path = "?update=";
-        PostRequest updateGroup = new PostRequest(app, app.getApiPath(), app.getUserID(), path) {
-
-            @Override
-            public void onSuccess(Resource result) {
-                app.fetchAccount(new Command() {
-
-                    @Override
-                    public void execute() {
-                        Group updatedGroup2 = app.getAccount().getGroup(groupName);
-                        if(updatedGroup2 != null) {
-                            app.updateGroupNode(updatedGroup2);
-                        }
-                        else {
-                            app.updateGroupNode(null);
-                        }
-                    }
-                });
-            }
+               containerPanel = aContainerPanel;
+           user = _user;
+       }
 
-            @Override
-            public void onError(Throwable t) {
-                GWT.log("", t);
-                app.setError(t);
-                if(t instanceof RestException) {
-                    app.displayError("Unable to update group:" + ((RestException) t).getHttpStatusText());
-                }
-                else {
-                    app.displayError("System error updating group:" + t.getMessage());
-                }
-            }
+       @Override
+       public void execute() {
+        if (containerPanel != null)
+                   containerPanel.hide();
+       final String groupName = user.getGroup();
+       final Group group = app.getAccount().getGroup(groupName);
+       if (group == null)
+               return;
+       group.removeMemberID(user.getUserID());
+       String path = "?update=";
+       PostRequest updateGroup = new PostRequest(app.getApiPath(), app.getUserID(), path) {
+                       
+                       @Override
+                       public void onSuccess(Resource result) {
+                               app.fetchAccount(new Command() {
+                                       
+                                       @Override
+                                       public void execute() {
+                                               Group updatedGroup2 = app.getAccount().getGroup(groupName);
+                                               if (updatedGroup2 != null)
+                                                       app.updateGroupNode(updatedGroup2);
+                                               else {
+                                                       app.updateGroupNode(null);
+                                               }
+                                       }
+                               });
+                       }
+                       
+                       @Override
+                       public void onError(Throwable t) {
+                               GWT.log("", t);
+                               app.setError(t);
+                               if (t instanceof RestException) {
+                                       app.displayError("Unable to update group:" + ((RestException) t).getHttpStatusText());
+                               }
+                               else
+                                       app.displayError("System error updating group:" + t.getMessage());
+                       }
 
-            @Override
-            protected void onUnauthorized(Response response) {
-                app.sessionExpired();
-            }
-        };
-        updateGroup.setHeader(Const.X_AUTH_TOKEN, app.getUserToken());
-        final String groupMembers;
-        if(!group.getUsers().isEmpty()) {
-            groupMembers = group.encodeUserIDsForXAccountGroup();
-        }
-        else {
-            groupMembers = "~";
-        }
-        updateGroup.setHeader(Const.X_ACCOUNT_GROUP_ + URL.encodePathSegment(group.getName()), groupMembers);
-        Scheduler.get().scheduleDeferred(updateGroup);
-    }
+                       @Override
+                       protected void onUnauthorized(Response response) {
+                               app.sessionExpired();
+                       }
+               };
+               updateGroup.setHeader("X-Auth-Token", app.getUserToken());
+               String groupMembers = "";
+               if (!group.getMemberIDs().isEmpty()) {
+                       for (String u : group.getMemberIDs())
+                               groupMembers += (URL.encodePathSegment(u) + ",");
+               }
+               else
+                       groupMembers = "~";
+               updateGroup.setHeader("X-Account-Group-" + URL.encodePathSegment(group.getName()), groupMembers);
+               Scheduler.get().scheduleDeferred(updateGroup);
+       }
 }
index ff8d56a..8778236 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011-2012 GRNET S.A. All rights reserved.
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
@@ -117,7 +117,7 @@ public class RestoreTrashCommand implements Command {
         if (iter.hasNext()) {
             File file = iter.next();
             String path = "/" + Const.HOME_CONTAINER + "/" + file.getPath();
-            PutRequest untrashFile = new PutRequest(app, app.getApiPath(), app.getUserID(), path) {
+            PutRequest untrashFile = new PutRequest(app.getApiPath(), app.getUserID(), path) {
                 @Override
                 public void onSuccess(Resource result) {
                     untrashFiles(iter, callback);
index b5ece80..2e257cd 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011-2012 GRNET S.A. All rights reserved.
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
@@ -127,7 +127,7 @@ public class ToTrashCommand implements Command{
         if (iter.hasNext()) {
             File file = iter.next();
             String path = "/" + Const.TRASH_CONTAINER + "/" + file.getPath();
-            PutRequest trashFile = new PutRequest(app, app.getApiPath(), app.getUserID(), path) {
+            PutRequest trashFile = new PutRequest(app.getApiPath(), app.getUserID(), path) {
                 @Override
                 public void onSuccess(Resource result) {
                     trashFiles(iter, callback);
index a97f161..6ae8f2d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011-2012 GRNET S.A. All rights reserved.
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
index e4011a0..58f50a4 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011-2012 GRNET S.A. All rights reserved.
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
 
 package gr.grnet.pithos.web.client.foldertree;
 
+import gr.grnet.pithos.web.client.Const;
+import gr.grnet.pithos.web.client.Resource;
+import gr.grnet.pithos.web.client.grouptree.Group;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
 import com.google.gwt.http.client.Header;
 import com.google.gwt.http.client.Response;
 import com.google.gwt.http.client.URL;
@@ -45,22 +53,12 @@ import com.google.gwt.json.client.JSONArray;
 import com.google.gwt.json.client.JSONObject;
 import com.google.gwt.json.client.JSONParser;
 import com.google.gwt.json.client.JSONValue;
-import gr.grnet.pithos.web.client.Const;
-import gr.grnet.pithos.web.client.Pithos;
-import gr.grnet.pithos.web.client.Resource;
-import gr.grnet.pithos.web.client.catalog.UpdateUserCatalogs;
-import gr.grnet.pithos.web.client.catalog.UserCatalogs;
-import gr.grnet.pithos.web.client.grouptree.Group;
-import gr.grnet.pithos.web.client.grouptree.User;
-
-import java.util.*;
 
 /**
  * Created by IntelliJ IDEA. User: chstath Date: 5/19/11 Time: 2:55 PM To change this template use File | Settings |
  * File Templates.
  */
 public class AccountResource extends Resource {
-    private final Pithos app;
 
     private long numberOfContainers = 0;
 
@@ -73,17 +71,13 @@ public class AccountResource extends Resource {
     private Date lastLogin = null;
 
     private Date lastModified = null;
-
+    
     private List<Folder> containers = new ArrayList<Folder>();
 
     private Date currentLogin = null;
 
     private List<Group> groups = new ArrayList<Group>();
 
-    public AccountResource(Pithos app) {
-        this.app = app;
-    }
-
     public long getQuota() {
         return quota;
     }
@@ -109,7 +103,7 @@ public class AccountResource extends Resource {
     }
 
     @Override
-    public Date getLastModified() {
+       public Date getLastModified() {
         return lastModified;
     }
 
@@ -145,208 +139,145 @@ public class AccountResource extends Resource {
         this.currentLogin = currentLogin;
     }
 
-    private void doAddUsersByIDs(final List<String> userIDs, final String groupName) {
-        app.LOG("AccountResource::doAddUsersByIDs(), group = ", groupName);
-        final Group group = new Group(groupName);
-        for(String userID : userIDs) {
-            final String userDisplayName = app.getUserDisplayNameForID(userID);
-            final User user = new User(userID, userDisplayName, groupName);
-            group.addUser(user);
-            app.LOG("AccountResource::doAddUsersByIDs(),   user = (", userID, ", ", userDisplayName, ")");
-
-        }
-        groups.add(group);
-
-    }
-
     public void populate(String owner, Response response) {
         DateTimeFormat df = DateTimeFormat.getFormat(PredefinedFormat.RFC_2822);
         groups.clear();
-
-        final Map<String, List<String>> parsedGroups = new HashMap<String, List<String>>();
-
-        for(Header h : response.getHeaders()) {
-            if(h != null) {
-                String name = h.getName();
-                if(name.startsWith(Const.X_ACCOUNT_GROUP_)) {
-                    final String groupName = URL.decodePathSegment(name.substring(Const.X_ACCOUNT_GROUP_.length()));
-                    final String[] users = h.getValue().split(",");
-                    final List<String> userIDs = new ArrayList<String>();
-                    for(String user : users) {
-                        final String userID = URL.decodePathSegment(user).trim();
-                        userIDs.add(userID);
-                    }
-                    parsedGroups.put(groupName, userIDs);
-                }
-                else if(name.equals(Const.X_ACCOUNT_CONTAINER_COUNT)) {
-                    numberOfContainers = Long.valueOf(h.getValue());
-                }
-                else if(name.equals(Const.X_ACCOUNT_OBJECT_COUNT)) {
-                    numberOfObjects = Long.valueOf(h.getValue());
-                }
-                else if(name.equals(Const.X_ACCOUNT_BYTES_USED)) {
-                    bytesUsed = Long.valueOf(h.getValue());
-                }
-                else if(name.equals(Const.X_ACCOUNT_POLICY_QUOTA)) {
-                    quota = Long.valueOf(h.getValue());
-                }
-                else if(name.equals(Const.X_ACCOUNT_LAST_LOGIN)) {
-                    lastLogin = df.parse(h.getValue());
-                }
-                else if(name.equals(Const.LAST_MODIFIED)) {
-                    lastModified = df.parse(h.getValue());
-                }
-            }
-        }
-        
-        // Gather all unknown users for the groups
-        final List<String> userIDsWithUnknownDisplayName = new ArrayList<String>();
-        for(Map.Entry<String, List<String>> parsedGroupEntry : parsedGroups.entrySet()) {
-            final List<String> groupUserIDs = parsedGroupEntry.getValue();
-            userIDsWithUnknownDisplayName.addAll(app.filterUserIDsWithUnknownDisplayName(groupUserIDs));
-        }
-        if(userIDsWithUnknownDisplayName.size() == 0) {
-            for(Map.Entry<String, List<String>> parsedGroupEntry : parsedGroups.entrySet()) {
-                final String groupName = parsedGroupEntry.getKey();
-                final List<String> groupUserIDs = parsedGroupEntry.getValue();
-                doAddUsersByIDs(groupUserIDs, groupName);
-            }
-        }
-        else {
-            new UpdateUserCatalogs(app, userIDsWithUnknownDisplayName) {
-                @Override
-                public void onSuccess(UserCatalogs requestedUserCatalogs, UserCatalogs updatedUserCatalogs) {
-                    for(Map.Entry<String, List<String>> parsedGroupEntry : parsedGroups.entrySet()) {
-                        final String groupName = parsedGroupEntry.getKey();
-                        final List<String> groupUserIDs = parsedGroupEntry.getValue();
-                        doAddUsersByIDs(groupUserIDs, groupName);
-                    }
-                }
-            }.scheduleEntry();
+        for (Header h : response.getHeaders()) {
+               if (h != null) {
+                       String name = h.getName();
+                       if (name.startsWith("X-Account-Group-")) {
+                           String groupName = URL.decodePathSegment(name.substring("X-Account-Group-".length()));
+                           Group g = new Group(groupName);
+                           String[] members = h.getValue().split(",");
+                           for (String s : members)
+                               g.addMemberID(URL.decodePathSegment(s).trim());
+                           groups.add(g);
+                       }
+                       else if (name.equals("X-Account-Container-Count")) {
+                           numberOfContainers = Long.valueOf(h.getValue());
+                       }
+                       else if (name.equals("X-Account-Object-Count")) {
+                           numberOfObjects = Long.valueOf(h.getValue());
+                       }
+                       else if (name.equals("X-Account-Bytes-Used")) {
+                           bytesUsed = Long.valueOf(h.getValue());
+                       }
+                       else if (name.equals("X-Account-Policy-Quota")) {
+                           quota = Long.valueOf(h.getValue());
+                       }
+                       else if (name.equals("X-Account-Last-Login")) {
+                           lastLogin = df.parse(h.getValue());
+                       }
+                       else if (name.equals("Last-Modified")) {
+                           lastModified = df.parse(h.getValue());
+                       }
+               }
         }
 
-        if(response.getText() != null && response.getText().length() > 0) {
-            containers.clear();
-            JSONValue json = JSONParser.parseStrict(response.getText());
-            JSONArray array = json.isArray();
-            if(array != null) {
-                for(int i = 0; i < array.size(); i++) {
-                    JSONObject o = array.get(i).isObject();
-                    if(o != null) {
-                        Folder f = new Folder();
-                        f.populate(null, o, owner, null);
-                        containers.add(f);
-                    }
-                }
-            }
+        if (response.getText() != null && response.getText().length() > 0) {
+               containers.clear();
+               JSONValue json = JSONParser.parseStrict(response.getText());
+               JSONArray array = json.isArray();
+               if (array != null) {
+                   for (int i=0; i<array.size(); i++) {
+                       JSONObject o = array.get(i).isObject();
+                       if (o != null) {
+                           Folder f = new Folder();
+                           f.populate(null, o, owner, null);
+                           containers.add(f);
+                       }
+                   }
+               }
         }
     }
 
-    public static AccountResource createFromResponse(Pithos app, String owner, Response response, AccountResource result) {
-        AccountResource a;
-        if(result == null) {
-            a = new AccountResource(app);
-        }
-        else {
-            a = result;
-        }
+    public static AccountResource createFromResponse(String owner, Response response, AccountResource result) {
+       AccountResource a;
+       if (result == null)
+               a = new AccountResource();
+       else
+               a = result;
         a.populate(owner, response);
         return a;
     }
 
-    private String getSize(Long size, Double division) {
-        Double res = Double.valueOf(size.toString()) / division;
-        NumberFormat nf = NumberFormat.getFormat(Const.NUMBER_FORMAT_1);
+    private String getSize(Long size, Double division){
+        Double res = Double.valueOf(size.toString())/division;
+        NumberFormat nf = NumberFormat.getFormat("######.#");
         return nf.format(res);
     }
 
     public String getFileSizeAsString() {
-        if(bytesUsed < 1024) {
+        if (bytesUsed < 1024)
             return String.valueOf(bytesUsed) + "B";
-        }
-        else if(bytesUsed < 1024 * 1024) {
+        else if (bytesUsed < 1024*1024)
             return getSize(bytesUsed, 1024D) + "KB";
-        }
-        else if(bytesUsed < 1024 * 1024 * 1024) {
-            return getSize(bytesUsed, (1024D * 1024D)) + "MB";
-        }
-        return getSize(bytesUsed, (1024D * 1024D * 1024D)) + "GB";
+        else if (bytesUsed < 1024*1024*1024)
+            return getSize(bytesUsed,(1024D*1024D)) + "MB";
+        return getSize(bytesUsed , (1024D*1024D*1024D)) + "GB";
     }
 
     public String getQuotaAsString() {
-        if(quota < 1024) {
+        if (quota < 1024)
             return String.valueOf(quota) + "B";
-        }
-        else if(quota < 1024 * 1024) {
+        else if (quota < 1024 * 1024)
             return getSize(quota, 1024D) + "KB";
-        }
-        else if(quota < 1024 * 1024 * 1024) {
-            return getSize(quota, (1024D * 1024D)) + "MB";
-        }
-        return getSize(quota, (1024D * 1024D * 1024D)) + "GB";
+        else if (quota < 1024 * 1024 * 1024)
+            return getSize(quota,(1024D * 1024D)) + "MB";
+        return getSize(quota , (1024D * 1024D * 1024D)) + "GB";
     }
 
     public List<Group> getGroups() {
         return groups;
     }
-
+    
     public boolean hasHomeContainer() {
-        for(Folder f : containers) {
-            if(f.getName().equals(Const.HOME_CONTAINER)) {
-                return true;
-            }
-        }
-        return false;
+       for (Folder f : containers)
+               if (f.getName().equals(Const.HOME_CONTAINER))
+                       return true;
+       return false;
     }
 
     public boolean hasTrashContainer() {
-        for(Folder f : containers) {
-            if(f.getName().equals(Const.TRASH_CONTAINER)) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    public void addGroup(Group group) {
-        groups.add(group);
-    }
-
-    public void removeGroup(Group group) {
-        groups.remove(group);
+       for (Folder f : containers)
+               if (f.getName().equals(Const.TRASH_CONTAINER))
+                       return true;
+       return false;
     }
 
-    public Folder getTrash() {
-        for(Folder c : containers) {
-            if(c.getName().equals(Const.TRASH_CONTAINER)) {
-                return c;
-            }
-        }
-        return null;
-    }
-
-    public double getUsedPercentage() {
-        if(quota == 0) {
-            return 0;
-        }
-        return ((double) bytesUsed) / quota;
-    }
-
-    public Folder getPithos() {
-        for(Folder f : containers) {
-            if(f.getName().equals(Const.HOME_CONTAINER)) {
-                return f;
-            }
-        }
-        return null;
-    }
-
-    public Group getGroup(String groupName) {
-        for(Group g : groups) {
-            if(g.getName().equalsIgnoreCase(groupName)) {
-                return g;
-            }
-        }
-        return null;
-    }
+       public void addGroup(Group newGroup) {
+               groups.add(newGroup);
+       }
+
+       public void removeGroup(Group group) {
+               groups.remove(group);
+       }
+
+       public Folder getTrash() {
+               for (Folder c : containers) {
+                       if (c.getName().equals(Const.TRASH_CONTAINER))
+                               return c;
+               }
+               return null;
+       }
+
+       public double getUsedPercentage() {
+               if (quota == 0)
+                       return 0;
+               return ((double) bytesUsed) / quota;
+       }
+
+       public Folder getPithos() {
+               for (Folder f : containers)
+                       if (f.getName().equals(Const.HOME_CONTAINER))
+                               return f;
+               return null;
+       }
+
+       public Group getGroup(String groupName) {
+               for (Group g : groups)
+                       if (g.getName().equalsIgnoreCase(groupName))
+                               return g;
+               return null;
+       }
 }
index a8a02da..188e68a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011-2012 GRNET S.A. All rights reserved.
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
index 40a6c98..639b8c1 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011-2012 GRNET S.A. All rights reserved.
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
index f2c5a6f..c5d9166 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011-2012 GRNET S.A. All rights reserved.
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
@@ -322,4 +322,9 @@ public class Folder extends Resource {
                                return true;
                return false;
        }
+
+    @Override
+    public String toString() {
+        return "Folder(container="+container+", name="+name+", prefix="+prefix+")";
+    }
 }
index 3a25a72..f0f63f9 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011-2012 GRNET S.A. All rights reserved.
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
index fb4d31f..2163c4e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011-2012 GRNET S.A. All rights reserved.
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
@@ -152,7 +152,7 @@ public class FolderTreeViewModel implements TreeViewModel {
             final Folder f = iter.next();
 
             String path = "/" + f.getContainer() + "?format=json&delimiter=/&prefix=" + URL.encodeQueryString(f.getPrefix());
-            GetRequest<Folder> getFolder = new GetRequest<Folder>(app, Folder.class, app.getApiPath(), f.getOwnerID(), path, f) {
+            GetRequest<Folder> getFolder = new GetRequest<Folder>(Folder.class, app.getApiPath(), f.getOwnerID(), path, f) {
                 @Override
                 public void onSuccess(Folder _result) {
                     fetchFolder(iter, callback);
@@ -236,7 +236,7 @@ public class FolderTreeViewModel implements TreeViewModel {
 
     public void fetchFolder(final Folder f, final ListDataProvider<Folder> dataProvider, final boolean showfiles, final Command callback) {
         String path = "/" + f.getContainer() + "?format=json&delimiter=/&prefix=" + URL.encodeQueryString(f.getPrefix());
-        GetRequest<Folder> getFolder = new GetRequest<Folder>(app, Folder.class, app.getApiPath(), f.getOwnerID(), path, f) {
+        GetRequest<Folder> getFolder = new GetRequest<Folder>(Folder.class, app.getApiPath(), f.getOwnerID(), path, f) {
             @Override
             public void onSuccess(final Folder _result) {
                 if (showfiles)
index a99a187..5e1e273 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011-2012 GRNET S.A. All rights reserved.
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
index 4ba80ea..ee85211 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011-2012 GRNET S.A. All rights reserved.
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
index af9c060..427e29e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011-2012 GRNET S.A. All rights reserved.
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
index aef15f5..c47cf57 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011-2012 GRNET S.A. All rights reserved.
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
 package gr.grnet.pithos.web.client.grouptree;
 
 import java.util.ArrayList;
-import java.util.Collections;
 import java.util.List;
 
-public final class Group {
+public class Group {
     private final String name;
 
-    private final List<User> users = new ArrayList<User>();
+    private final List<String> memberIDs = new ArrayList<String>();
 
     public Group(String name) {
         this.name = name;
     }
 
-    public List<User> getUsers() {
-        return Collections.unmodifiableList(users);
+    public List<String> getMemberIDs() {
+        return memberIDs;
     }
 
     public String getName() {
         return name;
     }
 
-    public void addUser(User user) {
-        this.users.add(user);
+    public void addMemberID(String userID) {
+        memberIDs.add(userID);
     }
 
-       public void removeUser(User user) {
-               this.users.remove(user);
+       public void removeMemberID(String userID) {
+               memberIDs.remove(userID);
        }
 
-    public String encodeUserIDsForXAccountGroup() {
-        final StringBuilder sb = new StringBuilder();
-        for(int i=0; i<users.size(); i++) {
-            final User user = users.get(i);
-            sb.append(user.getUserID());
-            if(i < users.size() - 1) {
-                sb.append(",");
-            }
-        }
-
-        return sb.toString();
-    }
-
     @Override
     public String toString() {
-        return "Group(" + name + ", " + users.size()+ " users)";
+        return "Group(" + name + ", " + memberIDs.size() + " members)";
     }
-
 }
index 56634e9..4285fab 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011-2012 GRNET S.A. All rights reserved.
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
index 79626cd..cfcd6e1 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011-2012 GRNET S.A. All rights reserved.
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
index 379c21f..be5e6fa 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011-2012 GRNET S.A. All rights reserved.
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
 
 package gr.grnet.pithos.web.client.grouptree;
 
+import gr.grnet.pithos.web.client.Pithos;
+import gr.grnet.pithos.web.client.commands.CreateGroupCommand;
+import gr.grnet.pithos.web.client.foldertree.File;
+import gr.grnet.pithos.web.client.grouptree.GroupTreeView.Templates;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+
 import com.google.gwt.cell.client.AbstractCell;
 import com.google.gwt.cell.client.Cell;
 import com.google.gwt.event.dom.client.ContextMenuEvent;
@@ -44,57 +53,48 @@ import com.google.gwt.view.client.ListDataProvider;
 import com.google.gwt.view.client.SelectionChangeEvent;
 import com.google.gwt.view.client.SingleSelectionModel;
 import com.google.gwt.view.client.TreeViewModel;
-import gr.grnet.pithos.web.client.Pithos;
-import gr.grnet.pithos.web.client.commands.CreateGroupCommand;
-import gr.grnet.pithos.web.client.foldertree.File;
-import gr.grnet.pithos.web.client.grouptree.GroupTreeView.Templates;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
 
 public class GroupTreeViewModel implements TreeViewModel {
-    final Group CreateGroupPlaceholder = new Group("Create new group...");
 
     protected Pithos app;
 
-    private Cell<Group> groupCell = new AbstractCell<Group>(ContextMenuEvent.getType().getName()) {
+       private Cell<Group> groupCell = new AbstractCell<Group>(ContextMenuEvent.getType().getName()) {
 
-        @Override
-        public void render(Context context, Group group, SafeHtmlBuilder sb) {
+               @Override
+               public void render(Context context,     Group value, SafeHtmlBuilder sb) {
             String html = AbstractImagePrototype.create(GroupTreeView.images.group()).getHTML();
             sb.appendHtmlConstant(html).appendHtmlConstant("&nbsp;");
-            sb.append(Templates.INSTANCE.nameSpan(group.getName()));
-        }
-
+            sb.append(Templates.INSTANCE.nameSpan(value.getName()));
+               }
+               
         @Override
         public void onBrowserEvent(Cell.Context context, com.google.gwt.dom.client.Element parent, Group group, com.google.gwt.dom.client.NativeEvent event, com.google.gwt.cell.client.ValueUpdater<Group> valueUpdater) {
-            if(!group.equals(CreateGroupPlaceholder)) {
-                GroupTreeViewModel.this.groupSelectionModel.setSelected(group, true);
-                if(event.getType().equals(ContextMenuEvent.getType().getName())) {
-                    GroupContextMenu menu = new GroupContextMenu(app, GroupTreeView.images, group);
-                    menu.setPopupPosition(event.getClientX(), event.getClientY());
-                    menu.show();
-                }
-            }
+               if (!group.equals(createGroup)) {
+                   GroupTreeViewModel.this.groupSelectionModel.setSelected(group, true);
+                   if (event.getType().equals(ContextMenuEvent.getType().getName())) {
+                       GroupContextMenu menu = new GroupContextMenu(app, GroupTreeView.images, group);
+                       menu.setPopupPosition(event.getClientX(), event.getClientY());
+                       menu.show();
+                   }
+               }
         }
-    };
+       };
 
     private Cell<User> userCell = new AbstractCell<User>(ContextMenuEvent.getType().getName()) {
 
-        @Override
-        public void render(Context context, User user, final SafeHtmlBuilder sb) {
+               @Override
+               public void render(Context context,     User user, SafeHtmlBuilder sb) {
             String html = AbstractImagePrototype.create(GroupTreeView.images.user()).getHTML();
             sb.appendHtmlConstant(html).appendHtmlConstant("&nbsp;");
-            final String userDisplayName = user.getUserDisplayName();
+            final String userID = user.getUserID();
+            final String userDisplayName = app.getDisplayNameForUserID(userID);
             sb.append(Templates.INSTANCE.nameSpan(userDisplayName));
-        }
+               }
 
         @Override
         public void onBrowserEvent(Cell.Context context, com.google.gwt.dom.client.Element parent, User user, com.google.gwt.dom.client.NativeEvent event, com.google.gwt.cell.client.ValueUpdater<User> valueUpdater) {
             GroupTreeViewModel.this.userSelectionModel.setSelected(user, true);
-            if(event.getType().equals(ContextMenuEvent.getType().getName())) {
+            if (event.getType().equals(ContextMenuEvent.getType().getName())) {
                 UserContextMenu menu = new UserContextMenu(app, GroupTreeView.images, user);
                 menu.setPopupPosition(event.getClientX(), event.getClientY());
                 menu.show();
@@ -105,127 +105,114 @@ public class GroupTreeViewModel implements TreeViewModel {
     protected ListDataProvider<Group> groupsDataProvider = new ListDataProvider<Group>();
 
     protected Map<Group, ListDataProvider<User>> userDataProviderMap = new HashMap<Group, ListDataProvider<User>>();
-
+    
     SingleSelectionModel<Group> groupSelectionModel;
     SingleSelectionModel<User> userSelectionModel;
+    
+    final Group createGroup = new Group("Create new group...");
 
     public GroupTreeViewModel(Pithos _app) {
         app = _app;
 
-        groupSelectionModel = new SingleSelectionModel<Group>();
-        app.addSelectionModel(groupSelectionModel);
-        groupSelectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
-
-            @Override
-            public void onSelectionChange(SelectionChangeEvent event) {
-                Group selected = groupSelectionModel.getSelectedObject();
-                if(selected != null) {
-                    app.deselectOthers(app.getGroupTreeView(), groupSelectionModel);
-                    app.showFiles(new HashSet<File>());
-                    app.disableUploadArea();
-                    app.upload.setEnabled(false);
-                    app.showRelevantToolbarButtons();
-                    if(selected.equals(CreateGroupPlaceholder)) {
-                        new CreateGroupCommand(app, null).execute();
-                        groupSelectionModel.setSelected(CreateGroupPlaceholder, false);
-                    }
-                }
-                else {
-                    if(app.getSelectedTree().equals(app.getGroupTreeView())) {
-                        app.setSelectedTree(null);
-                    }
-                    if(app.getSelectedTree() == null) {
-                        app.showRelevantToolbarButtons();
-                    }
-                }
-            }
-        });
-
-        userSelectionModel = new SingleSelectionModel<User>();
-        app.addSelectionModel(userSelectionModel);
-        userSelectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
-
-            @Override
-            public void onSelectionChange(SelectionChangeEvent event) {
-                if(userSelectionModel.getSelectedObject() != null) {
-                    app.deselectOthers(app.getGroupTreeView(), userSelectionModel);
-                    app.showFiles(new HashSet<File>());
-                    app.showRelevantToolbarButtons();
-                }
-                else {
-                    if(app.getSelectedTree().equals(app.getGroupTreeView())) {
-                        app.setSelectedTree(null);
-                    }
-                    if(app.getSelectedTree() == null) {
-                        app.showRelevantToolbarButtons();
-                    }
-                }
-            }
-        });
-    }
+       groupSelectionModel = new SingleSelectionModel<Group>();
+       app.addSelectionModel(groupSelectionModel);
+       groupSelectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
+                       
+                       @Override
+                       public void onSelectionChange(SelectionChangeEvent event) {
+                               Group selected = groupSelectionModel.getSelectedObject();
+                               if (selected != null) {
+                                       app.deselectOthers(app.getGroupTreeView(), groupSelectionModel);
+                                       app.showFiles(new HashSet<File>());
+                                       app.disableUploadArea();
+                                       app.upload.setEnabled(false);
+                                       app.showRelevantToolbarButtons();
+                                       if (selected.equals(createGroup)) {
+                                               new CreateGroupCommand(app, null).execute();
+                                               groupSelectionModel.setSelected(createGroup, false);
+                                       }
+                               }
+                               else {
+                                       if (app.getSelectedTree().equals(app.getGroupTreeView()))
+                                               app.setSelectedTree(null);
+                                       if (app.getSelectedTree() == null)
+                                               app.showRelevantToolbarButtons();
+                               }
+                       }
+               });
+
+       userSelectionModel = new SingleSelectionModel<User>();
+       app.addSelectionModel(userSelectionModel);
+       userSelectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
+                       
+                       @Override
+                       public void onSelectionChange(SelectionChangeEvent event) {
+                               if (userSelectionModel.getSelectedObject() != null) {
+                                       app.deselectOthers(app.getGroupTreeView(), userSelectionModel);
+                                       app.showFiles(new HashSet<File>());
+                                       app.showRelevantToolbarButtons();
+                               }
+                               else {
+                                       if (app.getSelectedTree().equals(app.getGroupTreeView()))
+                                               app.setSelectedTree(null);
+                                       if (app.getSelectedTree() == null)
+                                               app.showRelevantToolbarButtons();
+                               }
+                       }
+               });
+}
 
     @Override
     public <T> NodeInfo<?> getNodeInfo(T value) {
-        app.LOG("GroupTreeViewModel::getNodeInfo(), value = ", value);
-        if(value == null) {
-            groupsDataProvider.getList().clear();
-            groupsDataProvider.getList().addAll(app.getAccount().getGroups());
-            groupsDataProvider.getList().add(CreateGroupPlaceholder);
+        if (value == null) {
+               groupsDataProvider.getList().clear();
+                       groupsDataProvider.getList().addAll(app.getAccount().getGroups());
+                       groupsDataProvider.getList().add(createGroup);
             return new DefaultNodeInfo<Group>(groupsDataProvider, groupCell, groupSelectionModel, null);
         }
-        final Group group = (Group) value;
-        if(userDataProviderMap.get(group) == null) {
-            userDataProviderMap.put(group, new ListDataProvider<User>());
-        }
-        final ListDataProvider<User> dataProvider = userDataProviderMap.get(group);
-        dataProvider.getList().clear();
-        final List<User> users = group.getUsers();
-        for(User user : users) {
-            app.LOG("GroupTreeViewModel::getNodeInfo(), Add ", user);
-            dataProvider.getList().add(user);
-        }
-
-
-        return new DefaultNodeInfo<User>(dataProvider, userCell, userSelectionModel, null);
+       Group g = (Group) value;
+               if (userDataProviderMap.get(g) == null) {
+                       userDataProviderMap.put(g, new ListDataProvider<User>());
+               }
+               final ListDataProvider<User> dataProvider = userDataProviderMap.get(g);
+               dataProvider.getList().clear();
+               for (String userID : g.getMemberIDs())
+                       dataProvider.getList().add(new User(userID, g.getName()));
+       return new DefaultNodeInfo<User>(dataProvider, userCell, userSelectionModel, null);
     }
 
-    @Override
+       @Override
     public boolean isLeaf(Object o) {
-        if(o instanceof User) {
-            return true;
-        }
-        else if(o instanceof Group) {
-            return ((Group) o).getUsers().isEmpty();
+        if (o instanceof User) {
+                       return true;
         }
+        else if (o instanceof Group)
+               return ((Group) o).getMemberIDs().isEmpty();
         return false;
     }
-
-    public void updateGroupNode(Group group) {
-        if(group == null) {
-            groupsDataProvider.getList().clear();
-            groupsDataProvider.getList().addAll(app.getAccount().getGroups());
-            groupsDataProvider.getList().add(CreateGroupPlaceholder);
-        }
-        else {
-            if(userDataProviderMap.get(group) == null) {
-                userDataProviderMap.put(group, new ListDataProvider<User>());
-            }
-            final ListDataProvider<User> dataProvider = userDataProviderMap.get(group);
-            dataProvider.getList().clear();
-            for(User user : group.getUsers()) {
-                app.LOG("GroupTreeViewModel::updateGroupNode(), group = ", group, ". Add ", user);
-                dataProvider.getList().add(user);
-            }
-        }
-    }
-
-    public Object getSelectedObject() {
-        if(groupSelectionModel.getSelectedObject() != null) {
-            return groupSelectionModel.getSelectedObject();
-        }
-        if(userSelectionModel.getSelectedObject() != null) {
-            return userSelectionModel.getSelectedObject();
-        }
-        return null;
-    }
+       
+       public void updateGroupNode(Group group) {
+               if (group == null) {
+                       groupsDataProvider.getList().clear();
+                       groupsDataProvider.getList().addAll(app.getAccount().getGroups());
+                       groupsDataProvider.getList().add(createGroup);
+               }
+               else {
+                       if (userDataProviderMap.get(group) == null) {
+                               userDataProviderMap.put(group, new ListDataProvider<User>());
+                       }
+                       final ListDataProvider<User> dataProvider = userDataProviderMap.get(group);
+                       dataProvider.getList().clear();
+                       for (String u : group.getMemberIDs())
+                               dataProvider.getList().add(new User(u, group.getName()));
+               }
+       }
+
+       public Object getSelectedObject() {
+               if (groupSelectionModel.getSelectedObject() != null)
+                       return groupSelectionModel.getSelectedObject();
+               if (userSelectionModel.getSelectedObject() != null)
+                       return userSelectionModel.getSelectedObject();
+               return null;
+       }
 }
index e838385..f1f9157 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2012 GRNET S.A. All rights reserved.
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
index f6798ae..777adf6 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011-2012 GRNET S.A. All rights reserved.
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
@@ -38,26 +38,21 @@ package gr.grnet.pithos.web.client.grouptree;
 
 public final class User {
     private final String userID;
-    private final String userDisplayName;
+
     private final String group;
 
-    public User(String userID, String userDisplayName, String group) {
-        this.userID = userID;
-        this.userDisplayName = userDisplayName;
+    public User(String name, String group) {
+        this.userID = name;
         this.group = group;
     }
 
     public String getUserID() {
-        return userID;
-    }
-
-    public String getUserDisplayName() {
-        return userDisplayName;
+        return this.userID;
     }
 
     public String getGroup() {
-               return group;
-       }
+        return this.group;
+    }
 
     @Override
     public boolean equals(Object o) {
@@ -86,9 +81,4 @@ public final class User {
         result = 31 * result + (group != null ? group.hashCode() : 0);
         return result;
     }
-
-    @Override
-    public String toString() {
-        return "User(" + userID + ", " + userDisplayName + ", " + group + ")";
-    }
 }
index 3c56dee..ab36004 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011-2012 GRNET S.A. All rights reserved.
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
index 91578b8..14cb63e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011-2012 GRNET S.A. All rights reserved.
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
index cfa6dea..9598c87 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011-2012 GRNET S.A. All rights reserved.
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
@@ -35,6 +35,7 @@
 
 package gr.grnet.pithos.web.client.mysharedtree;
 
+import gr.grnet.pithos.web.client.Const;
 import gr.grnet.pithos.web.client.FolderContextMenu;
 import gr.grnet.pithos.web.client.Pithos;
 import gr.grnet.pithos.web.client.foldertree.AccountResource;
@@ -118,8 +119,9 @@ public class MysharedTreeViewModel implements TreeViewModel {
     }
 
        private void fetchSharedContainers(final Command callback) {
+        app.LOG("MysharedTreeViewModel::fetchSharedContainers(), callback=", callback);
         String path = "?format=json&shared=&public=";
-        GetRequest<AccountResource> getAccount = new GetRequest<AccountResource>(app, AccountResource.class, app.getApiPath(), app.getUserID(), path) {
+        GetRequest<AccountResource> getAccount = new GetRequest<AccountResource>(AccountResource.class, app.getApiPath(), app.getUserID(), path) {
             @Override
             public void onSuccess(final AccountResource _result) {
                                firstLevelDataProvider.getList().clear();
@@ -131,8 +133,10 @@ public class MysharedTreeViewModel implements TreeViewModel {
                 }
                 if (firstLevelDataProvider.getList().isEmpty())
                        firstLevelDataProvider.getList().add(dummy);
-                               if (callback != null)
-                                       callback.execute();
+                               if (callback != null) {
+                    app.LOG("MysharedTreeViewModel::fetchSharedContainers(), executing callback");
+                    callback.execute();
+                }
             }
 
             @Override
@@ -150,7 +154,7 @@ public class MysharedTreeViewModel implements TreeViewModel {
                                app.sessionExpired();
                        }
         };
-        getAccount.setHeader("X-Auth-Token", app.getUserToken());
+        getAccount.setHeader(Const.X_AUTH_TOKEN, app.getUserToken());
         Scheduler.get().scheduleDeferred(getAccount);
        }
 
@@ -160,17 +164,14 @@ public class MysharedTreeViewModel implements TreeViewModel {
                        return firstLevelDataProvider.getList().isEmpty();
                return true;
     }
-       
-       private native void log(String msg) /*-{
-               $wnd.console.log(msg);
-       }-*/;
 
     protected void fetchFolder(final Iterator<Folder> iter, final Command callback) {
+        app.LOG("MysharedTreeViewModel::fetchFolder(), iter=", iter.hasNext(), ", callback=", callback);
         if (iter.hasNext()) {
             final Folder f = iter.next();
 
             String path = "/" + f.getContainer() + "?format=json&shared=&public=&delimiter=/&prefix=" + URL.encodeQueryString(f.getPrefix());
-            GetRequest<Folder> getFolder = new GetRequest<Folder>(app, Folder.class, app.getApiPath(), f.getOwnerID(), path, f) {
+            GetRequest<Folder> getFolder = new GetRequest<Folder>(Folder.class, app.getApiPath(), f.getOwnerID(), path, f) {
                 @Override
                 public void onSuccess(Folder _result) {
                     fetchFolder(iter, callback);
@@ -191,11 +192,12 @@ public class MysharedTreeViewModel implements TreeViewModel {
                                        app.sessionExpired();
                                }
             };
-            getFolder.setHeader("X-Auth-Token", app.getUserToken());
+            getFolder.setHeader(Const.X_AUTH_TOKEN, app.getUserToken());
             Scheduler.get().scheduleDeferred(getFolder);
         }
-        else if (callback != null)
+        else if(callback != null) {
             callback.execute();
+        }
     }
 
     public Folder getSelection() {
@@ -207,8 +209,9 @@ public class MysharedTreeViewModel implements TreeViewModel {
     }
 
     public void fetchFolder(final Folder f, final boolean showfiles, final Command callback) {
+        app.LOG("MysharedTreeViewModel::fetchFolder(), folder=", f, ", showfiles=", showfiles, ", callback=", callback);
         String path = "/" + f.getContainer() + "?format=json&shared=&public=" + URL.encodeQueryString(f.getPrefix());
-        GetRequest<Folder> getFolder = new GetRequest<Folder>(app, Folder.class, app.getApiPath(), f.getOwnerID(), path, f) {
+        GetRequest<Folder> getFolder = new GetRequest<Folder>(Folder.class, app.getApiPath(), f.getOwnerID(), path, f) {
             @Override
             public void onSuccess(final Folder _result) {
                for (File file : _result.getFiles()) {
index f91e754..adfa624 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2012 GRNET S.A. All rights reserved.
+ * Copyright 2012-2013 GRNET S.A. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
index d28b45c..90b89b3 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011-2012 GRNET S.A. All rights reserved.
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
index 1c1a244..fedb1c2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011-2012 GRNET S.A. All rights reserved.
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
@@ -45,7 +45,6 @@ import com.google.gwt.event.dom.client.ContextMenuEvent;
 import com.google.gwt.http.client.Request;
 import com.google.gwt.http.client.Response;
 import com.google.gwt.http.client.URL;
-import com.google.gwt.json.client.JSONObject;
 import com.google.gwt.safehtml.shared.SafeHtml;
 import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
 import com.google.gwt.text.shared.SafeHtmlRenderer;
@@ -54,10 +53,10 @@ import com.google.gwt.user.client.ui.AbstractImagePrototype;
 import com.google.gwt.view.client.ListDataProvider;
 import com.google.gwt.view.client.SingleSelectionModel;
 import com.google.gwt.view.client.TreeViewModel;
+import gr.grnet.pithos.web.client.Const;
 import gr.grnet.pithos.web.client.FolderContextMenu;
 import gr.grnet.pithos.web.client.Pithos;
 import gr.grnet.pithos.web.client.SharingUsers;
-import gr.grnet.pithos.web.client.catalog.GetUserCatalogs;
 import gr.grnet.pithos.web.client.catalog.UpdateUserCatalogs;
 import gr.grnet.pithos.web.client.catalog.UserCatalogs;
 import gr.grnet.pithos.web.client.foldertree.AccountResource;
@@ -81,6 +80,7 @@ public class OtherSharedTreeViewModel implements TreeViewModel {
 
         @Override
         public void render(Context context, Folder folder, SafeHtmlBuilder safeHtmlBuilder) {
+//            app.LOG("OtherSharedTreeViewModel::render(), folder=", folder);
             String html = AbstractImagePrototype.create(OtherSharedTreeView.images.folderYellow()).getHTML();
             safeHtmlBuilder.appendHtmlConstant(html).appendHtmlConstant("&nbsp;");
             safeHtmlBuilder.append(Templates.INSTANCE.nameSpan(folder.getName()));
@@ -88,6 +88,7 @@ public class OtherSharedTreeViewModel implements TreeViewModel {
 
         @Override
         public void onBrowserEvent(Context context, com.google.gwt.dom.client.Element parent, final Folder folder, com.google.gwt.dom.client.NativeEvent event, ValueUpdater<Folder> valueUpdater) {
+            app.LOG("OtherSharedTreeViewModel::render(), folder=", folder, ", parent=", parent.getString());
             if(event.getType().equals(ContextMenuEvent.getType().getName())) {
                 final int x = event.getClientX();
                 final int y = event.getClientY();
@@ -106,7 +107,6 @@ public class OtherSharedTreeViewModel implements TreeViewModel {
     };
 
     protected ListDataProvider<String> userLevelDataProviderForIDs = new ListDataProvider<String>();
-//    protected ListDataProvider<String> userLevelDataProviderForDisplayNames = new ListDataProvider<String>();
 
     protected Map<String, ListDataProvider<Folder>> userDataProviderMap = new HashMap<String, ListDataProvider<Folder>>();
     private Map<Folder, ListDataProvider<Folder>> dataProviderMap = new HashMap<Folder, ListDataProvider<Folder>>();
@@ -121,14 +121,14 @@ public class OtherSharedTreeViewModel implements TreeViewModel {
     @Override
     public <T> NodeInfo<?> getNodeInfo(T value) {
         if(value == null) {
-//            LOG("getNodeInfo(null), calling fetchSharingUsers(null)");
+            app.LOG("OtherSharedTreeViewModel::getNodeInfo(null), calling fetchSharingUsers(null)");
             fetchSharingUsers(null);
-//            LOG("getNodeInfo(null), called fetchSharingUsers(null)");
+            app.LOG("OtherSharedTreeViewModel::getNodeInfo(null), called fetchSharingUsers(null)");
             return new DefaultNodeInfo<String>(userLevelDataProviderForIDs, new TextCell(new SafeHtmlRenderer<String>() {
                 @Override
                 public SafeHtml render(String object) {
-                    final String displayName = app.getUserDisplayNameForID(object);
-//                    LOG("render(userID = "+object+"), displayName = " + displayName);
+                    final String displayName = app.getDisplayNameForUserID(object);
+                    app.LOG("OtherSharedTreeViewModel::(getNodeInfo)render(String ", object, "), parameter is userID, displayName=", displayName);
                     SafeHtmlBuilder builder = new SafeHtmlBuilder();
                     render(displayName, builder);
                     return builder.toSafeHtml();
@@ -137,17 +137,16 @@ public class OtherSharedTreeViewModel implements TreeViewModel {
                 @Override
                 public void render(String object, SafeHtmlBuilder builder) {
                     if(!object.equals(dummy)) {
-//                        LOG("render(userID [not dummy] = "+object+")");
+                        app.LOG("OtherSharedTreeViewModel::(getNodeInfo)render(String ", object, ") parameter is not [dummy]");
                         String html = AbstractImagePrototype.create(OtherSharedTreeView.images.myShared()).getHTML();
                         builder.appendHtmlConstant(html).appendHtmlConstant("&nbsp;");
                     }
-                    final String displayName = app.getUserDisplayNameForID(object);
                     builder.append(OtherSharedTreeView.Templates.INSTANCE.nameSpan(object));
                 }
             }), null, null);
         }
         else if(value instanceof String) {
-//            LOG("getNodeInfo(String "+value+"), called with userID");
+            app.LOG("OtherSharedTreeViewModel::getNodeInfo(String ", value, "), parameter is userID");
             final String userID = (String) value;
 
             if(userDataProviderMap.get(userID) == null) {
@@ -159,7 +158,7 @@ public class OtherSharedTreeViewModel implements TreeViewModel {
             return new DefaultNodeInfo<Folder>(userIDDataProvider, folderCell, selectionModel, null);
         }
         else {
-//            LOG("getNodeInfo(Folder "+value+"), called with a folder");
+            app.LOG("OtherSharedTreeViewModel::getNodeInfo(Folder ", value, ")");
             final Folder f = (Folder) value;
             if(dataProviderMap.get(f) == null) {
                 dataProviderMap.put(f, new ListDataProvider<Folder>());
@@ -170,31 +169,27 @@ public class OtherSharedTreeViewModel implements TreeViewModel {
         }
     }
 
-//    native void LOG(String message) /*-{
-//      console.log(message );
-//    }-*/;
-
     private void fetchSharingUsers(final Command callback) {
-        GetRequest<SharingUsers> getSharingUsers = new GetRequest<SharingUsers>(app, SharingUsers.class, app.getApiPath(), "", "?format=json") {
+        app.LOG("OtherSharedTreeViewModel::fetchSharingUsers() callback=", callback);
+        GetRequest<SharingUsers> getSharingUsers = new GetRequest<SharingUsers>(SharingUsers.class, app.getApiPath(), "", "?format=json") {
             @Override
             public void onSuccess(final SharingUsers _result) {
                 userLevelDataProviderForIDs.getList().clear();
 
                 final List<String> userIDs = _result.getUserIDs();
-//                for(String userID : userIDs) {
-//                    LOG("fetchSharingUsers(): userID =" + userID);
-//                }
+                for(String userID : userIDs) {
+                    app.LOG("OtherSharedTreeViewModel::fetchSharingUsers()::onSuccess() Sharing userID=", userID);
+                }
                 final List<String> userIDsWithUnknownDisplayNames = app.filterUserIDsWithUnknownDisplayName(userIDs);
 //                for(String userID : userIDsWithUnknownDisplayNames) {
-//                    LOG("fetchSharingUsers(): userID (with unknown name) =" + userID);
+//                    app.LOG("OtherSharedTreeViewModel::fetchSharingUsers(): userID (with unknown name) =" + userID);
 //                }
 
                 userLevelDataProviderForIDs.getList().addAll(userIDs);
                 if(userLevelDataProviderForIDs.getList().isEmpty()) {
                     userLevelDataProviderForIDs.getList().add(dummy);
-//                    userLevelDataProviderForDisplayNames.getList().add(dummy);
-                } else {
-//                    userLevelDataProviderForDisplayNames.getList().addAll(app.getUserDisplayNamesForIDs(userIDs));
+                    app.LOG("OtherSharedTreeViewModel::fetchSharingUsers()::onSuccess() NO sharing users, adding [dummy]=\"", dummy, "\"");
+                    return; // Only the dummy node is present, nothing to fetch from the server
                 }
 
                 if(userIDsWithUnknownDisplayNames.size() == 0) {
@@ -234,11 +229,12 @@ public class OtherSharedTreeViewModel implements TreeViewModel {
                 app.sessionExpired();
             }
         };
-        getSharingUsers.setHeader("X-Auth-Token", app.getUserToken());
+        getSharingUsers.setHeader(Const.X_AUTH_TOKEN, app.getUserToken());
         Scheduler.get().scheduleDeferred(getSharingUsers);
     }
 
     protected void fetchSharedContainers(final Iterator<String> userIDsIterator, final Command callback) {
+        app.LOG("OtherSharedTreeViewModel::fetchSharedContainers(), userIDsIterator=", userIDsIterator.hasNext(), ", callback=", callback);
         if(userIDsIterator.hasNext()) {
             String userID = userIDsIterator.next();
             if(userDataProviderMap.get(userID) == null) {
@@ -263,29 +259,30 @@ public class OtherSharedTreeViewModel implements TreeViewModel {
     public boolean isLeaf(Object o) {
         if(o == null) {
             boolean result =  userLevelDataProviderForIDs.getList().isEmpty();
-//            LOG("isLeaf(null) ==> " + result);
+//            app.LOG("isLeaf(null) ==> " + result);
             return result;
         }
         else if(o instanceof Folder) {
             Folder folder = (Folder) o;
             boolean result = folder.getSubfolders().isEmpty();
-//            LOG("isLeaf(Folder "+folder+") ==> " + result);
+//            app.LOG("isLeaf(Folder "+folder+") ==> " + result);
             return result;
         }
         else {
             ListDataProvider<Folder> dp = userDataProviderMap.get(o);
             if(dp != null) {
                 boolean result =  dp.getList().isEmpty();
-//                LOG("isLeaf("+o.getClass().getName()+" "+o+") ==> " + result);
+//                app.LOG("isLeaf("+o.getClass().getName()+" "+o+") ==> " + result);
                 return result;
             }
-//            LOG("isLeaf("+o.getClass().getName()+" "+o+") ==> (true)");
+//            app.LOG("isLeaf("+o.getClass().getName()+" "+o+") ==> (true)");
             return true;
         }
     }
 
     private void fetchSharedContainers(final String userID, final ListDataProvider<Folder> dataProvider, final Command callback) {
-        GetRequest<AccountResource> getUserSharedContainers = new GetRequest<AccountResource>(app, AccountResource.class, app.getApiPath(), userID, "?format=json") {
+        app.LOG("OtherSharedTreeViewModel::fetchSharedContainers(), userID=", userID, ", callback=", callback);
+        GetRequest<AccountResource> getUserSharedContainers = new GetRequest<AccountResource>(AccountResource.class, app.getApiPath(), userID, "?format=json") {
 
             @Override
             public void onSuccess(AccountResource _result) {
@@ -321,16 +318,17 @@ public class OtherSharedTreeViewModel implements TreeViewModel {
                 app.sessionExpired();
             }
         };
-        getUserSharedContainers.setHeader("X-Auth-Token", app.getUserToken());
+        getUserSharedContainers.setHeader(Const.X_AUTH_TOKEN, app.getUserToken());
         Scheduler.get().scheduleDeferred(getUserSharedContainers);
     }
 
     protected void fetchFolder(final String userID, final Iterator<Folder> folderIterator, final ListDataProvider<Folder> dataProvider, final Command callback) {
+        app.LOG("OtherSharedTreeViewModel::fetchFolder(), userID=", userID, " folderIterator=", folderIterator.hasNext(), ", callback=", callback);
         if(folderIterator.hasNext()) {
             final Folder f = folderIterator.next();
 
             String path = "/" + f.getContainer() + "?format=json&delimiter=/&prefix=" + URL.encodeQueryString(f.getPrefix());
-            GetRequest<Folder> getFolder = new GetRequest<Folder>(app, Folder.class, app.getApiPath(), userID, path, f) {
+            GetRequest<Folder> getFolder = new GetRequest<Folder>(Folder.class, app.getApiPath(), userID, path, f) {
                 @Override
                 public void onSuccess(Folder _result) {
                     dataProvider.getList().add(_result);
@@ -354,7 +352,7 @@ public class OtherSharedTreeViewModel implements TreeViewModel {
                     app.sessionExpired();
                 }
             };
-            getFolder.setHeader("X-Auth-Token", app.getUserToken());
+            getFolder.setHeader(Const.X_AUTH_TOKEN, app.getUserToken());
             Scheduler.get().scheduleDeferred(getFolder);
         }
         else if(callback != null) {
@@ -367,6 +365,7 @@ public class OtherSharedTreeViewModel implements TreeViewModel {
     }
 
     public void updateFolder(Folder folder, boolean showfiles, Command callback) {
+        app.LOG("OtherSharedTreeViewModel::updateFolder(), folder=", folder, ", showfiles=", showfiles, ", callback=", callback);
         if(dataProviderMap.get(folder) == null) {
             dataProviderMap.put(folder, new ListDataProvider<Folder>());
         }
@@ -375,8 +374,9 @@ public class OtherSharedTreeViewModel implements TreeViewModel {
     }
 
     public void fetchFolder(final Folder f, final ListDataProvider<Folder> dataProvider, final boolean showfiles, final Command callback) {
+        app.LOG("OtherSharedTreeViewModel::fetchFolder(), folder=", f, ", showfiles=", showfiles, ", callback=", callback);
         String path = "/" + f.getContainer() + "?format=json&delimiter=/&prefix=" + URL.encodeQueryString(f.getPrefix());
-        GetRequest<Folder> getFolder = new GetRequest<Folder>(app, Folder.class, app.getApiPath(), f.getOwnerID(), path, f) {
+        GetRequest<Folder> getFolder = new GetRequest<Folder>(Folder.class, app.getApiPath(), f.getOwnerID(), path, f) {
             @Override
             public void onSuccess(final Folder _result) {
                 if(showfiles) {
@@ -413,11 +413,12 @@ public class OtherSharedTreeViewModel implements TreeViewModel {
                 app.sessionExpired();
             }
         };
-        getFolder.setHeader("X-Auth-Token", app.getUserToken());
+        getFolder.setHeader(Const.X_AUTH_TOKEN, app.getUserToken());
         Scheduler.get().scheduleDeferred(getFolder);
     }
 
     public void initialize(Command callback) {
+        app.LOG("OtherSharedTreeViewModel::initialize(), callback=", callback);
         fetchSharingUsers(callback);
     }
 }
index 8a910f3..a7a9b6b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2012 GRNET S.A. All rights reserved.
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
index bea8c44..e6e3b11 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011-2012 GRNET S.A. All rights reserved.
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
@@ -35,7 +35,6 @@
 
 package gr.grnet.pithos.web.client.rest;
 
-import gr.grnet.pithos.web.client.Pithos;
 import gr.grnet.pithos.web.client.Resource;
 
 import java.util.HashMap;
@@ -56,8 +55,6 @@ public abstract class DeleteRequest implements ScheduledCommand {
        
        protected static final int MAX_RETRIES = 3; 
 
-    private final Pithos app;
-
        protected int retries = 0; 
 
        private String api;
@@ -72,8 +69,7 @@ public abstract class DeleteRequest implements ScheduledCommand {
 
     public abstract void onError(Throwable t);
 
-    public DeleteRequest(Pithos app, String api, String owner, String path) {
-        this.app = app;
+    public DeleteRequest(String api, String owner, String path) {
         this.api = api;
         this.owner = owner;
         this.path = path;
@@ -94,7 +90,7 @@ public abstract class DeleteRequest implements ScheduledCommand {
 
                 @Override
                 public Resource deserialize(Response response) {
-                    return Resource.createFromResponse(app, Resource.class, owner, response, null);
+                    return Resource.createFromResponse(Resource.class, owner, response, null);
                 }
 
                 @Override
index ab5d519..e697e7a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011-2012 GRNET S.A. All rights reserved.
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
@@ -35,7 +35,6 @@
 
 package gr.grnet.pithos.web.client.rest;
 
-import gr.grnet.pithos.web.client.Pithos;
 import gr.grnet.pithos.web.client.Resource;
 
 import java.util.HashMap;
@@ -52,9 +51,7 @@ public abstract class GetRequest<T extends Resource> implements ScheduledCommand
        
        protected static final int MAX_RETRIES = 3; 
 
-       protected int retries = 0;
-
-    private final Pithos app;
+       protected int retries = 0; 
 
        protected Class<T> resourceClass;
 
@@ -74,8 +71,7 @@ public abstract class GetRequest<T extends Resource> implements ScheduledCommand
 
     public abstract void onError(Throwable t);
 
-    public GetRequest(Pithos app, Class<T> resourceClass, String api, String owner, String path, int okCode, T result) {
-        this.app = app;
+    public GetRequest(Class<T> resourceClass, String api, String owner, String path, int okCode, T result) {
         this.resourceClass = resourceClass;
         this.api = api;
         this.owner = owner;
@@ -84,12 +80,32 @@ public abstract class GetRequest<T extends Resource> implements ScheduledCommand
         this.result = result;
     }
 
-    public GetRequest(Pithos app, Class<T> resourceClass, String api, String owner, String path) {
-        this(app, resourceClass, api, owner, path, -1, null);
+    public GetRequest(Class<T> resourceClass, String api, String owner, String path) {
+        this(resourceClass, api, owner, path, -1, null);
+        LOG("GetRequest() resourceClass = ", resourceClass.getName(), ", api=", api, ", owner=", owner, ", path=", path);
+    }
+
+    public GetRequest(Class<T> resourceClass, String api, String owner, String path, T result) {
+        this(resourceClass, api, owner, path, -1, result);
     }
 
-    public GetRequest(Pithos app, Class<T> resourceClass, String api, String owner, String path, T result) {
-        this(app, resourceClass, api, owner, path, -1, result);
+    static native void __ConsoleLog(String message) /*-{
+      try {
+        console.log(message);
+      } catch (e) {
+      }
+    }-*/;
+
+    public static void LOG(Object ...args) {
+        if(false) {
+            final StringBuilder sb = new StringBuilder();
+            for(Object arg : args) {
+                sb.append(arg);
+            }
+            if(sb.length() > 0) {
+                __ConsoleLog(sb.toString());
+            }
+        }
     }
 
     @Override
@@ -98,6 +114,8 @@ public abstract class GetRequest<T extends Resource> implements ScheduledCommand
                path += "&t=" + System.currentTimeMillis();
        else
                path += "?t=" + System.currentTimeMillis();
+        LOG("GET api = ", api, ", owner = ", owner, ", path = ", path);
+        LOG("   ==> ", api + owner + path);
         RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, api + owner + path);
 
         for (String header : headers.keySet()) {
@@ -112,7 +130,7 @@ public abstract class GetRequest<T extends Resource> implements ScheduledCommand
 
                 @Override
                 public T deserialize(Response response) {
-                    return Resource.createFromResponse(app, resourceClass, owner, response, result);
+                    return Resource.createFromResponse(resourceClass, owner, response, result);
                 }
 
                 @Override
@@ -135,6 +153,7 @@ public abstract class GetRequest<T extends Resource> implements ScheduledCommand
             retries++;
         }
         catch (RequestException e) {
+            LOG("Error in GetRequest: ", e.toString());
         }
     }
 
index 1148554..1c40647 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011-2012 GRNET S.A. All rights reserved.
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
@@ -35,7 +35,6 @@
 
 package gr.grnet.pithos.web.client.rest;
 
-import gr.grnet.pithos.web.client.Pithos;
 import gr.grnet.pithos.web.client.Resource;
 
 import java.util.HashMap;
@@ -52,8 +51,6 @@ public abstract class HeadRequest<T extends Resource> implements ScheduledComman
 
        protected static final int MAX_RETRIES = 3; 
 
-    private final Pithos app;
-
        protected int retries = 0; 
 
        protected Class<T> aClass;
@@ -76,8 +73,7 @@ public abstract class HeadRequest<T extends Resource> implements ScheduledComman
 
     public abstract void onError(Throwable t);
 
-    public HeadRequest(Pithos app, Class<T> aClass, String api, String owner, String path, int okCode, T result) {
-        this.app = app;
+    public HeadRequest(Class<T> aClass, String api, String owner, String path, int okCode, T result) {
         this.aClass = aClass;
         this.api = api;
         this.owner = owner;
@@ -86,12 +82,12 @@ public abstract class HeadRequest<T extends Resource> implements ScheduledComman
         this.result = result;
     }
 
-    public HeadRequest(Pithos app, Class<T> aClass, String api, String owner, String path) {
-        this(app, aClass, api, owner, path, Response.SC_NO_CONTENT, null);
+    public HeadRequest(Class<T> aClass, String api, String owner, String path) {
+        this(aClass, api, owner, path, Response.SC_NO_CONTENT, null);
     }
 
-    public HeadRequest(Pithos app, Class<T> aClass, String api, String owner, String path, T result) {
-        this(app, aClass, api, owner, path, Response.SC_NO_CONTENT, result);
+    public HeadRequest(Class<T> aClass, String api, String owner, String path, T result) {
+        this(aClass, api, owner, path, Response.SC_NO_CONTENT, result);
     }
 
     @Override
@@ -113,7 +109,7 @@ public abstract class HeadRequest<T extends Resource> implements ScheduledComman
 
                 @Override
                 public T deserialize(Response response) {
-                    return Resource.createFromResponse(app, aClass, owner, response, result);
+                    return Resource.createFromResponse(aClass, owner, response, result);
                 }
 
                 @Override
index a5437a5..f06bb22 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011-2012 GRNET S.A. All rights reserved.
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
@@ -35,7 +35,6 @@
 
 package gr.grnet.pithos.web.client.rest;
 
-import gr.grnet.pithos.web.client.Pithos;
 import gr.grnet.pithos.web.client.Resource;
 
 import java.util.HashMap;
@@ -50,8 +49,6 @@ import com.google.gwt.http.client.Response;
 
 public abstract class PostRequest implements ScheduledCommand {
 
-    private final Pithos app;
-
     private String api;
 
     protected String owner;
@@ -66,15 +63,13 @@ public abstract class PostRequest implements ScheduledCommand {
 
     public abstract void onError(Throwable t);
 
-    public PostRequest(Pithos app, String api, String owner, String path) {
-        this.app = app;
+    public PostRequest(String api, String owner, String path) {
         this.api = api;
         this.owner = owner;
         this.path = path;
     }
 
-    public PostRequest(Pithos app, String api, String owner, String path, String data) {
-        this.app = app;
+    public PostRequest(String api, String owner, String path, String data) {
         this.api = api;
         this.owner = owner;
         this.path = path;
@@ -96,7 +91,7 @@ public abstract class PostRequest implements ScheduledCommand {
 
                 @Override
                 public Resource deserialize(Response response) {
-                    return Resource.createFromResponse(app, Resource.class, owner, response, null);
+                    return Resource.createFromResponse(Resource.class, owner, response, null);
                 }
 
                 @Override
index 73ee55d..f27c4a1 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011-2012 GRNET S.A. All rights reserved.
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
@@ -34,7 +34,7 @@
  */
 
 /*
- * Copyright 2011-2012 GRNET S.A. All rights reserved.
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
@@ -70,7 +70,6 @@
 
 package gr.grnet.pithos.web.client.rest;
 
-import gr.grnet.pithos.web.client.Pithos;
 import gr.grnet.pithos.web.client.Resource;
 
 import java.util.HashMap;
@@ -84,8 +83,6 @@ import com.google.gwt.http.client.Response;
 
 public abstract class PutRequest implements ScheduledCommand {
 
-    private final Pithos app;
-
     private String api;
 
     protected String owner;
@@ -98,8 +95,7 @@ public abstract class PutRequest implements ScheduledCommand {
 
     public abstract void onError(Throwable t);
 
-    public PutRequest(Pithos app, String api, String owner, String path) {
-        this.app = app;
+    public PutRequest(String api, String owner, String path) {
         this.api = api;
         this.owner = owner;
         this.path = path;
@@ -120,7 +116,7 @@ public abstract class PutRequest implements ScheduledCommand {
 
                 @Override
                 public Resource deserialize(Response response) {
-                    return Resource.createFromResponse(app, Resource.class, owner, response, null);
+                    return Resource.createFromResponse(Resource.class, owner, response, null);
                 }
 
                 @Override
index bfbfdcf..a9280f6 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011-2012 GRNET S.A. All rights reserved.
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
index 91da6da..b1c8f54 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011-2012 GRNET S.A. All rights reserved.
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
index e51ceb3..650a84e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011-2012 GRNET S.A. All rights reserved.
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
index da9db3a..5c0501a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011-2012 GRNET S.A. All rights reserved.
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
index 96e71e8..653db23 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011-2012 GRNET S.A. All rights reserved.
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following
@@ -147,7 +147,7 @@ public class TagTreeViewModel implements TreeViewModel {
         if (iter.hasNext()) {
             Folder f = iter.next();
             String path = f.getUri() + "?format=json&meta=" + t.getName();
-            GetRequest<Folder> getFolder = new GetRequest<Folder>(app, Folder.class, app.getApiPath(), app.getUserID(), path) {
+            GetRequest<Folder> getFolder = new GetRequest<Folder>(Folder.class, app.getApiPath(), app.getUserID(), path) {
                 @Override
                 public void onSuccess(Folder _result) {
                     files.addAll(_result.getFiles());
index 8a9dd6b..19836a6 100644 (file)
@@ -1,5 +1,5 @@
 <!--
-  ~ Copyright 2011-2012 GRNET S.A. All rights reserved.
+  ~ Copyright 2011-2013 GRNET S.A. All rights reserved.
   ~
   ~ Redistribution and use in source and binary forms, with or
   ~ without modification, are permitted provided that the following
index 27c15e7..cef60f6 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011-2012 GRNET S.A. All rights reserved.
+ * Copyright 2011-2013 GRNET S.A. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or
  * without modification, are permitted provided that the following