mirror of
https://github.com/owncloud/android-library.git
synced 2025-06-08 16:36:13 +00:00
ren owncloud to OC
This commit is contained in:
parent
cd3d20db07
commit
e354a716cb
@ -2,11 +2,11 @@ package com.owncloud.android.lib.refactor;
|
|||||||
|
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
|
|
||||||
import com.owncloud.android.lib.refactor.authentication.OwnCloudCredentials;
|
import com.owncloud.android.lib.refactor.authentication.OCCredentials;
|
||||||
|
|
||||||
|
|
||||||
public class OwnCloudContext {
|
public class OCContext {
|
||||||
private static final String TAG = OwnCloudContext.class.toString();
|
private static final String TAG = OCContext.class.toString();
|
||||||
|
|
||||||
public static final String WEBDAV_PATH_4_0 = "/remote.php/dav";
|
public static final String WEBDAV_PATH_4_0 = "/remote.php/dav";
|
||||||
public static final String STATUS_PATH = "/status.php";
|
public static final String STATUS_PATH = "/status.php";
|
||||||
@ -18,13 +18,13 @@ public class OwnCloudContext {
|
|||||||
private static final boolean PARAM_SINGLE_COOKIE_HEADER_VALUE = true;
|
private static final boolean PARAM_SINGLE_COOKIE_HEADER_VALUE = true;
|
||||||
private static final String PARAM_PROTOCOL_VERSION = "http.protocol.version";
|
private static final String PARAM_PROTOCOL_VERSION = "http.protocol.version";
|
||||||
|
|
||||||
private OwnCloudCredentials mCredentials = null;
|
private OCCredentials mCredentials = null;
|
||||||
private Uri mBaseUri;
|
private Uri mBaseUri;
|
||||||
|
|
||||||
public class Builder {
|
public class Builder {
|
||||||
OwnCloudContext ocContext = new OwnCloudContext();
|
OCContext ocContext = new OCContext();
|
||||||
|
|
||||||
public Builder setCredentials(OwnCloudCredentials credentials) {
|
public Builder setCredentials(OCCredentials credentials) {
|
||||||
ocContext.mCredentials = credentials;
|
ocContext.mCredentials = credentials;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@ -34,13 +34,13 @@ public class OwnCloudContext {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public OwnCloudContext build() {
|
public OCContext build() {
|
||||||
return ocContext;
|
return ocContext;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public OwnCloudCredentials getCredentials() {
|
public OCCredentials getCredentials() {
|
||||||
return mCredentials;
|
return mCredentials;
|
||||||
}
|
}
|
||||||
|
|
@ -1,17 +1,15 @@
|
|||||||
package com.owncloud.android.lib.refactor;
|
package com.owncloud.android.lib.refactor;
|
||||||
|
|
||||||
import com.owncloud.android.lib.refactor.RemoteOperation;
|
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import okhttp3.OkHttpClient;
|
import okhttp3.OkHttpClient;
|
||||||
import okhttp3.Request;
|
import okhttp3.Request;
|
||||||
|
|
||||||
public abstract class RemoteOperation {
|
public abstract class RemoteOperation {
|
||||||
private final OwnCloudContext mContext;
|
private final OCContext mContext;
|
||||||
private static OkHttpClient httpClient = null;
|
private static OkHttpClient httpClient = null;
|
||||||
|
|
||||||
protected RemoteOperation(OwnCloudContext context) {
|
protected RemoteOperation(OCContext context) {
|
||||||
mContext = context;
|
mContext = context;
|
||||||
|
|
||||||
if(httpClient == null) {
|
if(httpClient == null) {
|
||||||
@ -23,7 +21,7 @@ public abstract class RemoteOperation {
|
|||||||
|
|
||||||
public abstract RemoteOperationResult exec();
|
public abstract RemoteOperationResult exec();
|
||||||
|
|
||||||
public OwnCloudContext getOCContext() {
|
public OCContext getOCContext() {
|
||||||
return mContext;
|
return mContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ import java.util.HashMap;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
public interface OwnCloudCredentials {
|
public interface OCCredentials {
|
||||||
|
|
||||||
Map<String, String> getCredentialHeaders();
|
Map<String, String> getCredentialHeaders();
|
||||||
|
|
@ -1,11 +1,11 @@
|
|||||||
package com.owncloud.android.lib.refactor.authentication.credentials;
|
package com.owncloud.android.lib.refactor.authentication.credentials;
|
||||||
|
|
||||||
|
|
||||||
import com.owncloud.android.lib.refactor.authentication.OwnCloudCredentials;
|
import com.owncloud.android.lib.refactor.authentication.OCCredentials;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
public class OwnCloudAnonymousCredentials implements OwnCloudCredentials {
|
public class OCAnonymousCredentials implements OCCredentials {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, String> getCredentialHeaders() {
|
public Map<String, String> getCredentialHeaders() {
|
@ -23,20 +23,19 @@
|
|||||||
*/
|
*/
|
||||||
package com.owncloud.android.lib.refactor.authentication.credentials;
|
package com.owncloud.android.lib.refactor.authentication.credentials;
|
||||||
|
|
||||||
import com.owncloud.android.lib.refactor.authentication.OwnCloudCredentials;
|
import com.owncloud.android.lib.refactor.authentication.OCCredentials;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import okhttp3.Authenticator;
|
|
||||||
import okhttp3.Credentials;
|
import okhttp3.Credentials;
|
||||||
|
|
||||||
public class OwnCloudBasicCredentials implements OwnCloudCredentials {
|
public class OCBasicCredentials implements OCCredentials {
|
||||||
|
|
||||||
private String mUsername;
|
private String mUsername;
|
||||||
private String mPassword;
|
private String mPassword;
|
||||||
|
|
||||||
public OwnCloudBasicCredentials(String username, String password) {
|
public OCBasicCredentials(String username, String password) {
|
||||||
mUsername = username != null ? username : "";
|
mUsername = username != null ? username : "";
|
||||||
mPassword = password != null ? password : "";
|
mPassword = password != null ? password : "";
|
||||||
}
|
}
|
@ -25,20 +25,18 @@ package com.owncloud.android.lib.refactor.authentication.credentials;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
import com.owncloud.android.lib.refactor.authentication.OwnCloudCredentials;
|
import com.owncloud.android.lib.refactor.authentication.OCCredentials;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import okhttp3.Authenticator;
|
public class OCBearerCredentials implements OCCredentials {
|
||||||
|
|
||||||
public class OwnCloudBearerCredentials implements OwnCloudCredentials {
|
|
||||||
|
|
||||||
private String mUsername;
|
private String mUsername;
|
||||||
|
|
||||||
private String mAccessToken;
|
private String mAccessToken;
|
||||||
|
|
||||||
public OwnCloudBearerCredentials(String username, String accessToken) {
|
public OCBearerCredentials(String username, String accessToken) {
|
||||||
mUsername = username != null ? username : "";
|
mUsername = username != null ? username : "";
|
||||||
mAccessToken = accessToken != null ? accessToken : "";
|
mAccessToken = accessToken != null ? accessToken : "";
|
||||||
}
|
}
|
@ -25,22 +25,20 @@ package com.owncloud.android.lib.refactor.authentication.credentials;
|
|||||||
|
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
|
|
||||||
import com.owncloud.android.lib.refactor.authentication.OwnCloudCredentials;
|
import com.owncloud.android.lib.refactor.authentication.OCCredentials;
|
||||||
|
|
||||||
import org.apache.commons.httpclient.Cookie;
|
import org.apache.commons.httpclient.Cookie;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class OwnCloudSamlSsoCredentials implements OwnCloudCredentials {
|
public class OCSamlSsoCredentials implements OCCredentials {
|
||||||
|
|
||||||
private final String mUsername;
|
private final String mUsername;
|
||||||
private final String mSessionCookie;
|
private final String mSessionCookie;
|
||||||
private final Uri mBaseUrl;
|
private final Uri mBaseUrl;
|
||||||
|
|
||||||
public OwnCloudSamlSsoCredentials(String username, String sessionCookie, Uri baseUrl) {
|
public OCSamlSsoCredentials(String username, String sessionCookie, Uri baseUrl) {
|
||||||
mUsername = username != null ? username : "";
|
mUsername = username != null ? username : "";
|
||||||
mSessionCookie = sessionCookie != null ? sessionCookie : "";
|
mSessionCookie = sessionCookie != null ? sessionCookie : "";
|
||||||
mBaseUrl = baseUrl;
|
mBaseUrl = baseUrl;
|
@ -28,14 +28,14 @@ package com.owncloud.android.lib.refactor.authentication.oauth;
|
|||||||
|
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
|
|
||||||
import com.owncloud.android.lib.refactor.OwnCloudContext;
|
import com.owncloud.android.lib.refactor.OCContext;
|
||||||
import com.owncloud.android.lib.refactor.RemoteOperation;
|
import com.owncloud.android.lib.refactor.RemoteOperation;
|
||||||
import com.owncloud.android.lib.refactor.authentication.oauth.operations.OAuth2GetAccessTokenOperation;
|
import com.owncloud.android.lib.refactor.authentication.oauth.operations.OAuth2GetAccessTokenOperation;
|
||||||
import com.owncloud.android.lib.refactor.authentication.oauth.operations.OAuth2RefreshAccessTokenOperation;
|
import com.owncloud.android.lib.refactor.authentication.oauth.operations.OAuth2RefreshAccessTokenOperation;
|
||||||
|
|
||||||
public class OwnCloudOAuth2RequestBuilder implements OAuth2RequestBuilder {
|
public class OwnCloudOAuth2RequestBuilder implements OAuth2RequestBuilder {
|
||||||
|
|
||||||
private OwnCloudContext ocContext;
|
private OCContext ocContext;
|
||||||
private OwnCloudOAuth2Provider mOAuth2Provider;
|
private OwnCloudOAuth2Provider mOAuth2Provider;
|
||||||
|
|
||||||
private OAuthRequest mRequest;
|
private OAuthRequest mRequest;
|
||||||
@ -67,7 +67,7 @@ public class OwnCloudOAuth2RequestBuilder implements OAuth2RequestBuilder {
|
|||||||
mRefreshToken = refreshToken;
|
mRefreshToken = refreshToken;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setOcContext(OwnCloudContext ocContext) {
|
public void setOcContext(OCContext ocContext) {
|
||||||
this.ocContext = ocContext;
|
this.ocContext = ocContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ package com.owncloud.android.lib.refactor.authentication.oauth.operations;
|
|||||||
|
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
|
|
||||||
import com.owncloud.android.lib.refactor.OwnCloudContext;
|
import com.owncloud.android.lib.refactor.OCContext;
|
||||||
import com.owncloud.android.lib.refactor.RemoteOperationResult;
|
import com.owncloud.android.lib.refactor.RemoteOperationResult;
|
||||||
import com.owncloud.android.lib.refactor.authentication.oauth.OAuth2Constants;
|
import com.owncloud.android.lib.refactor.authentication.oauth.OAuth2Constants;
|
||||||
import com.owncloud.android.lib.refactor.authentication.oauth.OAuth2ResponseParser;
|
import com.owncloud.android.lib.refactor.authentication.oauth.OAuth2ResponseParser;
|
||||||
@ -59,7 +59,7 @@ public class OAuth2GetAccessTokenOperation extends RemoteOperation {
|
|||||||
|
|
||||||
|
|
||||||
public OAuth2GetAccessTokenOperation(
|
public OAuth2GetAccessTokenOperation(
|
||||||
OwnCloudContext context,
|
OCContext context,
|
||||||
String grantType,
|
String grantType,
|
||||||
String code,
|
String code,
|
||||||
String clientId,
|
String clientId,
|
||||||
|
@ -21,12 +21,12 @@
|
|||||||
|
|
||||||
package com.owncloud.android.lib.refactor.authentication.oauth.operations;
|
package com.owncloud.android.lib.refactor.authentication.oauth.operations;
|
||||||
|
|
||||||
import com.owncloud.android.lib.refactor.OwnCloudContext;
|
import com.owncloud.android.lib.refactor.OCContext;
|
||||||
import com.owncloud.android.lib.refactor.RemoteOperationResult;
|
import com.owncloud.android.lib.refactor.RemoteOperationResult;
|
||||||
import com.owncloud.android.lib.refactor.Log_OC;
|
import com.owncloud.android.lib.refactor.Log_OC;
|
||||||
import com.owncloud.android.lib.refactor.RemoteOperation;
|
import com.owncloud.android.lib.refactor.RemoteOperation;
|
||||||
import com.owncloud.android.lib.refactor.authentication.credentials.OwnCloudBasicCredentials;
|
import com.owncloud.android.lib.refactor.authentication.credentials.OCBasicCredentials;
|
||||||
import com.owncloud.android.lib.refactor.authentication.OwnCloudCredentials;
|
import com.owncloud.android.lib.refactor.authentication.OCCredentials;
|
||||||
import com.owncloud.android.lib.refactor.authentication.oauth.OAuth2Constants;
|
import com.owncloud.android.lib.refactor.authentication.oauth.OAuth2Constants;
|
||||||
import com.owncloud.android.lib.refactor.authentication.oauth.OAuth2GrantType;
|
import com.owncloud.android.lib.refactor.authentication.oauth.OAuth2GrantType;
|
||||||
import com.owncloud.android.lib.refactor.authentication.oauth.OAuth2ResponseParser;
|
import com.owncloud.android.lib.refactor.authentication.oauth.OAuth2ResponseParser;
|
||||||
@ -55,7 +55,7 @@ public class OAuth2RefreshAccessTokenOperation extends RemoteOperation {
|
|||||||
private final OAuth2ResponseParser mResponseParser;
|
private final OAuth2ResponseParser mResponseParser;
|
||||||
|
|
||||||
public OAuth2RefreshAccessTokenOperation(
|
public OAuth2RefreshAccessTokenOperation(
|
||||||
OwnCloudContext ocContext,
|
OCContext ocContext,
|
||||||
String clientId,
|
String clientId,
|
||||||
String secretId,
|
String secretId,
|
||||||
String refreshToken,
|
String refreshToken,
|
||||||
@ -98,7 +98,7 @@ public class OAuth2RefreshAccessTokenOperation extends RemoteOperation {
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
|
||||||
OwnCloudCredentials oauthCredentials = new OwnCloudBasicCredentials(
|
OCCredentials oauthCredentials = new OCBasicCredentials(
|
||||||
mClientId,
|
mClientId,
|
||||||
mClientSecret
|
mClientSecret
|
||||||
);
|
);
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
package com.owncloud.android.lib.refactor.operations;
|
package com.owncloud.android.lib.refactor.operations;
|
||||||
|
|
||||||
import com.owncloud.android.lib.refactor.OwnCloudContext;
|
import com.owncloud.android.lib.refactor.OCContext;
|
||||||
import com.owncloud.android.lib.refactor.RemoteOperation;
|
import com.owncloud.android.lib.refactor.RemoteOperation;
|
||||||
import com.owncloud.android.lib.refactor.RemoteOperationResult;
|
import com.owncloud.android.lib.refactor.RemoteOperationResult;
|
||||||
|
|
||||||
public class PropfindOperation extends RemoteOperation {
|
public class PropfindOperation extends RemoteOperation {
|
||||||
|
|
||||||
public PropfindOperation(OwnCloudContext context) {
|
public PropfindOperation(OCContext context) {
|
||||||
super(context);
|
super(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user