On Tue, 4 Feb 2003, J.Pietschmann wrote:

> Stephan Michels wrote:
> > And why do you not use org.apache.excalibur.source.Source instead, and use
> > org.apache.excalibur.xml.dom.DOMParser and
> > org.apache.excalibur.xml.sax.SAXParser to get the content for you
> > StreamSource or SAXSource?
>
> Because I can't find any of the above in my Excalibur source
> distribution. You are invited to add your proposal to the wiki,
> with proper references of course.

I never used Wiki, so I don't want to break something.

Some points I want to propose are

1. Hide implementation behing a universal interface

public interface FOProcessor {
  public final static String ROLE = "org.apache.fop.api.FOProcessor";

  public void render(String source,
                     org.apache.fop.api.Renderer renderer)
        throws FOPException {
  }

  public void setRenderer(org.apache.fop.api.Renderer renderer) {
  }

  public void setImageResolver(ImageResolver resolver) {
  }

  public ImageResolver getImageResolver() {
  }

  public void setFontResolver(FontResolver resolver) {
  }

  public FontResolver getFontResolver() {
  }
}

public class FOProcessorImpl implements FOProcessor, Composable,
                                        Configurable, LogEnabled{

   public void compose(ComponentManager cm) {
      this.sourceresolver = cm.lookup(SourceResolver.ROLE);
   }

   public void enableLogger(Logger logger) {
      this.logger = logger;
   }

   public Font getFont(String font) {
  }

  public FontResolver getFontResolver() {
  }
}

public class FOProcessorImpl implements FOProcessor, Composable,
                                        Configurable, LogEnabled{

   public void compose(ComponentManager cm) {
      this.sourceresolver = cm.lookup(SourceResolver.ROLE);
   }

   public void enableLogger(Logger logger) {
      this.logger = logger;
   }

   public Font getFont(String font) {
      String uri = fontresolver.getURI(font);
      Source source = sourceresolver.resolveURI(uri);
      InputStream in = source.getInputStream();
      [...]
   }
}

This will also prevents you make dependencies to the Avlon project.

Which XML presentation do you prefer internally SAX/DOM? You will have
a problem if you will support both representations, IHMO. Following
solution could work..

ContentHandler =
(ContentHandler)FOProcessorFactory.createSAXFOProcessor();

DOMFOProcessor = FOProcessorFactory.createDOMFOProcessor();

My two cents, Stephan Michels.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to