krysalis-update/src/java/org/krysalis/depot/update/util/xml XMLContext.java,1.1,1.2 XMLHandler.java,1.1,1.2 XMLGrouperElement.java,1.1,1.2 XMLTagConstants.java,1.1,1.2 XMLParser.java,1.1,1.2 XMLEntryTable.java,1.1,1.2
Nick Chalko <[email protected]> Wed, 08 Dec 2004 09:11:54 +0000
| Newsgroups | gmane.comp.krysalis.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/krysalis/krysalis-update/src/java/org/krysalis/depot/update/util/xml
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26470/src/java/org/krysalis/depot/update/util/xml
Modified Files:
XMLContext.java XMLHandler.java XMLGrouperElement.java
XMLTagConstants.java XMLParser.java XMLEntryTable.java
Log Message:
format
Index: XMLGrouperElement.java
===================================================================
RCS file: /cvsroot/krysalis/krysalis-update/src/java/org/krysalis/depot/update/util/xml/XMLGrouperElement.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** XMLGrouperElement.java 8 Dec 2004 09:06:29 -0000 1.1
--- XMLGrouperElement.java 8 Dec 2004 09:11:51 -0000 1.2
***************
*** 21,26 ****
*/
public class XMLGrouperElement {
! public static final String XML_GROUPER_ELEMENT_CLASSNAME =
! XMLGrouperElement.class.getName();
/**
--- 21,26 ----
*/
public class XMLGrouperElement {
! public static final String XML_GROUPER_ELEMENT_CLASSNAME = XMLGrouperElement.class
! .getName();
/**
Index: XMLTagConstants.java
===================================================================
RCS file: /cvsroot/krysalis/krysalis-update/src/java/org/krysalis/depot/update/util/xml/XMLTagConstants.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** XMLTagConstants.java 8 Dec 2004 09:06:29 -0000 1.1
--- XMLTagConstants.java 8 Dec 2004 09:11:51 -0000 1.2
***************
*** 22,34 ****
--- 22,41 ----
public class XMLTagConstants {
public final static String XML_TAG_ID = "id";
+
public final static String XML_TAG_REF_ID = "refId";
// XML tags
public final static String CONFIG_TAG = "config";
+
public final static String PROPERTY_XML_TAG = "property";
+
public final static String REPOSITORY_TAG = "repository";
+
public final static String REPOSITORY_URL_TAG = "repository.url";
+
public final static String REPOSITORY_ACTIVE_TAG = "repository.active";
+
public final static String REPOSITORY_REMOTE_TAG = "repository.remote";
+
public final static String REPOSITORYSET_TAG = "repositoryset";
Index: XMLParser.java
===================================================================
RCS file: /cvsroot/krysalis/krysalis-update/src/java/org/krysalis/depot/update/util/xml/XMLParser.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** XMLParser.java 8 Dec 2004 09:06:29 -0000 1.1
--- XMLParser.java 8 Dec 2004 09:11:52 -0000 1.2
***************
*** 25,30 ****
import javax.xml.parsers.SAXParserFactory;
- import org.krysalis.depot.update.util.io.FileUtils;
import org.krysalis.depot.common.util.envsafe.ClassLoaderContext;
import org.xml.sax.InputSource;
import org.xml.sax.XMLReader;
--- 25,30 ----
import javax.xml.parsers.SAXParserFactory;
import org.krysalis.depot.common.util.envsafe.ClassLoaderContext;
+ import org.krysalis.depot.update.util.io.FileUtils;
import org.xml.sax.InputSource;
import org.xml.sax.XMLReader;
***************
*** 33,40 ****
* Parser for xml-configuration files
*
! * @author <a href="http://incubator.apache.org/depot">The Apache Incubator Depot Project</a>
*/
public class XMLParser {
private XMLEntryTable m_xmlEntryTable;
private ClassLoaderContext m_classLoaderHelper;
--- 33,42 ----
* Parser for xml-configuration files
*
! * @author <a href="http://incubator.apache.org/depot">The Apache Incubator
! * Depot Project </a>
*/
public class XMLParser {
private XMLEntryTable m_xmlEntryTable;
+
private ClassLoaderContext m_classLoaderHelper;
***************
*** 42,51 ****
* Constructor for the XMLParser
*
! * @param xmlEntryTable a XMLEntryTable
! * @param loaderHelper a ClassLoaderContext
*/
! public XMLParser(
! XMLEntryTable xmlEntryTable,
! ClassLoaderContext loaderHelper) {
m_xmlEntryTable = xmlEntryTable;
--- 44,54 ----
* Constructor for the XMLParser
*
! * @param xmlEntryTable
! * a XMLEntryTable
! * @param loaderHelper
! * a ClassLoaderContext
*/
! public XMLParser(XMLEntryTable xmlEntryTable,
! ClassLoaderContext loaderHelper) {
m_xmlEntryTable = xmlEntryTable;
***************
*** 56,84 ****
XMLContext xmlContext = new XMLContext();
! return parse(
! source,
! new XMLHandler(xmlContext, m_xmlEntryTable, m_classLoaderHelper));
}
/**
* Parse a source xml input.
! *
! * @param source the xml source
! * @exception XMLException if an error occurs
*/
public XMLContext parse(Object source) throws XMLException {
XMLContext xmlContext = new XMLContext();
! return parse(
! source,
! new XMLHandler(xmlContext, m_xmlEntryTable, m_classLoaderHelper));
}
/**
! * @param source the xml source
! * @param handler the root handler to use (contains the current context)
! * @exception XMLException if the configuration is invalid or cannot
! * be read
*/
public XMLContext parse(Object source, XMLHandler handler)
! throws XMLException {
XMLContext xmlContext = handler.getContext();
--- 59,90 ----
XMLContext xmlContext = new XMLContext();
! return parse(source, new XMLHandler(xmlContext, m_xmlEntryTable,
! m_classLoaderHelper));
}
+
/**
* Parse a source xml input.
! *
! * @param source
! * the xml source
! * @exception XMLException
! * if an error occurs
*/
public XMLContext parse(Object source) throws XMLException {
XMLContext xmlContext = new XMLContext();
! return parse(source, new XMLHandler(xmlContext, m_xmlEntryTable,
! m_classLoaderHelper));
}
/**
! * @param source
! * the xml source
! * @param handler
! * the root handler to use (contains the current context)
! * @exception XMLException
! * if the configuration is invalid or cannot be read
*/
public XMLContext parse(Object source, XMLHandler handler)
! throws XMLException {
XMLContext xmlContext = handler.getContext();
***************
*** 92,103 ****
xmlContext.setBuildFile(buildFile);
buildFileName = buildFile.toString();
! }
! else if (source instanceof URL) {
url = (URL) source;
buildFileName = url.toString();
! }
! else if (!(source instanceof InputStream)) {
! throw new XMLException(
! "Source " + source.getClass().getName() + " not supported");
}
--- 98,107 ----
xmlContext.setBuildFile(buildFile);
buildFileName = buildFile.toString();
! } else if (source instanceof URL) {
url = (URL) source;
buildFileName = url.toString();
! } else if (!(source instanceof InputStream)) {
! throw new XMLException("Source " + source.getClass().getName()
! + " not supported");
}
***************
*** 121,130 ****
uri = FileUtils.toURI(buildFile.getPath());
inputStream = new FileInputStream(buildFile);
! }
! else if (url != null) {
inputStream = url.openStream();
uri = url.toString();
! }
! else {
inputStream = (InputStream) source;
}
--- 125,132 ----
uri = FileUtils.toURI(buildFile.getPath());
inputStream = new FileInputStream(buildFile);
! } else if (url != null) {
inputStream = url.openStream();
uri = url.toString();
! } else {
inputStream = (InputStream) source;
}
***************
*** 141,154 ****
parser.setDTDHandler(handler);
parser.parse(inputSource);
! }
! catch (Exception exc) {
throw new XMLException(exc.getLocalizedMessage(), exc);
! }
! finally {
if (inputStream != null) {
try {
inputStream.close();
! }
! catch (IOException ioe) {
// ignore this
}
--- 143,153 ----
parser.setDTDHandler(handler);
parser.parse(inputSource);
! } catch (Exception exc) {
throw new XMLException(exc.getLocalizedMessage(), exc);
! } finally {
if (inputStream != null) {
try {
inputStream.close();
! } catch (IOException ioe) {
// ignore this
}
Index: XMLHandler.java
===================================================================
RCS file: /cvsroot/krysalis/krysalis-update/src/java/org/krysalis/depot/update/util/xml/XMLHandler.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** XMLHandler.java 8 Dec 2004 09:06:29 -0000 1.1
--- XMLHandler.java 8 Dec 2004 09:11:51 -0000 1.2
***************
*** 20,28 ****
import java.util.Stack;
import org.krysalis.depot.update.impl.ReferenceManager;
import org.krysalis.depot.update.util.text.MessageConstants;
import org.krysalis.depot.update.util.text.Messages;
- import org.krysalis.depot.common.log.Logger;
- import org.krysalis.depot.common.util.envsafe.ClassLoaderContext;
import org.xml.sax.Attributes;
import org.xml.sax.Locator;
--- 20,28 ----
import java.util.Stack;
+ import org.krysalis.depot.common.log.Logger;
+ import org.krysalis.depot.common.util.envsafe.ClassLoaderContext;
import org.krysalis.depot.update.impl.ReferenceManager;
import org.krysalis.depot.update.util.text.MessageConstants;
import org.krysalis.depot.update.util.text.Messages;
import org.xml.sax.Attributes;
import org.xml.sax.Locator;
***************
*** 37,44 ****
--- 37,47 ----
private Stack m_tagObjectStack = new Stack();
+
private Object m_currentTagObject;
+
private ClassLoaderContext m_classLoaderHelper = null;
private XMLContext m_context;
+
private XMLEntryTable m_xmlEntryTable;
***************
*** 48,52 ****
}
! public XMLHandler(XMLContext context, XMLEntryTable xmlEntryTable, ClassLoaderContext loaderHelper) {
m_context = context;
m_xmlEntryTable = xmlEntryTable;
--- 51,56 ----
}
! public XMLHandler(XMLContext context, XMLEntryTable xmlEntryTable,
! ClassLoaderContext loaderHelper) {
m_context = context;
m_xmlEntryTable = xmlEntryTable;
***************
*** 58,69 ****
}
! public void startElement(
! String uri,
! String tag,
! String qname,
! Attributes attributes)
! throws SAXParseException {
try {
!
Logger.getLogger().debug("startElement : " + qname);
--- 62,69 ----
}
! public void startElement(String uri, String tag, String qname,
! Attributes attributes) throws SAXParseException {
try {
!
Logger.getLogger().debug("startElement : " + qname);
***************
*** 71,88 ****
// add the property to the xmlEntryTable
setAttributesToEntryTable(attributes);
! }
! else {
! // handle the case where the class is different from the one in xmltable
! String classAttributeName =
! attributes.getValue(XMLTagConstants.XML_CLASS_ATTRIBUTE);
!
String clazzName = null;
!
! // find out if the tag - class is defined in the depot-update.xml / XMLEntryTable
if (classAttributeName != null
! && !classAttributeName.equals("")){
! clazzName = classAttributeName;
! }
! else{
clazzName = (String) m_xmlEntryTable.get(tag);
}
--- 71,88 ----
// add the property to the xmlEntryTable
setAttributesToEntryTable(attributes);
! } else {
! // handle the case where the class is different from the one in
! // xmltable
! String classAttributeName = attributes
! .getValue(XMLTagConstants.XML_CLASS_ATTRIBUTE);
!
String clazzName = null;
!
! // find out if the tag - class is defined in the
! // depot-update.xml / XMLEntryTable
if (classAttributeName != null
! && !classAttributeName.equals("")) {
! clazzName = classAttributeName;
! } else {
clazzName = (String) m_xmlEntryTable.get(tag);
}
***************
*** 91,176 ****
Logger.getLogger().debug("Class : " + clazzName);
-
- // if it is the XMLGrouperElement
- if (!clazzName
- .equals(
- XMLGrouperElement.XML_GROUPER_ELEMENT_CLASSNAME)) {
- Object currentTagObject = null;
- Class clazz =
- m_classLoaderHelper.getClassForName(clazzName);
! String tagId =
! attributes.getValue(XMLTagConstants.XML_TAG_ID);
! String refId =
! attributes.getValue(XMLTagConstants.XML_TAG_REF_ID);
! Logger.getLogger().debug("TagId : " + tagId);
! Logger.getLogger().debug("RefId : " + refId);
!
! if (tagId == null) {
! throw new Exception(
! "No Id for the xml entry " + tag);
! }
! //if there is an object already in the stack, add this as child to it
! if (!m_tagObjectStack.empty()) {
! Object parent = this.m_tagObjectStack.peek();
! if (parent != null) {
!
! /// TODO ***
! currentTagObject =
! setChild(parent, clazz, tagId, refId);
! if (currentTagObject == null) {
! throw new Exception(
! "Unexpected child \""
! + qname
! + "\" "
! + tag
! + " for the parent element "
! + parent.getClass().getName());
! }
! }
! else {
! // parent is null so call the ref Mgr and create a ref
! currentTagObject =
! ReferenceManager.createReferenceObject(
! clazz,
! tagId,
! refId);
}
}
! else {
! // create the object
! currentTagObject =
! ReferenceManager.createReferenceObject(
! clazz,
! tagId,
! refId);
! }
! if (currentTagObject == null) {
! //TODO
! String message = "No tagObject " + tag;
! throw new Exception(message);
! }
! //set the attributes
! setObjectAttributes(tag, currentTagObject, attributes);
! // add this to stack and the created objects
! this.m_tagObjectStack.push(currentTagObject);
! this.m_context.putCreatedTagObject(
! tag,
! currentTagObject);
! }
}
! }
! catch (Exception exception) {
Logger.getLogger().error("XML_BEAN_ERROR", exception);
!
! throw new SAXParseException(
! exception.getLocalizedMessage(),
! m_context.getLocator(),
! exception);
}
--- 91,160 ----
Logger.getLogger().debug("Class : " + clazzName);
! // if it is the XMLGrouperElement
! if (!clazzName
! .equals(XMLGrouperElement.XML_GROUPER_ELEMENT_CLASSNAME)) {
! Object currentTagObject = null;
! Class clazz = m_classLoaderHelper
! .getClassForName(clazzName);
! String tagId = attributes
! .getValue(XMLTagConstants.XML_TAG_ID);
! String refId = attributes
! .getValue(XMLTagConstants.XML_TAG_REF_ID);
! Logger.getLogger().debug("TagId : " + tagId);
! Logger.getLogger().debug("RefId : " + refId);
!
! if (tagId == null) {
! throw new Exception("No Id for the xml entry " + tag);
! }
!
! // if there is an object already in the stack, add this as
! // child to it
! if (!m_tagObjectStack.empty()) {
! Object parent = this.m_tagObjectStack.peek();
! if (parent != null) {
!
! // / TODO ***
! currentTagObject = setChild(parent, clazz, tagId,
! refId);
! if (currentTagObject == null) {
! throw new Exception("Unexpected child \""
! + qname + "\" " + tag
! + " for the parent element "
! + parent.getClass().getName());
}
+ } else {
+ // parent is null so call the ref Mgr and create a
+ // ref
+ currentTagObject = ReferenceManager
+ .createReferenceObject(clazz, tagId, refId);
}
! } else {
! // create the object
! currentTagObject = ReferenceManager
! .createReferenceObject(clazz, tagId, refId);
! }
! if (currentTagObject == null) {
! // TODO
! String message = "No tagObject " + tag;
! throw new Exception(message);
! }
! // set the attributes
! setObjectAttributes(tag, currentTagObject, attributes);
! // add this to stack and the created objects
! this.m_tagObjectStack.push(currentTagObject);
! this.m_context.putCreatedTagObject(tag, currentTagObject);
! }
}
! } catch (Exception exception) {
Logger.getLogger().error("XML_BEAN_ERROR", exception);
!
! throw new SAXParseException(exception.getLocalizedMessage(),
! m_context.getLocator(), exception);
}
***************
*** 178,182 ****
private void setAttributesToEntryTable(Attributes attributes)
! throws Exception {
for (int j = 0; j < attributes.getLength(); j++) {
String attributeName = attributes.getLocalName(j);
--- 162,166 ----
private void setAttributesToEntryTable(Attributes attributes)
! throws Exception {
for (int j = 0; j < attributes.getLength(); j++) {
String attributeName = attributes.getLocalName(j);
***************
*** 188,203 ****
}
! private Object setChild(
! Object parent,
! Class childClass,
! String tagId,
! String refId)
! throws Exception {
Object childObject = null;
! /*String childName = childClass.getName();
! int index = childName.lastIndexOf(".");
! if (index != -1) {
! childName = childName.substring(index + 1, childName.length());
! }*/
// introspect to see if there is a method with this childName
--- 172,183 ----
}
! private Object setChild(Object parent, Class childClass, String tagId,
! String refId) throws Exception {
Object childObject = null;
! /*
! * String childName = childClass.getName(); int index =
! * childName.lastIndexOf("."); if (index != -1) { childName =
! * childName.substring(index + 1, childName.length()); }
! */
// introspect to see if there is a method with this childName
***************
*** 211,229 ****
Class[] parameters = method.getParameterTypes();
! if (parameters.length == 3
! && methodName.startsWith("createChild")) {
!
! //TODO **** going wrong in the child class
! childObject =
! method.invoke(
! parent,
! new Object[] { childClass, tagId, refId });
! // log it
Logger.getLogger().debug(
! "Child :"
! + childClass.getName()
! + " is set, for the Parent "
! + clazz.getName());
// jump out of the loop
--- 191,204 ----
Class[] parameters = method.getParameterTypes();
! if (parameters.length == 3 && methodName.startsWith("createChild")) {
! // TODO **** going wrong in the child class
! childObject = method.invoke(parent, new Object[] { childClass,
! tagId, refId });
!
! // log it
Logger.getLogger().debug(
! "Child :" + childClass.getName()
! + " is set, for the Parent " + clazz.getName());
// jump out of the loop
***************
*** 234,242 ****
}
! private boolean setMethods(
! Object tagObject,
! Object attribute,
! Object attributeValue)
! throws Exception {
// introspect to see if there is a method with this attribute Name
Class clazz = tagObject.getClass();
--- 209,214 ----
}
! private boolean setMethods(Object tagObject, Object attribute,
! Object attributeValue) throws Exception {
// introspect to see if there is a method with this attribute Name
Class clazz = tagObject.getClass();
***************
*** 247,252 ****
if (attribute instanceof String) {
attributeName = (String) attribute;
! }
! else {
attributeName = getClassNameWithoutPackage(attribute);
}
--- 219,223 ----
if (attribute instanceof String) {
attributeName = (String) attribute;
! } else {
attributeName = getClassNameWithoutPackage(attribute);
}
***************
*** 260,265 ****
// check of setXyz(Class) pattern
if (java.lang.Void.TYPE.equals(returnType)
! && methodName.startsWith("set")) {
! // remove the set from the method name
String tmp = methodName.substring(3, methodName.length());
// compare it with attribute name
--- 231,236 ----
// check of setXyz(Class) pattern
if (java.lang.Void.TYPE.equals(returnType)
! && methodName.startsWith("set")) {
! // remove the set from the method name
String tmp = methodName.substring(3, methodName.length());
// compare it with attribute name
***************
*** 267,283 ****
if (parameters.length == 1
! && parameters[0] == attributeValue.getClass()) {
! method.invoke(
! tagObject,
! new Object[] { attributeValue });
! }
! else if (parameters.length == 2) {
! method.invoke(
! tagObject,
! new Object[] { attribute, attributeValue });
}
! // log it
Logger.getLogger().debug(
! "Attribute :" + attributeName + " is set");
attributeSet = true;
--- 238,251 ----
if (parameters.length == 1
! && parameters[0] == attributeValue.getClass()) {
! method.invoke(tagObject,
! new Object[] { attributeValue });
! } else if (parameters.length == 2) {
! method.invoke(tagObject, new Object[] { attribute,
! attributeValue });
}
! // log it
Logger.getLogger().debug(
! "Attribute :" + attributeName + " is set");
attributeSet = true;
***************
*** 290,298 ****
}
! private void setObjectAttributes(
! String tag,
! Object tagObject,
! Attributes attributes)
! throws Exception {
// introspect to see if there is a method with this attribute Name
Class clazz = tagObject.getClass();
--- 258,263 ----
}
! private void setObjectAttributes(String tag, Object tagObject,
! Attributes attributes) throws Exception {
// introspect to see if there is a method with this attribute Name
Class clazz = tagObject.getClass();
***************
*** 305,357 ****
// tag, ref id and class attributes are already handled
if (attributeName != XMLTagConstants.XML_TAG_ID
! && attributeName != XMLTagConstants.XML_TAG_REF_ID
! && attributeName != XMLTagConstants.XML_CLASS_ATTRIBUTE) {
! //check the xmlEntryTable to see if there are any class names
// for the attributes
! String attributeClassName =
! (String) this.m_xmlEntryTable.get(
! tag + "." + attributeName);
Object objectAttributeValue = null;
if (attributeClassName != null
! && !attributeClassName.equals("")) {
// if there is a class name, load a class
! Class attributeClass =
! m_classLoaderHelper.getClassForName(attributeClassName);
! objectAttributeValue =
! ReferenceManager.createObject(
! attributeClass,
! attributeName,
! null);
if (objectAttributeValue != null) {
if (!(objectAttributeValue instanceof IXMLAttribute)) {
! objectAttributeValue =
! ReferenceManager.createObject(
! attributeClass,
! (String) attributeValue,
! null);
attributeValue = objectAttributeValue;
! attribute =
! getClassNameWithoutPackage(attributeClassName);
! }
! else {
attribute = objectAttributeValue;
}
}
}
! // invoke the setMethod if Found
! boolean attributeSet =
! setMethods(tagObject, attribute, attributeValue);
if (!attributeSet) {
Logger.getLogger().error(
! "Attribute :"
! + attributeName
! + " is not available in the class :"
! + clazz.getName());
}
}
--- 270,313 ----
// tag, ref id and class attributes are already handled
if (attributeName != XMLTagConstants.XML_TAG_ID
! && attributeName != XMLTagConstants.XML_TAG_REF_ID
! && attributeName != XMLTagConstants.XML_CLASS_ATTRIBUTE) {
! // check the xmlEntryTable to see if there are any class names
// for the attributes
! String attributeClassName = (String) this.m_xmlEntryTable
! .get(tag + "." + attributeName);
Object objectAttributeValue = null;
if (attributeClassName != null
! && !attributeClassName.equals("")) {
// if there is a class name, load a class
! Class attributeClass = m_classLoaderHelper
! .getClassForName(attributeClassName);
! objectAttributeValue = ReferenceManager.createObject(
! attributeClass, attributeName, null);
if (objectAttributeValue != null) {
if (!(objectAttributeValue instanceof IXMLAttribute)) {
! objectAttributeValue = ReferenceManager
! .createObject(attributeClass,
! (String) attributeValue, null);
attributeValue = objectAttributeValue;
! attribute = getClassNameWithoutPackage(attributeClassName);
! } else {
attribute = objectAttributeValue;
}
}
}
! // invoke the setMethod if Found
! boolean attributeSet = setMethods(tagObject, attribute,
! attributeValue);
if (!attributeSet) {
Logger.getLogger().error(
! "Attribute :" + attributeName
! + " is not available in the class :"
! + clazz.getName());
}
}
***************
*** 366,380 ****
int index = pkgClassName.lastIndexOf(".");
if (index != -1) {
! pkgClassName =
! pkgClassName.substring(index + 1, pkgClassName.length());
}
return pkgClassName;
}
/**
* Sets the locator in the project helper for future reference.
! *
! * @param locator The locator used by the parser.
! * Will not be <code>null</code>.
*/
public void setDocumentLocator(Locator locator) {
--- 322,337 ----
int index = pkgClassName.lastIndexOf(".");
if (index != -1) {
! pkgClassName = pkgClassName.substring(index + 1, pkgClassName
! .length());
}
return pkgClassName;
}
+
/**
* Sets the locator in the project helper for future reference.
! *
! * @param locator
! * The locator used by the parser. Will not be <code>null</code>.
*/
public void setDocumentLocator(Locator locator) {
***************
*** 383,397 ****
/**
! * @param uri The namespace URI for this element.
! * @param name The name of the element which is ending.
! * Will not be <code>null</code>.
! * @param qName The qualified name for this element.
! *
! * @exception SAXException in case of error (not thrown in
! * this implementation)
! *
*/
public void endElement(String uri, String name, String qName)
! throws SAXException {
try {
--- 340,357 ----
/**
! * @param uri
! * The namespace URI for this element.
! * @param name
! * The name of the element which is ending. Will not be
! * <code>null</code>.
! * @param qName
! * The qualified name for this element.
! *
! * @exception SAXException
! * in case of error (not thrown in this implementation)
! *
*/
public void endElement(String uri, String name, String qName)
! throws SAXException {
try {
***************
*** 401,426 ****
// if it is the XMLGrouperElement
if (!clazzName
! .equals(XMLGrouperElement.XML_GROUPER_ELEMENT_CLASSNAME)) {
// pop the element out of the stack
m_tagObjectStack.pop();
}
! }
! catch (Exception exception) {
! Logger.getLogger().error(Messages.getString(MessageConstants.XML_BEAN_ERROR), exception);
! throw new SAXParseException(
! exception.getLocalizedMessage(),
! m_context.getLocator(),
! exception);
}
}
/**
! * @param buf A character array of the test.
! * @param start The start offset in the array.
! * @param count The number of characters to read.
! * @exception SAXParseException if an error occurs
*/
public void characters(char[] buf, int start, int count)
! throws SAXParseException {
}
--- 361,389 ----
// if it is the XMLGrouperElement
if (!clazzName
! .equals(XMLGrouperElement.XML_GROUPER_ELEMENT_CLASSNAME)) {
// pop the element out of the stack
m_tagObjectStack.pop();
}
! } catch (Exception exception) {
! Logger.getLogger().error(
! Messages.getString(MessageConstants.XML_BEAN_ERROR),
! exception);
! throw new SAXParseException(exception.getLocalizedMessage(),
! m_context.getLocator(), exception);
}
}
/**
! * @param buf
! * A character array of the test.
! * @param start
! * The start offset in the array.
! * @param count
! * The number of characters to read.
! * @exception SAXParseException
! * if an error occurs
*/
public void characters(char[] buf, int start, int count)
! throws SAXParseException {
}
***************
*** 428,434 ****
/**
* Start a namespace prefix to uri mapping
! *
! * @param prefix the namespace prefix
! * @param uri the namespace uri
*/
public void startPrefixMapping(String prefix, String uri) {
--- 391,399 ----
/**
* Start a namespace prefix to uri mapping
! *
! * @param prefix
! * the namespace prefix
! * @param uri
! * the namespace uri
*/
public void startPrefixMapping(String prefix, String uri) {
***************
*** 438,447 ****
/**
* End a namepace prefix to uri mapping
! *
! * @param prefix the prefix that is not mapped anymore
*/
public void endPrefixMapping(String prefix) {
m_context.endPrefixMapping(prefix);
}
/**
* @return
--- 403,414 ----
/**
* End a namepace prefix to uri mapping
! *
! * @param prefix
! * the prefix that is not mapped anymore
*/
public void endPrefixMapping(String prefix) {
m_context.endPrefixMapping(prefix);
}
+
/**
* @return
Index: XMLContext.java
===================================================================
RCS file: /cvsroot/krysalis/krysalis-update/src/java/org/krysalis/depot/update/util/xml/XMLContext.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** XMLContext.java 8 Dec 2004 09:06:29 -0000 1.1
--- XMLContext.java 8 Dec 2004 09:11:51 -0000 1.2
***************
*** 28,36 ****
* @author anou_mana
*/
! public class XMLContext
! {
/**
! * Locator for the configuration file parser.
! * Used for giving locations of errors etc.
*/
private Locator locator;
--- 28,35 ----
* @author anou_mana
*/
! public class XMLContext {
/**
! * Locator for the configuration file parser. Used for giving locations of
! * errors etc.
*/
private Locator locator;
***************
*** 40,51 ****
File m_buildFile = null;
!
private HashMap m_createdTagObjects = new HashMap();
!
/**
*
*/
! public XMLContext()
! {
super();
// TODO Auto-generated constructor stub
--- 39,49 ----
File m_buildFile = null;
!
private HashMap m_createdTagObjects = new HashMap();
!
/**
*
*/
! public XMLContext() {
super();
// TODO Auto-generated constructor stub
***************
*** 54,57 ****
--- 52,56 ----
/**
* access the locator
+ *
* @return locator
*/
***************
*** 62,66 ****
/**
* sets the locator
! * @param locator locator
*/
public void setLocator(Locator locator) {
--- 61,67 ----
/**
* sets the locator
! *
! * @param locator
! * locator
*/
public void setLocator(Locator locator) {
***************
*** 70,76 ****
/**
* Called during parsing, stores the prefix to uri mapping.
! *
! * @param prefix a namespace prefix
! * @param uri a namespace uri
*/
public void startPrefixMapping(String prefix, String uri) {
--- 71,79 ----
/**
* Called during parsing, stores the prefix to uri mapping.
! *
! * @param prefix
! * a namespace prefix
! * @param uri
! * a namespace uri
*/
public void startPrefixMapping(String prefix, String uri) {
***************
*** 85,90 ****
/**
* End of prefix to uri mapping.
! *
! * @param prefix the namespace prefix
*/
public void endPrefixMapping(String prefix) {
--- 88,94 ----
/**
* End of prefix to uri mapping.
! *
! * @param prefix
! * the namespace prefix
*/
public void endPrefixMapping(String prefix) {
***************
*** 98,103 ****
/**
* prefix to namespace uri mapping
! *
! * @param prefix the prefix to map
* @return the uri for this prefix, null if not present
*/
--- 102,108 ----
/**
* prefix to namespace uri mapping
! *
! * @param prefix
! * the prefix to map
* @return the uri for this prefix, null if not present
*/
***************
*** 113,118 ****
* @return
*/
! public File getBuildFile()
! {
return m_buildFile;
}
--- 118,122 ----
* @return
*/
! public File getBuildFile() {
return m_buildFile;
}
***************
*** 121,126 ****
* @param file
*/
! public void setBuildFile(File file)
! {
m_buildFile = file;
}
--- 125,129 ----
* @param file
*/
! public void setBuildFile(File file) {
m_buildFile = file;
}
***************
*** 129,134 ****
* @return
*/
! public HashMap getCreatedTagObjects()
! {
return m_createdTagObjects;
}
--- 132,136 ----
* @return
*/
! public HashMap getCreatedTagObjects() {
return m_createdTagObjects;
}
***************
*** 137,152 ****
* @param map
*/
! public void setCreatedTagObjects(HashMap map)
! {
m_createdTagObjects = map;
}
! public Object getCreatedTagObject(String tagName)
! {
return this.m_createdTagObjects.get(tagName);
}
!
! public void putCreatedTagObject(String tagName, Object tagObject)
! {
this.m_createdTagObjects.put(tagName, tagObject);
}
--- 139,151 ----
* @param map
*/
! public void setCreatedTagObjects(HashMap map) {
m_createdTagObjects = map;
}
! public Object getCreatedTagObject(String tagName) {
return this.m_createdTagObjects.get(tagName);
}
!
! public void putCreatedTagObject(String tagName, Object tagObject) {
this.m_createdTagObjects.put(tagName, tagObject);
}
Index: XMLEntryTable.java
===================================================================
RCS file: /cvsroot/krysalis/krysalis-update/src/java/org/krysalis/depot/update/util/xml/XMLEntryTable.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** XMLEntryTable.java 8 Dec 2004 09:06:29 -0000 1.1
--- XMLEntryTable.java 8 Dec 2004 09:11:52 -0000 1.2
***************
*** 20,31 ****
/**
! * Implementation to store xml configuration tags and values in the provided classes. These classes
! * can be provided through the xml-tag "class". Some standard-Classes are normally provided by the
! * sub-classes
*
! * @author <a href="http://incubator.apache.org/depot">The Apache Incubator Depot Project</a>
*/
! public class XMLEntryTable
! {
protected HashMap m_entryToClassMap = new HashMap();
--- 20,31 ----
/**
! * Implementation to store xml configuration tags and values in the provided
! * classes. These classes can be provided through the xml-tag "class". Some
! * standard-Classes are normally provided by the sub-classes
*
! * @author <a href="http://incubator.apache.org/depot">The Apache Incubator
! * Depot Project </a>
*/
! public class XMLEntryTable {
protected HashMap m_entryToClassMap = new HashMap();
***************
*** 33,56 ****
* Constructor
*/
! public XMLEntryTable()
! {
super();
}
! public void put(String entry, Class clazz)
! {
this.m_entryToClassMap.put(entry, clazz);
}
!
! public void put(String entry, String className) throws Exception
! {
this.m_entryToClassMap.put(entry, className);
}
!
! public Object get(String entry)
! {
return this.m_entryToClassMap.get(entry);
}
!
/**
* This returns the Class to the given entry
--- 33,52 ----
* Constructor
*/
! public XMLEntryTable() {
super();
}
! public void put(String entry, Class clazz) {
this.m_entryToClassMap.put(entry, clazz);
}
!
! public void put(String entry, String className) throws Exception {
this.m_entryToClassMap.put(entry, className);
}
!
! public Object get(String entry) {
return this.m_entryToClassMap.get(entry);
}
!
/**
* This returns the Class to the given entry
***************
*** 59,64 ****
* @return
*/
! public Object getClass(String entry)
! {
return this.m_entryToClassMap.get(entry);
}
--- 55,59 ----
* @return
*/
! public Object getClass(String entry) {
return this.m_entryToClassMap.get(entry);
}
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/