SlideShare a Scribd company logo
Getting Started with Wonder
                     Kieran Kelleher               WOWODC 2010 Montreal
                     Green Island Consulting LLC
                     SmartleadsUSA LLC
                     SmartMix Technologies LLC




Friday, September 3, 2010
Getting Started with Wonder
                            •   Get you started using Wonder

                                •   Wonder installation and upgrade - Binaries and Source

                                •   Create a Wonder Application

                                •   Convert existing non-Wonder to a Wonder Application

                            •   Review a few useful features of Wonder

                                •   ERXProperties, Properties files usage, ERXEC usage

                                •   ERPrototypes and Overriding prototypes


Friday, September 3, 2010
What Is It?
                            •      World’s largest Open Source WebObjects project

                            •      Umbrella Project for

                                 •       Patches and Bug Fixes to WebObjects

                                 •       Very Useful Extensions to Standard WebObjects Functionality

                                 •       Reusable WOComponents

                                 •       Powerful Reusable Frameworks

                                 •       Example Applications
  * Some verbiage reproduced from Jonathon “Wolf” Rentzsch’s 2002 CAWUG Presentation



Friday, September 3, 2010
Brief History Snippet
                            •   A long long time ago in a galaxy far far away...

                                •   dotcom: “eResource” (“ER*”), then became NetStruxr

                                •   WOnder is acronym for

                                    •   WebObjects Nodes for Distributing E-Resources

                                •   NetStruxr closed

                                    •   SourceForge project named WONDER was created (~2002)



Friday, September 3, 2010
What’s in It

         GoogleChart           ERChronic       ... and much more!   (db *)PlugIn     ERModernLook



            ERTaggable         ERCaptcha          ERProfiling        ERIndexing     ERModernDefaultSkin



        ERAttachment         ExcelGenerator    ERPDFGeneration        ERRest         ERModernD.T.W.



                 Ajax       JavaWOExtensions       WOOgnl           WOJRebel         ERNeutralLook



         ERExtensions            ERJars          ERPrototypes       ERJavaMail       ERDirectToWeb



Friday, September 3, 2010
Why Should You Use It?
                            •   Bug fixes to standard WebObjects frameworks

                            •   Even Apple uses Wonder (Branch 2_0_0?)

                            •   Improved and Replaced Functionality

                            •   Extended and Additional Functionality

                            •   The source code has an educational benefit

                            •   Why reinvent and debug the wheel?



Friday, September 3, 2010
How Do You Get It?

        “Semi-Pro” Way*                                                      “Pro” Way*




                            Binaries                                                      Source



 * Terms coined by David Holt on wonder-disc mailing list on May 12, 2010

Friday, September 3, 2010
Binary Frameworks Initial Installation
   $ mkdir WonderBinaries54


   $ cd WonderBinaries54


   $ curl -O http://webobjects.mdimension.com/hudson/job/Wonder54/lastSuccessfulBuild/artifact/dist/Wonder-Frameworks.tar.gz


   $ tar -xzvf Wonder-Frameworks.tar.gz


   $ sudo cp -Rvf *.framework /Library/Frameworks




         For WebObjects 5.3, replace “54” above with “53”
Friday, September 3, 2010
Binary Frameworks Upgrade Installation
   $ cd WonderBinaries54


   $ for FRAMEWORK in `echo *.framework`; do sudo rm -r /Library/Frameworks/${FRAMEWORK}; done


   $ rm -r *


   $ curl -O http://webobjects.mdimension.com/hudson/job/Wonder54/lastSuccessfulBuild/artifact/dist/Wonder-Frameworks.tar.gz


   $ tar -xzvf Wonder-Frameworks.tar.gz


   $ sudo cp -Rvf *.framework /Library/Frameworks




         For WebObjects 5.3, replace “54” above with “53”
Friday, September 3, 2010
Source Frameworks Initial Installation
   $ svn co http://wonder.svn.sourceforge.net/svnroot/wonder/trunk/Wonder --revision <ARG> WonderSource



   $ cd WonderSource



   $ ant -Dwonder.patch=54 frameworks; sudo ant -Dwonder.patch=54 frameworks.install     [WO 5.4]



                            OR



   $ ant frameworks; sudo ant frameworks.install      [WO 5.3]




         <ARG> = HEAD to get latest version. Type svn --help checkout for more.
