|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface EmbedderFactory
Factory interface for a factory returning an Embedder
object. Any EmbedderFactories available to the Context will be checked to
see if they match the "format" attribute of the XML, and if they do an
Embedder
will be created.
package mypackage; import java.io.*; import javax.imageio.*; import org.faceless.graph2.tag.*; public class JPEGEmbedderFactory extends EmbedderFactory { public boolean matches(String format) { return "jpeg".equals(format); } public Embedder newEmbedder() { return new PNGEmbedder() { public String getMIMEType() { return "image/jpeg"; } public void writeBitmap(ImageOutput img, OutputStream out) throws IOException { ImageIO.write(img.getImage(), "JPEG", out); } }; } }Second, create the following file exactly as it is here:
# List of EmbedderFactories in this Jar mypackage.JPEGEmbedderFactoryFinally, add this file as
META-INF/services/org.faceless.graph2.tag.EmbedderFactories
along with the class files created above to a Jar file. The Jar should contain the following files.
mypackage/JPEGEmbedderFactory.class mypackage/JPEGEmbedderFactory$1.class META-INF/services/org.faceless.graph2.tag.EmbedderFactoriesMake the Jar available to your web application and reload the context. You'll then be able to add
format="jpeg"
as an attribute to your graphs to create
JPEG images.
Method Summary | |
---|---|
boolean |
matches(String type)
Return true if this Factory mathches the specified type |
Embedder |
newEmbedder(String type)
Create a new Embedder object |
Method Detail |
---|
boolean matches(String type)
Embedder newEmbedder(String type)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |