Skip to content
This repository has been archived by the owner on Mar 19, 2024. It is now read-only.

Commit

Permalink
Merge pull request #82 from owncloud/copy
Browse files Browse the repository at this point in the history
Copy operation
  • Loading branch information
masensio committed Sep 4, 2015
2 parents dbc8c32 + ef07416 commit 17bb724
Show file tree
Hide file tree
Showing 9 changed files with 778 additions and 105 deletions.
35 changes: 14 additions & 21 deletions .travis.yml
@@ -1,34 +1,27 @@
language: android
android:
components:
- build-tools-22.0.1
- android-19
- android-17
- android-14
- extra-android-support
licenses:
- 'android-sdk-license-5be876d5'
- 'android-sdk-license-598b93a6'
jdk: oraclejdk7
- build-tools-22.0.1
- android-19
before_install:
- echo no | android create avd --force -n test -t $ANDROID_TARGET --abi $ANDROID_ABI -c 20M
- echo no | android create avd --force -n test -t $ANDROID_TARGET --abi $ANDROID_ABI
-c 20M
- emulator -avd test -no-skin -no-audio -no-window &
- rm pom.xml
- android update project -p .
before_script:
- chmod +x ./wait_for_emulator.sh
- ./wait_for_emulator.sh
script:
- ant clean
- ant debug
- cd test_client/tests
- ant acceptance-test
- cd ../..
- ./gradlew clean build
- ant clean
- ant debug
- cd test_client/tests
- ant acceptance-test
- cd ../..
- ./gradlew clean build
env:
global:
- secure: f4Kms/mzkYRG4Kp8k6hsvG3Y0ztbJnA2J79OBw3VdqJOKVTzwsxMd1Yh325YDYO7I4HeHxGXy0H4p3rAPzIWr/nrOJ4wmcDwQYDQtVjF7S1ARWsX51FrCEV6A9ec2LAqNCQ8ZC0SoGb+HsmpFCE3uKAxRQt+B5MzOZvKNcvYpMA=
- secure: aF4U20Xlu/rfrbxCmoJAiGh1doYTAZ10UEDmajuinT+ZGSJLivuqD7DDY/00sI6IXWg+J1vL+7jJm4JSYusHPg38UHZ4q92k6RmZycW2ATUzZnGT54O5FRnY67MfVwgVpIMK9UOL/6NEciBHEjlIOL0wbKQiJB++1YtBZOQLGL4=
- secure: N+ECSwNg8v2GsAFJ2y/tCiffauHDpN76zuFI2pDqf0fjmCtJZHu4BH5ArXBHjyHKmgn20a/8eZXcwJaH1HsJ80bo7vDJ2miShjGIQ90hPcdmUiB2XVJcew4f04CtvMDH5o7DRt4ykWArlbPL2rhVag0jotlSidolHBwRFnbDhDY=
- secure: HxHoqnC8mauCKi87zlo7pQcSsSw0W5MtW+iUcB8T11quwTBgUPWIOmycXv2FcmwpST0E43Ct+dhE+mttm+6P+5PSB33HQNLq00hfTVIJ4ttcb/5eWW8MnP7L+kPK8d0EtfDG6GQto7QktaybeG4+sNKKD336ZlFfM7xgPtPv+tg=
- secure: WQMw0ciloe8i2ApGhePhuTmmH8UgAV1Ri10C1qhUH9hVOJAr+/1X5A93VPYGrgJ2EH5MdiL6f2XMDCYAgb9efuvZIUKNE0J92xh8m/yRa8nAVWNBE0PBdS4+OycoHpIQfMcUghooERXjP4GUYd/ZwICvWA+sXdOYWDdKjODUgl4=
- secure: QPxKT8vC7sm1b/hYJcfkQkLgpwNRBvVKk8S8S0t43mmqPJfs94FJTQHH4kZaGSwOeuDkRQbGuKzYtXOnGOKX2hhUBqKJd1idpJnUID8id8Kqo6VutjG017+XxZQp0hPHmfmDxYkDvlaLeoZpP2NkpwZ1p4TL2MSCr2Ibl6uTWvc=
matrix:
- ANDROID_TARGET=android-19 ANDROID_ABI=armeabi-v7a
- ANDROID_TARGET=android-19 ANDROID_ABI=armeabi-v7a
1 change: 1 addition & 0 deletions build.gradle
Expand Up @@ -6,6 +6,7 @@ buildscript {
classpath 'com.android.tools.build:gradle:1.2.3'
}
}