Friday, September 3, 2010
Source Frameworks Upgrade Installation
   $ cd ~/Roots/



   $ for FRAMEWORK in `echo *.framework`; do sudo rm -r /Library/Frameworks/${FRAMEWORK}; done



   $ cd /path/to/WonderSource



   $ svn update --force --accept theirs-full --revision <ARG>



   $ ant -Dwonder.patch=54 clean; ant -Dwonder.patch=54 frameworks; sudo ant -Dwonder.patch=54 frameworks.install   [WO 5.4]



                        OR



   $ ant clean; ant frameworks; sudo ant frameworks.install         [WO 5.3]




Friday, September 3, 2010
Working with Wonder Source

                            •   Some Advantages of working with Source over Binaries:

                                •   Learn much about WebObjects and EOF (and java dev styles?)

                                •   Easily browse and search the source

                                •   Work with a specific svn version (teams, quality control)

                                •   Discover the Hidden Treasures (Don’t miss Chuck Hill later)

                            •   Note ERXExtensions classpath file contents for 5.3 vs 5.4 .....


Friday, September 3, 2010
Demo


                            •   Linking Wonder Source projects to your Workspace

                            •   Creating a Wonder app

                            •   What is different between a Wonder app and a Standard app




Friday, September 3, 2010
Integrating Wonder into Your
                                     Existing Application
                            •   Add Frameworks

                            •   Adjust Application, Session and DirectAction superclasses

                            •   Use ERXGenericRecord instead of EOGenericRecord

                            •   Configure Wonder-specific Properties

                                •   copy/paste from a new temp Wonder app as a starting point



Friday, September 3, 2010
Integrating Wonder into an
                                     Existing Application


                            •   DEMO




Friday, September 3, 2010
Configuring Wonder’s Features
                            •   Wonder is configured, more or less, using Properties files.

                                •   Check comments and contents of each framework’s
                                    Properties file

                            •   Where to find Documentation

                                •   Java API

                                •   Framework “Documentation” directory

                                •   http://wiki.objectstyle.org/confluence/display/WONDER/Home

                                •   Examine Source code

Friday, September 3, 2010
Select Features

                            •   ERXProperties

                            •   EOModel Connection Dictionary using Properties

                            •   ERXEC usage

                            •   ERPrototypes

                            •   Over-riding Prototypes via ERXModel and ERXModelGroup



Friday, September 3, 2010
ERXProperties

                            •   A variety of ways to organize Properties

                            •   ERXProperties replaces and extends deprecated NSProperties

                                •   many convenient utility methods including property coercion

                            •   log4j configured via Properties

                            •   Understanding how ERXProperties works can facilitate better
                                team organization, app administration and general happiness :-)



Friday, September 3, 2010
The Standard WebObjects Way

 Override

                            Properties                    Framework Resources
                             Properties
                              Properties


                            Properties                    Application Resources


                            WebObjects.properties         [user.home] dir


                        -DpropertyName=propertyValue      Command Line arguments
                        -DpropertyName=”property Value”




Friday, September 3, 2010
Properties: The Wonder Way
          Properties
           Properties
            Properties
          Properties.<username>
                                              Framework Resources                                                          Override
           Properties.<username>
            Properties.<username>

          Properties                          Application Resources
          WebObjects.properties               [user.home] dir

          ( file1, file2, file3 )                [er.extensions.ERXProperties.OptionalConfigurationFiles]
                                                 (absolute filepaths AND/OR application Resource filenames)
          Properties OR                       [er.extensions.ERXProperties.machinePropertiesPath]
          /<appName>/Properties                  (absolute filepath, default “/etc/WebObjects”)

          Properties.dev                       [er.extensions.ERXProperties.devPropertiesName]
                                                  (file extension, App Resource, default “dev”)
          Properties.<username>                Application Resources
          -DpropertyName=propertyValue         Command Line arguments
          -DpropertyName=”property Value”


          @see er.extensions.foundation.ERXProperties.pathsForUserAndBundleProperties(boolean)
          Note: [propertyname] denotes a system property (so properties are determining the loading of more properties!)
