org.apache.commons.jjar
Class RepositoryXML

java.lang.Object
  extended by uk.co.wilson.xml.MinML2
      extended by org.apache.commons.jjar.RepositoryXML
All Implemented Interfaces:
Repository, ContentHandler, ErrorHandler, Locator, XMLReader

public class RepositoryXML
extends uk.co.wilson.xml.MinML2
implements Repository

Repository implementation that supports XML repository definitions. Uses a great small little lightweight SAX parser - but it's not clear what it doesn't support, so be careful

Version:
$Id: RepositoryXML.java 155454 2005-02-26 13:23:34Z dirkv $
Author:
Geir Magnusson Jr.

Field Summary
 
Fields inherited from class uk.co.wilson.xml.MinML2
change, decLevel, defaultBufferIncrement, defaultInitialBufferSize, discardAndChange, discardSaveAndChange, emitCharacters, emitEndElement, emitStartElement, endCDATA, endComment, endStartName, exitParser, inAttribute, inAttribute1, inAttributeQuotesValue, inAttributeQuoteValue, inAttributeValue, inCDATA, inCDATA1, inCharData, incLevel, inComment, inDTD, inETag, inETag1, inMTTag, inNextAttribute, inPI, inPI1, inPossiblyAttribute, inPossiblySkipping, inSkipping, inSTag, inTag, parseError, processCharRef, saveAndChange, saveAttributeName, saveAttributeValue, startCDATA, startComment, writeCdata
 
Constructor Summary
RepositoryXML()
           
 
Method Summary
 void endElement(String namespaceURI, String localName, String qName)
          end element event handler for SAX parsing
 void fatalError(SAXParseException e)
           
 List getDependencyList(String pkg, String version)
          returns a list of dependencies for a given package.
 String getFetchTarget(String pkg, String version)
          returns the 'fetch' target (jarname) for the given package : version
 int getPackageCount()
          returns the number of packages known to the repository
 String getPackageDefaultVersion(String pkg)
          returns the default version of the package to the caller
 String getPackageDescription(String pkg)
          returns the info/desc string to the caller
 Iterator getPackageListIter()
          returns an iterator over the list of package names
 List getPackageVersionList(String pkg)
          returns a list of the know versions available for this package
 String getProp(String s)
          returns a given property not implemented
 boolean isPackage(String pkg)
          determines if something is a known package
 void load(URL url)
          loads the object with the XML data from the passed in URL.
 void load(URL url, Map pkgMap)
           
static void main(String[] args)
          used for debugging
 Writer startElement(String namespaceURI, String localName, String qName, Attributes atts, Writer writer)
          start element event handler for SAX.
 
Methods inherited from class uk.co.wilson.xml.MinML2
characters, endDocument, endPrefixMapping, error, getColumnNumber, getContentHandler, getDefaultNamespace, getDTDHandler, getEntityResolver, getErrorHandler, getFeature, getLineNumber, getNamespace, getProperty, getPublicId, getSystemId, ignorableWhitespace, parse, parse, parse, processingInstruction, setContentHandler, setContentHandler, setDocumentLocator, setDTDHandler, setEntityResolver, setErrorHandler, setFeature, setProperty, skippedEntity, startDocument, startDocument, startElement, startPrefixMapping, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RepositoryXML

public RepositoryXML()
Method Detail

load

public void load(URL url)
loads the object with the XML data from the passed in URL. Invokes the SAX parser.

Specified by:
load in interface Repository
Parameters:
url - location of the repository.xml

load

public void load(URL url,
                 Map pkgMap)

getDependencyList

public List getDependencyList(String pkg,
                              String version)
returns a list of dependencies for a given package. The list contains Maps, with 'package' and 'version' as the keys for the necessary info.

Specified by:
getDependencyList in interface Repository
Parameters:
pkg - package to get dep list for
Returns:
List of Maps

getPackageListIter

public Iterator getPackageListIter()
returns an iterator over the list of package names

Specified by:
getPackageListIter in interface Repository

getPackageCount

public int getPackageCount()
returns the number of packages known to the repository

Specified by:
getPackageCount in interface Repository

getPackageDefaultVersion

public String getPackageDefaultVersion(String pkg)
returns the default version of the package to the caller

Specified by:
getPackageDefaultVersion in interface Repository

getPackageDescription

public String getPackageDescription(String pkg)
returns the info/desc string to the caller

Specified by:
getPackageDescription in interface Repository

getFetchTarget

public String getFetchTarget(String pkg,
                             String version)
returns the 'fetch' target (jarname) for the given package : version

Specified by:
getFetchTarget in interface Repository

isPackage

public boolean isPackage(String pkg)
determines if something is a known package

Specified by:
isPackage in interface Repository

getProp

public String getProp(String s)
returns a given property not implemented


getPackageVersionList

public List getPackageVersionList(String pkg)
returns a list of the know versions available for this package

Specified by:
getPackageVersionList in interface Repository

startElement

public Writer startElement(String namespaceURI,
                           String localName,
                           String qName,
                           Attributes atts,
                           Writer writer)
                    throws SAXException
start element event handler for SAX.

Overrides:
startElement in class uk.co.wilson.xml.MinML2
Throws:
SAXException

endElement

public void endElement(String namespaceURI,
                       String localName,
                       String qName)
                throws SAXException
end element event handler for SAX parsing

Specified by:
endElement in interface ContentHandler
Overrides:
endElement in class uk.co.wilson.xml.MinML2
Throws:
SAXException

fatalError

public void fatalError(SAXParseException e)
                throws SAXException
Specified by:
fatalError in interface ErrorHandler
Overrides:
fatalError in class uk.co.wilson.xml.MinML2
Throws:
SAXException

main

public static void main(String[] args)
used for debugging



Copyright © 2001-2010 The Apache Software Foundation. All Rights Reserved.