July 24, 2006. The training materials for the Plone Magic Camp in Brooklyn, NY. This day-long course helps you get started with rapid application development using ArchGenXML and ArgoUML. We walk through an example of building an Artist and Group classes in ArgoUML, and auto-generate the Plone product code using ArchGenXML.
Call Girls In Noida 959961⊹3876 Independent Escort Service Noida
Developing for Plone using ArchGenXML / ArgoUML
1. Developing for Plone using
ArchGenXML / ArgoUML
Plone Magic Camp
Brooklyn, NY
July 24, 2006
Nate Aune
Jazkarta Consulting
www.jazkarta.com
2. Who am I?
• Founder and developer, Jazkarta Consulting
(www.jazkarta.com)
• Musician - saxophonist and composer
(www.nateaune.com/music/)
• Founder of Plone4Artists project
(www.plone4artists.org)
3. Agenda
• What is Archetypes?
• What is UML?
• What is ArchGenXML?
• Build a model using ArgoUML
• Transform the model into a Plone product
• 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
9. What is UML?
• UML = Uniform Modeling Language
• Standard widely-adopted graphical language
• Describes the artifacts of software systems
• Focus on conceptual representations
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
19. Install ArchGenXML
• Get PloneMagicCamp-bundle
$ svn co svn://svn.plone4artists.org/trunk/PloneMagicCamp-bundle
(* if you don’t have SVN, download the .zip file)
$ cd $INSTANCE/Products
$ ln -s /path/to/PloneMagicCamp-bundle/* .
$ cd i18ndude; sudo /path/to/python setup.py install
$ cd ../; ./getStripogram.sh
$ cd stripogram; sudo /path/to/python setup.py install
* If you don’t have SVN client, get the ZIP file.
$ wget http://www.jazkarta.com/PloneMagicCamp-bundle.zip
$ unzip PloneMagicCamp-bundle.zip
20. Install ArgoUML
• Use the pre-configured one that comes with the bundle
• --OR-- download from http://argouml.tigris.org
$ wget http://argouml-downloads.tigris.org/nonav/argouml-0.20/
ArgoUML-0.20.tar.gz
$ tar xvfz ArgoUML-0.20.tar.gz
$ cd ArgoUML-0.20
$ cp $INSTANCE_HOME/Products/ArchGenXML/argouml/argouml_profile.xmi .
$ cp argouml.sh argouml.sh.orig; vi argouml.sh
change line 48 to:
${JAVACMD} -Dargo.defaultModel=argouml_profile.xmi -jar $
{ARGO_HOME}/argouml-mdr.jar $*
$ sh argouml.sh (to launch ArgoUML)
--OR--
$ java -Dargo.defaultModel=argouml_profile.xmi -jar argouml-mdr.jar
27. Running the script
• Save project to $INSTANCE_HOME/Products/ArtistSite.zargo
$ cd $INSTANCE_HOME/Products
$ ArchGenXML/ArchGenXML.py -o ArtistSite ArtistSite.zargo
ArchGenXML Version 1.5.0 svn/devel
(c) 2003-2006 BlueDynamics, Austria, GNU General Public License 2.0
or later
INFO Parsing...
INFO Directory in which we're generating the files: 'ArtistSite'.
INFO Generating...
INFO Starting new Product: 'ArtistSite'.
INFO Generating package 'content'.
INFO Generating class 'Artist'.
$
28. ArtistSite product dir
$ cd $INSTANCE_HOME/Products/ArtistSite
$ ls
content __init__.py i18n skins
Extensions config.py refresh.txt version.txt
$ cd content
$ ls
__init__.py Artist.py
$ vi Artist.py
29. Inspect Artist.py
• Inserts documentation
• Placeholders for custom code
• i18n message ids
• Using ArtistSite/model/generate_source.sh
• inserts author information (ArtistSite.conf)
• creates i18n generated.pot file (i18ndude)
• strips HTML from doc strings (stripogram)
30. Add new artist
1. Restart Zope
2. Install ArtistSite using QuickInstaller
3. Add new Artist
33. Move model into product
• Close ArgoUML since we are going to move the file
$ cd $INSTANCE/Products
$ mkdir ArtistSite/model
$ mv ArtistSite.zargo ArtistSite/model
$ ArchGenXML/ArchGenXML.py --sample-config ArtistSite/model/
ArtistSite.conf
$ cp PloneMagicCamp-bundle/generate_source.sh ArtistSite/model/
34. Edit ArtistSite.conf
• Add your own author, email and copyright
[DOCUMENTATION]
strip-html: yes
author: Nate Aune
e-mail: natea (at) jazkarta (dot) com
copyright: Jazkarta
[GENERAL]
outfile: ArtistSite
36. Run generate_source.sh
$ cd $INSTANCE_HOME/Products
$ ArtistSite/model/generate_source.sh
ArchGenXML Version 1.5.0 svn/devel
(c) 2003-2006 BlueDynamics, Austria, GNU General Public License 2.0
or later
INFO Parsing...
INFO Directory in which we're generating the files: 'ArtistSite'.
INFO Generating...
INFO Starting new Product: 'ArtistSite'.
INFO Generating package 'content'.
INFO Generating class 'Artist'.
$
62. 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
63. What I didn’t cover
• Additional Stereotypes
• actions, portal_tool, abstract, stub,
ordered
• portlets, configlet, customization policy
• Generalization (Interfaces)
• Workflow
• Unit testing, doctests
64. 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
• PDF formatted: http://www.fraterdeus.com/downloads/ArchGenXML_PDF_0.2.1/view
• 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 Quick Reference by Maik Röder
• http://plone.org/products/archetypes/documentation/manual/quickref/referencemanual-all-pages
• Archetypes API
• http://api.plone.org/