cuba.wired.ddread
Class WiredAppReader

java.lang.Object
  extended by cuba.wired.ddread.XmlReader
      extended by cuba.wired.ddread.WiredAppReader

public class WiredAppReader
extends XmlReader

XML reader for the descriptor of a wired application

Author:
Jan Lessner

Field Summary
 
Fields inherited from class cuba.wired.ddread.XmlReader
REVISION_ID
 
Constructor Summary
WiredAppReader(java.util.Properties props)
          Create a WiredAppReader, fetching the application descriptor with a predefined name META-INF/wired-application.xml from the CLASSPATH.
WiredAppReader(java.lang.String filename, java.util.Properties props)
          Create a WiredAppReader for the passed application descriptor
 
Method Summary
protected  void checkLinkage(ReferenceMap.Reference ref, AbstractDescriptor desc, java.lang.String compName, java.lang.String refName, java.lang.String globalName)
           
 java.lang.String[] getModuleNames()
          Return all module names, not regarding if these are component JARs or ordinary archives
 java.lang.String locateModule(java.lang.String rawModuleName)
          Find the actual location of a module, specified in the application descriptor in the following search order: Try to find the module as an ordinary file on the file system Try to find a JAR file with the given name from the current classloader's module source archives.
 java.lang.String locateModuleFromClasspath(java.lang.String rawModuleName)
           
static void main(java.lang.String[] args)
          For test purposes only
 java.lang.Object[] process()
          Process the application descriptor retrieved and parsed on construction
 java.util.Map registerPermissions(org.w3c.dom.Element appdd)
          Return the role associations of all users being specified in the application descriptor in run-as tags
 
Methods inherited from class cuba.wired.ddread.XmlReader
getAttribute, getChild, getChildNode, getElementName, getJarEntry, getMandatoryAttribute, getMandatoryChild, getMandatoryChildNode, getMandatoryFirstChildValue, getResource, getRootElement, getRootElement, getSystemResource, getURL, setXmlParser, setXmlParserType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WiredAppReader

public WiredAppReader(java.lang.String filename,
                      java.util.Properties props)
               throws InitException
Create a WiredAppReader for the passed application descriptor

Parameters:
filename - The file to be parsed as an XML wired application descriptor.
props - Configuration properties to be used for the initialization process
Throws:
InitException - if the file does not exist or cannot be parsed

WiredAppReader

public WiredAppReader(java.util.Properties props)
               throws InitException
Create a WiredAppReader, fetching the application descriptor with a predefined name META-INF/wired-application.xml from the CLASSPATH.

Throws:
InitException - if the descriptor could not be found from the CLASSPATH or cannot be parsed.
Method Detail

checkLinkage

protected void checkLinkage(ReferenceMap.Reference ref,
                            AbstractDescriptor desc,
                            java.lang.String compName,
                            java.lang.String refName,
                            java.lang.String globalName)
                     throws InitException
Throws:
InitException

locateModuleFromClasspath

public java.lang.String locateModuleFromClasspath(java.lang.String rawModuleName)

locateModule

public java.lang.String locateModule(java.lang.String rawModuleName)
Find the actual location of a module, specified in the application descriptor in the following search order:
  1. Try to find the module as an ordinary file on the file system
  2. Try to find a JAR file with the given name from the current classloader's module source archives. This sounds unnecessarily complicated but it's the only portable way which works for any environment, including J2SE applications and servlet engines.
  3. Try to find a JAR file with the given name in the CLASSPATH. This should be a subset of the JAR files above and remains here for historical reasons. I just didn't dare to remove it ;-)
  4. Try to load the file as a resource from the current class loader. This is for nested archives and should not be the usual case.


process

public java.lang.Object[] process()
                           throws InitException
Process the application descriptor retrieved and parsed on construction

Returns:
an object array with the assembled ComponentMap as its first element and the ResourceFactoryMap as its second element.
Throws:
InitException - if there occurs any error during assembly

registerPermissions

public java.util.Map registerPermissions(org.w3c.dom.Element appdd)
                                  throws InitException
Return the role associations of all users being specified in the application descriptor in run-as tags

Throws:
InitException

getModuleNames

public java.lang.String[] getModuleNames()
Return all module names, not regarding if these are component JARs or ordinary archives


main

public static void main(java.lang.String[] args)
                 throws InitException
For test purposes only

Throws:
InitException