apply plugin: 'com.android.library'

repositories {
Expand Down
5 changes: 5 additions & 0 deletions sample_client/build.gradle
Expand Up @@ -43,4 +43,9 @@ android {
packagingOptions {
exclude 'META-INF/LICENSE.txt'
}
android {
lintOptions {
abortOnError false
}
}
}
Expand Up @@ -33,8 +33,12 @@
import java.net.SocketTimeoutException;
import java.net.UnknownHostException;
import java.util.ArrayList;
import android.accounts.Account;
import android.accounts.AccountsException;

import javax.net.ssl.SSLException;
import com.owncloud.android.lib.common.accounts.AccountUtils.AccountNotFoundException;
import com.owncloud.android.lib.common.network.CertificateCombinedException;
import com.owncloud.android.lib.common.utils.Log_OC;

import org.apache.commons.httpclient.ConnectTimeoutException;
import org.apache.commons.httpclient.Header;
Expand All @@ -43,26 +47,21 @@
import org.apache.jackrabbit.webdav.DavException;
import org.json.JSONException;

import android.accounts.Account;
import android.accounts.AccountsException;

import com.owncloud.android.lib.common.accounts.AccountUtils.AccountNotFoundException;
import com.owncloud.android.lib.common.network.CertificateCombinedException;
import com.owncloud.android.lib.common.utils.Log_OC;
import javax.net.ssl.SSLException;


/**
* The result of a remote operation required to an ownCloud server.
*
* <p/>
* Provides a common classification of remote operation results for all the
* application.
*
*
* @author David A. Velasco
*/
public class RemoteOperationResult implements Serializable {

/** Generated - should be refreshed every time the class changes!! */;
private static final long serialVersionUID = -1909603208238358633L;
private static final long serialVersionUID = 1129130415603799707L;

private static final String TAG = RemoteOperationResult.class.getSimpleName();

Expand All @@ -71,41 +70,43 @@ public enum ResultCode {
OK_SSL,
OK_NO_SSL,
UNHANDLED_HTTP_CODE,
UNAUTHORIZED,
FILE_NOT_FOUND,
INSTANCE_NOT_CONFIGURED,
UNKNOWN_ERROR,
WRONG_CONNECTION,
TIMEOUT,
INCORRECT_ADDRESS,
HOST_NOT_AVAILABLE,
NO_NETWORK_CONNECTION,
UNAUTHORIZED,
FILE_NOT_FOUND,
INSTANCE_NOT_CONFIGURED,
UNKNOWN_ERROR,
WRONG_CONNECTION,
TIMEOUT,
INCORRECT_ADDRESS,
HOST_NOT_AVAILABLE,
NO_NETWORK_CONNECTION,
SSL_ERROR,
SSL_RECOVERABLE_PEER_UNVERIFIED,
BAD_OC_VERSION,
CANCELLED,
INVALID_LOCAL_FILE_NAME,
CANCELLED,
INVALID_LOCAL_FILE_NAME,
INVALID_OVERWRITE,
CONFLICT,
CONFLICT,
OAUTH2_ERROR,
SYNC_CONFLICT,
LOCAL_STORAGE_FULL,
LOCAL_STORAGE_NOT_MOVED,
LOCAL_STORAGE_NOT_COPIED,
LOCAL_STORAGE_FULL,
LOCAL_STORAGE_NOT_MOVED,
LOCAL_STORAGE_NOT_COPIED,
OAUTH2_ERROR_ACCESS_DENIED,
QUOTA_EXCEEDED,
ACCOUNT_NOT_FOUND,
ACCOUNT_EXCEPTION,
ACCOUNT_NOT_NEW,
QUOTA_EXCEEDED,
ACCOUNT_NOT_FOUND,
ACCOUNT_EXCEPTION,
ACCOUNT_NOT_NEW,
ACCOUNT_NOT_THE_SAME,
INVALID_CHARACTER_IN_NAME,
SHARE_NOT_FOUND,
LOCAL_STORAGE_NOT_REMOVED,
FORBIDDEN,
SHARE_FORBIDDEN,
OK_REDIRECT_TO_NON_SECURE_CONNECTION,
INVALID_MOVE_INTO_DESCENDANT,
INVALID_MOVE_INTO_DESCENDANT,
INVALID_COPY_INTO_DESCENDANT,
PARTIAL_MOVE_DONE,
PARTIAL_COPY_DONE,
INVALID_CHARACTER_DETECT_IN_SERVER
}

Expand Down Expand Up @@ -161,20 +162,20 @@ private RemoteOperationResult(boolean success, int httpCode) {
}
}
}

