1/*
2 * Copyright (C) 2009 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.cooliris.media;
18
19import java.util.ArrayList;
20
21public interface DataSource {
22    // Load the sets to be displayed.
23    void loadMediaSets(final MediaFeed feed);
24
25    // rangeStart->rangeEnd is inclusive
26    // Pass in Shared.INFINITY for the rangeEnd to load all items.
27    void loadItemsForSet(final MediaFeed feed, final MediaSet parentSet, int rangeStart, int rangeEnd);
28
29    // Called when the data source will no longer be used.
30    void shutdown();
31
32    boolean performOperation(int operation, ArrayList<MediaBucket> mediaBuckets, Object data);
33
34    DiskCache getThumbnailCache();
35
36    // This method is called so that we can setup listeners for any databases that the datasource uses
37    String[] getDatabaseUris();
38
39    // Called when the user explicitly requests a refresh, or when the application is brought to the foreground.
40    // Alternatively, when one or more of the database's data changes, this method will be called.
41    void refresh(final MediaFeed feed, final String[] databaseUris);
42
43}
44