Friday, September 3, 2010
Examples of Properties fiddling...
   ## We always want to use @@ as the delimiter and NOT a single @
   er.extensions.ERXSimpleTemplateParser.useOldDelimiter=false

   app.directActionPassword=passw0rd
   er.extensions.ERXJUnitPassword = @@app.directActionPassword@@
   er.extensions.ERXLog4JPassword = @@app.directActionPassword@@
   er.extensions.ERXGCPassword = @@app.directActionPassword@@
   er.extensions.ERXDirectAction.ChangeSystemPropertyPassword = @@app.directActionPassword@@

   app.smtpserver=192.168.3.142
   WOSMTPHost=@@app.smtpserver@@
   log4j.appender.myMail.SMTPHost=@@app.smtpserver@@


                                                                                               Automatically generated into Resources by build




   ## Optional properties to load
   er.extensions.ERXProperties.OptionalConfigurationFiles=deploy.properties

   log4j.appender.A2.file=/var/log/webobjects_apps/@@build.app.bundle.name@@-@@WOPort@@.log

   log4j.appender.myMail.Subject=Log4jError (@@build.app.bundle.name@@ @@host@@ @@WOPort@@)




Friday, September 3, 2010
Common Dev/Deploy Properties Strategy




Friday, September 3, 2010
EOModel Connection Dictionary
       WebObjects Way




Friday, September 3, 2010
EOModel Connection Dictionary
     Wonder Way - Properties File:
                            # For individual eomodels
                            model.URL = jdbc:mysql://hostname/firstdatabase
                            model.DBUser = firstuser
                            model.DBPassword = firstpassword
                            model.DBDriver =
                            model.DBPlugin =



                            # Global, or default where model entry not specified
                            dbConnectURLGLOBAL = jdbc:mysql://hostname/nextdatabase
                            dbConnectUserGLOBAL = nextuser
                            dbConnectPasswordGLOBAL = nextpassword
                            dbConnectDriverGLOBAL =
                            dbConnectPluginGLOBAL =



     Wonder Way - WOMonitor Launch Arguments:
                            -Dmodel.URL=”jdbc:mysql://localhost/database?useUnicode=true&characterEncoding=UTF-8”
                            -Dmodel.DBUser=firstuser
                            -Dmodel.DBPassword=firstpassword




Friday, September 3, 2010
ERXEC
                            •   EOEditingContext subclass
                                •   EOEditingContext ec = ERXEC.newEditingContext();


                            •   supports automatic lock/unlock in R-R cycle
                                •   er.extensions.ERXEC.safeLocking=true


                                •   enabled by default for new Wonder projects

                            •   Calls ERXEnterpriseObject state transition will*/did* methods

                                •   Implemented by ERXGenericRecord


Friday, September 3, 2010
ERXEC Auto Lock/Unlock

                            •   Implicitly supported in Request-Response threads
                                •   ERXApplication._endRequest()    ... which calls ...

                                    •   ERXEC.unlockAllContextsForCurrentThread();


                            •   Background threads are your responsibility!

                                •   Here is how to do it ...




Friday, September 3, 2010
Runnable lock handling
   public class MyTask implements Runnable {

   	       public void run() {
   	       	    ERXApplication._startRequest();
   	       	    try {
   	       	    	     performTask();
   	       	    } finally {
   	       	    	     ERXApplication._endRequest();
   	       	    }
   	       }
   	
   	       private void performTask() {
   	       	    EOEditingContext ec = ERXEC.newEditingContext();

   	       	      ec.lock();
   	       	      try {

   	       	      	         // Do some EOF stuff with the ec.

   	       	      } catch (Exception e) {
   	       	      	    // handle exception
   	       	      } finally {
   	       	      	    ec.unlock();
   	       	      }
   	       }
   }

Friday, September 3, 2010
Callable lock handling
   public class MyTask implements Callable<MyResultClass> {

   	       public MyResultClass call() {
   	       	    ERXApplication._startRequest();
   	       	    try {
   	       	    	     return performTask();
   	       	    } finally {
   	       	    	     ERXApplication._endRequest();
   	       	    }
   	       }
   	
   	       private MyResultClass performTask() {
   	       	    EOEditingContext ec = ERXEC.newEditingContext();
   	       	    ec.lock();
   	       	    try {
   	       	    	     // Do some EOF stuff with the ec.

   	       	      } catch (Exception e) {
   	       	      	    // handle exception
   	       	      } finally {
   	       	      	    ec.unlock();
   	       	      }
   	       	      return myResult;
   	       }
   }


Friday, September 3, 2010
Passing Objects to a Thread
   	       public WOActionResults shuffleStudioAction() {
   	       	   Studio studio = selectedStudio();
   	       	
   	       	   EOGlobalID studioGid = (EOGlobalID) ERXEOControlUtilities.convertEOtoGID(studio);
   	       	
   	       	   ProcessStudioTask task = new ProcessStudioTask(studioGid);
   	       	
   	       	   MyExecutorServices.executorService().execute(task);
   	       	
   	       	   return null;
   	       }




