build by design for plone - lmu

Post on 11-Apr-2022

1 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

ArchGenXMLBuild by Design

for Plone

Richard Amerman7 Tech NW

www.7technw.com

Who am I?

● Open Source Advocate● Plone, Asterisk, LEAF

● Plone/Asterisk Developer/Integrator● Owner of 7 Tech Northwest● Plone Trainer● Idealist

Overview

● What is this all about?● What are the pieces?

– Archetypes– UML– ArchGenXML

● Why would I use this?● How do I use this?● Where are things going in the future?

What is this all about?

● RAD (Rapid Application Development)

● For the un-initiated– Generating a new product for Plone from a drawing

● For the converted– Generating an Archetypes based Plone product

from a UML diagram

What are the Pieces?

● Archetypes● UML (Universal Modeling Language)● ArchGenXML

What is Archetypes?

● Framework for developing Plone products– Automatically creates view and edit pages– Maintains unique object IDs– Creates references between objects

Archetypes framework● Field validation● Standard security setup● Alternate storage options● Data transformation capabilities

Archetypes Architecture● Class

– Schema● Field

–Widget● Field

–Widget● ...

– Method– Method

Archetypes Example: rogue

schema=Schema(( StringField('first_name'), StringField('last_name'), ImageField('photo'),))

class Rogue(BaseContent) schema = BaseSchema + schema

registerType(Rogue,PROJECTNAME)

Archetypes: Widgets

schema=Schema(( StringField('first_name', widget=StringWidget( label='First Name', size=15) ), StringField('last_name', widget=StringWidget( label='Last Name', size=15) ), ImageField('photo', widget=ImageWidget( label='Headshot', show_content_type=True) ),))

What is UML?

● UML = Uniform Modeling Language● Standard widely-adopted graphical language● Describes the artifacts of software systems● Focus on conceptual representations

Rogue defined in UML

Poseidon for UML

More Complex UML Model

UML Editors

● Recomended– Poseidon (Commercial) (by Gentleware)– ArgoUML (Open Source)

● Others– ObjectDomain (Commercial) – Powerdesigner (Commercial) (by Sybase)– Umbrello (Open Source) (KDE)

What is ArchGenXML?

● Command line utility● Auto-generates code from a UML model● Produces well formed Archetypes based Plone

products ready to install● No round-trip support yet● Custom code is preserved upon regeneration

Why Would I Use This?

● Your cool● You like pictures● 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

Why Would I Use This?Continued

● 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 patterndriven software development

● You want to maintain your project in the future without getting a headache

● You want to have productive discussions with your clients about a product without creating extra documentation

How Would I Use This?

● Design and maintain product as model● Generate product using ArchGenXML● Add additional code to safe areas of generated

items● Use model as the center of discussion about

the product

UML to Archetypesusing ArchGenXML

schema=Schema(( StringField('first_name', widget=StringWidget( label='First Name', size=15) ), StringField('last_name', widget=StringWidget( label='Last Name', size=15) ), ImageField('photo', widget=ImageWidget( label='Headshot', show_content_type=True) ),))

UML speak to AT speak

● package● class● operation● attribute● tagged value

● product● content type● Method● field● property

In practice1)Create UML model to describe your type

2)Export your model as XMI

3)Run the ArchGenXML script

4)Restart Zope to install product in Zope

5)Install the newly generated product in Plone site

Generated Files/Folders

[mytype].py

● Inserts documentation● Placeholders for custom code● i18n message ids● Using generate_source.sh

– Inserts author information– Creates i18n msg catalog .pot file– strips HTML from doc strings

Tagged Values

● Set properties on object– Widget– Required– Default– Vocabulary– Searchable– Accessor– allowed_types– multiValued

Tagged Values: Example

Variants of Content Types

● Simple Classes● Folderish Classes● Portal Tools● Packages● Advanced

– Abstract mixin classes– Stub classes– Interfaces

Workflow Generation

● Created using UML state diagram● Attached to a single class● Consists of the following:

– Initial State– States– Transitions (an arrow connecting two states)

Workflow: Additional Items

● Transition guards● Permissions● Workflow actions● Worklists

Workflow: Example State Diagram

Custom Template Generation

● Custom Templates– Add method with 'view' stereotype

● Should follow [mytype]_view naming convention● Example: <<view>>+rogue_view{}:● Produces sparse template

● Portlet Generation– Add method with 'portlet' stereotype

● Should follow portlet_[myportlet] naming convention● Example: <<portlet>>+rogue_view{}:● Produces nice template

Other Items

● Methods– Added as methods to a class in the model– Should not have a return

● Actions– Added as methods to a class in the model

● Forms– Added as methods to a class in the model– Generates empty form-controller template

Third Party Product Integration

● ATVocabularyManager– Dynamic Vocabularies

● Relations– Support for Relations Product (complex references)

● CMFMember– Custom member types– Replace existing Plone member

CMFMember Integration

uml.joelburton.com● http://uml.joelburton.com/● An experimental web service for converting UML diagrams to Archetypes products.

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

Where are Things Going in the Future?

● ArchGenXML– Still actively developed (more than Genesis)– Will be updated for Plone 2.5

● Genesis– New replacement for ArchGenXML– Still being developed

Summary

● What is this all about?● What are the pieces?

– Archetypes– UML– ArchGenXML

● Why would I use this?● How do I use this?● Where are things going in the future?

Missing Pieces

● Deriving/Subclassing● Command Line Switches● Custom Validation● Custom Widgets● Imports● Methods and Actions● Unit testing

Resources● ArchGenXML product page

– http://plone.org/products/archgenxml

● ArchGenXML getting started tutorial by Jens Klein

– http://plone.org/documentation/tutorial/archgenxml-getting-started

● Archetypes: Customizing Plone in 60 seconds (PDF) by Andy McKay

– http://www.enfoldsystems.com/About/Talks/archetypes.pdf

● Archetypes Quick Reference Manual by Maik Röder

– http://plone.org/products/archetypes/documentation/manual/quickref

ArchGenXML Acknowledgements

● Philipp Auersperg (Blue Dynamics)● Jens Klein (jensens)● Martin Aspeli (optilude)● Reinout van Rees (reinout)● Joel Burton● ArchGenXML Dev Team● Plone community

Special Acknowledgement

Special Thanks!This presentation was inspired by and barowed from a

great presentation by Nate Aune:● http://www.jazkarta.com/presentations/ArchGenXML-UML-talk.pdf

● Nate Aune (natea)– www.jazkarta.com

– natea@jazkarta.com

top related