ArchGenXML / UML
    and Plone
   Plone Regional Symposium
       New Orleans, LA
          July 22, 2005

          Nate ...
Who am I?

• Developer and owner, Jazkarta Consulting
  (www.jazkarta.com)

• Musician - saxophonist and composer
  (www.n...
Overview
• What is Archetypes?
• What is UML?
• What is ArchGenXML?
• Build a model using UML
• Transform the model into a...
What is Archetypes?

• Framework for developing Plone products
  • Automatically creates view and edit pages
  • Maintains...
Archetypes framework

• Field validation
• Standard security setup
• Alternate storage options
• Data transformation capab...
Archetypes
        architecture
• Schema
  • Field
   • Widget
  • Field
   • Widget
  • ...
Example Archetype:
      Artist
schema= Schema((
     StringField('title'),
     ImageField('photo'),
     LinesField('ins...
Widgets
schema= Schema((
     StringField('title',
         widget=StringWidget(
                  label=’Artist name’,
  ...
What is UML?

• UML = Uniform Modeling Language
• Standard widely-adopted graphical language
• Describes the artifacts of ...
Artist:
Described in UML
Poseidon UML tool
What is ArchGenXML?

• Command line utility
• Auto-generates code from a UML model
• No round-trip support yet
• Custom co...
Why use ArchGenXML?
      (part 1)
• You want to save time
• You are a lazy programmer
• You don’t like to reinvent the wh...
Why use ArchGenXML?
      (part 2)
• You have big projects with many different
  content types

• You want or need a well-...
UML to Archetypes
using ArchGenXML
            schema= Schema((
                     StringField('title',
                ...
UML speak to AT speak
                 • product
• package

                 • content type
• class

                 • me...
In practice

• 1) Save your model to the Products dir
• 2) Run the ArchGenXML script
• 3) Restart Zope
• 4) Install the ne...
Running the script
$ cd /var/local/zope/instance1/Products
$ ArchGenXML/ArchGenXML.py -o ArtistSite ArtistSite.zuml
ArchGe...
ArtistSite product dir
$ ls ArtistSite
Artist.py       __init__.py   i18n          skins
Extensions      config.py     ref...
Artist.py
• Inserts documentation
• Placeholders for custom code
• i18n message ids
• Using ArtistSite/model/generate_sour...
Add new artist
Edit artist form
View artist
Static vocabulary




• Define a static vocabulary of instruments
Dynamic vocabulary




Use ATVocabularyManager to manage list of instruments
Dynamic vocab cont...
Containment




    Use the solid rhomb to make a strict containment
‘Artist’ instances can only be added to an ‘Artists’ ...
Artist container
Override base class




The artists folder will get large, so make it a BTreeFolder
References


           Create a
       direct association

           results in:

        Reference field
       group to...
Group
edit form




   Group is
  associated
  with artists
Reference Browser Widget
        as default
Configure browser widget

             Select the end point




                 Make multivalued
                Specify r...
Adding references
Back references
Back
references




   Groups that
 artist belongs to
Stereotypes




 Add the ‘member’ stereotype to tell
ArchGenXML to subclass CMFMember
Registration
   form

• SiteMember is installed
• Replaces default member
• Easy way to create new
  member types
PloneMall

• Example of a sophisticated e-commerce
     framework built using UML

• See the UML model here:
•   http://ww...
What I didn’t cover
• Methods
• Stereotypes
  • actions, portal_tool, abstract, stub,
     ordered

• Generalization (Inte...
Acknowledgements
• Philipp Auersperg (Blue Dynamics)
• Jens Klein (jensens)
• Martin Aspeli (optilude)
• Fabiano Weimar do...
Links
•   ArchGenXML presentation - http://www.jazkarta.com/presentations/archgenxml-presentation

•   ArchGenXML product ...
ArchGenXML / UML and Plone
Upcoming SlideShare
Loading in...5
×

ArchGenXML / UML and Plone

2,403

Published 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 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)

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
2,403
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
67
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

ArchGenXML / UML and Plone

  1. 1. ArchGenXML / UML and Plone Plone Regional Symposium New Orleans, LA July 22, 2005 Nate Aune Jazkarta Consulting www.jazkarta.com
  2. 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. 3. Overview • What is Archetypes? • What is UML? • What is ArchGenXML? • Build a model using UML • Transform the model into a Plone • Questions?
  4. 4. What is Archetypes? • Framework for developing Plone products • Automatically creates view and edit pages • Maintains unique object IDs • Creates references between objects
  5. 5. Archetypes framework • Field validation • Standard security setup • Alternate storage options • Data transformation capabilities
  6. 6. Archetypes architecture • Schema • Field • Widget • Field • Widget • ...
  7. 7. Example Archetype: Artist schema= Schema(( StringField('title'), ImageField('photo'), LinesField('instrument'), )) class Artist(BaseContent) schema = BaseSchema + schema registerType(Artist,PROJECTNAME)
  8. 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. 9. What is UML? • UML = Uniform Modeling Language • Standard widely-adopted graphical language • Describes the artifacts of software systems • Focus on conceptual representations
  10. 10. Artist: Described in UML
  11. 11. Poseidon UML tool
  12. 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. 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. 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. 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. 16. UML speak to AT speak • product • package • content type • class • method • operation • field • attribute • property • tagged value
  17. 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. 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. 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. 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. 21. Add new artist
  22. 22. Edit artist form
  23. 23. View artist
  24. 24. Static vocabulary • Define a static vocabulary of instruments
  25. 25. Dynamic vocabulary Use ATVocabularyManager to manage list of instruments
  26. 26. Dynamic vocab cont...
  27. 27. Containment Use the solid rhomb to make a strict containment ‘Artist’ instances can only be added to an ‘Artists’ instance
  28. 28. Artist container
  29. 29. Override base class The artists folder will get large, so make it a BTreeFolder
  30. 30. References Create a direct association results in: Reference field group to artist(s)
  31. 31. Group edit form Group is associated with artists
  32. 32. Reference Browser Widget as default
  33. 33. Configure browser widget Select the end point Make multivalued Specify relationship Define query
  34. 34. Adding references
  35. 35. Back references
  36. 36. Back references Groups that artist belongs to
  37. 37. Stereotypes Add the ‘member’ stereotype to tell ArchGenXML to subclass CMFMember
  38. 38. Registration form • SiteMember is installed • Replaces default member • Easy way to create new member types
  39. 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. 40. What I didn’t cover • Methods • Stereotypes • actions, portal_tool, abstract, stub, ordered • Generalization (Interfaces) • Workflow • Unit testing
  41. 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. 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
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×