Friday, September 3, 2010
Thread Hydrates EO
   public class ProcessStudioTask extends ERXRunnable {
   	
   	    private final EOGlobalID _studioGlobalID;

   	       public ProcessStudioTask(EOGlobalID studioGlobalID) {
   	       	    _studioGlobalID = studioGlobalID;
   	       }
   	
   	       @Override
   	       public void _run() {
   	       	    EOEditingContext ec = ERXEC.newEditingContext();
   	       	    ec.lock();
   	       	    try {
   	
   	       	      	         Studio studio = (Studio) ERXEOControlUtilities.convertGIDtoEO(ec, _studioGlobalID);

   	       	      } catch (Exception e) {
   	       	      	    // Handle error
   	       	      } finally {
   	       	      	    ec.unlock();
   	       	      }
   	       }

   }




Friday, September 3, 2010
ERPrototypes



                            •   DEMO




Friday, September 3, 2010
Overriding Prototypes
                       •      ERXModel and ERXModelGroup

                       •      Allow “over-riding” of prototypes based on prototype entity naming
                              conventions

                       •      Feature configured in system Properties:


                            er.extensions.ERXModelGroup.modelClassName = com.webobjects.eoaccess.ERXModel
                            er.extensions.ERXModel.useExtendedPrototypes = true
                            er.extensions.ERXModelGroup.flattenPrototypes = false




Friday, September 3, 2010
Prototypes Over-ride Order
                       •    From lowest to highest priority:

                            •   EOPrototypes

                            •   EO<adaptorName>Prototypes (Wonder has ‘Memory’ and ‘REST’ adaptor protypes)

                            •   EOJDBC<pluginName>Prototypes (Wonder database prototype names)

                            •   EOCustomPrototypes

                            •   EO<adaptorName>CustomPrototypes

                            •   EOJDBC<pluginName>CustomPrototypes

                            •   EO<modelName>Prototypes

                            •   EO<adaptorName><modelName>Prototypes

                            •   EOJDBC<pluginName><modelName>Prototypes



Friday, September 3, 2010
Override Prototypes



                            •   DEMO




Friday, September 3, 2010
Resources
                            •   http://wiki.objectstyle.org/confluence/display/WONDER/Home

                            •   http://projectwonder.blogspot.com/

                            •   http://webobjects.mdimension.com/hudson/

                                •   JavaDoc and Binaries

                                •   “Wonder53” = Wonder for WebObjects 5.3.3

                                •   “Wonder54” = Wonder for WebObjects 5.4.3

                            •   Mailing Lists

                                •   https://lists.sourceforge.net/lists/listinfo/wonder-disc

                                •   https://lists.sourceforge.net/lists/listinfo/wonder-cvs


Friday, September 3, 2010
Q&A
                     Getting Start with Wonder
                     WOWODC 2010




Friday, September 3, 2010

More Related Content

PDF
Filtering data with D2W
PDF
WebObjects Optimization
PDF
Beyond Fluffy Bunny. How I leveraged WebObjects in my lean startup.
PDF
WebObjects Developer Tools
PDF
Beefing Up AIR - FITC AMS 2012
PDF
Persistent Session Storage
PPTX
An Annotation Framework for Fedora
PPT
Object oriented programming_Unit1_Introduction.ppt
Filtering data with D2W
WebObjects Optimization
Beyond Fluffy Bunny. How I leveraged WebObjects in my lean startup.
WebObjects Developer Tools
Beefing Up AIR - FITC AMS 2012
Persistent Session Storage
An Annotation Framework for Fedora
Object oriented programming_Unit1_Introduction.ppt

Similar to Getting Started with Wonder (20)

