summaryrefslogtreecommitdiff
path: root/src/de/danoeh/antennapod/miroguide
diff options
context:
space:
mode:
authordaniel oeh <daniel.oeh@gmail.com>2012-08-02 23:00:01 +0200
committerdaniel oeh <daniel.oeh@gmail.com>2012-08-02 23:00:01 +0200
commit941154704b8d6576d2868ab216a906469e841ecb (patch)
tree48bbe06912da8aa10f0ce7fa7ffb47eaf53423f1 /src/de/danoeh/antennapod/miroguide
parentc084d172de38b46f510f1dd500e9dfd659d57982 (diff)
downloadAntennaPod-941154704b8d6576d2868ab216a906469e841ecb.zip
Replaced 'miro' in filenames with 'miroguide'
Diffstat (limited to 'src/de/danoeh/antennapod/miroguide')
-rw-r--r--src/de/danoeh/antennapod/miroguide/con/MiroException.java23
-rw-r--r--src/de/danoeh/antennapod/miroguide/con/MiroGuideConnector.java (renamed from src/de/danoeh/antennapod/miroguide/con/MiroConnector.java)26
-rw-r--r--src/de/danoeh/antennapod/miroguide/con/MiroGuideException.java23
-rw-r--r--src/de/danoeh/antennapod/miroguide/con/MiroGuideService.java (renamed from src/de/danoeh/antennapod/miroguide/con/MiroService.java)22
4 files changed, 47 insertions, 47 deletions
diff --git a/src/de/danoeh/antennapod/miroguide/con/MiroException.java b/src/de/danoeh/antennapod/miroguide/con/MiroException.java
deleted file mode 100644
index 7b4ee1651..000000000
--- a/src/de/danoeh/antennapod/miroguide/con/MiroException.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package de.danoeh.antennapod.miroguide.con;
-
-public class MiroException extends Exception {
- private static final long serialVersionUID = -8834656185748713194L;
-
- public MiroException() {
- super();
- }
-
- public MiroException(String arg0, Throwable arg1) {
- super(arg0, arg1);
- }
-
- public MiroException(String arg0) {
- super(arg0);
- }
-
- public MiroException(Throwable arg0) {
- super(arg0);
- }
-
-
-}
diff --git a/src/de/danoeh/antennapod/miroguide/con/MiroConnector.java b/src/de/danoeh/antennapod/miroguide/con/MiroGuideConnector.java
index d6bcb93c9..cccfff4d5 100644
--- a/src/de/danoeh/antennapod/miroguide/con/MiroConnector.java
+++ b/src/de/danoeh/antennapod/miroguide/con/MiroGuideConnector.java
@@ -17,7 +17,7 @@ import org.json.JSONObject;
import android.net.Uri;
/** Executes HTTP requests and returns the results. */
-public class MiroConnector {
+public class MiroGuideConnector {
private HttpClient httpClient;
private static final String HOST_URL = "https://www.miroguide.com/api/";
@@ -25,7 +25,7 @@ public class MiroConnector {
private static final String PATH_LIST_CATEGORIES = "list_categories";
private static final String PATH_GET_CHANNEL = "get_channel";
- public MiroConnector() {
+ public MiroGuideConnector() {
httpClient = new DefaultHttpClient();
}
@@ -39,23 +39,23 @@ public class MiroConnector {
return builder;
}
- public JSONArray getArrayResponse(Uri uri) throws MiroException {
+ public JSONArray getArrayResponse(Uri uri) throws MiroGuideException {
try {
JSONArray result = new JSONArray(executeRequest(uri));
return result;
} catch (JSONException e) {
e.printStackTrace();
- throw new MiroException();
+ throw new MiroGuideException();
}
}
- public JSONObject getSingleObjectResponse(Uri uri) throws MiroException {
+ public JSONObject getSingleObjectResponse(Uri uri) throws MiroGuideException {
try {
JSONObject result = new JSONObject(executeRequest(uri));
return result;
} catch (JSONException e) {
e.printStackTrace();
- throw new MiroException();
+ throw new MiroGuideException();
}
}
@@ -63,9 +63,9 @@ public class MiroConnector {
* Executes a HTTP GET request with the given URI and returns the content of
* the return value.
*
- * @throws MiroException
+ * @throws MiroGuideException
*/
- private String executeRequest(Uri uri) throws MiroException {
+ private String executeRequest(Uri uri) throws MiroGuideException {
HttpGet httpGet = new HttpGet(uri.toString());
String result = null;
try {
@@ -80,19 +80,19 @@ public class MiroConnector {
result = reader.readLine();
}
} else {
- throw new MiroException(response.getStatusLine()
+ throw new MiroGuideException(response.getStatusLine()
.getReasonPhrase());
}
} catch (IOException e) {
e.printStackTrace();
- throw new MiroException(e.getMessage());
+ throw new MiroGuideException(e.getMessage());
}
return result;
}
public Uri createGetChannelsUri(String filter, String filterValue,
- String sort, String limit, String offset) throws MiroException {
+ String sort, String limit, String offset) throws MiroGuideException {
Uri.Builder resultBuilder = getBaseURIBuilder(PATH_GET_CHANNELS);
resultBuilder.appendQueryParameter("filter", filter)
.appendQueryParameter("filter_value", filterValue);
@@ -110,14 +110,14 @@ public class MiroConnector {
return result;
}
- public Uri createListCategoriesURI() throws MiroException {
+ public Uri createListCategoriesURI() throws MiroGuideException {
Uri.Builder resultBuilder = getBaseURIBuilder(PATH_LIST_CATEGORIES);
Uri result = resultBuilder.build();
return result;
}
- public Uri createGetChannelUri(String id) throws MiroException {
+ public Uri createGetChannelUri(String id) throws MiroGuideException {
Uri.Builder resultBuilder = getBaseURIBuilder(PATH_GET_CHANNEL)
.appendQueryParameter("id", id);
Uri result = resultBuilder.build();
diff --git a/src/de/danoeh/antennapod/miroguide/con/MiroGuideException.java b/src/de/danoeh/antennapod/miroguide/con/MiroGuideException.java
new file mode 100644
index 000000000..074fc3d3c
--- /dev/null
+++ b/src/de/danoeh/antennapod/miroguide/con/MiroGuideException.java
@@ -0,0 +1,23 @@
+package de.danoeh.antennapod.miroguide.con;
+
+public class MiroGuideException extends Exception {
+ private static final long serialVersionUID = -8834656185748713194L;
+
+ public MiroGuideException() {
+ super();
+ }
+
+ public MiroGuideException(String arg0, Throwable arg1) {
+ super(arg0, arg1);
+ }
+
+ public MiroGuideException(String arg0) {
+ super(arg0);
+ }
+
+ public MiroGuideException(Throwable arg0) {
+ super(arg0);
+ }
+
+
+}
diff --git a/src/de/danoeh/antennapod/miroguide/con/MiroService.java b/src/de/danoeh/antennapod/miroguide/con/MiroGuideService.java
index 3c077e071..a3ecf6e06 100644
--- a/src/de/danoeh/antennapod/miroguide/con/MiroService.java
+++ b/src/de/danoeh/antennapod/miroguide/con/MiroGuideService.java
@@ -16,7 +16,7 @@ import de.danoeh.antennapod.miroguide.model.MiroItem;
/** Provides methods to communicate with the Miroguide API on an abstract level. */
-public class MiroService {
+public class MiroGuideService {
public static final int DEFAULT_CHANNEL_LIMIT = 20;
public static final String FILTER_CATEGORY = "category";
@@ -27,7 +27,7 @@ public class MiroService {
public static final String JSON_DATE_FORMAT_STRING = "yyyy-MM-dd'T'HH:mm:ss";
- private MiroConnector connector;
+ private MiroGuideConnector connector;
private static ThreadLocal<SimpleDateFormat> jSONDateFormat = new ThreadLocal<SimpleDateFormat>() {
@Override
@@ -37,11 +37,11 @@ public class MiroService {
};
- public MiroService() {
- connector = new MiroConnector();
+ public MiroGuideService() {
+ connector = new MiroGuideConnector();
}
- public String[] getCategories() throws MiroException {
+ public String[] getCategories() throws MiroGuideException {
JSONArray resultArray = connector.getArrayResponse(connector
.createListCategoriesURI());
String[] result = new String[resultArray.length()];
@@ -50,7 +50,7 @@ public class MiroService {
result[i] = resultArray.getJSONObject(i).getString("name");
} catch (JSONException e) {
e.printStackTrace();
- throw new MiroException();
+ throw new MiroGuideException();
}
}
return result;
@@ -58,7 +58,7 @@ public class MiroService {
/** Get a list of MiroChannel objects without their items. */
public List<MiroChannel> getChannelList(String filter, String filterValue,
- String sort, int limit, int offset) throws MiroException {
+ String sort, int limit, int offset) throws MiroGuideException {
JSONArray resultArray = connector.getArrayResponse(connector
.createGetChannelsUri(filter, filterValue, sort,
Integer.toString(limit), Integer.toString(offset)));
@@ -72,7 +72,7 @@ public class MiroService {
channels.add(channel);
} catch (JSONException e) {
e.printStackTrace();
- throw new MiroException();
+ throw new MiroGuideException();
}
}
@@ -82,9 +82,9 @@ public class MiroService {
/**
* Get a single channel with its items.
*
- * @throws MiroException
+ * @throws MiroGuideException
*/
- public MiroChannel getChannel(long id) throws MiroException {
+ public MiroChannel getChannel(long id) throws MiroGuideException {
JSONObject resultObject = connector.getSingleObjectResponse(connector
.createGetChannelUri(Long.toString(id)));
MiroChannel result = null;
@@ -92,7 +92,7 @@ public class MiroService {
result = extractMiroChannel(resultObject, true);
} catch (JSONException e) {
e.printStackTrace();
- throw new MiroException();
+ throw new MiroGuideException();
}
return result;
}