Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(876)

Issue 91120: GadgetSpec / MessageBundle factory cleanup

Can't Edit
Can't Publish+Mail
Start Review
Created:
16 years, 1 month ago by etnu00
Modified:
10 years, 8 months ago
Reviewers:
johnfargo, shindig.remailer, awiner
CC:
fargo
Base URL:
https://svn.apache.org/repos/asf/incubator/shindig/trunk/
Visibility:
Public.

Description

Clean up of GadgetSpec / MessageBundle factories to use a common base class and get consistent behavior between them. This allows for a much simpler message bundle model that eliminates a bug in the current code which potentially causes a high level of churn on caches and inconsistent updates. Deleted application manifest code as the spec was formally removed from opensocial before 0.9 was released.

Patch Set 1 #

Total comments: 12

Patch Set 2 : Updated to reflect feedback #

Messages

Total messages: 5
johnfargo
Test comment (experiencing weird codereview issues).
16 years, 1 month ago (2009-07-15 02:00:55 UTC) #1
johnfargo
Looks good. http://codereview.appspot.com/91120/diff/1/4 File java/gadgets/src/main/java/org/apache/shindig/gadgets/DefaultGadgetSpecFactory.java (right): http://codereview.appspot.com/91120/diff/1/4#newcode57 Line 57: return cacheProvider.createCache(CACHE_NAME); curious, any special value ...
16 years, 1 month ago (2009-07-15 22:25:53 UTC) #2
awiner
http://codereview.appspot.com/91120/diff/1/5 File java/gadgets/src/main/java/org/apache/shindig/gadgets/AbstractSpecFactory.java (right): http://codereview.appspot.com/91120/diff/1/5#newcode105 Line 105: throw new GadgetException(GadgetException.Code.INTERNAL_SERVER_ERROR, i'd be just as happy/happier ...
16 years, 1 month ago (2009-07-15 22:38:00 UTC) #3
etnu00
http://codereview.appspot.com/91120/diff/1/4 File java/gadgets/src/main/java/org/apache/shindig/gadgets/DefaultGadgetSpecFactory.java (right): http://codereview.appspot.com/91120/diff/1/4#newcode57 Line 57: return cacheProvider.createCache(CACHE_NAME); On 2009/07/15 22:25:53, johnfargo wrote: > ...
16 years, 1 month ago (2009-07-15 22:45:45 UTC) #4
etnu00
16 years, 1 month ago (2009-07-16 00:43:38 UTC) #5
updated patch

http://codereview.appspot.com/91120/diff/1/5
File
java/gadgets/src/main/java/org/apache/shindig/gadgets/AbstractSpecFactory.java
(right):

http://codereview.appspot.com/91120/diff/1/5#newcode105
Line 105: throw new GadgetException(GadgetException.Code.INTERNAL_SERVER_ERROR,
On 2009/07/15 22:38:00, awiner wrote:
> i'd be just as happy/happier to see a ClassCastException, so I'd write this
code
> above as:
> 
> if (obj instanceof GadgetException) {
>   throw (GadgetException) obj;
> }
> 
> return clazz.cast(obj);

yeah, that makes sense.

http://codereview.appspot.com/91120/diff/1/5#newcode111
Line 111: * Retrieves a gadget specification from the Internet, processes its
views and
On 2009/07/15 22:38:00, awiner wrote:
> inaccurate comment now

Done.

http://codereview.appspot.com/91120/diff/1/5#newcode208
Line 208: logger.log(Level.INFO, "Failed to update {1}. Using cached version.",
query.specUri);
On 2009/07/15 22:38:00, awiner wrote:
> {0} - these are zero-indexed

Done.

http://codereview.appspot.com/91120/diff/1/5#newcode211
Line 211: logger.log(Level.INFO, "Failed to update {1}. Applying negative
cache.", query.specUri);
On 2009/07/15 22:38:00, awiner wrote:
> ditto

Done.

http://codereview.appspot.com/91120/diff/1/8
File
java/gadgets/src/main/java/org/apache/shindig/gadgets/DefaultMessageBundleFactory.java
(right):

http://codereview.appspot.com/91120/diff/1/8#newcode69
Line 69: return new MessageBundle(all, new MessageBundle(parent, self));
On 2009/07/15 22:38:00, awiner wrote:
> Wouldn't MessageBundle.EMPTY common?  If so, consider an optimized factory
> method
>   MessageBundle.merge(a, b)
> ... that can check for empty bundles and avoid creating and copying maps
> unnecessarily.

MessageBundle.EMPTY is only going to be common for the middle bundle. Most
gadgets have both a fallback (all/ALL) and a specific match. There's no overhead
for additional 'empty' bundles beyond one extra loop iteration.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b