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

Issue 1876047: Refactor Shindig BasicImageRewriter (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
15 years, 5 months ago by vikaas.arora
Modified:
15 years, 4 months ago
Base URL:
http://svn.apache.org/repos/asf/shindig/trunk/
Visibility:
Public.

Description

The existing Image Rewriter's (BasicImageRewriter) rewrite method is a huge monster that executes different steps and the resize checks are scattered through out the method. This change is an attempt to refactor the main method 'rewrite' with the added flexibility for any child class to override the four discrete steps of rewrite viz ReadImage, resizeImage, updateResponse and applyOptimizer. In the proposed refactoring, the resize checks are wrapped under a private method 'canRewrite'. The specific checks and their relative orders are very much dependent on the underlying Image processing package (Sanselan) used. This Rewriter can be further generalised/re-factored to make this method 'canRewrite' public and provide abstract methods for extracting ImageFormat & ImageInfo; thereby removing the hard dependency on Apache Sanselan package.

Patch Set 1 #

Total comments: 2

Patch Set 2 : Removed class variables (maintaining state) #

Total comments: 3

Patch Set 3 : Incorporated Jacobo's feedback #

Patch Set 4 : Adding Satya to this change #

Total comments: 4

Patch Set 5 : Satya's feedback #

Unified diffs Side-by-side diffs Delta from patch set Stats (+200 lines, -95 lines) Patch
java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/image/BasicImageRewriter.java View 1 2 3 4 7 chunks +196 lines, -91 lines 0 comments Download
java/gadgets/src/test/java/org/apache/shindig/gadgets/rewrite/image/ImageRewriterTest.java View 1 2 1 chunk +4 lines, -4 lines 0 comments Download

Messages

Total messages: 21
vikaas.arora
15 years, 5 months ago (2010-08-03 07:55:09 UTC) #1
johnfargo
Looks like a great start, thanks Vikas. I've got only one substantive comment for the ...
15 years, 5 months ago (2010-08-04 23:14:01 UTC) #2
vikaas.arora
http://codereview.appspot.com/1876047/diff/1/3 File java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/image/BasicImageRewriter.java (right): http://codereview.appspot.com/1876047/diff/1/3#newcode159 java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/image/BasicImageRewriter.java:159: setRequireResize(false); On 2010/08/04 23:14:01, johnfargo wrote: > Since rewriters ...
15 years, 5 months ago (2010-08-05 10:40:22 UTC) #3
vikaas.arora
Removed class variables (maintaining state)
15 years, 5 months ago (2010-08-05 10:42:25 UTC) #4
jtarrio
http://codereview.appspot.com/1876047/diff/7001/8002 File java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/image/BasicImageRewriter.java (right): http://codereview.appspot.com/1876047/diff/7001/8002#newcode223 java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/image/BasicImageRewriter.java:223: image = resizeImageImpl(image, requestedWidth, requestedHeight, widthDelta, heightDelta); It looks ...
15 years, 5 months ago (2010-08-06 21:12:48 UTC) #5
johnfargo
Hey Vikas, just giving a friendly ping. Thoughts on this one? Cheers, John On Fri, ...
15 years, 5 months ago (2010-08-18 16:25:58 UTC) #6
vikaas.arora
Hi John - The day Jacobo gave the feedback, I went on vacation. Will close ...
15 years, 5 months ago (2010-08-19 04:33:47 UTC) #7
johnfargo
Aha, I'd missed that you were on vacation. Enjoy the remainder of your rest! On ...
15 years, 5 months ago (2010-08-19 04:34:55 UTC) #8
vikaas.arora
On 2010/08/19 04:34:55, johnfargo wrote: > Aha, I'd missed that you were on vacation. Enjoy ...
15 years, 4 months ago (2010-09-13 11:57:19 UTC) #9
vikaas.arora
Adding Satya to this change
15 years, 4 months ago (2010-09-14 06:32:25 UTC) #10
vikaas.arora
Ping ...
15 years, 4 months ago (2010-09-15 03:16:29 UTC) #11
satya3656
http://codereview.appspot.com/1876047/diff/21001/java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/image/BasicImageRewriter.java File java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/image/BasicImageRewriter.java (right): http://codereview.appspot.com/1876047/diff/21001/java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/image/BasicImageRewriter.java#newcode151 java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/image/BasicImageRewriter.java:151: private Pair<Boolean, Boolean> checkImage(HttpRequest request, HttpResponseBuilder response, Most of ...
15 years, 4 months ago (2010-09-16 05:31:31 UTC) #12
vikaas.arora
Incorporated Satya's feedback
15 years, 4 months ago (2010-09-16 08:42:37 UTC) #13
vikaas.arora
Satya's feedback
15 years, 4 months ago (2010-09-16 08:59:13 UTC) #14
vikaas.arora
http://codereview.appspot.com/1876047/diff/21001/java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/image/BasicImageRewriter.java File java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/image/BasicImageRewriter.java (right): http://codereview.appspot.com/1876047/diff/21001/java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/image/BasicImageRewriter.java#newcode151 java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/image/BasicImageRewriter.java:151: private Pair<Boolean, Boolean> checkImage(HttpRequest request, HttpResponseBuilder response, On 2010/09/16 ...
15 years, 4 months ago (2010-09-16 09:04:31 UTC) #15
satya3656
LGTM
15 years, 4 months ago (2010-09-16 11:28:34 UTC) #16
jtarrio
lgtm On Tue, Sep 14, 2010 at 8:16 PM, <vikaas.arora@gmail.com> wrote: > Ping ... > ...
15 years, 4 months ago (2010-09-17 03:25:34 UTC) #17
vikaas.arora
Time to ping Gagan to use his commit powers :-) On Fri, Sep 17, 2010 ...
15 years, 4 months ago (2010-09-17 03:40:14 UTC) #18
gagan.goku
Will take a look and submit sometime in the evening if thats okay with you. ...
15 years, 4 months ago (2010-09-17 03:46:32 UTC) #19
vikaas.arora
Please take your time. No hurry. Thanks, Vikas On Fri, Sep 17, 2010 at 9:16 ...
15 years, 4 months ago (2010-09-17 03:54:51 UTC) #20
gagan.goku
15 years, 4 months ago (2010-09-17 17:29:55 UTC) #21
All tests passing, committed patch as r998214.
Sign in to reply to this message.

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