Devfestx brian gwt_gae_webalbum

1,427 views

Published on

I made this presentation for DFX Korea 2012.
I will present this in web/cloud session.
For more information of the event, please go to https://sites.google.com/site/devfestxkorea/program

Published in: Technology, News & Politics
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,427
On SlideShare
0
From Embeds
0
Number of Embeds
160
Actions
Shares
0
Downloads
6
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Devfestx brian gwt_gae_webalbum

    1. 1. Make cloud web album Google Web Toolkit Google AppEngine mixed with and @brian02k
    2. 2. Who am I?• Back-End Developer• Network Comm. (banking/Van/Cards)• Distributed processing (ex: Hadoop)• ShopN/Mobile-Tmoney/Gateway(bank)• Datacenter/Cloud Computing• twitter : @brian02k
    3. 3. Today Demo web albumsupports n-screen
    4. 4. Google Web Toolkit convert Javascript
    5. 5. Convert java to javascript function Person(firstName, lastName){ this._firstName = firstName; this._lastName = lastName; } function TextBox(){ javascript var e = ! parent.document.createElement(INPUT); e.type = text; e.style = gwt-TextBox;public class Person return e;{ String firstName; String lastName; java }.. function onModuleLoad(){} var nameField, usr; nameField = new TextBox;TextBox nameField = new TextBox(); usr = new Person(Brian, Lee);Person usr = new Persion(“Brian”,”Lee”); setText(nameField, getName(usr));nameField.setText(user.getName()); }
    6. 6. showcase Java Framework for building rich web app http://demo.vaadin.com/sampler SmartGWThttp://www.smartclient.com/smartgwt/showcase/#main
    7. 7. Googe AppEngine Sandbox Datastore Integrated with Google Service Google Cloud SQL(High speed) Task Queue (Long excution support) Store image into the Google Cloud Support https !The goal is to make it easy to get started with a new webapp, and then make it easy to scale when that app reaches the point where its receiving significant traffic and has millions of users.
    8. 8. showcaseSamples for Google App Enginehttp://code.google.com/p/google-app-engine-samples/List of Open Source Google App Engine Hosted Projectshttp://www.uptosomething.in/weblog/?page_id=355FavouriteOpen Source Google App Engine apps (Java or Python)http://stackoverflow.com/questions/1502820/favourite-open-source-google-app-engine-apps-java-or-pythonGAE Projects from Githubhttps://github.com/search?langOverride=&q=Google+App+Engine&repo=&start_value=1&type=Repositories15 cool apps from the Google Applications Gallery (2009-04-08)http://news.cnet.com/8301-17939_109-10214930-2.html
    9. 9. GAE vs Amazon cost usability difficulty scalability security stability maintenance developer library(reuse)
    10. 10. web albumDefered Binding !
    11. 11. Defered Binding! <replace-with class="org.seoul.gtugs.client.ui.MobilePhotoListUI">! <when-type-is class="org.seoul.gtugs.client.ui.PhotoListDisplay"/>! <when-property-is name="formfactor" value="mobile"/>! </replace-with>! <replace-with class="org.seoul.gtugs.client.ui.DesktopPhotoListUI">! <when-type-is class="org.seoul.gtugs.client.ui.PhotoListDisplay"/>! <when-property-is name="formfactor" value="desktop"/>! </replace-with>! <property-provider name="formfactor"> FormFactor.gwt.xml <![CDATA[ var ua = navigator.userAgent.toLowerCase(); if (ua.indexOf("iphone") != -1 || ua.indexOf("ipod") != -1) { return "mobile"; } else if (ua.indexOf("ipad") != -1) { return "tablet"; } else if (ua.indexOf("android") != -1 || ua.indexOf("mobile") != -1) { var dpi = 160; var width = $wnd.screen.width / dpi; var height = $wnd.screen.height / dpi; var size = Math.sqrt(width*width + height*height); return (size < 6) ? "mobile" : "tablet"; } return "desktop"; ]]> </property-provider>
    12. 12. web album !
    13. 13. GWT RPC !
    14. 14. Implement RPC what service are you interested in?@RemoteServiceRelativePath("stockPrices") public interface StockPriceService extends RemoteService { StockPrice getSumPrices(StockPrice[] items) throws IllegalArgumentException;} provide the service in server sidepublic class StockPriceServiceImpl extends RemoteServiceServlet implements StockPriceService{ public StockPrice getSumPrices(StockPrice[] items) throws IllegalArgumentException{ int sum = 0; for (int i=0; i<items.length; i++) { sum += items[i].getPrice(); } StockPrice stk = new StockPrice(); stk.setSymbol("총합"); stk.setPrice(sum); return stk; }}
    15. 15. Implement RPCcallbackfinal StockPriceServiceAsync stockPriceSvc = GWT.create(StockPriceService.class);AsyncCallback<StockPrice> callback = new AsyncCallback<StockPrice>() { public void onSuccess(StockPrice result) { nameField.setText(result.getSymbol() + ":" + result.getPrice()); }};stockPriceSvc.getSumPrices(items, callback);
    16. 16. store image into the datastore!ImagesService imagesService = ImagesServiceFactory.getImagesService();!String imageUrl = imagesService.getServingUrl(blobKey.get(0));!!Entity uploadedImage = new Entity("UploadedImage");!uploadedImage.setProperty("blobKey", blobKey);!uploadedImage.setProperty("createdAt", new Date());!uploadedImage.setProperty("ownerId", "brianlee");!!uploadedImage.setUnindexedProperty("serveUrl", imageUrl);!!DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();!datastore.put(uploadedImage);!!String keyString = KeyFactory.keyToString(uploadedImage.getKey()); res.sendRedirect("/upload?uploadedImageKey=" + keyString);
    17. 17. demohttp://photogalleryservice.appspot.com/

    ×