From: Thomas F. <tfo...@us...> - 2000-11-08 14:12:11
|
Update of /cvsroot/kuml/kuml/docs/developer/analysis/usecases In directory slayer.i.sourceforge.net:/tmp/cvs-serv1658 Added Files: README uc.dtd uc.xml uc2html.xsl Log Message: Added use case document --- NEW FILE --- This directory contains an XML based use case document for the kuml project. It consists of the following files : --uc.dtd the use case DTD --uc.xml the proposed use case document --uc2html.xsl an XSL stylesheet for creating an HTML version of the use case XML document. --README this readme If you want to add/modify use cases, edit uc.xml. Please look at uc.dtd first which contains some comments on the intended semantics of the different elements. To regenerate the HTML file you need the java version of the Xalan XSLT processor (http://xml.apache.org/xalan/index.html). The command line then is: >java org.apache.xalan.xslt.Process -in uc.xml -xsl uc2html.xsl After the processing there should be one index.html file and 1 html file per actor and use case. --- NEW FILE --- <?xml version="1.0" encoding="ISO-8859-1" ?> <!ELEMENT root ((actor|usecase)*) > <!-- A short description of an actor or use case for indices --> <!ELEMENT short (#PCDATA)> <!-- Long description of an actor or use case action--> <!ELEMENT description (#PCDATA|p)*> <!-- Matches to <p>...</p> in HTML --> <!ELEMENT p (#PCDATA)> <!-- ***************************************************** --> <!-- Actors --> <!-- ***************************************************** --> <!ELEMENT actor (short,description?) > <!ATTLIST actor id CDATA #REQUIRED name CDATA #REQUIRED > <!-- ***************************************************** --> <!-- Use Cases --> <!-- ***************************************************** --> <!-- A usecase. name & id should be clear. (optional) extend holds the id of an extension point --> <!ELEMENT usecase (actorref*,short,(description|step*)) > <!ATTLIST usecase id CDATA #REQUIRED name CDATA #REQUIRED extend CDATA "" > <!-- A reference to an actor which uses the use case --> <!ELEMENT actorref EMPTY> <!ATTLIST actorref ref CDATA #REQUIRED > <!-- A single use case step --> <!ELEMENT step (#PCDATA|uses|xp)* > <!-- Stores reference to used(included) use case --> <!ELEMENT uses EMPTY > <!ATTLIST uses ref CDATA #REQUIRED > <!-- An extension point in a use case --> <!ELEMENT xp (#PCDATA) > <!ATTLIST xp id CDATA #REQUIRED > --- NEW FILE --- <?xml version="1.0" encoding="ISO-8859-1" ?> <!DOCTYPE root SYSTEM "uc.dtd"> <root> <!--**********************--> <!-- Actors of the system --> <!--**********************--> <actor id="1" name="User"> <short>A user of the GUI program</short> <description>This is a general user of the GUI program. In a generalization hierarchy it would be the root element for actors which interact with the GUI </description> </actor> <actor id="2" name="Project Administrator"> <short>A project administrator which uses the GUI</short> <description> <p>The user which fires up a project, gives it a name and administers the project team.</p> <p>For doing that he has some extra rights in the system</p> </description> </actor> <actor id="3" name="Developer"> <short>A Software Developer</short> </actor> <actor id="4" name="Analyst"> <short>An Analyst</short> </actor> <actor id="5" name="Designer"> <short>A Systems Designer</short> </actor> <!--*******************--> <!-- List of Use Cases --> <!--*******************--> <usecase id="uc1" name="New Project"> <actorref ref="2"/> <short>Create an empty project</short> <step>system creates empty project in memory</step> <step>system adapts UI</step> </usecase> <usecase id="uc2" name="Load Project"> <actorref ref="1"/> <short>Load a project from file</short> <step><xp id="xp3">Current project is modified but not saved</xp></step> <step>System prompts for filename</step> <step>User enters filename</step> <step>System creates project in memory with information from file</step> </usecase> <usecase id="uc3" name="Save Project"> <actorref ref="1"/> <short>Save a project to file</short> <step><xp id="xp1">Project not named yet</xp></step> <step><xp id="xp2">Project not modified</xp></step> <step>System saves modified model parts to file</step> </usecase> <usecase id="uc4" name="Save Project As"> <actorref ref="1"/> <short>Save a project under new name</short> <step>System prompts for project file name</step> <step>User enters filename</step> <step>System saves memory model to file</step> </usecase> <usecase id="uc5" name="Close Project"> <actorref ref="1"/> <short>Close the current project</short> <step><xp id="xp3">Project is modified but not saved</xp></step> <step>system discards model in memory</step> <step>system adapts UI</step> </usecase> <usecase id="uc6" name="Close Modified Project" extend="xp3"> <short>Close a modified but not saved project</short> <step>systems warns user that project is not saved yet and provides yes/no decision to save the project</step> <step>If user chooses 'yes' <uses ref="uc3"/></step> </usecase> <usecase id="uc7" name="Exit Program"> <actorref ref="1"/> <short>Exit the GUI program</short> <step><uses ref="uc5"/></step> <step>system stores persistent configuration information</step> <step>system exits with exitcode 0</step> </usecase> <usecase id="uc8" name="Add Diagram"> <actorref ref="1"/> <short>Add a new diagram to the model</short> <step>User selects a classifier to put diagram in</step> <step>System prompts for diagram type</step> <step>user defines diagram type</step> <step>system creates empty diagram as child of the selected classifier</step> <step>system makes new diagram current and adapts the UI</step> </usecase> </root> --- NEW FILE --- <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:xalan="org.apache.xalan.xslt.extensions.Redirect" extension-element-prefixes="xalan" > <xsl:output method="html"/> <xsl:template match="/"> <!-- create index file --> <xsl:message>Writing index.html</xsl:message> <xalan:write file="index.html"> <html> <head></head> <body bgcolor="#ffffff" link="#8B0000" vlink="#3662B4"> <h1>Use Case Documentation for kUML</h1> <h3>Actors</h3> <table bgcolor="#cccccc" cellpadding="3" cellspacing="1" width="100%"> <tr bgcolor="#aaaaaa"> <th>id</th><th>name</th><th>description</th> </tr> <xsl:apply-templates select="//actor" mode="index"> <xsl:sort select="@name"/> </xsl:apply-templates> </table> <h3>Use Cases</h3> <table bgcolor="#cccccc" cellpadding="3" cellspacing="1" width="100%"> <tr bgcolor="#aaaaaa"> <th>id</th><th>name</th><th>description</th><th>type</th> </tr> <xsl:apply-templates select="//usecase" mode="index"> <xsl:sort select="not(actorref)" /> <xsl:sort select="@name"/> </xsl:apply-templates> </table> </body></html> </xalan:write> <xsl:message>Done</xsl:message> <!-- Create single files for use cases and actors --> <xsl:apply-templates mode="file"/> </xsl:template> <xsl:template match="actor" mode="index"> <xsl:variable name="filename" select="concat('actor',@id,'.html')"/> <tr> <td><xsl:value-of select="@id"/></td> <td><a href="{$filename}"><xsl:value-of select="@name"/></a></td> <td><xsl:apply-templates select="short"/></td> </tr> </xsl:template> <xsl:template match="actor" mode="file"> <xsl:variable name="filename" select="concat('actor',@id,'.html')"/> <xsl:message>Writing <xsl:value-of select="$filename"/></xsl:message> <xalan:write file="{$filename}"> <html><head></head> <body bgcolor="#ffffff" link="#8B0000" vlink="#3662B4"> <p><a href="index.html">Index</a></p> <h1><xsl:value-of select="@id"/> - <xsl:value-of select="@name"/></h1> <xsl:choose> <xsl:when test="description"> <xsl:apply-templates select="description"/> </xsl:when> <xsl:otherwise> <xsl:apply-templates select="short"/> </xsl:otherwise> </xsl:choose> </body> </html> </xalan:write> <xsl:message>Done</xsl:message> </xsl:template> <xsl:template match="usecase" mode="index"> <xsl:variable name="filename" select="concat('uc',@id,'.html')"/> <tr> <td><xsl:value-of select="@id"/></td> <td><a href="{$filename}"><xsl:value-of select="@name"/></a></td> <td><xsl:apply-templates select="short"/></td> <xsl:choose> <xsl:when test="actorref"> <td>primary</td> </xsl:when> <xsl:otherwise> <td>secondary</td> </xsl:otherwise> </xsl:choose> </tr> </xsl:template> <xsl:template match="usecase" mode="file"> <xsl:variable name="filename" select="concat('uc',@id,'.html')"/> <xsl:message>Writing <xsl:value-of select="$filename"/></xsl:message> <xalan:write file="{$filename}"> <html><head></head> <body bgcolor="#ffffff" link="#8B0000" vlink="#3662B4"> <p><a href="index.html">Index</a></p> <h1><xsl:value-of select="@id"/> - <xsl:value-of select="@name"/></h1> <xsl:if test="actorref"> <h4>Actors involved</h4> <table> <xsl:apply-templates select="actorref"/> </table> </xsl:if> <xsl:if test="not(@extend='')"> Replace extension point <b><xsl:value-of select="@extend"/></b> of extended use case with </xsl:if> <xsl:choose> <xsl:when test="description"> <xsl:apply-templates select="description"/> </xsl:when> <xsl:when test="step"> <h4>Sequence</h4> <table bgcolor="#cccccc" cellpadding="3" cellspacing="1"> <xsl:apply-templates select="step"/> </table> </xsl:when> </xsl:choose> </body> </html> </xalan:write> <xsl:message>Done</xsl:message> </xsl:template> <xsl:template match="step"> <tr><td><xsl:value-of select="position(.)"/>.</td> <td><xsl:apply-templates/></td></tr> </xsl:template> <xsl:template match="uses"> <xsl:variable name="filename" select="concat('uc',@ref,'.html')"/> <xsl:variable name="ucref" select="@ref"/> «uses» <a href="{$filename}"><xsl:value-of select="//usecase[@id=$ucref]/@name"/></a> </xsl:template> <xsl:template match="xp"> <b>Extension Point <xsl:value-of select="@id"/>: </b> <xsl:apply-templates/> </xsl:template> <xsl:template match="actorref"> <xsl:variable name="acref" select="@ref"/> <xsl:apply-templates select="//actor[@id=$acref]" mode="index"/> </xsl:template> <xsl:template match="description"> <h4>Description</h4> <xsl:apply-templates/> </xsl:template> <xsl:template match="p"> <p><xsl:value-of select="."/></p> </xsl:template> </xsl:stylesheet> |