diff --git a/src/at/bitfire/davdroid/syncadapter/DavResourceFinder.java b/src/at/bitfire/davdroid/resource/DavResourceFinder.java similarity index 92% rename from src/at/bitfire/davdroid/syncadapter/DavResourceFinder.java rename to src/at/bitfire/davdroid/resource/DavResourceFinder.java index 31159660..aeb8bf6e 100644 --- a/src/at/bitfire/davdroid/syncadapter/DavResourceFinder.java +++ b/src/at/bitfire/davdroid/resource/DavResourceFinder.java @@ -1,4 +1,4 @@ -package at.bitfire.davdroid.syncadapter; +package at.bitfire.davdroid.resource; import java.io.IOException; import java.net.URI; @@ -40,7 +40,7 @@ public class DavResourceFinder { Log.i(TAG, "Found address book home set: " + pathAddressBooks); WebDavResource homeSetAddressBooks = new WebDavResource(principal, pathAddressBooks); - if (checkCapabilities(homeSetAddressBooks, "addressbook")) { + if (checkHomesetCapabilities(homeSetAddressBooks, "addressbook")) { homeSetAddressBooks.propfind(Mode.CARDDAV_COLLECTIONS); List addressBooks = new LinkedList(); @@ -80,7 +80,7 @@ public class DavResourceFinder { Log.i(TAG, "Found calendar home set: " + pathCalendars); WebDavResource homeSetCalendars = new WebDavResource(principal, pathCalendars); - if (checkCapabilities(homeSetCalendars, "calendar-access")) { + if (checkHomesetCapabilities(homeSetCalendars, "calendar-access")) { homeSetCalendars.propfind(Mode.CALDAV_COLLECTIONS); List calendars = new LinkedList(); @@ -147,16 +147,12 @@ public class DavResourceFinder { return null; } - private static boolean checkCapabilities(WebDavResource resource, String davCapability) throws IOException { + private static boolean checkHomesetCapabilities(WebDavResource resource, String davCapability) throws IOException { // check for necessary capabilities try { resource.options(); if (resource.supportsDAV(davCapability) && - resource.supportsMethod("PROPFIND") && - resource.supportsMethod("GET") && - resource.supportsMethod("REPORT") && - resource.supportsMethod("PUT") && - resource.supportsMethod("DELETE")) + resource.supportsMethod("PROPFIND")) // check only for methods that MUST be available for home sets return true; } catch(HttpException e) { // for instance, 405 Method not allowed diff --git a/src/at/bitfire/davdroid/resource/LocalCalendar.java b/src/at/bitfire/davdroid/resource/LocalCalendar.java index 459463cf..8f9c6e63 100644 --- a/src/at/bitfire/davdroid/resource/LocalCalendar.java +++ b/src/at/bitfire/davdroid/resource/LocalCalendar.java @@ -60,7 +60,6 @@ import android.provider.CalendarContract.Events; import android.provider.CalendarContract.Reminders; import android.provider.ContactsContract; import android.util.Log; -import at.bitfire.davdroid.syncadapter.ServerInfo; /** * Represents a locally stored calendar, containing Events. diff --git a/src/at/bitfire/davdroid/syncadapter/ServerInfo.java b/src/at/bitfire/davdroid/resource/ServerInfo.java similarity index 97% rename from src/at/bitfire/davdroid/syncadapter/ServerInfo.java rename to src/at/bitfire/davdroid/resource/ServerInfo.java index e5f11d22..958c1bbc 100644 --- a/src/at/bitfire/davdroid/syncadapter/ServerInfo.java +++ b/src/at/bitfire/davdroid/resource/ServerInfo.java @@ -5,7 +5,7 @@ * which accompanies this distribution, and is available at * http://www.gnu.org/licenses/gpl.html ******************************************************************************/ -package at.bitfire.davdroid.syncadapter; +package at.bitfire.davdroid.resource; import java.io.Serializable; import java.util.LinkedList; diff --git a/src/at/bitfire/davdroid/syncadapter/AccountDetailsFragment.java b/src/at/bitfire/davdroid/syncadapter/AccountDetailsFragment.java index f3e3c862..1ffe0e81 100644 --- a/src/at/bitfire/davdroid/syncadapter/AccountDetailsFragment.java +++ b/src/at/bitfire/davdroid/syncadapter/AccountDetailsFragment.java @@ -29,6 +29,7 @@ import at.bitfire.davdroid.Constants; import at.bitfire.davdroid.R; import at.bitfire.davdroid.resource.LocalCalendar; import at.bitfire.davdroid.resource.LocalStorageException; +import at.bitfire.davdroid.resource.ServerInfo; public class AccountDetailsFragment extends Fragment implements TextWatcher { public static final String KEY_SERVER_INFO = "server_info"; diff --git a/src/at/bitfire/davdroid/syncadapter/AccountSettings.java b/src/at/bitfire/davdroid/syncadapter/AccountSettings.java index 526b1b6f..a58fe407 100644 --- a/src/at/bitfire/davdroid/syncadapter/AccountSettings.java +++ b/src/at/bitfire/davdroid/syncadapter/AccountSettings.java @@ -23,6 +23,7 @@ import android.os.Bundle; import android.provider.CalendarContract; import android.provider.CalendarContract.Calendars; import android.util.Log; +import at.bitfire.davdroid.resource.ServerInfo; import ezvcard.VCardVersion; public class AccountSettings { diff --git a/src/at/bitfire/davdroid/syncadapter/QueryServerDialogFragment.java b/src/at/bitfire/davdroid/syncadapter/QueryServerDialogFragment.java index 12c224b3..fea12816 100644 --- a/src/at/bitfire/davdroid/syncadapter/QueryServerDialogFragment.java +++ b/src/at/bitfire/davdroid/syncadapter/QueryServerDialogFragment.java @@ -23,6 +23,8 @@ import android.view.ViewGroup; import android.widget.ProgressBar; import android.widget.Toast; import at.bitfire.davdroid.R; +import at.bitfire.davdroid.resource.DavResourceFinder; +import at.bitfire.davdroid.resource.ServerInfo; import at.bitfire.davdroid.webdav.DavException; import ch.boye.httpclientandroidlib.HttpException; diff --git a/src/at/bitfire/davdroid/syncadapter/SelectCollectionsAdapter.java b/src/at/bitfire/davdroid/syncadapter/SelectCollectionsAdapter.java index 65406dd4..121ea308 100644 --- a/src/at/bitfire/davdroid/syncadapter/SelectCollectionsAdapter.java +++ b/src/at/bitfire/davdroid/syncadapter/SelectCollectionsAdapter.java @@ -17,6 +17,7 @@ import android.widget.BaseAdapter; import android.widget.CheckedTextView; import android.widget.ListAdapter; import at.bitfire.davdroid.R; +import at.bitfire.davdroid.resource.ServerInfo; public class SelectCollectionsAdapter extends BaseAdapter implements ListAdapter { final static int TYPE_ADDRESS_BOOKS_HEADING = 0, diff --git a/src/at/bitfire/davdroid/syncadapter/SelectCollectionsFragment.java b/src/at/bitfire/davdroid/syncadapter/SelectCollectionsFragment.java index 493b7d57..91a57388 100644 --- a/src/at/bitfire/davdroid/syncadapter/SelectCollectionsFragment.java +++ b/src/at/bitfire/davdroid/syncadapter/SelectCollectionsFragment.java @@ -20,6 +20,7 @@ import android.widget.AdapterView.OnItemClickListener; import android.widget.ListAdapter; import android.widget.ListView; import at.bitfire.davdroid.R; +import at.bitfire.davdroid.resource.ServerInfo; public class SelectCollectionsFragment extends ListFragment { public static final String KEY_SERVER_INFO = "server_info"; diff --git a/test/src/at/bitfire/davdroid/syncadapter/DavResourceFinderTest.java b/test/src/at/bitfire/davdroid/syncadapter/DavResourceFinderTest.java index 12406189..d577d262 100644 --- a/test/src/at/bitfire/davdroid/syncadapter/DavResourceFinderTest.java +++ b/test/src/at/bitfire/davdroid/syncadapter/DavResourceFinderTest.java @@ -4,7 +4,9 @@ import java.util.List; import ezvcard.VCardVersion; import android.test.InstrumentationTestCase; -import at.bitfire.davdroid.syncadapter.ServerInfo.ResourceInfo; +import at.bitfire.davdroid.resource.DavResourceFinder; +import at.bitfire.davdroid.resource.ServerInfo; +import at.bitfire.davdroid.resource.ServerInfo.ResourceInfo; import at.bitfire.davdroid.test.Constants; public class DavResourceFinderTest extends InstrumentationTestCase {