X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/bb257ec72911fa0418c7093863bac51d589419fa..98d95b576ead4119ec16719a72d83ca6db82b77a:/src/com/owncloud/android/syncadapter/AbstractOwnCloudSyncAdapter.java diff --git a/src/com/owncloud/android/syncadapter/AbstractOwnCloudSyncAdapter.java b/src/com/owncloud/android/syncadapter/AbstractOwnCloudSyncAdapter.java index 523f06b7..26bfff7e 100644 --- a/src/com/owncloud/android/syncadapter/AbstractOwnCloudSyncAdapter.java +++ b/src/com/owncloud/android/syncadapter/AbstractOwnCloudSyncAdapter.java @@ -3,9 +3,8 @@ * Copyright (C) 2012-2013 ownCloud Inc. * * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. + * it under the terms of the GNU General Public License version 2, + * as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -20,16 +19,17 @@ package com.owncloud.android.syncadapter; import java.io.IOException; -import java.net.UnknownHostException; -import java.util.Date; +//import java.net.UnknownHostException; +//import java.util.Date; import org.apache.http.HttpRequest; import org.apache.http.HttpResponse; import org.apache.http.client.ClientProtocolException; -import org.apache.http.conn.ConnectionKeepAliveStrategy; -import org.apache.http.protocol.HttpContext; +//import org.apache.http.conn.ConnectionKeepAliveStrategy; +//import org.apache.http.protocol.HttpContext; -import com.owncloud.android.AccountUtils; +import com.owncloud.android.authentication.AccountUtils; +import com.owncloud.android.authentication.AccountUtils.AccountNotFoundException; import com.owncloud.android.datamodel.DataStorageManager; import com.owncloud.android.network.OwnCloudClientUtils; @@ -43,11 +43,13 @@ import android.content.Context; import eu.alefzero.webdav.WebdavClient; /** - * Base SyncAdapter for OwnCloud Designed to be subclassed for the concrete - * SyncAdapter, like ConcatsSync, CalendarSync, FileSync etc.. + * Base synchronization adapter for ownCloud designed to be subclassed for different + * resource types, like FileSync, ConcatsSync, CalendarSync, etc.. * - * @author sassman + * Implements the standard {@link AbstractThreadedSyncAdapter}. * + * @author sassman + * @author David A. Velasco */ public abstract class AbstractOwnCloudSyncAdapter extends AbstractThreadedSyncAdapter { @@ -55,7 +57,7 @@ public abstract class AbstractOwnCloudSyncAdapter extends private AccountManager accountManager; private Account account; private ContentProviderClient contentProvider; - private Date lastUpdated; + //private Date lastUpdated; private DataStorageManager mStoreManager; private WebdavClient mClient = null; @@ -89,14 +91,6 @@ public abstract class AbstractOwnCloudSyncAdapter extends this.contentProvider = contentProvider; } - public Date getLastUpdated() { - return lastUpdated; - } - - public void setLastUpdated(Date lastUpdated) { - this.lastUpdated = lastUpdated; - } - public void setStorageManager(DataStorageManager storage_manager) { mStoreManager = storage_manager; } @@ -105,6 +99,41 @@ public abstract class AbstractOwnCloudSyncAdapter extends return mStoreManager; } + protected void initClientForCurrentAccount() throws OperationCanceledException, AuthenticatorException, IOException, AccountNotFoundException { + AccountUtils.constructFullURLForAccount(getContext(), account); + mClient = OwnCloudClientUtils.createOwnCloudClient(account, getContext()); + } + + protected WebdavClient getClient() { + return mClient; + } + + + /* method called by ContactSyncAdapter, that is never used */ + protected HttpResponse fireRawRequest(HttpRequest query) + throws ClientProtocolException, OperationCanceledException, + AuthenticatorException, IOException { + /* + * BasicHttpContext httpContext = new BasicHttpContext(); BasicScheme + * basicAuth = new BasicScheme(); + * httpContext.setAttribute("preemptive-auth", basicAuth); + * + * HttpResponse response = getClient().execute(mHost, query, + * httpContext); + */ + return null; + } + + /* methods never used below */ + /* + public Date getLastUpdated() { + return lastUpdated; + } + + public void setLastUpdated(Date lastUpdated) { + this.lastUpdated = lastUpdated; + } + protected ConnectionKeepAliveStrategy getKeepAliveStrategy() { return new ConnectionKeepAliveStrategy() { public long getKeepAliveDuration(HttpResponse response, @@ -128,29 +157,5 @@ public abstract class AbstractOwnCloudSyncAdapter extends } }; } - - protected HttpResponse fireRawRequest(HttpRequest query) - throws ClientProtocolException, OperationCanceledException, - AuthenticatorException, IOException { - /* - * BasicHttpContext httpContext = new BasicHttpContext(); BasicScheme - * basicAuth = new BasicScheme(); - * httpContext.setAttribute("preemptive-auth", basicAuth); - * - * HttpResponse response = getClient().execute(mHost, query, - * httpContext); - */ - return null; - } - - protected void initClientForCurrentAccount() throws UnknownHostException { - if (AccountUtils.constructFullURLForAccount(getContext(), account) == null) { - throw new UnknownHostException(); - } - mClient = OwnCloudClientUtils.createOwnCloudClient(account, getContext()); - } - - protected WebdavClient getClient() { - return mClient; - } + */ } \ No newline at end of file