abdera-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ugo Cei <ugo....@gmail.com>
Subject Using a custom factory
Date Mon, 09 Oct 2006 12:19:17 GMT
Folks,

I'm trying to extend the stock Abdera factory to perform some tricks  
(more on this later). This is what I'm doing:

         System.setProperty("org.apache.abdera.factory.Factory",
                            "org.apache.abdera.ext.MyFactory");
         InputStream in = this.getClass().getResourceAsStream("/ 
simple.xml");
         Parser parser = Abdera.getNewParser();
         Document<Feed> doc = parser.parse(in);

And here's my Factory class:


public class MyFactory extends FOMFactory {

     private static final Log logger = LogFactory.getLog 
(MyFactory.class);

     public MyFactory() {
         super();
         logger.debug("<init>");
     }

     public MyFactory(Abdera abdera) {
         super(abdera);
         logger.debug("<init>(" + abdera + ")");
     }

     @Override
     protected OMElement createElement(QName qname, OMContainer  
parent, FOMBuilder builder) {
         logger.debug("createElement(" + qname + ")");
         OMElement element = super.createElement(qname, parent,  
builder);
         return element;
     }

     @Override
     protected OMElement createElement(QName qname, OMContainer  
parent, OMFactory factory, Object objecttype) {
         logger.debug("createElement(" + qname + ")");
         OMElement element = super.createElement(qname, parent,  
factory, objecttype);
         return element;
     }

}

As you can see I'm basically delegating everything back to the parent  
class, apart from some logging.

I would expect my overridden createElement methods to be called, but  
they are not. I get the logging output from the MyFactory(Abdera  
abdera) constructor, but nothing else.

Any hints?

	Ugo



-- 
Ugo Cei
Blog: http://agylen.com/
Open Source Zone: http://oszone.org/
Evil or Not?: http://evilornot.info/
Company: http://www.sourcesense.com/



Mime
View raw message