public RemoteOperationResult(boolean success, int httpCode, Header[] headers) {
this(success, httpCode);
if (headers != null) {
Header current;
for (int i=0; i<headers.length; i++) {
for (int i = 0; i < headers.length; i++) {
current = headers[i];
if ("location".equals(current.getName().toLowerCase())) {
mRedirectedLocation = current.getValue();
continue;
}
if ("www-authenticate".equals(current.getName().toLowerCase())) {
mAuthenticate = current.getValue();
continue;
mAuthenticate = current.getValue();
continue;
}
}
}
Expand Down Expand Up @@ -234,10 +235,10 @@ public RemoteOperationResult(Exception e) {

} else if (e instanceof AccountNotFoundException) {
mCode = ResultCode.ACCOUNT_NOT_FOUND;

} else if (e instanceof AccountsException) {
mCode = ResultCode.ACCOUNT_EXCEPTION;

} else if (e instanceof SSLException || e instanceof RuntimeException) {
CertificateCombinedException se = getCertificateCombinedException(e);
if (se != null) {
Expand All @@ -259,14 +260,14 @@ public RemoteOperationResult(Exception e) {
}


public void setData(ArrayList<Object> files){
mData = files;
public void setData(ArrayList<Object> files) {
mData = files;
}
public ArrayList<Object> getData(){
return mData;
}

public ArrayList<Object> getData() {
return mData;
}

public boolean isSuccess() {
return mSuccess;
}
Expand All @@ -291,9 +292,9 @@ public boolean isSslRecoverableException() {
return mCode == ResultCode.SSL_RECOVERABLE_PEER_UNVERIFIED;
}

public boolean isRedirectToNonSecureConnection() {
return mCode == ResultCode.OK_REDIRECT_TO_NON_SECURE_CONNECTION;
}
public boolean isRedirectToNonSecureConnection() {
return mCode == ResultCode.OK_REDIRECT_TO_NON_SECURE_CONNECTION;
}

private CertificateCombinedException getCertificateCombinedException(Exception e) {
CertificateCombinedException result = null;
Expand Down Expand Up @@ -360,10 +361,10 @@ public String getLogMessage() {

} else if (mException instanceof AccountsException) {
return "Exception while using account";

} else if (mException instanceof JSONException) {
return "JSON exception";
return "JSON exception";

} else {
return "Unexpected exception";
}
Expand Down Expand Up @@ -415,25 +416,24 @@ public boolean isTemporalRedirection() {
public String getRedirectedLocation() {
return mRedirectedLocation;
}

public boolean isIdPRedirection() {
return (mRedirectedLocation != null &&
(mRedirectedLocation.toUpperCase().contains("SAML") ||
mRedirectedLocation.toLowerCase().contains("wayf")));
(mRedirectedLocation.toUpperCase().contains("SAML") ||
mRedirectedLocation.toLowerCase().contains("wayf")));
}

/**
* Checks if is a non https connection
*
* @return boolean true/false
*/
public boolean isNonSecureRedirection() {
return (mRedirectedLocation != null && !(mRedirectedLocation.toLowerCase().startsWith("https://")));
}

/**
* Checks if is a non https connection
*
* @return boolean true/false
*/
public boolean isNonSecureRedirection() {
return (mRedirectedLocation != null &&
!(mRedirectedLocation.toLowerCase().startsWith("https://")));
}

public String getAuthenticateHeader() {
return mAuthenticate;
return mAuthenticate;
}

public String getLastPermanentLocation() {
Expand Down

0 comments on commit 17bb724

Please sign in to comment.