|
|
|
@@ -1,5 +1,5 @@ |
|
|
|
/* |
|
|
|
* Copyright 2000-2004 The Apache Software Foundation |
|
|
|
* Copyright 2000-2005 The Apache Software Foundation |
|
|
|
* |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
@@ -112,11 +112,23 @@ public class DescriptorHandler extends org.xml.sax.HandlerBase { |
|
|
|
*/ |
|
|
|
private File srcDir; |
|
|
|
|
|
|
|
/** |
|
|
|
* Constructor for DescriptorHandler. |
|
|
|
* @param task the task that owns this desciptor |
|
|
|
* @param srcDir the source directory |
|
|
|
*/ |
|
|
|
public DescriptorHandler(Task task, File srcDir) { |
|
|
|
this.owningTask = task; |
|
|
|
this.srcDir = srcDir; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Register a dtd with a location. |
|
|
|
* The location is one of a filename, a resource name in the classpath, or |
|
|
|
* a URL. |
|
|
|
* @param publicId the public identity of the dtd |
|
|
|
* @param location the location of the dtd |
|
|
|
*/ |
|
|
|
public void registerDTD(String publicId, String location) { |
|
|
|
if (location == null) { |
|
|
|
return; |
|
|
|
@@ -156,6 +168,7 @@ public class DescriptorHandler extends org.xml.sax.HandlerBase { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/** @see org.xml.sax.EntityResolver#resolveEntity(String, String) */ |
|
|
|
public InputSource resolveEntity(String publicId, String systemId) |
|
|
|
throws SAXException { |
|
|
|
this.publicId = publicId; |
|
|
|
@@ -201,6 +214,7 @@ public class DescriptorHandler extends org.xml.sax.HandlerBase { |
|
|
|
|
|
|
|
/** |
|
|
|
* Getter method that returns the set of files to include in the EJB jar. |
|
|
|
* @return the map of files |
|
|
|
*/ |
|
|
|
public Hashtable getFiles() { |
|
|
|
return (ejbFiles == null) ? new Hashtable() : ejbFiles; |
|
|
|
@@ -208,6 +222,7 @@ public class DescriptorHandler extends org.xml.sax.HandlerBase { |
|
|
|
|
|
|
|
/** |
|
|
|
* Get the publicId of the DTD |
|
|
|
* @return the public id |
|
|
|
*/ |
|
|
|
public String getPublicId() { |
|
|
|
return publicId; |
|
|
|
@@ -215,6 +230,7 @@ public class DescriptorHandler extends org.xml.sax.HandlerBase { |
|
|
|
|
|
|
|
/** |
|
|
|
* Getter method that returns the value of the <ejb-name> element. |
|
|
|
* @return the ejb name |
|
|
|
*/ |
|
|
|
public String getEjbName() { |
|
|
|
return ejbName; |
|
|
|
@@ -223,6 +239,7 @@ public class DescriptorHandler extends org.xml.sax.HandlerBase { |
|
|
|
/** |
|
|
|
* SAX parser call-back method that is used to initialize the values of some |
|
|
|
* instance variables to ensure safe operation. |
|
|
|
* @throws SAXException on error |
|
|
|
*/ |
|
|
|
public void startDocument() throws SAXException { |
|
|
|
this.ejbFiles = new Hashtable(10, 1); |
|
|
|
@@ -237,6 +254,7 @@ public class DescriptorHandler extends org.xml.sax.HandlerBase { |
|
|
|
* instance variable. |
|
|
|
* @param name The name of the element being entered. |
|
|
|
* @param attrs Attributes associated to the element. |
|
|
|
* @throws SAXException on error |
|
|
|
*/ |
|
|
|
public void startElement(String name, AttributeList attrs) |
|
|
|
throws SAXException { |
|
|
|
@@ -266,6 +284,7 @@ public class DescriptorHandler extends org.xml.sax.HandlerBase { |
|
|
|
* data this is a simpler and workable solution. |
|
|
|
* @param name The name of the attribute being exited. Ignored |
|
|
|
* in this implementation. |
|
|
|
* @throws SAXException on error |
|
|
|
*/ |
|
|
|
public void endElement(String name) throws SAXException { |
|
|
|
processElement(); |
|
|
|
@@ -300,6 +319,7 @@ public class DescriptorHandler extends org.xml.sax.HandlerBase { |
|
|
|
* array to start reading from. |
|
|
|
* @param length An integer representing an offset into the |
|
|
|
* char array where the current data terminates. |
|
|
|
* @throws SAXException on error |
|
|
|
*/ |
|
|
|
public void characters(char[] ch, int start, int length) |
|
|
|
throws SAXException { |
|
|
|
@@ -308,6 +328,12 @@ public class DescriptorHandler extends org.xml.sax.HandlerBase { |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* Called when an endelement is seen. |
|
|
|
* This may be overridden in derived classes. |
|
|
|
* This updates the ejbfiles if the element is an interface or a bean class. |
|
|
|
* This updates the ejbname if the element is an ejb name. |
|
|
|
*/ |
|
|
|
protected void processElement() { |
|
|
|
if (inEJBRef |
|
|
|
|| (parseState != STATE_IN_ENTITY |
|
|
|
@@ -340,7 +366,7 @@ public class DescriptorHandler extends org.xml.sax.HandlerBase { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// Get the value of the <ejb-name> tag. Only the first occurrence. |
|
|
|
// Get the value of the <ejb-name> tag. Only the first occurrence. |
|
|
|
if (currentElement.equals(EJB_NAME)) { |
|
|
|
if (ejbName == null) { |
|
|
|
ejbName = currentText.trim(); |
|
|
|
|