Transcript
Page 1: Open/Closed Software - Developing freemium application using Spring Framework

© 2013 SpringOne 2GX. All rights reserved. Do not distribute without permission.

Open/Closed Software Developing a freemium application with Spring

Page 2: Open/Closed Software - Developing freemium application using Spring Framework

Your Speaker

● Fred Simon

– Chief Architect, JFrog

– @freddy33

● github.com/freddy33

Page 3: Open/Closed Software - Developing freemium application using Spring Framework

Agenda

● History of a freemium application

● OSS base of the architecture

● Reloadable

● Commercial Addons

● Layers... More layers!

● Testable

Page 4: Open/Closed Software - Developing freemium application using Spring Framework

Artifactory History

● 2006: The OSS version

● 2008: First “professional” OSS version

● 2009: The SaaS version then the Pro

● 2012: Bintray

● 2013: The 3.0 version

● 2013: The HA version

Page 5: Open/Closed Software - Developing freemium application using Spring Framework

OSS is the base

● The core engine for all

– UI,

– Spring TX

– Spring Security

– Transactional VFS

– Security

Page 6: Open/Closed Software - Developing freemium application using Spring Framework

Architecture

● Based on Spring and IoC from the start

● Highly modular

● SaaS => No static members!

● A spring context (and Wicket application) is the

app

Page 7: Open/Closed Software - Developing freemium application using Spring Framework

Reloadable Beans

● Artifactory Configuration => Spring Beans

configuration

● Reloading beans

● No singletons ;-)

Page 8: Open/Closed Software - Developing freemium application using Spring Framework

Converter Manager

● Since 2.0 (2009) drop the war

– DB auto-update

– Configuration schema and default change

● Config, Logback, Mimetypes

– Directory structure changes

● 3.0 (2013)

Page 9: Open/Closed Software - Developing freemium application using Spring Framework

Version Converter Matrix

● I like Enums (See the extended Enums ;-)

● Branches are hard

● Keeping it Modular (Reloadable Beans)

Page 10: Open/Closed Software - Developing freemium application using Spring Framework

Addons Manager

● Addons are pure interfaces <=> features

– Multiple implementations

– One manager that from classpath + license load the correct addon

● Each addon has:

– META-INF/addon.properties

– Addon.xml (Spring beans)

– Many annotated spring beans

Page 11: Open/Closed Software - Developing freemium application using Spring Framework

Extending the UI

● Using Wicket dynamic loading

● Addon provides HTML and Java code for extended

page/panel

Page 12: Open/Closed Software - Developing freemium application using Spring Framework

REST API

● Jersey

– All resources in the OSS version in a single jar

● Because of IBM WebSphere ;-(

– Jersey actually load all path correctly

– Jersey annotation parsing 60% of load time!

● => Reflections

● Jersey Spring integration use the Addon Manager

Page 13: Open/Closed Software - Developing freemium application using Spring Framework

More Layers...

● The HA and Online SaaS versions

● Just more addons

Page 14: Open/Closed Software - Developing freemium application using Spring Framework

Tests are everything

● Your software is defined by your tests

Page 15: Open/Closed Software - Developing freemium application using Spring Framework

Users Plugins

● Extensible Software

– Entry/Exit points

– Listeners

– Interceptors

– Extra REST API and Scheduled Jobs

Page 16: Open/Closed Software - Developing freemium application using Spring Framework

Unit Tests

● Unit tests for each module

– Spring Config with classpath filters

● Testing conversion

● Stabbing with Easymock

Page 17: Open/Closed Software - Developing freemium application using Spring Framework

Versions Integration Tests

● For each version

– Make sure the classpath are accurate (Maven hell ;)

– Adding new functionality tests from the previous base

● Testing remote HTTP calls: MockServer

– Slow network

– Broken sockets

– Basic HTTP response codes and headers

Page 18: Open/Closed Software - Developing freemium application using Spring Framework

Higher Tests

● Integration tests for REST, Replication and HA

– Running multiple web servers

– For multiple databases

– Backward and Forward compatibility