org.apache.creadur.whisker.fromxml
public class JDomBuilder extends Object
Constructor and Description |
---|
JDomBuilder() |
Modifier and Type | Method and Description |
---|---|
Descriptor |
build(org.jdom.Document document)
Builds work from the given document.
|
Descriptor |
build(InputStream xmlStream) |
ByOrganisation |
byOrganisation(org.jdom.Element byOrganisation,
Map<String,Organisation> organisationsById)
Builds a by-organisation model from xml.
|
ByOrganisation |
byOrganisation(org.jdom.Element element,
Organisation organisation)
Builds a by-organisation model from xml.
|
SortedSet<ByOrganisation> |
collectByOrganisations(org.jdom.Element parent,
Map<String,Organisation> map)
Collects by-organisation children.
|
Collection<WithinDirectory> |
collectContents(org.jdom.Document document,
Map<String,License> licenses,
Map<String,Organisation> organisations)
Collects contents of the document.
|
Collection<Resource> |
collectResources(org.jdom.Element element) |
License |
license(org.jdom.Element element)
Builds a license model from xml.
|
License |
license(org.jdom.Element element,
Map<String,License> licenses)
Finds the license with an id matching that referenced by the element.
|
Map<String,License> |
mapLicenses(org.jdom.Document document)
Collects license definitions within document.
|
Map<String,String> |
mapNotices(org.jdom.Document document)
Collects notices in the given documents.
|
Map<String,Organisation> |
mapOrganisations(org.jdom.Document document)
Collects organisation definitions within document.
|
Organisation |
organisation(org.jdom.Element element)
Builds an organisation model from xml.
|
Organisation |
organisation(org.jdom.Element element,
Map<String,Organisation> organisationsById)
Finds the organisation linked by ID from the given element.
|
Map<String,String> |
parameters(org.jdom.Element element)
Builds a list of parameter values by name.
|
String |
primaryCopyrightNotice(org.jdom.Document document)
Gets the additional primary copyright notice
from the document.
|
License |
primaryLicense(org.jdom.Document document,
Map<String,License> licenses)
Finds the primary license for the given document from the given licenses.
|
String |
primaryNotice(org.jdom.Document document)
Retrieves the text of the primary notice.
|
String |
primaryOrganisationId(org.jdom.Document document)
Retrieves the ID of the primary organisation.
|
Collection<ByOrganisation> |
publicDomain(Map<String,Organisation> organisations,
org.jdom.Element parent)
Collects child organisations of public domain.
|
Resource |
resource(org.jdom.Element element)
Builds a resource.
|
WithinDirectory |
withinDirectory(org.jdom.Element element,
Map<String,License> licenses,
Map<String,Organisation> organisations)
Builds a within directory model from XML.
|
WithLicense |
withLicense(org.jdom.Element element,
Map<String,License> licenses,
Map<String,Organisation> organisations)
Builds a with-license model from xml.
|
Collection<WithLicense> |
withLicenses(Map<String,License> licenses,
Map<String,Organisation> organisations,
org.jdom.Element parent)
Collects child with-licenses.
|
public Resource resource(org.jdom.Element element) throws UnexpectedElementException
element
- not nullUnexpectedElementException
- when element is not named 'resource'public Organisation organisation(org.jdom.Element element) throws UnexpectedElementException
element,
- not nullOrganisation
not nullUnexpectedElementException
- when element is not named 'organisation'public Collection<Resource> collectResources(org.jdom.Element element)
element
- public Organisation organisation(org.jdom.Element element, Map<String,Organisation> organisationsById) throws MissingIDException
element
- modelled ByOrganisation, not nullorganisationsById
- organisations identified, not nullMissingIDException
- when the linked organisation is not found in the given mappublic ByOrganisation byOrganisation(org.jdom.Element element, Organisation organisation)
element
- not nullorganisation
- not nullpublic ByOrganisation byOrganisation(org.jdom.Element byOrganisation, Map<String,Organisation> organisationsById) throws MissingIDException
byOrganisation
- not nullorganisationsById
- not nullMissingIDException
- when the linked organisation is not found in the given mappublic SortedSet<ByOrganisation> collectByOrganisations(org.jdom.Element parent, Map<String,Organisation> map)
parent
- not nullmap
- not nullpublic License license(org.jdom.Element element)
element
- not nullpublic License license(org.jdom.Element element, Map<String,License> licenses) throws MissingIDException
element
- not nulllicenses
- not nullMissingIDException
- when referenced license isn't found in the collectionpublic WithLicense withLicense(org.jdom.Element element, Map<String,License> licenses, Map<String,Organisation> organisations) throws MissingIDException
element
- not nulllicenses
- not nullorganisations
- not nullMissingIDException
- when referenced license isn't found in the collectionpublic Map<String,String> parameters(org.jdom.Element element) throws DuplicateElementException
element
- not nullDuplicateElementException
- when two parameters shared the same namepublic Collection<WithLicense> withLicenses(Map<String,License> licenses, Map<String,Organisation> organisations, org.jdom.Element parent)
licenses
- not nullorganisations
- not nullparent
- not nullpublic Collection<ByOrganisation> publicDomain(Map<String,Organisation> organisations, org.jdom.Element parent)
organisations
- not nullparent
- not nullpublic WithinDirectory withinDirectory(org.jdom.Element element, Map<String,License> licenses, Map<String,Organisation> organisations)
element
- not nulllicenses
- not nullorganisations
- not nullpublic Map<String,Organisation> mapOrganisations(org.jdom.Document document)
document,
- not nullpublic Map<String,License> mapLicenses(org.jdom.Document document)
document,
- not nullpublic License primaryLicense(org.jdom.Document document, Map<String,License> licenses)
document
- not nulllicenses
- not nullpublic String primaryCopyrightNotice(org.jdom.Document document)
document
- not nullpublic Map<String,String> mapNotices(org.jdom.Document document)
document,
- not nullpublic String primaryNotice(org.jdom.Document document)
document,
- not nullpublic String primaryOrganisationId(org.jdom.Document document)
document,
- not nullpublic Collection<WithinDirectory> collectContents(org.jdom.Document document, Map<String,License> licenses, Map<String,Organisation> organisations) throws DuplicateElementException
document
- not nullDuplicateElementException
- when dir names are not uniquepublic Descriptor build(org.jdom.Document document)
document
- not nullpublic Descriptor build(InputStream xmlStream) throws org.jdom.JDOMException, IOException
org.jdom.JDOMException
IOException
Copyright © 2011-2013 Apache Software Foundation. All Rights Reserved.