Upgrade to Pro — share decks privately, control downloads, hide ads and more …

A Comprehensive Spring Showcase: Personal Cloud Storage Application

A Comprehensive Spring Showcase: Personal Cloud Storage Application

Erdem Günay

June 09, 2015
Tweet

Other Decks in Technology

Transcript

  1. 1 Unless otherwise indicated, these slides are © 2014-2015 Pivotal

    Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Unless otherwise indicated, these slides are © 2014-2015 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ A Comprehensive Spring Showcase: Personal Cloud Storage Application Erdem Günay, Expert Software Developer, Turkcell @gunayus
  2. 2 Unless otherwise indicated, these slides are © 2014-2015 Pivotal

    Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ About me
  3. 3 Unless otherwise indicated, these slides are © 2014-2015 Pivotal

    Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ About professional me  B. Sc. Degree from Computer Engineering, Middle East Technical University, Ankara, 1999  15 years experience with Java  10 years experience with Spring  Started and contirbuted project http://www.gwt-openlayers.org/  Enterprise application architecture  Working @Turkcell for 10 years  In organization Advanced Spring Framework trainer  In the project, software architect and developer
  4. 4 Unless otherwise indicated, these slides are © 2014-2015 Pivotal

    Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Agenda  Spring Boot  Spring Data  Spring Amqp  Elastic Search  Openstack  App Demo
  5. 5 Unless otherwise indicated, these slides are © 2014-2015 Pivotal

    Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Mobile Cloud Middleware
  6. 6 Unless otherwise indicated, these slides are © 2014-2015 Pivotal

    Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Personal Cloud Solution Architecture Clients API LAYER Frontend Storage Elastic Search file metadata index token cache Oracle DB account subscription file system structure file metadata sharing metadata Openstack keystone swift file binary data upload / downoad Social / Cloud Backend Backend Services Legacy Enterprise Backend Systems Rabbit MQ
  7. 7 Unless otherwise indicated, these slides are © 2014-2015 Pivotal

    Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ spring.io
  8. 8 Unless otherwise indicated, these slides are © 2014-2015 Pivotal

    Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Unless otherwise indicated, these slides are © 2014-2015 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ SPRING IO EXECUTION: Spring Boot
  9. 9 Unless otherwise indicated, these slides are © 2014-2015 Pivotal

    Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Before Spring Boot – hard work on dependency management …. …. many others
  10. 10 Unless otherwise indicated, these slides are © 2014-2015 Pivotal

    Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ After Spring Boot – less work on dependency management
  11. 11 Unless otherwise indicated, these slides are © 2014-2015 Pivotal

    Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ After Spring Boot – still have all the jars …. …. many others
  12. 12 Unless otherwise indicated, these slides are © 2014-2015 Pivotal

    Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ So easy to start & debug a web app
  13. 13 Unless otherwise indicated, these slides are © 2014-2015 Pivotal

    Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ & Expose a Rest service
  14. 14 Unless otherwise indicated, these slides are © 2014-2015 Pivotal

    Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ & Expose a SOAP Web service
  15. 15 Unless otherwise indicated, these slides are © 2014-2015 Pivotal

    Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Deploy on a web app container
  16. 16 Unless otherwise indicated, these slides are © 2014-2015 Pivotal

    Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Auto configuring properties application.properties # Spring Profiles # =============== spring.profiles.active=test, apiservice, backend # Global properties ... application-apiservice.properties # apiservice related properties # =============== api.service.url=http://... # other properties ... application-backend.properties # backend related properties # =============== backend.service.url=http://... # other properties ...
  17. 17 Unless otherwise indicated, these slides are © 2014-2015 Pivotal

    Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Configuring environmental differences – DEV
  18. 18 Unless otherwise indicated, these slides are © 2014-2015 Pivotal

    Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Configuring environmental differences – TEST & PROD
  19. 19 Unless otherwise indicated, these slides are © 2014-2015 Pivotal

    Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ @Scheduled, @Async
  20. 20 Unless otherwise indicated, these slides are © 2014-2015 Pivotal

    Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ @Scheduled, @Async
  21. 21 Unless otherwise indicated, these slides are © 2014-2015 Pivotal

    Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Unless otherwise indicated, these slides are © 2014-2015 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ SPRING IO FOUNDATION: Spring Data
  22. 22 Unless otherwise indicated, these slides are © 2014-2015 Pivotal

    Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ In the beginning – all work done by developers
  23. 23 Unless otherwise indicated, these slides are © 2014-2015 Pivotal

    Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Spring killed the pain a bit – obtained & released resources
  24. 24 Unless otherwise indicated, these slides are © 2014-2015 Pivotal

    Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Got better with JPA & Hibernate, but still coded by developers
  25. 25 Unless otherwise indicated, these slides are © 2014-2015 Pivotal

    Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Finally, «no code no bug»
  26. 26 Unless otherwise indicated, these slides are © 2014-2015 Pivotal

    Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ All you need is javax.persistence @Entity /** * @author Oliver Gierke */ @Entity public class Customer { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; private String firstname; private String lastname; @JsonIgnore @OneToMany(mappedBy="customer") private Set<Account> accounts = new HashSet<Account>();
  27. 27 Unless otherwise indicated, these slides are © 2014-2015 Pivotal

    Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Still plain old Sql, but not coded, auto generated, time saving select customer0_.id as id1_1_, customer0_.firstname as firstnam2_1_, customer0_.lastname as lastname3_1_ from customer customer0_ where (customer0_.firstname like ?) and upper(customer0_.lastname)=upper(?) public List<Customer> findByFirstnameLikeAndLastnameIgnoreCase( String firstname, String lastname);
  28. 28 Unless otherwise indicated, these slides are © 2014-2015 Pivotal

    Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Custom, native, modifying queries
  29. 29 Unless otherwise indicated, these slides are © 2014-2015 Pivotal

    Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Unless otherwise indicated, these slides are © 2014-2015 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Spring AMQP
  30. 30 Unless otherwise indicated, these slides are © 2014-2015 Pivotal

    Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Spring AMQP – RabbitMQ Configuration
  31. 31 Unless otherwise indicated, these slides are © 2014-2015 Pivotal

    Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Spring AMQP – Consumer Configuration
  32. 32 Unless otherwise indicated, these slides are © 2014-2015 Pivotal

    Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Spring AMQP – Message listener
  33. 33 Unless otherwise indicated, these slides are © 2014-2015 Pivotal

    Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Spring AMQP – Message producer
  34. 34 Unless otherwise indicated, these slides are © 2014-2015 Pivotal

    Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Spring summary  Spring Boot : the parent of everything, auto configuration  Spring Web : Restful APIs, @RestTemplate  Spring Data JPA : Repositories, custom, native, modifying queries  Spring Security  Spring Social : sharing on Twitter, Facebook  Spring Web Services : client & server  Spring AMQP  @Async, @Scheduled, @Transactional  @Bean Java config  No XML config or web.xml at all
  35. 35 Unless otherwise indicated, these slides are © 2014-2015 Pivotal

    Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Unless otherwise indicated, these slides are © 2014-2015 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Elastic Search
  36. 36 Unless otherwise indicated, these slides are © 2014-2015 Pivotal

    Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Elastic Search
  37. 37 Unless otherwise indicated, these slides are © 2014-2015 Pivotal

    Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Elastic Search
  38. 38 Unless otherwise indicated, these slides are © 2014-2015 Pivotal

    Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Elastic Search – index a document index type id source
  39. 39 Unless otherwise indicated, these slides are © 2014-2015 Pivotal

    Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Elastic Search – get a document
  40. 40 Unless otherwise indicated, these slides are © 2014-2015 Pivotal

    Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Elastic Search – Integrate with Spring App Context
  41. 41 Unless otherwise indicated, these slides are © 2014-2015 Pivotal

    Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Elastic Search – Index a document
  42. 42 Unless otherwise indicated, these slides are © 2014-2015 Pivotal

    Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Elastic Search – Search documents
  43. 43 Unless otherwise indicated, these slides are © 2014-2015 Pivotal

    Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Elastic Search – Delete user documents
  44. 44 Unless otherwise indicated, these slides are © 2014-2015 Pivotal

    Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Unless otherwise indicated, these slides are © 2014-2015 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ openstack
  45. 45 Unless otherwise indicated, these slides are © 2014-2015 Pivotal

    Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Openstack
  46. 46 Unless otherwise indicated, these slides are © 2014-2015 Pivotal

    Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Openstack - Modules
  47. 47 Unless otherwise indicated, these slides are © 2014-2015 Pivotal

    Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Openstack – Keystone authentication API
  48. 48 Unless otherwise indicated, these slides are © 2014-2015 Pivotal

    Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Openstack – Authentication from Spring
  49. 49 Unless otherwise indicated, these slides are © 2014-2015 Pivotal

    Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Openstack – Account creation from Spring
  50. 50 Unless otherwise indicated, these slides are © 2014-2015 Pivotal

    Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Openstack – User creation from Spring
  51. 51 Unless otherwise indicated, these slides are © 2014-2015 Pivotal

    Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Openstack – File upload from Spring https://{swift_url}/v1/AUTH_049037f79ea24214b2778830c96fd243/CONTAINER_MAIN/ 3b841cd9-547b-432a-98d9-3ce6211bab4f project_id container_name file_path
  52. 52 Unless otherwise indicated, these slides are © 2014-2015 Pivotal

    Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Openstack – File download from Spring
  53. 53 Unless otherwise indicated, these slides are © 2014-2015 Pivotal

    Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Demo Unless otherwise indicated, these slides are © 2014-2015 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ APPLICATION
  54. 54 Unless otherwise indicated, these slides are © 2014-2015 Pivotal

    Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ The Team  Volkan Esgel – Security master  Hüseyin Özcan – The UI man  Erdem Günay – it’s me  Kemal Yılmaz – the manager of the team
  55. 55 Unless otherwise indicated, these slides are © 2014-2015 Pivotal

    Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Learn More. Stay Connected.  Twitter: twitter.com/gunayus  LinkedIn: linkedin.com/in/gunayus  Github: github.com/egunay Twitter: twitter.com/springcentral YouTube: spring.io/video LinkedIn: spring.io/linkedin Google Plus: spring.io/gplus