Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

"Framework Principal" pattern


Published on

Published in: Technology, Education
  • Be the first to comment

  • Be the first to like this

"Framework Principal" pattern

  1. 1. “Framework Principal" patternPhilippe Rabier -
  2. 2. @prabierFollow me!
  3. 3. Why this presentation?
  4. 4. •What is a Framework Principal?• Starter class automatically instantiated, very early• Used to initialize your stuffs• Independent from the Application• @see ERXFrameworkPrincipal
  5. 5. What is the goal?Resource optimization!
  6. 6. Feedback fromYou ’N Push
  7. 7. Sandbox environment1 applicationBack Office FTP Server Web ServicesJob SchedulerIn-AppPurchaseServicePushNotificationService
  8. 8. Production environmentBack Office FTP Server Web ServicesJob SchedulerIn-AppPurchaseServicePushNotificationService4 applications
  9. 9. How to do that?Not rocket science!
  10. 10. • Make your FP runnable. Change the like this:principalClass=ca.wowodc.pascal.util.MyFrameworkPrincipal• Create an empty Wonder application• Add the frameworks to the classpath• Choose a rule for your properties file names likeProperties.staging or Properties.production• Set your properties• Set the appropriate user name in the WOMonitor configuration• …et voilà!The Recipe
  11. 11. Skeleton of a FP public static boolean serviceMustRun() { return ERXProperties.booleanForKeyWithDefault("myServiceToLaunch", false); } public void finishInitialization() { if (serviceMustRun() ) { // your code ... } } public boolean isServiceRunning() { return a condition; }
  12. 12. Skeleton of a Properties file#Launch first servicefirstServiceToLaunch=true#second service is not runningsecondServiceToLaunch=false
  13. 13. WOMonitor configsThe application will look for Properties.production fileThe application will look for Properties.sandbox file
  14. 14. 2 Strategies• Only one application• user name is different for each application• ex: Properties.scheduler, Properties.backoffice, …• Several specialized applications• user name is the same for every app like Properties.production• applications are different: scheduler.woa, backoffice.woa, …
  15. 15. Do you know?• ERRest can be configured in a FP (set up the request handler, theroutes, …)• D2W applications could be defined in a FP (theERXNavigationManager loads all navigationMenu.plist in anyframeworks, the rules can be anywhere, …).
  16. 16. @prabierFollow me!
  17. 17. Q&A“Framework Principal" pattern