building an artist community website with archgenxml / poseidon
DESCRIPTION
Sept. 21, 2005. Talk given at Plone Conference 2005 in Vienna.TRANSCRIPT
www.jazkarta.com 866.864.4918Building an Artist Community Website (9/21/05)
Building an artist community website
with Poseidon / ArchGenXML / Plone
Nate AunePlone Conference
Vienna, AustriaSept. 21, 2005
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
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)
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
Overview• What is Archetypes?
• What is UML?
• What is ArchGenXML?
• Build a model using UML
• Transform the model into a Plone product
• Multimedia
• Questions?
jazkarta.com/presentations/artist-community.pdf
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
What is Archetypes?
• Framework for developing Plone products
• Automatically creates view and edit pages
• Maintains unique object IDs
• Creates references between objects
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
Archetypes framework
• Field validation
• Standard security setup
• Alternate storage options
• Data transformation capabilities
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
Archetypes schemas
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
Example Archetype: Artist
schema= Schema(( StringField('title'), ImageField('photo'), LinesField('instrument'),))
class Artist(BaseContent) schema = BaseSchema + schema
registerType(Artist,PROJECTNAME)
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
Widgetsschema= Schema(( StringField('title', widget=StringWidget( label=’Artist name’, size=20), ), ImageField('photo', widget=ImageWidget( label=’Headshot’), ), LinesField('instrument', widget=MultiSelectionWidget( label=’Instruments’), multiValue=1, ),))
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
What is UML?
• UML = Uniform Modeling Language
• Standard widely-adopted graphical language
• Describes the artifacts of software systems
• Focus on conceptual representations
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
Artist: Described in UML
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
Poseidon UML tool
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
What is ArchGenXML?
• Command line utility
• Auto-generates code from a UML model
• No round-trip support yet
• Custom code is preserved upon regeneration
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
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
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
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
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
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, ),))
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
UML speak to AT speak• product
• content type
• method
• field
• property
• subclass, view
• package
• class
• operation
• attribute
• tagged value
• stereotype
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
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
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
Running the script$ cd /var/local/zope/instance1/Products$ ArchGenXML/ArchGenXML.py -o ArtistSite ArtistSite.zumlArchGenXML 1.4 devel 4(c) 2003 BlueDynamics GmbH, under GNU General Public License 2.0 or later
set outfilename [string] to ArtistSiteParsing...===============opening zargoXMI version: 1.2using xmi 1.2+ parseroutfile: ArtistSiteGenerating...==============method bodies will be preserved>>> Starting new Product: ArtistSite Generating class: Artist$
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
ArtistSite product dir
$ ls Products/ArtistSiteArtist.py __init__.py i18n skinsExtensions config.py refresh.txt version.txt$
Restart ZopeInstall product using QuickInstaller
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
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
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
Add new artist
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
Edit artist form
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
View artist
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
Static vocabulary
• Define a static vocabulary of instruments
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
Dynamic vocabulary
Use ATVocabularyManager to manage list of instruments
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
Dynamic vocab cont...
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
Containment
Use the solid rhomb to make a strict containment‘Artist’ instances can only be added to an ‘Artists’ instance
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
Artist container
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
Override base class
The artists folder will get large, so make it a BTreeFolder
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
Stereotype <<large>>
• Select the class
• Click on the stereotypes button (...)
• Select the ‘stub’ stereotype
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
References
Create a direct association
results in:
Reference fieldgroup to artist(s)
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
Group edit form
Group is associated with artists
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
Reference Browser Widget as default
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
Configure browser widget
Select the end point
Make multivaluedSpecify relationship
Define query
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
Adding references
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
Back references
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
Backreferences
Groups that artist belongs to
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
Stereotype <<member>>
Add the ‘member’ stereotype to tell ArchGenXML to subclass CMFMember
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
Registration form
• SiteMember is installed
• Replaces default member
• Easy way to create new member types
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
Stereotype <<stub>>
• Add content types to your model without having them get generated
• Makes it easy to integrate 3rd party products into your custom product
• Adds allowed_content_types to your class
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
<<stub>>
• Select the class
• Click on the stereotypes button (...)
• Select the ‘stub’ stereotype
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
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
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
SiteEvent : a custom event type
• Subclass ATEvent and add your own fields
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
Associate with venue
• Make a:
• Venues container
• Venue content type
• Direct association from SiteEvent to Venue
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
What I didn’t cover• Methods
• Additional Stereotypes
• actions, portal_tool, abstract, ordered
• Generalization (Interfaces)
• Workflow
• Unit testing
• Documentation
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
Acknowledgements• Philipp Auersperg (Blue Dynamics)
• Jens Klein (jensens)
• Martin Aspeli (optilude)
• Fabiano Weimar dos Santos (xiru)
• Bernie Snizek (DrZoltron)
• Blue Dynamics - conference organizers
• Plone communityGo to Jens and Phil’s ArchGenXML talk!
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
Links• How to subclass ATContentType in 7 minutes
•http://plone.org/documentation/how-to/subclass-atct-using-archgenxml• 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
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
Multimedia in Plone
• Multimedia = audio, video, photo, etc.
• Currently limited built-in support for these media file types
• No definitive multimedia package for Plone
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
Existing 3rd party products• Audio
• ATAudio, Plodcasting, PloneRadio
• Video
• ATVideo, lilix.movie, Parwin
• Photo
• ATPhoto, CMFPhoto, ZPhotoSlides
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
PloneMultimedia• PloneMultimedia
• ATAudio
• ATVideo
• ATPhoto
• Common ‘base’ products in which to build custom multimedia products
• Add-on product for ATContentTypes
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
Subclass ATCT• ATAudio - subclass ATFile
• inherit methods: cleanupFilename, download, getIcon
• validators: checkFileSize
• ATPhoto - subclass ATImage
• getEXIF, ATFolder template-mixin (Display menu)
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
Upload audio file
• Type in a description
• Upload file
• Click ‘Next’ button
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
Metadata
• ATAudio extracts metadata
• Auto-populates form fields
• Extensible genres
• Upload album art
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
Audio view page
• Embedded player
• Play in popup window
• Stream to external media player
• Download to FS
Drag-n-drop MP3s
Drag-n-drop MP3s to WebDAV folder MP3s appear in recordings folder
Metadata extracted
Song Metadata (from iTunes)
ATAudio auto-extracts ID3 tags
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
CD view page
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
Flash player
• Flash popup player
• Uses XSPF playlist
• Jump forward/backward through tracks
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
Demo
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
Thanks to...
• ATAudio team
• Volodymr Cherepanyak (chervol)
• Rocky Burt (RockyBurt)
• Salim Fadhley (_salimfadhley)
• jenner (for adding Flash player support)
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
Multimedia sprint
• This thursday and friday at the Hotel Academia!
• http://plone.org/events/sprints/multimedia
• Ask Nate for a map to the hotel
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
Multimedia Resources• http://plone.org/products/ataudio
• http://plone.org/products/plonemultimedia
• http://plone4artists.org
• Mailing list: [email protected] with subject “subscribe”
• Mailing list: [email protected] with subject “subscribe”
Building an Artist Community Website (9/21/05) www.jazkarta.com 866.864.4918
Questions?