PDF
Semtech2006
PDF
02 Objective C
PPTX
Otago vre-overview
PPTX
Xcore meets IncQuery: How the New Generation of DSLs are Made
PDF
Pharo Status ESUG 2014
PDF
Making Fedora easier to implement with Fez
PDF
Building OBO Foundry ontology using semantic web tools
PPTX
Reactive summit 2020 microsoft orleans the easy way
PDF
Eclipse e4
PDF
Django è pronto per l'Enterprise
PDF
Semantic web assignment 3
PPTX
OER for repository managers
PDF
Building a Lightweight Discovery Interface for China's Patents@NYC Solr/Lucen...
PPTX
Entity Framework Today (May 2012)
PDF
Django in enterprise world
PDF
Architecting Smarter Apps with Entity Framework
PDF
Devoxx France 2013 Cloud Best Practices
PPTX
Design patterns
PDF
Stackato v5
PDF
Red Dirt Ruby Conference
Semtech2006
02 Objective C
Otago vre-overview
Xcore meets IncQuery: How the New Generation of DSLs are Made
Pharo Status ESUG 2014
Making Fedora easier to implement with Fez
Building OBO Foundry ontology using semantic web tools
Reactive summit 2020 microsoft orleans the easy way
Eclipse e4
Django è pronto per l'Enterprise
Semantic web assignment 3
OER for repository managers
Building a Lightweight Discovery Interface for China's Patents@NYC Solr/Lucen...
Entity Framework Today (May 2012)
Django in enterprise world
Architecting Smarter Apps with Entity Framework
Devoxx France 2013 Cloud Best Practices
Design patterns
Stackato v5
Red Dirt Ruby Conference
Ad

More from WO Community (20)

PDF
KAAccessControl
PDF
In memory OLAP engine
PDF
Using Nagios to monitor your WO systems
PDF
Build and deployment
PDF
High availability
PDF
Reenabling SOAP using ERJaxWS
PDF
Chaining the Beast - Testing Wonder Applications in the Real World
PDF
D2W Stateful Controllers
PDF
Deploying WO on Windows
PDF
Unit Testing with WOUnit
PDF
Life outside WO
PDF
Apache Cayenne for WO Devs
PDF
Advanced Apache Cayenne
PDF
Migrating existing Projects to Wonder
PDF
iOS for ERREST - alternative version
PDF
iOS for ERREST
PDF
"Framework Principal" pattern
PDF
PDF
Localizing your apps for multibyte languages
PDF
KAAccessControl
In memory OLAP engine
Using Nagios to monitor your WO systems
Build and deployment
High availability
Reenabling SOAP using ERJaxWS
Chaining the Beast - Testing Wonder Applications in the Real World
D2W Stateful Controllers
Deploying WO on Windows
Unit Testing with WOUnit
Life outside WO
Apache Cayenne for WO Devs
Advanced Apache Cayenne
Migrating existing Projects to Wonder
iOS for ERREST - alternative version
iOS for ERREST
"Framework Principal" pattern
Localizing your apps for multibyte languages
Ad

Recently uploaded (20)

PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPTX
Cloud computing and distributed systems.
PPT
Teaching material agriculture food technology
PDF
solutions_manual_-_materials___processing_in_manufacturing__demargo_.pdf
PDF
KodekX | Application Modernization Development
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Approach and Philosophy of On baking technology
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PPTX
Big Data Technologies - Introduction.pptx
PPTX
breach-and-attack-simulation-cybersecurity-india-chennai-defenderrabbit-2025....
PDF
Advanced IT Governance
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Machine learning based COVID-19 study performance prediction
PDF
cuic standard and advanced reporting.pdf
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PPTX
MYSQL Presentation for SQL database connectivity
Mobile App Security Testing_ A Comprehensive Guide.pdf
Cloud computing and distributed systems.
Teaching material agriculture food technology
solutions_manual_-_materials___processing_in_manufacturing__demargo_.pdf
KodekX | Application Modernization Development
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Approach and Philosophy of On baking technology
Review of recent advances in non-invasive hemoglobin estimation
Network Security Unit 5.pdf for BCA BBA.
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Big Data Technologies - Introduction.pptx
breach-and-attack-simulation-cybersecurity-india-chennai-defenderrabbit-2025....
Advanced IT Governance
CIFDAQ's Market Insight: SEC Turns Pro Crypto
Advanced methodologies resolving dimensionality complications for autism neur...
Machine learning based COVID-19 study performance prediction
cuic standard and advanced reporting.pdf
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
MYSQL Presentation for SQL database connectivity

