ArchGenXML / UML and Plone

  • 2,356 views
Uploaded on

July 22, 2005. Using the Poseidon UML modeling tool and ArchGenXML, this presentation shows how to create a Plone product in a matter of minutes without writing a single line of code. The example used …

July 22, 2005. Using the Poseidon UML modeling tool and ArchGenXML, this presentation shows how to create a Plone product in a matter of minutes without writing a single line of code. The example used is ArtistSite, a model of artists, bands and recordings which is then transformed into a Plone product. Presented at the North America Plone Symposium in New Orleans, LA. (7/22/2005)

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
2,356
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
66
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. ArchGenXML / UML and Plone Plone Regional Symposium New Orleans, LA July 22, 2005 Nate Aune Jazkarta Consulting www.jazkarta.com
  • 2. Who am I? • Developer and owner, Jazkarta Consulting (www.jazkarta.com) • Musician - saxophonist and composer (www.nateaune.com/music/) • Founder of Plone4Artists project (www.plone4artists.org)
  • 3. Overview • What is Archetypes? • What is UML? • What is ArchGenXML? • Build a model using UML • Transform the model into a Plone • Questions?
  • 4. What is Archetypes? • Framework for developing Plone products • Automatically creates view and edit pages • Maintains unique object IDs • Creates references between objects
  • 5. Archetypes framework • Field validation • Standard security setup • Alternate storage options • Data transformation capabilities
  • 6. Archetypes architecture • Schema • Field • Widget • Field • Widget • ...
  • 7. Example Archetype: Artist schema= Schema(( StringField('title'), ImageField('photo'), LinesField('instrument'), )) class Artist(BaseContent) schema = BaseSchema + schema registerType(Artist,PROJECTNAME)
  • 8. Widgets schema= Schema(( StringField('title', widget=StringWidget( label=’Artist name’, size=20), ), ImageField('photo', widget=ImageWidget( label=’Headshot’), ), LinesField('instrument', widget=MultiSelectionWidget( label=’Instruments’), multiValue=1, ), ))
  • 9. What is UML? • UML = Uniform Modeling Language • Standard widely-adopted graphical language • Describes the artifacts of software systems • Focus on conceptual representations
  • 10. Artist: Described in UML
  • 11. Poseidon UML tool
  • 12. What is ArchGenXML? • Command line utility • Auto-generates code from a UML model • No round-trip support yet • Custom code is preserved upon regeneration
  • 13. Why use ArchGenXML? (part 1) • You want to save time • You are a lazy programmer • You don’t like to reinvent the wheel • You don’t like copying and pasting code • You make heavy use of references and interfaces
  • 14. Why use ArchGenXML? (part 2) • You have big projects with many different content types • You want or need a well-documented interface to your product • You like structured model- and pattern- driven software development • You want to maintain your project in the future without getting a headache
  • 15. UML to Archetypes using ArchGenXML schema= Schema(( StringField('title', widget=StringWidget( label=’Artist name’ size=20), ), ImageField('photo', widget=ImageWidget( label=’Headshot’), ), LinesField('instrument', widget=MultiSelectionWidget( label=’Instruments’), multiValue=1, ), ))
  • 16. UML speak to AT speak • product • package • content type • class • method • operation • field • attribute • property • tagged value
  • 17. In practice • 1) Save your model to the Products dir • 2) Run the ArchGenXML script • 3) Restart Zope • 4) Install the newly generated product svn co svn://svn.plone4artists.org/trunk/ArtistSite
  • 18. Running the script $ cd /var/local/zope/instance1/Products $ ArchGenXML/ArchGenXML.py -o ArtistSite ArtistSite.zuml ArchGenXML 1.4 devel 4 (c) 2003 BlueDynamics GmbH, under GNU General Public License 2.0 or later set outfilename [string] to ArtistSite Parsing... =============== opening zargo XMI version: 1.2 using xmi 1.2+ parser outfile: ArtistSite Generating... ============== method bodies will be preserved >>> Starting new Product: ArtistSite Generating class: Artist $
  • 19. ArtistSite product dir $ ls ArtistSite Artist.py __init__.py i18n skins Extensions config.py refresh.txt version.txt $ Restart Zope Install product using QuickInstaller
  • 20. Artist.py • Inserts documentation • Placeholders for custom code • i18n message ids • Using ArtistSite/model/generate_source.sh • Inserts author information • Creates i18n msg catalog .pot file • strips HTML from doc strings
  • 21. Add new artist
  • 22. Edit artist form
  • 23. View artist
  • 24. Static vocabulary • Define a static vocabulary of instruments
  • 25. Dynamic vocabulary Use ATVocabularyManager to manage list of instruments
  • 26. Dynamic vocab cont...
  • 27. Containment Use the solid rhomb to make a strict containment ‘Artist’ instances can only be added to an ‘Artists’ instance
  • 28. Artist container
  • 29. Override base class The artists folder will get large, so make it a BTreeFolder
  • 30. References Create a direct association results in: Reference field group to artist(s)
  • 31. Group edit form Group is associated with artists
  • 32. Reference Browser Widget as default
  • 33. Configure browser widget Select the end point Make multivalued Specify relationship Define query
  • 34. Adding references
  • 35. Back references
  • 36. Back references Groups that artist belongs to
  • 37. Stereotypes Add the ‘member’ stereotype to tell ArchGenXML to subclass CMFMember
  • 38. Registration form • SiteMember is installed • Replaces default member • Easy way to create new member types
  • 39. PloneMall • Example of a sophisticated e-commerce framework built using UML • See the UML model here: • http://www.plonemall.com/uml/UML-beta2.png/image_view_fullscreen
  • 40. What I didn’t cover • Methods • Stereotypes • actions, portal_tool, abstract, stub, ordered • Generalization (Interfaces) • Workflow • Unit testing
  • 41. Acknowledgements • Philipp Auersperg (Blue Dynamics) • Jens Klein (jensens) • Martin Aspeli (optilude) • Fabiano Weimar dos Santos (xiru) • Bernie Snizek (DrZoltron) • Alan Runyan and Enfold Systems • Plone community
  • 42. Links • ArchGenXML presentation - http://www.jazkarta.com/presentations/archgenxml-presentation • ArchGenXML product page - http://plone.org/products/archgenxml • ArchGenXML getting started tutorial by Jens Klein • http://plone.org/documentation/tutorial/archgenxml-getting-started • ArchGenXML manual (with screenshots) • http://plone.org/documentation/archetypes/archgenxml-manual • Intro to Archetypes by Sidnei da Silva, published on ZopeMag.com • http://www.zopemag.com/Issue006/Section_Articles/article_IntroToArchteypes.html • Archetypes: Customizing Plone in 60 seconds (PDF) by Andy McKay • http://www.enfoldsystems.com/About/Talks/archetypes.pdf • Archetypes Fields Quick Reference by Maik Röder • http://plone.org/documentation/archetypes/arch_field_quickref_1_3_1 • Archetypes Widgets Quick Reference by Maik Röder • http://plone.org/documentation/archetypes/arch_widget_quickref_1_3_1