Agenda
• Review Initial Draft of API• Tools and Libraries• Maven Overview• Code Conventions• How to Get Started
API Overview
• Establishes the foundation for the development effort by providing a contract for what a subsystem must provide functionally.– Validators – provide information on the validity of an incoming
document. More than one validator may be used on a specified document.
– Translators – convert a document from one input document format to an output format. More than one translator may be used to perform the conversion.
– Handlers – assemble the validators and translators to best handle a specified input document.
Core Contractclass System
contract::Document
- content: String- docType: DocumentType
+ Document(DocumentType, String)+ getContent() : String+ getDocType() : DocumentType+ toString() : String
«interface»contract::DocumentHandler
+ translate(Document, DocumentType) : Document+ validate(Document) : Collection<ValidationMessage>
«interface»contract::DocumentTranslator
+ translate(Document, DocumentType) : Document
«enumeration»contract::DocumentType
CDA CCD CIM
Attributes- code: String- name: String
~ DocumentType(String, String)+ getCode() : String+ getName() : String
«interface»contract::DocumentValidator
+ validate(Document) : Collection<ValidationMessage>
RuntimeException
contract::TranslationException
+ TranslationException()+ TranslationException(String)+ TranslationException(Throwable)+ TranslationException(String, Throwable)
RuntimeException
contract::ValidationException
+ ValidationException()+ ValidationException(String)+ ValidationException(Throwable)+ ValidationException(String, Throwable)
contract::ValidationMessage
- message: String- severity: Severity
+ getMessage() : String+ getSeverity() : Severity+ toString() : String+ ValidationMessage(Severity, String)
«enumeration»contract::ValidationMessage::Sev erity
ERROR WARN INFO
-severity
-docType
DocumentHandlerclass handlers
GenericDocumentHandler
- handlers: Map<String, DocumentHandler>- translators: Map<String, DocumentTranslator>- validators: Map<String, DocumentValidator>
+ setHandlers(Map<String, DocumentHandler>) : void+ setTranslators(Map<String, DocumentTranslator>) : void+ setValidators(Map<String, DocumentValidator>) : void+ translate(Document, DocumentType) : Document+ validate(Document) : Collection<ValidationMessage>
SimpleDocumentHandler
- translators: Map<String, DocumentTranslator>- validator: DocumentValidator
+ setTranslators(Map<String, DocumentTranslator>) : void+ setValidator(DocumentValidator) : void+ translate(Document, DocumentType) : Document+ validate(Document) : Collection<ValidationMessage>
«interface»contract::DocumentHandler
+ translate(Document, DocumentType) : Document+ validate(Document) : Collection<ValidationMessage>
DocumentValidatorclass v alidators
ChainedDocumentValidator
- continueOnError: boolean- validators: List<DocumentValidator>
- containsErrors(Collection<ValidationMessage>) : boolean+ setContinueOnError(boolean) : void+ setValidators(List<DocumentValidator>) : void+ validate(Document) : Collection<ValidationMessage>
SchematronDocumentValidator
- xsl: String
+ getXsl() : String+ setXsl(String) : void+ validate(Document) : Collection<ValidationMessage>
«interface»contract::DocumentValidator
+ validate(Document) : Collection<ValidationMessage>
DocumentTranslatorclass translators
ChainedDocumentTranslator
- translatorDestDocTypes: List<String>- translators: List<DocumentTranslator>
+ setTranslatorDestDocTypes(List<String>) : void+ setTranslators(List<DocumentTranslator>) : void+ translate(Document, DocumentType) : Document
XSLDocumentTranslator
- xsl: String
+ getXsl() : String+ setXsl(String) : void+ translate(Document, DocumentType) : Document
«interface»contract::DocumentTranslator
+ translate(Document, DocumentType) : Document
Tools and Libraries
• Libraries– Spring
• http://www.springsource.com/developer/spring“Spring is a popular and widely deployed open source framework that helps developers build high quality applications faster. Spring provides a consistent programming and configuration model that is well understood and used by millions of developers worldwide.“ – from springsource.com
– Maven• http://maven.apache.org
“Apache Maven is a software project management and comprehension tool. Based on the concept of a project object model (POM), Maven can manage a project's build, reporting and documentation from a central piece of information.” – from apache.org
– Saxon• http://saxon.sourceforge.net
The Saxon package is a collection of tools for processing XML documents. The main components are: an XSLT 1.0/2.0 processor, an XPath 2.0 processor, an XQuery 1.0 processor, and an XML Schema 1.0 processor.
– Schematron• http://www.schematron.com
“A language for making assertions about the presence or absence of patterns in XML documents.” – from schematron.com
Tools and Libraries cont.
• Tools– Open Health Tools
• http://www.openhealthtools.org• Provides a source code repository• Provides document repository• Provides wiki forum• Provides discussion forum
Maven Overview
• Typical Project– Pom.xml – specifies the project structure, dependent libraries, reports,
unit-testing, etc.– Src
• Main – contains the deliverable code– Java– Config– Resources
• Test – contains the code that tests the deliverable code– Java– Config– Resources
– Target – the destination for all compiled code, reports, etc.• Site – contains the generated reports (checkstyle, cobertura, javadoc, etc)
• $USER_HOME\.m2– Settings.xml– Repository – contains the dependent libraries
Maven Overview cont.
• Sample commands– mvn install – sets up project locally by downloading dependent
libraries, etc.– mvn clean – cleans all target items– mvn test – tests the code– mvn site – generate all reports for the project
• Plugins– M2Eclipse – http://m2eclipse.sonatype.org – NetBeans – http://wiki.netbeans.org/MavenBestPractices– IntelliJ – http://www.jetbrains.com/idea/features/ant_maven.html
See http://maven.apache.org for detailed reference, samples, quickstart, etc.
Development Conventions & Process• Package structure
– gov.hhs.hin.ri.toc• gov.hhs.hin.ri.toc.contract – contains the API (e.g.,
DocumentHandler, DocumentTranslator, etc.)• gov.hhs.hin.ri.toc.handlers – contains the handler
implementations (e.g., GenericDocumentHandler)• gov.hhs.hin.ri.toc.translators – contains the translator
implementations (e.g., XslTranslator)• gov.hhs.hin.ri.toc.validators – contains the validator
implementations (e.g., SchematronValidator)
• Process– http://wiki.siframework.org/S%26I+Framework+RI+Develop
ment+Process
How to Get Started
• Please provide feedback and suggestions on development plan and API by 7/7/2011.
• Create a login account at www.openhealthtools.org.• Install Maven 3.0 and review documentation.• Install IDE (Eclipse, NetBeans, etc.) if desired.• Suggested Review
– Spring• http://blog.springsource.com/category/green-beans/• Suggest Getting Started with Spring Integration
– Saxon• http://www.saxonica.com/documentation/about/gettingstarted/gettingstartedjav
a.xml– Schematron
• http://www.schematron.com/elements.html
• Tasks assignments are scheduled to begin 7/12/2011.
Top Related