aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Sawicki2011-05-02 20:02:15 (EDT)
committerChris Aniszczyk2011-05-03 10:07:48 (EDT)
commite1551203823beb3e8cc7e2ef135a518dcf8bda03 (patch)
tree7001a878c230202f4d8d10654ea9e850c954e3e7
parentf6a43aac89499faa78a2c30fb2d0415dc37b800a (diff)
downloadegit-github-e1551203823beb3e8cc7e2ef135a518dcf8bda03.zip
egit-github-e1551203823beb3e8cc7e2ef135a518dcf8bda03.tar.gz
egit-github-e1551203823beb3e8cc7e2ef135a518dcf8bda03.tar.bz2
Add resource provider interface for v2 api callsrefs/changes/22/3322/5
Change-Id: I21983d7cf05d263a705b1c7e1538ea72e7bb3289 Signed-off-by: Kevin Sawicki <kevin@github.com> Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
-rw-r--r--org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/IResourceProvider.java30
-rw-r--r--org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/RepositoryContainer.java8
-rw-r--r--org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/RepositoryService.java4
3 files changed, 35 insertions, 7 deletions
diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/IResourceProvider.java b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/IResourceProvider.java
new file mode 100644
index 0000000..37d15b3
--- /dev/null
+++ b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/IResourceProvider.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2011 GitHub Inc.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Kevin Sawicki (GitHub Inc.) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.mylyn.github.internal;
+
+import java.util.List;
+
+/**
+ * Interface for container classes that can provide a collection of resources of
+ * the same type.
+ *
+ * @param <V>
+ */
+public interface IResourceProvider<V> {
+
+ /**
+ * Get collection of resources
+ *
+ * @return non-null but possibly empty collection
+ */
+ List<V> getResources();
+
+}
diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/RepositoryContainer.java b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/RepositoryContainer.java
index aa0b1e9..df3b075 100644
--- a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/RepositoryContainer.java
+++ b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/RepositoryContainer.java
@@ -17,16 +17,14 @@ import java.util.List;
*
* @author Kevin Sawicki (kevin@github.com)
*/
-public class RepositoryContainer {
+public class RepositoryContainer implements IResourceProvider<Repository> {
private List<Repository> repositories;
/**
- * Get repositories
- *
- * @return list of repositories
+ * @see org.eclipse.mylyn.github.internal.IResourceProvider#getResources()
*/
- public List<Repository> getRepositories() {
+ public List<Repository> getResources() {
return this.repositories;
}
diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/RepositoryService.java b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/RepositoryService.java
index be8a5a3..4d24de1 100644
--- a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/RepositoryService.java
+++ b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/RepositoryService.java
@@ -49,7 +49,7 @@ public class RepositoryService {
RepositoryContainer container = client.get(uri.toString(),
RepositoryContainer.class);
- return container.getRepositories();
+ return container.getResources();
}
/**
@@ -66,6 +66,6 @@ public class RepositoryService {
RepositoryContainer container = client.get(uri.toString(),
RepositoryContainer.class);
- return container.getRepositories();
+ return container.getResources();
}
}