Getting Started with Wonder

  • 1. Getting Started with Wonder Kieran Kelleher WOWODC 2010 Montreal Green Island Consulting LLC SmartleadsUSA LLC SmartMix Technologies LLC Friday, September 3, 2010
  • 2. Getting Started with Wonder • Get you started using Wonder • Wonder installation and upgrade - Binaries and Source • Create a Wonder Application • Convert existing non-Wonder to a Wonder Application • Review a few useful features of Wonder • ERXProperties, Properties files usage, ERXEC usage • ERPrototypes and Overriding prototypes Friday, September 3, 2010
  • 3. What Is It? • World’s largest Open Source WebObjects project • Umbrella Project for • Patches and Bug Fixes to WebObjects • Very Useful Extensions to Standard WebObjects Functionality • Reusable WOComponents • Powerful Reusable Frameworks • Example Applications * Some verbiage reproduced from Jonathon “Wolf” Rentzsch’s 2002 CAWUG Presentation Friday, September 3, 2010
  • 4. Brief History Snippet • A long long time ago in a galaxy far far away... • dotcom: “eResource” (“ER*”), then became NetStruxr • WOnder is acronym for • WebObjects Nodes for Distributing E-Resources • NetStruxr closed • SourceForge project named WONDER was created (~2002) Friday, September 3, 2010
  • 5. What’s in It GoogleChart ERChronic ... and much more! (db *)PlugIn ERModernLook ERTaggable ERCaptcha ERProfiling ERIndexing ERModernDefaultSkin ERAttachment ExcelGenerator ERPDFGeneration ERRest ERModernD.T.W. Ajax JavaWOExtensions WOOgnl WOJRebel ERNeutralLook ERExtensions ERJars ERPrototypes ERJavaMail ERDirectToWeb Friday, September 3, 2010
  • 6. Why Should You Use It? • Bug fixes to standard WebObjects frameworks • Even Apple uses Wonder (Branch 2_0_0?) • Improved and Replaced Functionality • Extended and Additional Functionality • The source code has an educational benefit • Why reinvent and debug the wheel? Friday, September 3, 2010
  • 7. How Do You Get It? “Semi-Pro” Way* “Pro” Way* Binaries Source * Terms coined by David Holt on wonder-disc mailing list on May 12, 2010 Friday, September 3, 2010
  • 8. Binary Frameworks Initial Installation $ mkdir WonderBinaries54 $ cd WonderBinaries54 $ curl -O http://webobjects.mdimension.com/hudson/job/Wonder54/lastSuccessfulBuild/artifact/dist/Wonder-Frameworks.tar.gz $ tar -xzvf Wonder-Frameworks.tar.gz $ sudo cp -Rvf *.framework /Library/Frameworks For WebObjects 5.3, replace “54” above with “53” Friday, September 3, 2010
  • 9. Binary Frameworks Upgrade Installation $ cd WonderBinaries54 $ for FRAMEWORK in `echo *.framework`; do sudo rm -r /Library/Frameworks/${FRAMEWORK}; done $ rm -r * $ curl -O http://webobjects.mdimension.com/hudson/job/Wonder54/lastSuccessfulBuild/artifact/dist/Wonder-Frameworks.tar.gz $ tar -xzvf Wonder-Frameworks.tar.gz $ sudo cp -Rvf *.framework /Library/Frameworks For WebObjects 5.3, replace “54” above with “53” Friday, September 3, 2010
  • 10. Source Frameworks Initial Installation $ svn co http://wonder.svn.sourceforge.net/svnroot/wonder/trunk/Wonder --revision <ARG> WonderSource $ cd WonderSource $ ant -Dwonder.patch=54 frameworks; sudo ant -Dwonder.patch=54 frameworks.install [WO 5.4] OR $ ant frameworks; sudo ant frameworks.install [WO 5.3] <ARG> = HEAD to get latest version. Type svn --help checkout for more. Friday, September 3, 2010
  • 11. Source Frameworks Upgrade Installation $ cd ~/Roots/ $ for FRAMEWORK in `echo *.framework`; do sudo rm -r /Library/Frameworks/${FRAMEWORK}; done $ cd /path/to/WonderSource $ svn update --force --accept theirs-full --revision <ARG> $ ant -Dwonder.patch=54 clean; ant -Dwonder.patch=54 frameworks; sudo ant -Dwonder.patch=54 frameworks.install [WO 5.4] OR $ ant clean; ant frameworks; sudo ant frameworks.install [WO 5.3] Friday, September 3, 2010
  • 12. Working with Wonder Source • Some Advantages of working with Source over Binaries: • Learn much about WebObjects and EOF (and java dev styles?) • Easily browse and search the source • Work with a specific svn version (teams, quality control) • Discover the Hidden Treasures (Don’t miss Chuck Hill later) • Note ERXExtensions classpath file contents for 5.3 vs 5.4 ..... Friday, September 3, 2010
  • 13. Demo • Linking Wonder Source projects to your Workspace • Creating a Wonder app • What is different between a Wonder app and a Standard app Friday, September 3, 2010
  • 14. Integrating Wonder into Your Existing Application • Add Frameworks • Adjust Application, Session and DirectAction superclasses • Use ERXGenericRecord instead of EOGenericRecord • Configure Wonder-specific Properties • copy/paste from a new temp Wonder app as a starting point Friday, September 3, 2010
  • 15. Integrating Wonder into an Existing Application • DEMO Friday, September 3, 2010
  • 16. Configuring Wonder’s Features • Wonder is configured, more or less, using Properties files. • Check comments and contents of each framework’s Properties file • Where to find Documentation • Java API • Framework “Documentation” directory • http://wiki.objectstyle.org/confluence/display/WONDER/Home • Examine Source code Friday, September 3, 2010
  • 17. Select Features • ERXProperties • EOModel Connection Dictionary using Properties • ERXEC usage • ERPrototypes • Over-riding Prototypes via ERXModel and ERXModelGroup Friday, September 3, 2010
  • 18. ERXProperties • A variety of ways to organize Properties • ERXProperties replaces and extends deprecated NSProperties • many convenient utility methods including property coercion • log4j configured via Properties • Understanding how ERXProperties works can facilitate better team organization, app administration and general happiness :-) Friday, September 3, 2010
  • 19. The Standard WebObjects Way Override Properties Framework Resources Properties Properties Properties Application Resources WebObjects.properties [user.home] dir -DpropertyName=propertyValue Command Line arguments -DpropertyName=”property Value” Friday, September 3, 2010
  • 20. Properties: The Wonder Way Properties Properties Properties Properties.<username> Framework Resources Override Properties.<username> Properties.<username> Properties Application Resources WebObjects.properties [user.home] dir ( file1, file2, file3 ) [er.extensions.ERXProperties.OptionalConfigurationFiles] (absolute filepaths AND/OR application Resource filenames) Properties OR [er.extensions.ERXProperties.machinePropertiesPath] /<appName>/Properties (absolute filepath, default “/etc/WebObjects”) Properties.dev [er.extensions.ERXProperties.devPropertiesName] (file extension, App Resource, default “dev”) Properties.<username> Application Resources -DpropertyName=propertyValue Command Line arguments -DpropertyName=”property Value” @see er.extensions.foundation.ERXProperties.pathsForUserAndBundleProperties(boolean) Note: [propertyname] denotes a system property (so properties are determining the loading of more properties!) Friday, September 3, 2010
  • 21. Examples of Properties fiddling... ## We always want to use @@ as the delimiter and NOT a single @ er.extensions.ERXSimpleTemplateParser.useOldDelimiter=false app.directActionPassword=passw0rd er.extensions.ERXJUnitPassword = @@app.directActionPassword@@ er.extensions.ERXLog4JPassword = @@app.directActionPassword@@ er.extensions.ERXGCPassword = @@app.directActionPassword@@ er.extensions.ERXDirectAction.ChangeSystemPropertyPassword = @@app.directActionPassword@@ app.smtpserver=192.168.3.142 WOSMTPHost=@@app.smtpserver@@ log4j.appender.myMail.SMTPHost=@@app.smtpserver@@ Automatically generated into Resources by build ## Optional properties to load er.extensions.ERXProperties.OptionalConfigurationFiles=deploy.properties log4j.appender.A2.file=/var/log/webobjects_apps/@@build.app.bundle.name@@-@@WOPort@@.log log4j.appender.myMail.Subject=Log4jError (@@build.app.bundle.name@@ @@host@@ @@WOPort@@) Friday, September 3, 2010
  • 22. Common Dev/Deploy Properties Strategy Friday, September 3, 2010
  • 23. EOModel Connection Dictionary WebObjects Way Friday, September 3, 2010
  • 24. EOModel Connection Dictionary Wonder Way - Properties File: # For individual eomodels model.URL = jdbc:mysql://hostname/firstdatabase model.DBUser = firstuser model.DBPassword = firstpassword model.DBDriver = model.DBPlugin = # Global, or default where model entry not specified dbConnectURLGLOBAL = jdbc:mysql://hostname/nextdatabase dbConnectUserGLOBAL = nextuser dbConnectPasswordGLOBAL = nextpassword dbConnectDriverGLOBAL = dbConnectPluginGLOBAL = Wonder Way - WOMonitor Launch Arguments: -Dmodel.URL=”jdbc:mysql://localhost/database?useUnicode=true&characterEncoding=UTF-8” -Dmodel.DBUser=firstuser -Dmodel.DBPassword=firstpassword Friday, September 3, 2010
  • 25. ERXEC • EOEditingContext subclass • EOEditingContext ec = ERXEC.newEditingContext(); • supports automatic lock/unlock in R-R cycle • er.extensions.ERXEC.safeLocking=true • enabled by default for new Wonder projects • Calls ERXEnterpriseObject state transition will*/did* methods • Implemented by ERXGenericRecord Friday, September 3, 2010
  • 26. ERXEC Auto Lock/Unlock • Implicitly supported in Request-Response threads • ERXApplication._endRequest() ... which calls ... • ERXEC.unlockAllContextsForCurrentThread(); • Background threads are your responsibility! • Here is how to do it ... Friday, September 3, 2010
  • 27. Runnable lock handling public class MyTask implements Runnable { public void run() { ERXApplication._startRequest(); try { performTask(); } finally { ERXApplication._endRequest(); } } private void performTask() { EOEditingContext ec = ERXEC.newEditingContext(); ec.lock(); try { // Do some EOF stuff with the ec. } catch (Exception e) { // handle exception } finally { ec.unlock(); } } } Friday, September 3, 2010
  • 28. Callable lock handling public class MyTask implements Callable<MyResultClass> { public MyResultClass call() { ERXApplication._startRequest(); try { return performTask(); } finally { ERXApplication._endRequest(); } } private MyResultClass performTask() { EOEditingContext ec = ERXEC.newEditingContext(); ec.lock(); try { // Do some EOF stuff with the ec. } catch (Exception e) { // handle exception } finally { ec.unlock(); } return myResult; } } Friday, September 3, 2010
  • 29. Passing Objects to a Thread public WOActionResults shuffleStudioAction() { Studio studio = selectedStudio(); EOGlobalID studioGid = (EOGlobalID) ERXEOControlUtilities.convertEOtoGID(studio); ProcessStudioTask task = new ProcessStudioTask(studioGid); MyExecutorServices.executorService().execute(task); return null; } Friday, September 3, 2010
  • 30. Thread Hydrates EO public class ProcessStudioTask extends ERXRunnable { private final EOGlobalID _studioGlobalID; public ProcessStudioTask(EOGlobalID studioGlobalID) { _studioGlobalID = studioGlobalID; } @Override public void _run() { EOEditingContext ec = ERXEC.newEditingContext(); ec.lock(); try { Studio studio = (Studio) ERXEOControlUtilities.convertGIDtoEO(ec, _studioGlobalID); } catch (Exception e) { // Handle error } finally { ec.unlock(); } } } Friday, September 3, 2010
  • 31. ERPrototypes • DEMO Friday, September 3, 2010
  • 32. Overriding Prototypes • ERXModel and ERXModelGroup • Allow “over-riding” of prototypes based on prototype entity naming conventions • Feature configured in system Properties: er.extensions.ERXModelGroup.modelClassName = com.webobjects.eoaccess.ERXModel er.extensions.ERXModel.useExtendedPrototypes = true er.extensions.ERXModelGroup.flattenPrototypes = false Friday, September 3, 2010
  • 33. Prototypes Over-ride Order • From lowest to highest priority: • EOPrototypes • EO<adaptorName>Prototypes (Wonder has ‘Memory’ and ‘REST’ adaptor protypes) • EOJDBC<pluginName>Prototypes (Wonder database prototype names) • EOCustomPrototypes • EO<adaptorName>CustomPrototypes • EOJDBC<pluginName>CustomPrototypes • EO<modelName>Prototypes • EO<adaptorName><modelName>Prototypes • EOJDBC<pluginName><modelName>Prototypes Friday, September 3, 2010
  • 34. Override Prototypes • DEMO Friday, September 3, 2010
  • 35. Resources • http://wiki.objectstyle.org/confluence/display/WONDER/Home • http://projectwonder.blogspot.com/ • http://webobjects.mdimension.com/hudson/ • JavaDoc and Binaries • “Wonder53” = Wonder for WebObjects 5.3.3 • “Wonder54” = Wonder for WebObjects 5.4.3 • Mailing Lists • https://lists.sourceforge.net/lists/listinfo/wonder-disc • https://lists.sourceforge.net/lists/listinfo/wonder-cvs Friday, September 3, 2010
  • 36. Q&A Getting Start with Wonder WOWODC 2010 Friday, September 3, 2010