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
+ PostRequest updateGroup = new PostRequest(Pithos.getStorageAPIURL(), app.getUserID(), path) {\r
\r
@Override\r
public void onSuccess(Resource result) {\r
if (iter.hasNext()) {\r
File f = iter.next();\r
String path = f.getUri();\r
- DeleteRequest deleteFile = new DeleteRequest(app.getApiPath(), f.getOwnerID(), URL.encode(path)) {\r
+ DeleteRequest deleteFile = new DeleteRequest(Pithos.getStorageAPIURL(), f.getOwnerID(), URL.encode(path)) {\r
@Override\r
public void onSuccess(Resource result) {\r
deleteFile(iter);\r
import gr.grnet.pithos.web.client.commands.PropertiesCommand;
import gr.grnet.pithos.web.client.commands.RestoreTrashCommand;
import gr.grnet.pithos.web.client.commands.ToTrashCommand;
-import gr.grnet.pithos.web.client.commands.UploadFileCommand;
import gr.grnet.pithos.web.client.foldertree.File;
import gr.grnet.pithos.web.client.foldertree.Folder;
@Override
public void execute() {
for (File f : selectedFiles)
- Window.open(app.getApiPath() + f.getOwnerID() + f.getUri(), "_blank", "");
+ Window.open(Pithos.getStorageAPIURL() + f.getOwnerID() + f.getUri(), "_blank", "");
}
}));
sb.append(Templates.INSTANCE.filenameSpan(object.getName()));
if (object.getContentType() != null && (object.getContentType().endsWith("png") || object.getContentType().endsWith("gif") || object.getContentType().endsWith("jpeg"))) {
sb.appendHtmlConstant(" ")
- .append(Templates.INSTANCE.viewLink(app.getApiPath() + object.getOwnerID() + object.getUri(), object.getName()));
+ .append(Templates.INSTANCE.viewLink(Pithos.getStorageAPIURL() + object.getOwnerID() + object.getUri(), object.getName()));
}
return sb.toSafeHtml();
if (DOM.eventGetType(event) == Event.ONDBLCLICK)
if (getSelectedFiles().size() == 1) {
File file = getSelectedFiles().get(0);
- Window.open(app.getApiPath() + file.getOwnerID() + file.getUri(), "_blank", "");
+ Window.open(Pithos.getStorageAPIURL() + file.getOwnerID() + file.getUri(), "_blank", "");
event.preventDefault();
return;
}
int i = 0;
boolean scrolled = false;
for (File f : files) {
- if (selectedUrls.contains(app.getApiPath() + f.getOwnerID() + f.getUri())) {
+ if (selectedUrls.contains(Pithos.getStorageAPIURL() + f.getOwnerID() + f.getUri())) {
selectionModel.setSelected(f, true);
if (!scrolled) {
celltable.getRowElement(i).getCells().getItem(0).scrollIntoView();
void showLinkIfShared() {\r
if (file.isShared()) {\r
UrlBuilder b = Window.Location.createUrlBuilder();\r
- b.setPath(app.getApiPath() + file.getOwnerID() + file.getUri());\r
+ b.setPath(Pithos.getStorageAPIURL() + file.getOwnerID() + file.getUri());\r
String href = Window.Location.getHref();\r
boolean hasParameters = href.contains(Const.QUESTION_MARK);\r
path.setText(href + (hasParameters ? Const.AMPERSAND : Const.QUESTION_MARK) + Const.GOTO_EQ + b.buildString());\r
@Override\r
protected boolean accept() {\r
updateMetaData(\r
- app.getApiPath(),\r
+ Pithos.getStorageAPIURL(),\r
app.getUserID(),\r
file.getUri() + Const.QUESTION_MARK_UPDATE_EQ,\r
permList.getPermissions()\r
PostRequest updateFile = new PostRequest(api, owner, path) {\r
@Override\r
public void onSuccess(Resource result) {\r
- HeadRequest<File> headFile = new HeadRequest<File>(File.class, app.getApiPath(), file.getOwnerID(), path, file) {\r
+ HeadRequest<File> headFile = new HeadRequest<File>(File.class, Pithos.getStorageAPIURL(), file.getOwnerID(), path, file) {\r
\r
@Override\r
public void onSuccess(File _result) {\r
\r
if (newFilename != null) {\r
final String path = file.getParent().getUri() + "/" + newFilename;\r
- PutRequest updateFile = new PutRequest(app.getApiPath(), app.getUserID(), path) {\r
+ PutRequest updateFile = new PutRequest(Pithos.getStorageAPIURL(), app.getUserID(), path) {\r
@Override\r
public void onSuccess(Resource result) {\r
- updateMetaData(app.getApiPath(), file.getOwnerID(), path, newMeta);\r
+ updateMetaData(Pithos.getStorageAPIURL(), file.getOwnerID(), path, newMeta);\r
}\r
\r
@Override\r
Scheduler.get().scheduleDeferred(updateFile);\r
}\r
else\r
- updateMetaData(app.getApiPath(), app.getUserID(), file.getUri(), newMeta);\r
+ updateMetaData(Pithos.getStorageAPIURL(), app.getUserID(), file.getUri(), newMeta);\r
return true;\r
}\r
\r
private void showLinkForPrivateSharing() {
if (isFilePrivatelyShared()) {
UrlBuilder b = Window.Location.createUrlBuilder();
- b.setPath(app.getApiPath() + file.getOwnerID() + file.getUri());
+ b.setPath(Pithos.getStorageAPIURL() + file.getOwnerID() + file.getUri());
String href = Window.Location.getHref();
boolean hasParameters = href.contains(Const.QUESTION_MARK);
privatePathText.setText(href + (hasParameters ? Const.AMPERSAND : Const.QUESTION_MARK) + Const.GOTO_EQ + b.buildString());
PostRequest updateFile = new PostRequest(api, owner, path) {
@Override
public void onSuccess(Resource result) {
- HeadRequest<File> headFile = new HeadRequest<File>(File.class, app.getApiPath(), file.getOwnerID(), path, file) {
+ HeadRequest<File> headFile = new HeadRequest<File>(File.class, Pithos.getStorageAPIURL(), file.getOwnerID(), path, file) {
@Override
public void onSuccess(File _result) {
}
protected void updateMetaDataForPublicSharing(Boolean published) {
updateMetaDataForPublicSharing(
- app.getApiPath(),
+ Pithos.getStorageAPIURL(),
app.getUserID(),
file.getUri() + Const.QUESTION_MARK_UPDATE_EQ,
published
PostRequest updateFile = new PostRequest(api, owner, path) {
@Override
public void onSuccess(Resource result) {
- HeadRequest<File> headFile = new HeadRequest<File>(File.class, app.getApiPath(), file.getOwnerID(), path, file) {
+ HeadRequest<File> headFile = new HeadRequest<File>(File.class, Pithos.getStorageAPIURL(), file.getOwnerID(), path, file) {
@Override
public void onSuccess(File _result) {
}
protected void updateMetaDataForPrivateSharing() {
updateMetaDataForPrivateSharing(
- app.getApiPath(),
+ Pithos.getStorageAPIURL(),
app.getUserID(),
file.getUri() + Const.QUESTION_MARK_UPDATE_EQ,
permList.getPermissions()
init: {
FilesAdded: function(up, files) {
- var api = app.@gr.grnet.pithos.web.client.Pithos::getApiPath()();
+ var api = @gr.grnet.pithos.web.client.Pithos::getStorageAPIURL()();
var folder = app.@gr.grnet.pithos.web.client.Pithos::getUploadFolder()();
var owner = folder.@gr.grnet.pithos.web.client.foldertree.Folder::getOwnerID()();
var uri = folder.@gr.grnet.pithos.web.client.foldertree.Folder::getUri()();
\r
protected void fetchVersions() {\r
String path = file.getUri() + "?format=json&version=list";\r
- GetRequest<FileVersions> getVersions = new GetRequest<FileVersions>(FileVersions.class, app.getApiPath(), file.getOwnerID(), path) {\r
+ GetRequest<FileVersions> getVersions = new GetRequest<FileVersions>(FileVersions.class, Pithos.getStorageAPIURL(), file.getOwnerID(), path) {\r
\r
@Override\r
public void onSuccess(FileVersions _result) {\r
\r
private void updateMetadataForPrivateSharing(final String path, final Map<String, Boolean[]> newPermissions) {\r
if(newPermissions != null) {\r
- PostRequest updateFolder = new PostRequest(app.getApiPath(), folder.getOwnerID(), path) {\r
+ PostRequest updateFolder = new PostRequest(Pithos.getStorageAPIURL(), folder.getOwnerID(), path) {\r
@Override\r
public void onSuccess(Resource result) {\r
app.updateFolder(folder.getParent(), false, new Command() {\r
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.getApiPath(), folder.getOwnerID(), path1) {\r
+ PutRequest newFolder = new PutRequest(Pithos.getStorageAPIURL(), folder.getOwnerID(), path1) {\r
@Override\r
public void onSuccess(Resource result) {\r
updateMetadataForPrivateSharing(path, newPermissions);\r
return;\r
}\r
String path = folder.getUri() + "/" + name;\r
- PutRequest createFolder = new PutRequest(app.getApiPath(), folder.getOwnerID(), path) {\r
+ PutRequest createFolder = new PutRequest(Pithos.getStorageAPIURL(), folder.getOwnerID(), path) {\r
@Override\r
public void onSuccess(Resource result) {\r
app.updateFolder(folder, true, new Command() {\r
* Entry point classes define <code>onModuleLoad()</code>.
*/
public class Pithos implements EntryPoint, ResizeHandler {
- private static final boolean IsLOGEnabled = false;
+ private static final boolean IsLOGEnabled = true;
public static final boolean IsDetailedHTTPLOGEnabled = true;
public static final boolean IsFullResponseBodyLOGEnabled = true;
}
public static final Configuration config = GWT.create(Configuration.class);
+ public static final String CONFIG_API_PATH = config.apiPath();
+ static {
+ LOG("CONFIG_API_PATH = ", CONFIG_API_PATH);
+ }
+
+ public static final Dictionary otherProperties = Dictionary.getDictionary(Const.OTHER_PROPERTIES);
+ public static String getFromOtherPropertiesOrNull(String key) {
+ try {
+ return otherProperties.get(key);
+ }
+ catch(Exception e) {
+ LOGError(e);
+ return null;
+ }
+ }
+ public static final String OTHERPROPS_STORAGE_API_URL = getFromOtherPropertiesOrNull("STORAGE_API_URL");
+ public static final String OTHERPROPS_USER_CATALOGS_API_URL = getFromOtherPropertiesOrNull("USER_CATALOGS_API_URL");
+ static {
+ LOG("STORAGE_API_URL = ", OTHERPROPS_STORAGE_API_URL);
+ LOG("USER_CATALOGS_API_URL = ", OTHERPROPS_USER_CATALOGS_API_URL);
+ }
+
+ public static final String STORAGE_API_URL;
+ static {
+ if(OTHERPROPS_STORAGE_API_URL != null) {
+ STORAGE_API_URL = OTHERPROPS_STORAGE_API_URL;
+ }
+ else if(CONFIG_API_PATH != null) {
+ STORAGE_API_URL = CONFIG_API_PATH;
+ }
+ else {
+ throw new RuntimeException("Unknown STORAGE_API_URL");
+ }
+ }
+ public static final String USER_CATALOGS_API_URL;
+ static {
+ if(OTHERPROPS_USER_CATALOGS_API_URL != null) {
+ USER_CATALOGS_API_URL = OTHERPROPS_USER_CATALOGS_API_URL;
+ }
+ else if(OTHERPROPS_STORAGE_API_URL != null) {
+ throw new RuntimeException("STORAGE_API_URL is defined but USER_CATALOGS_API_URL is not");
+ }
+ else {
+ // https://server.com/v1/ --> https://server.com
+ String url = CONFIG_API_PATH;
+ url = Helpers.stripTrailing(url, "/");
+ url = Helpers.upToIncludingLastPart(url, "/");
+ url = Helpers.stripTrailing(url, "/");
+ url = url + "/user_catalogs";
+
+ USER_CATALOGS_API_URL = url;
+
+ LOG("USER_CATALOGS_API_URL = ", USER_CATALOGS_API_URL);
+ }
+ }
public interface Style extends CssResource {
String commandAnchor();
return true;
}
- HeadRequest<Folder> head = new HeadRequest<Folder>(Folder.class, getApiPath(), f.getOwnerID(), "/" + f.getContainer()) {
+ HeadRequest<Folder> head = new HeadRequest<Folder>(Folder.class, getStorageAPIURL(), f.getOwnerID(), "/" + f.getContainer()) {
@Override
public void onSuccess(Folder _result) {
* Parse and store the user credentials to the appropriate fields.
*/
private boolean parseUserCredentials() {
- Configuration conf = (Configuration) GWT.create(Configuration.class);
- Dictionary otherProperties = Dictionary.getDictionary(Const.OTHER_PROPERTIES);
- String cookie = otherProperties.get(Const.AUTH_COOKIE);
+ final String cookie = otherProperties.get(Const.AUTH_COOKIE);
String auth = Cookies.getCookie(cookie);
if(auth == null) {
authenticateUser();
if(auth.endsWith("\"")) {
auth = auth.substring(0, auth.length() - 1);
}
- String[] authSplit = auth.split("\\" + conf.cookieSeparator(), 2);
+ String[] authSplit = auth.split("\\" + config.cookieSeparator(), 2);
if(authSplit.length != 2) {
authenticateUser();
return false;
}
- userID = authSplit[0];
- userToken = authSplit[1];
+ this.userID = authSplit[0];
+ this.userToken = authSplit[1];
String gotoUrl = Window.Location.getParameter("goto");
if(gotoUrl != null && gotoUrl.length() > 0) {
public void fetchAccount(final Command callback) {
String path = "?format=json";
- GetRequest<AccountResource> getAccount = new GetRequest<AccountResource>(AccountResource.class, getApiPath(), userID, path) {
+ GetRequest<AccountResource> getAccount = new GetRequest<AccountResource>(AccountResource.class, getStorageAPIURL(), userID, path) {
@Override
public void onSuccess(AccountResource accountResource) {
account = accountResource;
}
public void updateStatistics() {
- HeadRequest<AccountResource> headAccount = new HeadRequest<AccountResource>(AccountResource.class, getApiPath(), userID, "", account) {
+ HeadRequest<AccountResource> headAccount = new HeadRequest<AccountResource>(AccountResource.class, getStorageAPIURL(), userID, "", account) {
@Override
public void onSuccess(AccountResource _result) {
protected void createHomeContainer(final AccountResource _account, final Command callback) {
String path = "/" + Const.HOME_CONTAINER;
- PutRequest createPithos = new PutRequest(getApiPath(), getUserID(), path) {
+ PutRequest createPithos = new PutRequest(getStorageAPIURL(), getUserID(), path) {
@Override
public void onSuccess(Resource result) {
if(!_account.hasTrashContainer()) {
protected void createTrashContainer(final Command callback) {
String path = "/" + Const.TRASH_CONTAINER;
- PutRequest createPithos = new PutRequest(getApiPath(), getUserID(), path) {
+ PutRequest createPithos = new PutRequest(getStorageAPIURL(), getUserID(), path) {
@Override
public void onSuccess(Resource result) {
fetchAccount(callback);
$doc.body.onselectstart = null;
}-*/;
- /**
- * @return the absolute path of the API root URL
- */
- public String getApiPath() {
- Configuration conf = (Configuration) GWT.create(Configuration.class);
- return conf.apiPath();
+ public static String getStorageAPIURL() {
+ return STORAGE_API_URL;
+ }
+
+ public static String getUserCatalogsURL() {
+ return USER_CATALOGS_API_URL;
}
/**
final PleaseWaitPopup pwp = new PleaseWaitPopup();
pwp.center();
String path = "/" + folder.getContainer() + "/" + folder.getPrefix() + "?delimiter=/" + "&t=" + System.currentTimeMillis();
- DeleteRequest deleteFolder = new DeleteRequest(getApiPath(), folder.getOwnerID(), path) {
+ DeleteRequest deleteFolder = new DeleteRequest(getStorageAPIURL(), folder.getOwnerID(), path) {
@Override
protected void onUnauthorized(Response response) {
if(iter.hasNext()) {
File file = iter.next();
String path = targetUri + "/" + file.getName();
- PutRequest copyFile = new PutRequest(getApiPath(), targetUsername, path) {
+ PutRequest copyFile = new PutRequest(getStorageAPIURL(), targetUsername, path) {
@Override
public void onSuccess(Resource result) {
copyFiles(iter, targetUsername, targetUri, callback);
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(getApiPath(), targetUsername, path) {
+ PutRequest copyFolder = new PutRequest(getStorageAPIURL(), targetUsername, path) {
@Override
public void onSuccess(Resource result) {
if(callback != null) {
}
}
else {
- HeadRequest<Folder> headFolder = new HeadRequest<Folder>(Folder.class, getApiPath(), folder.getOwnerID(), folder.getUri(), folder) {
+ HeadRequest<Folder> headFolder = new HeadRequest<Folder>(Folder.class, getStorageAPIURL(), folder.getOwnerID(), folder.getUri(), folder) {
@Override
public void onSuccess(Folder _result) {
if(t instanceof RestException) {
if(((RestException) t).getHttpStatusCode() == Response.SC_NOT_FOUND) {
final String path = folder.getUri();
- PutRequest newFolder = new PutRequest(getApiPath(), folder.getOwnerID(), path) {
+ PutRequest newFolder = new PutRequest(getStorageAPIURL(), folder.getOwnerID(), path) {
@Override
public void onSuccess(Resource _result) {
scheduleFolderHeadCommand(folder, callback);
}
public void scheduleFileHeadCommand(File f, final Command callback) {
- HeadRequest<File> headFile = new HeadRequest<File>(File.class, getApiPath(), f.getOwnerID(), f.getUri(), f) {
+ HeadRequest<File> headFile = new HeadRequest<File>(File.class, getStorageAPIURL(), f.getOwnerID(), f.getUri(), f) {
@Override
public void onSuccess(File _result) {
public void purgeContainer(final Folder container) {
String path = "/" + container.getName() + "?delimiter=/";
- DeleteRequest delete = new DeleteRequest(getApiPath(), getUserID(), path) {
+ DeleteRequest delete = new DeleteRequest(getStorageAPIURL(), getUserID(), path) {
@Override
protected void onUnauthorized(Response response) {
@Override
public void execute() {
for (File f: files)
- Window.open(app.getApiPath() + f.getOwnerID() + f.getUri(), "_blank", "");
+ Window.open(Pithos.getStorageAPIURL() + f.getOwnerID() + f.getUri(), "_blank", "");
}
}));
empty = false;
downloadHtml.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
- String fileUrl = app.getApiPath() + file.getOwnerID() + file.getUri() + "?version=" + v.getVersion();
+ String fileUrl = Pithos.getStorageAPIURL() + file.getOwnerID() + file.getUri() + "?version=" + v.getVersion();
Window.open(fileUrl, "_BLANK", "");
}
});
void restoreVersion(int version) {
String path = file.getUri() + "?update=";
- PostRequest restoreVersion = new PostRequest(app.getApiPath(), file.getOwnerID(), path) {
+ PostRequest restoreVersion = new PostRequest(Pithos.getStorageAPIURL(), file.getOwnerID(), path) {
@Override
public void onSuccess(Resource result) {
package gr.grnet.pithos.web.client.catalog;
-import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.Scheduler;
import com.google.gwt.http.client.*;
import com.google.gwt.json.client.JSONArray;
* The request via which we obtain user catalog info.
*/
public class GetUserCatalogs implements Scheduler.ScheduledCommand {
- private final Pithos app;
private final String url;
private final String userToken;
private final List<String> ids;
private final List<String> names;
public static final int SuccessCode = 200;
- public static final String CallEndPoint = "/user_catalogs";
public static final String RequestField_uuids = "uuids";
public static final String RequestField_displaynames = "displaynames";
public static final String ResponseField_displayname_catalog = "displayname_catalog";
public static final String ResponseField_uuid_catalog = "uuid_catalog";
- public GetUserCatalogs(Pithos app) {
- this(app, null, null);
- }
-
- public GetUserCatalogs(Pithos app, String userID) {
- this(app, Helpers.toList(userID), null);
- }
-
- public GetUserCatalogs(Pithos app, List<String> ids) {
- this(app, ids, null);
- }
-
- public GetUserCatalogs(Pithos app, List<String> ids, List<String> names) {
- assert app != null;
-
- this.app = app;
-
- // FIXME: Probably use Window.Location.getHost()
- // https://server.com/v1/ --> https://server.com
- String path = app.getApiPath();
- path = Helpers.stripTrailing(path, "/");
- path = Helpers.upToIncludingLastPart(path, "/");
- path = Helpers.stripTrailing(path, "/");
-
- // https://server.com/user_catalogs
- this.url = path + CallEndPoint;
-
+ public GetUserCatalogs(String userToken, List<String> ids, List<String> names) {
+ this.url = Pithos.getUserCatalogsURL();
+ this.userToken = userToken;
this.ids = Helpers.safeList(ids);
this.names = Helpers.safeList(names);
- this.userToken = app.getUserToken();
}
public String getURL() {
}
public void onError(Request request, Throwable t) {
- app.LOG("GetUserCatalogs", t);
+ Pithos.LOG("GetUserCatalogs", t);
}
@Override
final RequestBuilder rb = new RequestBuilder(RequestBuilder.POST, getURL());
rb.setHeader(Const.X_AUTH_TOKEN, userToken);
final String requestData = makeRequestData().toString();
- app.LOG("GetUserCatalogs => ", requestData);
+ Pithos.LOG("GetUserCatalogs => ", requestData);
Pithos.LOG("POST ", getURL());
try {
final int statusCode = response.getStatusCode();
if(statusCode != SuccessCode) {
- app.LOG("GetUserCatalogs <= [", statusCode, " ", response.getStatusText(), "]");
+ Pithos.LOG("GetUserCatalogs <= [", statusCode, " ", response.getStatusText(), "]");
GetUserCatalogs.this.onBadStatusCode(request, response);
return;
}
final String responseText = response.getText();
final JSONValue jsonValue = JSONParser.parseStrict(responseText);
- app.LOG("GetUserCatalogs <= ", jsonValue.toString());
+ Pithos.LOG("GetUserCatalogs <= ", jsonValue.toString());
final JSONObject result = jsonValue.isObject();
if(result == null) {
});
}
catch(Exception e) {
- app.LOG("GetUserCatalogs", e);
+ Pithos.LOG("GetUserCatalogs", e);
}
}
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;
public UpdateUserCatalogs(Pithos app, List<String> ids, List<String> names) {
this.app = app;
- this.getUserCatalogs = new GetUserCatalogs(app, ids, names) {
+ this.getUserCatalogs = new GetUserCatalogs(app.getUserToken(), ids, names) {
@Override
public void onSuccess(Request request, Response response, JSONObject result, UserCatalogs userCatalogs) {
UpdateUserCatalogs.this.app.getUserCatalogs().updateFrom(userCatalogs);
containerPanel.hide();
if (Window.confirm("Are you sure you want to delete group " + group.getName())) {
String path = "?update=";
- PostRequest updateGroup = new PostRequest(app.getApiPath(), app.getUserID(), path) {
+ PostRequest updateGroup = new PostRequest(Pithos.getStorageAPIURL(), app.getUserID(), path) {
@Override
public void onSuccess(Resource result) {
if (iter.hasNext()) {
File file = iter.next();
String path = folder.getUri() + "/" + file.getName();
- PutRequest copyFile = new PutRequest(app.getApiPath(), folder.getOwnerID(), path) {
+ PutRequest copyFile = new PutRequest(Pithos.getStorageAPIURL(), folder.getOwnerID(), path) {
@Override
public void onSuccess(Resource result) {
moveFiles(iter, callback);
return;
group.removeMemberID(user.getUserID());
String path = "?update=";
- PostRequest updateGroup = new PostRequest(app.getApiPath(), app.getUserID(), path) {
+ PostRequest updateGroup = new PostRequest(Pithos.getStorageAPIURL(), app.getUserID(), path) {
@Override
public void onSuccess(Resource result) {
if (iter.hasNext()) {
File file = iter.next();
String path = "/" + Const.HOME_CONTAINER + "/" + file.getPath();
- PutRequest untrashFile = new PutRequest(app.getApiPath(), app.getUserID(), path) {
+ PutRequest untrashFile = new PutRequest(Pithos.getStorageAPIURL(), app.getUserID(), path) {
@Override
public void onSuccess(Resource result) {
untrashFiles(iter, callback);
if (iter.hasNext()) {
File file = iter.next();
String path = "/" + Const.TRASH_CONTAINER + "/" + file.getPath();
- PutRequest trashFile = new PutRequest(app.getApiPath(), app.getUserID(), path) {
+ PutRequest trashFile = new PutRequest(Pithos.getStorageAPIURL(), app.getUserID(), path) {
@Override
public void onSuccess(Resource result) {
trashFiles(iter, callback);
final Folder f = iter.next();
String path = "/" + f.getContainer() + "?format=json&delimiter=/&prefix=" + URL.encodeQueryString(f.getPrefix());
- GetRequest<Folder> getFolder = new GetRequest<Folder>(Folder.class, app.getApiPath(), f.getOwnerID(), path, f) {
+ GetRequest<Folder> getFolder = new GetRequest<Folder>(Folder.class, Pithos.getStorageAPIURL(), f.getOwnerID(), path, f) {
@Override
public void onSuccess(Folder _result) {
fetchFolder(iter, callback);
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>(Folder.class, app.getApiPath(), f.getOwnerID(), path, f) {
+ GetRequest<Folder> getFolder = new GetRequest<Folder>(Folder.class, Pithos.getStorageAPIURL(), f.getOwnerID(), path, f) {
@Override
public void onSuccess(final Folder _result) {
if (showfiles)
private void fetchSharedContainers(final Command callback) {
app.LOG("MysharedTreeViewModel::fetchSharedContainers(), callback=", callback);
String path = "?format=json&shared=&public=";
- GetRequest<AccountResource> getAccount = new GetRequest<AccountResource>(AccountResource.class, app.getApiPath(), app.getUserID(), path) {
+ GetRequest<AccountResource> getAccount = new GetRequest<AccountResource>(AccountResource.class, Pithos.getStorageAPIURL(), app.getUserID(), path) {
@Override
public void onSuccess(final AccountResource _result) {
firstLevelDataProvider.getList().clear();
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>(Folder.class, app.getApiPath(), f.getOwnerID(), path, f) {
+ GetRequest<Folder> getFolder = new GetRequest<Folder>(Folder.class, Pithos.getStorageAPIURL(), f.getOwnerID(), path, f) {
@Override
public void onSuccess(Folder _result) {
fetchFolder(iter, callback);
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>(Folder.class, app.getApiPath(), f.getOwnerID(), path, f) {
+ GetRequest<Folder> getFolder = new GetRequest<Folder>(Folder.class, Pithos.getStorageAPIURL(), f.getOwnerID(), path, f) {
@Override
public void onSuccess(final Folder _result) {
for (File file : _result.getFiles()) {
private void fetchSharingUsers(final Command callback) {
app.LOG("OtherSharedTreeViewModel::fetchSharingUsers() callback=", callback);
- GetRequest<SharingUsers> getSharingUsers = new GetRequest<SharingUsers>(SharingUsers.class, app.getApiPath(), "", "?format=json") {
+ GetRequest<SharingUsers> getSharingUsers = new GetRequest<SharingUsers>(SharingUsers.class, Pithos.getStorageAPIURL(), "", "?format=json") {
@Override
public void onSuccess(final SharingUsers _result) {
userLevelDataProviderForIDs.getList().clear();
private void fetchSharedContainers(final String userID, final ListDataProvider<Folder> dataProvider, final Command callback) {
app.LOG("OtherSharedTreeViewModel::fetchSharedContainers(), userID=", userID, ", callback=", callback);
- GetRequest<AccountResource> getUserSharedContainers = new GetRequest<AccountResource>(AccountResource.class, app.getApiPath(), userID, "?format=json") {
+ GetRequest<AccountResource> getUserSharedContainers = new GetRequest<AccountResource>(AccountResource.class, Pithos.getStorageAPIURL(), userID, "?format=json") {
@Override
public void onSuccess(AccountResource _result) {
final Folder f = folderIterator.next();
String path = "/" + f.getContainer() + "?format=json&delimiter=/&prefix=" + URL.encodeQueryString(f.getPrefix());
- GetRequest<Folder> getFolder = new GetRequest<Folder>(Folder.class, app.getApiPath(), userID, path, f) {
+ GetRequest<Folder> getFolder = new GetRequest<Folder>(Folder.class, Pithos.getStorageAPIURL(), userID, path, f) {
@Override
public void onSuccess(Folder _result) {
dataProvider.getList().add(_result);
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>(Folder.class, app.getApiPath(), f.getOwnerID(), path, f) {
+ GetRequest<Folder> getFolder = new GetRequest<Folder>(Folder.class, Pithos.getStorageAPIURL(), f.getOwnerID(), path, f) {
@Override
public void onSuccess(final Folder _result) {
if(showfiles) {
if (iter.hasNext()) {
Folder f = iter.next();
String path = f.getUri() + "?format=json&meta=" + t.getName();
- GetRequest<Folder> getFolder = new GetRequest<Folder>(Folder.class, app.getApiPath(), app.getUserID(), path) {
+ GetRequest<Folder> getFolder = new GetRequest<Folder>(Folder.class, Pithos.getStorageAPIURL(), app.getUserID(), path) {
@Override
public void onSuccess(Folder _result) {
files.addAll(_result.getFiles());