01: package org.conform.mdl;
02:
03: import org.conform.*;
04: import org.xml.sax.AttributeList;
05: import org.xml.sax.SAXException;
06: import org.apache.commons.logging.LogFactory;
07:
08: import java.beans.ExceptionListener;
09:
10: public class DomainProviderHandler extends ScopeHandler implements
11: ObjectScope {
12: private static org.apache.commons.logging.Log LOG = LogFactory
13: .getLog(Meta.class);
14:
15: private Object object;
16:
17: public DomainProviderHandler(ExceptionListener exceptionListener) {
18: super (exceptionListener);
19: }
20:
21: public void startElement(String name, AttributeList attributes)
22: throws SAXException {
23: if ("domain-provider".equals(name)) {
24: LOG.trace("domain-provider");
25: } else {
26: getHandler("java").setScope(this );
27: getHandler("java").startElement(name, attributes);
28: }
29: }
30:
31: public void endElement(String name) throws SAXException {
32: if ("domain-provider".equals(name)) {
33: if (getScope() instanceof PropertyMeta) {
34: PropertyMeta propertyMeta = (PropertyMeta) getScope();
35: propertyMeta.setDomainProvider((DomainProvider) object);
36: } else if (getScope() instanceof BeanMeta) {
37: BeanMeta beanMeta = (BeanMeta) getScope();
38: beanMeta.setDomainProvider((DomainProvider) object);
39: }
40: } else
41: getHandler("java").endElement(name);
42: }
43:
44: public void characters(char ch[], int start, int length)
45: throws SAXException {
46: getHandler("java").characters(ch, start, length);
47: }
48:
49: public void setObject(Object object) {
50: LOG.debug("domain provider = " + object);
51: this .object = object;
52: }
53:
54: public Object getObject() {
55: return object;
56: }
57: }
|