View | Details | Raw Unified | Return to bug 343602 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/mylyn/commons/identity/gravatar/GravatarCallbackAdapter.java (+34 lines)
Added Link Here
1
/*******************************************************************************
2
 *  Copyright (c) 2011 GitHub Inc.
3
 *  All rights reserved. This program and the accompanying materials
4
 *  are made available under the terms of the Eclipse Public License v1.0
5
 *  which accompanies this distribution, and is available at
6
 *  http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 *  Contributors:
9
 *    Kevin Sawicki (GitHub Inc.) - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.mylyn.commons.identity.gravatar;
12
13
/**
14
 * Base implementation of {@link IGravatarCallback}
15
 * 
16
 * @author Kevin Sawicki (kevin@github.com)
17
 */
18
public abstract class GravatarCallbackAdapter implements IGravatarCallback {
19
20
	/**
21
	 * @see org.eclipse.mylyn.commons.identity.gravatar.IGravatarCallback#loaded(org.eclipse.mylyn.commons.identity.gravatar.Gravatar)
22
	 */
23
	public void loaded(Gravatar avatar) {
24
		// Does nothing sub-clsases should override
25
	}
26
27
	/**
28
	 * @see org.eclipse.mylyn.commons.identity.gravatar.IGravatarCallback#error(java.lang.Exception)
29
	 */
30
	public void error(Exception exception) {
31
		// Does nothing sub-clsases should override
32
	}
33
34
}
(-)src/org/eclipse/mylyn/commons/identity/gravatar/IGravatarCallback.java (+35 lines)
Added Link Here
1
/*******************************************************************************
2
 *  Copyright (c) 2011 GitHub Inc.
3
 *  All rights reserved. This program and the accompanying materials
4
 *  are made available under the terms of the Eclipse Public License v1.0
5
 *  which accompanies this distribution, and is available at
6
 *  http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 *  Contributors:
9
 *    Kevin Sawicki (GitHub Inc.) - initial API and implementation
10
 *******************************************************************************/
11
12
package org.eclipse.mylyn.commons.identity.gravatar;
13
14
/**
15
 * Callback interface for when gravatar loading completes or fails.
16
 * 
17
 * @author Kevin Sawicki (kevin@github.com)
18
 */
19
public interface IGravatarCallback {
20
21
	/**
22
	 * Gravatar loaded successfully
23
	 * 
24
	 * @param avatar
25
	 */
26
	void loaded(Gravatar avatar);
27
28
	/**
29
	 * Gravatar loading failed
30
	 * 
31
	 * @param exception
32
	 */
33
	void error(Exception exception);
34
35
}
(-)src/org/eclipse/mylyn/commons/identity/gravatar/IGravatarHashProvider.java (+28 lines)
Added Link Here
1
/*******************************************************************************
2
 *  Copyright (c) 2011 GitHub Inc.
3
 *  All rights reserved. This program and the accompanying materials
4
 *  are made available under the terms of the Eclipse Public License v1.0
5
 *  which accompanies this distribution, and is available at
6
 *  http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 *  Contributors:
9
 *    Kevin Sawicki (GitHub Inc.) - initial API and implementation
10
 *******************************************************************************/
11
12
package org.eclipse.mylyn.commons.identity.gravatar;
13
14
/**
15
 * Interface for providing a gravatar hash.
16
 * 
17
 * @author Kevin Sawicki (kevin@github.com)
18
 */
19
public interface IGravatarHashProvider {
20
21
	/**
22
	 * Get hash for gravatar lookup
23
	 * 
24
	 * @return gravatar hash
25
	 */
26
	String getGravatarHash();
27
28
}
(-)src/org/eclipse/mylyn/commons/identity/gravatar/IGravatarStore.java (+104 lines)
Added Link Here
1
/*******************************************************************************
2
 *  Copyright (c) 2011 Kevin Sawicki
3
 *  All rights reserved. This program and the accompanying materials
4
 *  are made available under the terms of the Eclipse Public License v1.0
5
 *  which accompanies this distribution, and is available at
6
 *  http://www.eclipse.org/legal/epl-v10.html
7
 *  
8
 *******************************************************************************/
9
package org.eclipse.mylyn.commons.identity.gravatar;
10
11
import java.io.IOException;
12
13
import org.eclipse.core.runtime.IProgressMonitor;
14
15
/**
16
 * Gravatar store interface.
17
 * 
18
 * @author Kevin Sawicki (kevin@github.com)
19
 */
20
public interface IGravatarStore {
21
22
	/**
23
	 * Does this store contain a gravatar for the specified hash?
24
	 * 
25
	 * @param hash
26
	 * @return true if store contains avatar, false otherwise
27
	 */
28
	boolean containsGravatar(String hash);
29
30
	/**
31
	 * Refresh all gravatars currently in the store
32
	 * 
33
	 * @param monitor
34
	 * @return this store
35
	 */
36
	IGravatarStore refresh(IProgressMonitor monitor);
37
38
	/**
39
	 * Schedule refresh of gravatars asynchronously
40
	 * 
41
	 * @return this store
42
	 */
43
	IGravatarStore scheduleRefresh();
44
45
	/**
46
	 * Get last refresh time of store
47
	 * 
48
	 * @return local refresh time
49
	 */
50
	long getRefreshTime();
51
52
	/**
53
	 * Load gravatar by hash asynchronously
54
	 * 
55
	 * @param hash
56
	 * @param callback
57
	 * @return this store
58
	 */
59
	IGravatarStore loadGravatarByHash(String hash, IGravatarCallback callback);
60
61
	/**
62
	 * Load latest gravatar by specified hash
63
	 * 
64
	 * @param hash
65
	 * @return avatar or null if load fails
66
	 * @throws IOException
67
	 */
68
	Gravatar loadGravatarByHash(String hash) throws IOException;
69
70
	/**
71
	 * Load gravatar by e-mail address asynchronously
72
	 * 
73
	 * @param email
74
	 * @param callback
75
	 * @return this store
76
	 */
77
	IGravatarStore loadGravatarByEmail(String email, IGravatarCallback callback);
78
79
	/**
80
	 * Load latest gravatar for specified e-mail address
81
	 * 
82
	 * @param email
83
	 * @return gravatar or null if load fails
84
	 * @throws IOException
85
	 */
86
	Gravatar loadGravatarByEmail(String email) throws IOException;
87
88
	/**
89
	 * Get cached gravatar by hash
90
	 * 
91
	 * @param hash
92
	 * @return gravatar or null if not in cache
93
	 */
94
	Gravatar getGravatarByHash(String hash);
95
96
	/**
97
	 * Get cached gravatar by e-mail address
98
	 * 
99
	 * @param email
100
	 * @return gravatar or null if not in cache
101
	 */
102
	Gravatar getGravatarByEmail(String email);
103
104
}

Return to bug 343602