diff --git a/batik-all/pom.xml b/batik-all/pom.xml index d819e483c0..a6d598c604 100644 --- a/batik-all/pom.xml +++ b/batik-all/pom.xml @@ -27,7 +27,7 @@ batik-all ${project.groupId}:${project.artifactId} Batik aggregate artifact - pom + jar org.apache.xmlgraphics @@ -186,30 +186,21 @@ - org.apache.maven.plugins - maven-assembly-plugin - - - package-all - package - - single - - - false - false - - - true - org.apache.batik.apps.svgbrowser.Main - - - - src/tools/resources/assembly/assembly.xml - - - - + biz.aQute.bnd + bnd-maven-plugin + + + diff --git a/batik-all/src/tools/resources/assembly/assembly.xml b/batik-all/src/tools/resources/assembly/assembly.xml deleted file mode 100644 index dbda180969..0000000000 --- a/batik-all/src/tools/resources/assembly/assembly.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - all - - jar - - false - - - true - - - META-INF/maven - META-INF/maven/**/* - - - false - - - diff --git a/batik-anim/pom.xml b/batik-anim/pom.xml index d5f8fc7d15..1f03ee2618 100644 --- a/batik-anim/pom.xml +++ b/batik-anim/pom.xml @@ -60,11 +60,6 @@ batik-parser ${project.version} - - ${project.groupId} - batik-shared-resources - ${project.version} - ${project.groupId} batik-svg-dom @@ -85,23 +80,13 @@ - maven-dependency-plugin - ${dependency.version} - - - unpack-shared-resources - prepare-package - - unpack-dependencies - - - ${project.groupId} - batik-shared-resources - **/LICENSE,**/NOTICE - ${project.build.outputDirectory} - - - + biz.aQute.bnd + bnd-maven-plugin + + + diff --git a/batik-awt-util/pom.xml b/batik-awt-util/pom.xml index 3a42bed784..0bd2a0a172 100644 --- a/batik-awt-util/pom.xml +++ b/batik-awt-util/pom.xml @@ -35,11 +35,6 @@ - - ${project.groupId} - batik-shared-resources - ${project.version} - ${project.groupId} batik-util @@ -55,23 +50,15 @@ - maven-dependency-plugin - ${dependency.version} - - - unpack-shared-resources - prepare-package - - unpack-dependencies - - - ${project.groupId} - batik-shared-resources - **/LICENSE,**/NOTICE - ${project.build.outputDirectory} - - - + biz.aQute.bnd + bnd-maven-plugin + + + diff --git a/batik-awt-util/src/main/java/org/apache/batik/ext/awt/image/spi/JDKRegistryEntry.java b/batik-awt-util/src/main/java/org/apache/batik/ext/awt/image/spi/JDKRegistryEntry.java index 1b74800eeb..70461c90f1 100644 --- a/batik-awt-util/src/main/java/org/apache/batik/ext/awt/image/spi/JDKRegistryEntry.java +++ b/batik-awt-util/src/main/java/org/apache/batik/ext/awt/image/spi/JDKRegistryEntry.java @@ -35,16 +35,22 @@ Licensed to the Apache Software Foundation (ASF) under one or more import org.apache.batik.ext.awt.image.renderable.RedRable; import org.apache.batik.util.ParsedURL; +import aQute.bnd.annotation.spi.ServiceProvider; + /** * This Image tag registy entry is setup to wrap the core JDK * Image stream tools. * * @version $Id$ */ +@ServiceProvider(value = RegistryEntry.class, attribute = { + "mimeTypes:List='" + JDKRegistryEntry.MIMETYPE_IMAGE_GIF + "'", + "extensions:List=''" }) public class JDKRegistryEntry extends AbstractRegistryEntry implements URLRegistryEntry { - /** + protected static final String MIMETYPE_IMAGE_GIF = "image/gif"; + /** * The priority of this entry. * This entry should in most cases be the last entry. * but if one wishes one could set a priority higher and be called @@ -54,7 +60,7 @@ public class JDKRegistryEntry extends AbstractRegistryEntry 1000*MagicNumberRegistryEntry.PRIORITY; public JDKRegistryEntry() { - super ("JDK", PRIORITY, new String[0], new String [] {"image/gif"}); + super ("JDK", PRIORITY, new String[0], new String [] {MIMETYPE_IMAGE_GIF}); } /** diff --git a/batik-bridge/pom.xml b/batik-bridge/pom.xml index 551b22fe60..4c4d025035 100644 --- a/batik-bridge/pom.xml +++ b/batik-bridge/pom.xml @@ -70,11 +70,6 @@ batik-script ${project.version} - - ${project.groupId} - batik-shared-resources - ${project.version} - ${project.groupId} batik-svg-dom @@ -111,23 +106,14 @@ - maven-dependency-plugin - ${dependency.version} - - - unpack-shared-resources - prepare-package - - unpack-dependencies - - - ${project.groupId} - batik-shared-resources - **/LICENSE,**/NOTICE - ${project.build.outputDirectory} - - - + biz.aQute.bnd + bnd-maven-plugin + + + diff --git a/batik-bridge/src/main/java/org/apache/batik/bridge/RhinoInterpreterFactory.java b/batik-bridge/src/main/java/org/apache/batik/bridge/RhinoInterpreterFactory.java index f715fa948e..6bc6836696 100644 --- a/batik-bridge/src/main/java/org/apache/batik/bridge/RhinoInterpreterFactory.java +++ b/batik-bridge/src/main/java/org/apache/batik/bridge/RhinoInterpreterFactory.java @@ -24,6 +24,8 @@ Licensed to the Apache Software Foundation (ASF) under one or more import org.apache.batik.script.Interpreter; import org.apache.batik.script.InterpreterFactory; +import aQute.bnd.annotation.spi.ServiceProvider; + /** * Allows to create instances of RhinoInterpreter class. * @@ -31,16 +33,25 @@ Licensed to the Apache Software Foundation (ASF) under one or more * @author Vincent Hardy * @version $Id$ */ +@ServiceProvider(value = InterpreterFactory.class, attribute = { "mimeTypes:List='" + + RhinoInterpreterFactory.MIMETYPE_TEXT_JAVASCRIPT + "," + + RhinoInterpreterFactory.MIMETYPE_TEXT_ECMASCRIPT + "," + + RhinoInterpreterFactory.MIMETYPE_APPLICATION_JAVASCRIPT + "," + + RhinoInterpreterFactory.MIMETYPE_APPLICATION_ECMASCRIPT + "'" }) public class RhinoInterpreterFactory implements InterpreterFactory { - /** + protected static final String MIMETYPE_TEXT_JAVASCRIPT = "text/javascript"; + protected static final String MIMETYPE_TEXT_ECMASCRIPT = "text/ecmascript"; + protected static final String MIMETYPE_APPLICATION_JAVASCRIPT = "application/javascript"; + protected static final String MIMETYPE_APPLICATION_ECMASCRIPT = "application/ecmascript"; + /** * The MIME types that Rhino can handle. */ public static final String[] RHINO_MIMETYPES = { - "application/ecmascript", - "application/javascript", - "text/ecmascript", - "text/javascript", + MIMETYPE_APPLICATION_ECMASCRIPT, + MIMETYPE_APPLICATION_JAVASCRIPT, + MIMETYPE_TEXT_ECMASCRIPT, + MIMETYPE_TEXT_JAVASCRIPT, }; /** diff --git a/batik-bridge/src/main/java/org/apache/batik/bridge/SVGBridgeExtension.java b/batik-bridge/src/main/java/org/apache/batik/bridge/SVGBridgeExtension.java index 84011d94a1..1aed6f1d78 100644 --- a/batik-bridge/src/main/java/org/apache/batik/bridge/SVGBridgeExtension.java +++ b/batik-bridge/src/main/java/org/apache/batik/bridge/SVGBridgeExtension.java @@ -24,6 +24,8 @@ Licensed to the Apache Software Foundation (ASF) under one or more import org.apache.batik.util.SVGConstants; import org.w3c.dom.Element; +import aQute.bnd.annotation.spi.ServiceProvider; + /** * This is a Service interface for classes that want to extend the * functionality of the Bridge, to support new tags in the rendering tree. @@ -31,6 +33,7 @@ Licensed to the Apache Software Foundation (ASF) under one or more * @author Thomas DeWeese * @version $Id$ */ +@ServiceProvider(value = BridgeExtension.class) public class SVGBridgeExtension implements BridgeExtension { /** diff --git a/batik-bridge/src/main/java/org/apache/batik/bridge/svg12/SVG12BridgeExtension.java b/batik-bridge/src/main/java/org/apache/batik/bridge/svg12/SVG12BridgeExtension.java index 5d77570b1f..31d2152519 100644 --- a/batik-bridge/src/main/java/org/apache/batik/bridge/svg12/SVG12BridgeExtension.java +++ b/batik-bridge/src/main/java/org/apache/batik/bridge/svg12/SVG12BridgeExtension.java @@ -22,12 +22,15 @@ Licensed to the Apache Software Foundation (ASF) under one or more import java.util.Iterator; import org.apache.batik.bridge.BridgeContext; +import org.apache.batik.bridge.BridgeExtension; import org.apache.batik.bridge.SVGBridgeExtension; import org.apache.batik.util.SVGConstants; import org.apache.batik.util.SVG12Constants; import org.apache.batik.util.XBLConstants; import org.w3c.dom.Element; +import aQute.bnd.annotation.spi.ServiceProvider; + /** * This is a Service interface for classes that want to extend the * functionality of the Bridge, to support new tags in the rendering tree. @@ -35,6 +38,7 @@ Licensed to the Apache Software Foundation (ASF) under one or more * @author Thomas DeWeese * @version $Id$ */ +@ServiceProvider(value = BridgeExtension.class) public class SVG12BridgeExtension extends SVGBridgeExtension { /** diff --git a/batik-bridge/src/main/resources/META-INF/services/org.apache.batik.script.InterpreterFactory b/batik-bridge/src/main/resources/META-INF/services/org.apache.batik.script.InterpreterFactory deleted file mode 100644 index 4912fea645..0000000000 --- a/batik-bridge/src/main/resources/META-INF/services/org.apache.batik.script.InterpreterFactory +++ /dev/null @@ -1,30 +0,0 @@ -# ----------------------------------------------------------------------------- -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# This file registers the interpreter factories for the -# script languages that Batik understands. -# -# $Id$ -# ----------------------------------------------------------------------------- - - -# ECMAScript -org.apache.batik.bridge.RhinoInterpreterFactory -# TCL -#org.apache.batik.script.jacl.JaclInterpreterFactory -# Python -#org.apache.batik.script.jpython.JPythonInterpreterFactory diff --git a/batik-codec/pom.xml b/batik-codec/pom.xml index 79d1386018..0f51510e2e 100644 --- a/batik-codec/pom.xml +++ b/batik-codec/pom.xml @@ -45,11 +45,6 @@ batik-bridge ${project.version} - - ${project.groupId} - batik-shared-resources - ${project.version} - ${project.groupId} batik-transcoder @@ -65,23 +60,14 @@ - maven-dependency-plugin - ${dependency.version} - - - unpack-shared-resources - prepare-package - - unpack-dependencies - - - ${project.groupId} - batik-shared-resources - **/LICENSE,**/NOTICE - ${project.build.outputDirectory} - - - + biz.aQute.bnd + bnd-maven-plugin + + + diff --git a/batik-codec/src/main/java/org/apache/batik/ext/awt/image/codec/imageio/ImageIOImageWriter.java b/batik-codec/src/main/java/org/apache/batik/ext/awt/image/codec/imageio/ImageIOImageWriter.java index 7b2bbbe230..78b302f73e 100644 --- a/batik-codec/src/main/java/org/apache/batik/ext/awt/image/codec/imageio/ImageIOImageWriter.java +++ b/batik-codec/src/main/java/org/apache/batik/ext/awt/image/codec/imageio/ImageIOImageWriter.java @@ -48,6 +48,8 @@ public class ImageIOImageWriter implements ImageWriter, IIOWriteWarningListener private String targetMIME; + public static final String CODEC="ImageIO"; + /** * Main constructor. * @param mime the MIME type of the image format diff --git a/batik-codec/src/main/java/org/apache/batik/ext/awt/image/codec/imageio/ImageIOJPEGImageWriter.java b/batik-codec/src/main/java/org/apache/batik/ext/awt/image/codec/imageio/ImageIOJPEGImageWriter.java index 71c77b764a..ad75fe38c4 100644 --- a/batik-codec/src/main/java/org/apache/batik/ext/awt/image/codec/imageio/ImageIOJPEGImageWriter.java +++ b/batik-codec/src/main/java/org/apache/batik/ext/awt/image/codec/imageio/ImageIOJPEGImageWriter.java @@ -29,20 +29,26 @@ Licensed to the Apache Software Foundation (ASF) under one or more import org.apache.batik.ext.awt.image.spi.ImageWriterParams; +import aQute.bnd.annotation.spi.ServiceProvider; + /** * ImageWriter that encodes JPEG images using Image I/O. * * @version $Id$ */ +@ServiceProvider(value = ImageWriter.class, attribute = { + "mimeType:String='" + ImageIOJPEGImageWriter.MIMETYPE_IMAGE_JPEG + "'" , + "codec:String='" + ImageIOImageWriter.CODEC + "'" }) public class ImageIOJPEGImageWriter extends ImageIOImageWriter { - private static final String JPEG_NATIVE_FORMAT = "javax_imageio_jpeg_image_1.0"; + public static final String MIMETYPE_IMAGE_JPEG = "image/jpeg"; + private static final String JPEG_NATIVE_FORMAT = "javax_imageio_jpeg_image_1.0"; /** * Main constructor. */ public ImageIOJPEGImageWriter() { - super("image/jpeg"); + super(MIMETYPE_IMAGE_JPEG); } /** {@inheritDoc} */ diff --git a/batik-codec/src/main/java/org/apache/batik/ext/awt/image/codec/imageio/ImageIOJPEGRegistryEntry.java b/batik-codec/src/main/java/org/apache/batik/ext/awt/image/codec/imageio/ImageIOJPEGRegistryEntry.java index 4102304311..3a33f0a97e 100644 --- a/batik-codec/src/main/java/org/apache/batik/ext/awt/image/codec/imageio/ImageIOJPEGRegistryEntry.java +++ b/batik-codec/src/main/java/org/apache/batik/ext/awt/image/codec/imageio/ImageIOJPEGRegistryEntry.java @@ -18,18 +18,35 @@ Licensed to the Apache Software Foundation (ASF) under one or more */ package org.apache.batik.ext.awt.image.codec.imageio; +import org.apache.batik.ext.awt.image.spi.RegistryEntry; + +import aQute.bnd.annotation.spi.ServiceProvider; + /** * RegistryEntry implementation for loading JPEG images through Image I/O. * * @version $Id$ */ +@ServiceProvider(value = RegistryEntry.class, attribute = { + "mimeTypes:List='" + ImageIOJPEGRegistryEntry.MIMETYPE_IMAGE_JPEG + "," + + ImageIOJPEGRegistryEntry.MIMETYPE_IMAGE_JPG + "'", + "extensions:List='" + ImageIOJPEGRegistryEntry.EXTENSION_JPG + "," + ImageIOJPEGRegistryEntry.EXTENSION_JPEG + + "'" }) public class ImageIOJPEGRegistryEntry extends AbstractImageIORegistryEntry { - static final byte [] sigJPEG = {(byte)0xFF, (byte)0xd8, + protected static final String EXTENSION_JPG = "jpg"; + + protected static final String EXTENSION_JPEG = "jpeg"; + + protected static final String MIMETYPE_IMAGE_JPG = "image/jpg"; + + protected static final String MIMETYPE_IMAGE_JPEG = "image/jpeg"; + + static final byte [] sigJPEG = {(byte)0xFF, (byte)0xd8, (byte)0xFF}; - static final String [] exts = {"jpeg", "jpg" }; - static final String [] mimeTypes = {"image/jpeg", "image/jpg" }; + static final String [] exts = {EXTENSION_JPEG, EXTENSION_JPG }; + static final String [] mimeTypes = {MIMETYPE_IMAGE_JPEG, MIMETYPE_IMAGE_JPG }; static final MagicNumber [] magicNumbers = { new MagicNumber(0, sigJPEG) }; diff --git a/batik-codec/src/main/java/org/apache/batik/ext/awt/image/codec/imageio/ImageIOPNGImageWriter.java b/batik-codec/src/main/java/org/apache/batik/ext/awt/image/codec/imageio/ImageIOPNGImageWriter.java index 44989753cf..dabe944e15 100644 --- a/batik-codec/src/main/java/org/apache/batik/ext/awt/image/codec/imageio/ImageIOPNGImageWriter.java +++ b/batik-codec/src/main/java/org/apache/batik/ext/awt/image/codec/imageio/ImageIOPNGImageWriter.java @@ -18,18 +18,27 @@ Licensed to the Apache Software Foundation (ASF) under one or more */ package org.apache.batik.ext.awt.image.codec.imageio; +import javax.imageio.ImageWriter; + +import aQute.bnd.annotation.spi.ServiceProvider; + /** * ImageWriter that encodes PNG images using Image I/O. * * @version $Id$ */ +@ServiceProvider(value = ImageWriter.class, attribute = { + "mimeType:String='" + ImageIOPNGImageWriter.MIMETYPE_IMAGE_PNG + "'" , + "codec:String='" + ImageIOImageWriter.CODEC + "'" }) public class ImageIOPNGImageWriter extends ImageIOImageWriter { - /** + public static final String MIMETYPE_IMAGE_PNG = "image/png"; + + /** * Main constructor. */ public ImageIOPNGImageWriter() { - super("image/png"); + super(MIMETYPE_IMAGE_PNG); } } diff --git a/batik-codec/src/main/java/org/apache/batik/ext/awt/image/codec/imageio/ImageIOPNGRegistryEntry.java b/batik-codec/src/main/java/org/apache/batik/ext/awt/image/codec/imageio/ImageIOPNGRegistryEntry.java index ac6b5b8a12..78eca10a7f 100644 --- a/batik-codec/src/main/java/org/apache/batik/ext/awt/image/codec/imageio/ImageIOPNGRegistryEntry.java +++ b/batik-codec/src/main/java/org/apache/batik/ext/awt/image/codec/imageio/ImageIOPNGRegistryEntry.java @@ -18,19 +18,30 @@ Licensed to the Apache Software Foundation (ASF) under one or more */ package org.apache.batik.ext.awt.image.codec.imageio; +import org.apache.batik.ext.awt.image.spi.RegistryEntry; + +import aQute.bnd.annotation.spi.ServiceProvider; + /** * RegistryEntry implementation for loading PNG images through Image I/O. * * @version $Id$ */ +@ServiceProvider(value = RegistryEntry.class, attribute = { + "mimeTypes:List='" + ImageIOPNGRegistryEntry.MIMETYPE_IMAGE_PNG + "'", + "extensions:List='" + ImageIOPNGRegistryEntry.EXTENSION_PNG + "'" }) public class ImageIOPNGRegistryEntry extends AbstractImageIORegistryEntry { - static final byte [] signature = {(byte)0x89, 80, 78, 71, 13, 10, 26, 10}; + protected static final String EXTENSION_PNG = "png"; + + protected static final String MIMETYPE_IMAGE_PNG = "image/png"; + + static final byte [] signature = {(byte)0x89, 80, 78, 71, 13, 10, 26, 10}; public ImageIOPNGRegistryEntry() { - super("PNG", "png", "image/png", 0, signature); + super("PNG", EXTENSION_PNG, MIMETYPE_IMAGE_PNG, 0, signature); } } diff --git a/batik-codec/src/main/java/org/apache/batik/ext/awt/image/codec/imageio/ImageIOTIFFImageWriter.java b/batik-codec/src/main/java/org/apache/batik/ext/awt/image/codec/imageio/ImageIOTIFFImageWriter.java index 23b8c2c131..f6f9502b8e 100644 --- a/batik-codec/src/main/java/org/apache/batik/ext/awt/image/codec/imageio/ImageIOTIFFImageWriter.java +++ b/batik-codec/src/main/java/org/apache/batik/ext/awt/image/codec/imageio/ImageIOTIFFImageWriter.java @@ -18,18 +18,27 @@ Licensed to the Apache Software Foundation (ASF) under one or more */ package org.apache.batik.ext.awt.image.codec.imageio; +import javax.imageio.ImageWriter; + +import aQute.bnd.annotation.spi.ServiceProvider; + /** * ImageWriter that encodes TIFF images using Image I/O. * * @version $Id$ */ +@ServiceProvider(value = ImageWriter.class, attribute = { + "mimeType:String='" + ImageIOTIFFImageWriter.MIMETYPE_IMAGE_TIFF + "'" , + "codec:String='" + ImageIOImageWriter.CODEC + "'" }) public class ImageIOTIFFImageWriter extends ImageIOImageWriter { - /** + public static final String MIMETYPE_IMAGE_TIFF = "image/tiff"; + + /** * Main constructor. */ public ImageIOTIFFImageWriter() { - super("image/tiff"); + super(MIMETYPE_IMAGE_TIFF); } } diff --git a/batik-codec/src/main/java/org/apache/batik/ext/awt/image/codec/imageio/ImageIOTIFFRegistryEntry.java b/batik-codec/src/main/java/org/apache/batik/ext/awt/image/codec/imageio/ImageIOTIFFRegistryEntry.java index 7836006e96..7b59349573 100644 --- a/batik-codec/src/main/java/org/apache/batik/ext/awt/image/codec/imageio/ImageIOTIFFRegistryEntry.java +++ b/batik-codec/src/main/java/org/apache/batik/ext/awt/image/codec/imageio/ImageIOTIFFRegistryEntry.java @@ -19,24 +19,40 @@ Licensed to the Apache Software Foundation (ASF) under one or more package org.apache.batik.ext.awt.image.codec.imageio; import org.apache.batik.ext.awt.image.spi.MagicNumberRegistryEntry; +import org.apache.batik.ext.awt.image.spi.RegistryEntry; + +import aQute.bnd.annotation.spi.ServiceProvider; /** * RegistryEntry implementation for loading TIFF images through Image I/O. * * @version $Id$ */ +@ServiceProvider(value = RegistryEntry.class, attribute = { + "mimeTypes:List='" + ImageIOTIFFRegistryEntry.MIMETYPE_IMAGE_TIF + "," + + ImageIOTIFFRegistryEntry.MIMETYPE_IMAGE_TIFF + "'", + "extensions:List='" + ImageIOTIFFRegistryEntry.EXTENSION_TIF + "," + ImageIOTIFFRegistryEntry.EXTENSION_TIFF + + "'" }) public class ImageIOTIFFRegistryEntry extends AbstractImageIORegistryEntry { - static final byte [] sig1 = {(byte)0x49, (byte)0x49, 42, 0}; + protected static final String MIMETYPE_IMAGE_TIF = "image/tif"; + + protected static final String MIMETYPE_IMAGE_TIFF = "image/tiff"; + + protected static final String EXTENSION_TIF = "tif"; + + protected static final String EXTENSION_TIFF = "tiff"; + + static final byte [] sig1 = {(byte)0x49, (byte)0x49, 42, 0}; static final byte [] sig2 = {(byte)0x4D, (byte)0x4D, 0, 42}; static MagicNumberRegistryEntry.MagicNumber [] magicNumbers = { new MagicNumberRegistryEntry.MagicNumber(0, sig1), new MagicNumberRegistryEntry.MagicNumber(0, sig2) }; - static final String [] exts = {"tiff", "tif" }; - static final String [] mimeTypes = {"image/tiff", "image/tif" }; + static final String [] exts = {EXTENSION_TIFF, EXTENSION_TIF }; + static final String [] mimeTypes = {MIMETYPE_IMAGE_TIFF, MIMETYPE_IMAGE_TIF }; public ImageIOTIFFRegistryEntry() { super("TIFF", exts, mimeTypes, magicNumbers); diff --git a/batik-codec/src/main/java/org/apache/batik/ext/awt/image/codec/png/PNGImageWriter.java b/batik-codec/src/main/java/org/apache/batik/ext/awt/image/codec/png/PNGImageWriter.java index 7cf831d5a0..17055aa2e7 100644 --- a/batik-codec/src/main/java/org/apache/batik/ext/awt/image/codec/png/PNGImageWriter.java +++ b/batik-codec/src/main/java/org/apache/batik/ext/awt/image/codec/png/PNGImageWriter.java @@ -31,9 +31,18 @@ Licensed to the Apache Software Foundation (ASF) under one or more * * @version $Id$ */ +// NOTE: the "codec" package is deprecated, there entries are kept here for compatibility with older JVM versions +// (uses "sun.image", which is only supported in Sun Java implementations and was retired in JDK 7) +//@ServiceProvider(value = ImageWriter.class, attribute = { +// "mimeType:String='" + PNGImageWriter.MIMETYPE_IMAGE_PNG + "'" , +// "codec:String='" + PNGImageWriter.CODEC + "'" }) public class PNGImageWriter implements ImageWriter { - /** + public static final String CODEC="Batik"; + + public static final String MIMETYPE_IMAGE_PNG = "image/png"; + + /** * @see ImageWriter#writeImage(java.awt.image.RenderedImage, java.io.OutputStream) */ public void writeImage(RenderedImage image, OutputStream out) @@ -54,6 +63,6 @@ public void writeImage(RenderedImage image, OutputStream out, * @see ImageWriter#getMIMEType() */ public String getMIMEType() { - return "image/png"; + return MIMETYPE_IMAGE_PNG; } } diff --git a/batik-codec/src/main/java/org/apache/batik/ext/awt/image/codec/png/PNGRegistryEntry.java b/batik-codec/src/main/java/org/apache/batik/ext/awt/image/codec/png/PNGRegistryEntry.java index f297472e5c..0596dbfbfb 100644 --- a/batik-codec/src/main/java/org/apache/batik/ext/awt/image/codec/png/PNGRegistryEntry.java +++ b/batik-codec/src/main/java/org/apache/batik/ext/awt/image/codec/png/PNGRegistryEntry.java @@ -34,20 +34,28 @@ Licensed to the Apache Software Foundation (ASF) under one or more import org.apache.batik.ext.awt.image.rendered.FormatRed; import org.apache.batik.ext.awt.image.spi.ImageTagRegistry; import org.apache.batik.ext.awt.image.spi.MagicNumberRegistryEntry; +import org.apache.batik.ext.awt.image.spi.RegistryEntry; import org.apache.batik.util.ParsedURL; +import aQute.bnd.annotation.spi.ServiceProvider; + /** * * @version $Id$ */ +@ServiceProvider(value = RegistryEntry.class, attribute = { + "mimeTypes:List='" + PNGRegistryEntry.MIMETYPE_IMAGE_PNG + "'", + "extensions:List='" + PNGRegistryEntry.EXTENSION_PNG + "'" }) public class PNGRegistryEntry extends MagicNumberRegistryEntry { - static final byte [] signature = {(byte)0x89, 80, 78, 71, 13, 10, 26, 10}; + protected static final String EXTENSION_PNG = "png"; + protected static final String MIMETYPE_IMAGE_PNG = "image/png"; + static final byte [] signature = {(byte)0x89, 80, 78, 71, 13, 10, 26, 10}; public PNGRegistryEntry() { - super("PNG", "png", "image/png", 0, signature); + super("PNG", EXTENSION_PNG, MIMETYPE_IMAGE_PNG, 0, signature); } /** diff --git a/batik-codec/src/main/resources/META-INF/services/org.apache.batik.ext.awt.image.spi.ImageWriter b/batik-codec/src/main/resources/META-INF/services/org.apache.batik.ext.awt.image.spi.ImageWriter deleted file mode 100644 index 221bd91a83..0000000000 --- a/batik-codec/src/main/resources/META-INF/services/org.apache.batik.ext.awt.image.spi.ImageWriter +++ /dev/null @@ -1,29 +0,0 @@ -# ----------------------------------------------------------------------------- -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# This file registers PNG and JPEG writer classes. -# -# $Id$ -# ----------------------------------------------------------------------------- - -# NOTE: the "codec" package is deprecated, there entries are kept here for compatibility with older JVM versions -# (uses "sun.image", which is only supported in Sun Java implementations and was retired in JDK 7) -#org.apache.batik.ext.awt.image.codec.png.PNGImageWriter - -org.apache.batik.ext.awt.image.codec.imageio.ImageIOPNGImageWriter -org.apache.batik.ext.awt.image.codec.imageio.ImageIOTIFFImageWriter -org.apache.batik.ext.awt.image.codec.imageio.ImageIOJPEGImageWriter diff --git a/batik-codec/src/main/resources/META-INF/services/org.apache.batik.ext.awt.image.spi.RegistryEntry b/batik-codec/src/main/resources/META-INF/services/org.apache.batik.ext.awt.image.spi.RegistryEntry deleted file mode 100644 index 5856820831..0000000000 --- a/batik-codec/src/main/resources/META-INF/services/org.apache.batik.ext.awt.image.spi.RegistryEntry +++ /dev/null @@ -1,27 +0,0 @@ -# ----------------------------------------------------------------------------- -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# This file registers PNG and JPEG codecs. -# -# $Id$ -# ----------------------------------------------------------------------------- - -org.apache.batik.ext.awt.image.codec.png.PNGRegistryEntry - -org.apache.batik.ext.awt.image.codec.imageio.ImageIOJPEGRegistryEntry -org.apache.batik.ext.awt.image.codec.imageio.ImageIOPNGRegistryEntry -org.apache.batik.ext.awt.image.codec.imageio.ImageIOTIFFRegistryEntry diff --git a/batik-constants/pom.xml b/batik-constants/pom.xml index 6ff1ce7e30..b27a0ce328 100644 --- a/batik-constants/pom.xml +++ b/batik-constants/pom.xml @@ -34,34 +34,17 @@ 1.14.0-SNAPSHOT - - - ${project.groupId} - batik-shared-resources - ${project.version} - - - - maven-dependency-plugin - ${dependency.version} - - - unpack-shared-resources - prepare-package - - unpack-dependencies - - - ${project.groupId} - batik-shared-resources - **/LICENSE,**/NOTICE - ${project.build.outputDirectory} - - - + biz.aQute.bnd + bnd-maven-plugin + + + diff --git a/batik-css/pom.xml b/batik-css/pom.xml index dd6e2b2aba..a7f7975678 100644 --- a/batik-css/pom.xml +++ b/batik-css/pom.xml @@ -35,11 +35,6 @@ - - ${project.groupId} - batik-shared-resources - ${project.version} - ${project.groupId} batik-util @@ -60,23 +55,14 @@ - maven-dependency-plugin - ${dependency.version} - - - unpack-shared-resources - prepare-package - - unpack-dependencies - - - ${project.groupId} - batik-shared-resources - **/LICENSE,**/NOTICE - ${project.build.outputDirectory} - - - + biz.aQute.bnd + bnd-maven-plugin + + + diff --git a/batik-dom/pom.xml b/batik-dom/pom.xml index bddae90fb2..1caf753722 100644 --- a/batik-dom/pom.xml +++ b/batik-dom/pom.xml @@ -45,11 +45,6 @@ batik-ext ${project.version} - - ${project.groupId} - batik-shared-resources - ${project.version} - ${project.groupId} batik-util @@ -80,23 +75,14 @@ - maven-dependency-plugin - ${dependency.version} - - - unpack-shared-resources - prepare-package - - unpack-dependencies - - - ${project.groupId} - batik-shared-resources - **/LICENSE,**/NOTICE - ${project.build.outputDirectory} - - - + biz.aQute.bnd + bnd-maven-plugin + + + diff --git a/batik-ext/pom.xml b/batik-ext/pom.xml index 8c3abe4234..a2188c4440 100644 --- a/batik-ext/pom.xml +++ b/batik-ext/pom.xml @@ -34,34 +34,17 @@ 1.14.0-SNAPSHOT - - - ${project.groupId} - batik-shared-resources - ${project.version} - - - - maven-dependency-plugin - ${dependency.version} - - - unpack-shared-resources - prepare-package - - unpack-dependencies - - - ${project.groupId} - batik-shared-resources - **/LICENSE,**/NOTICE - ${project.build.outputDirectory} - - - + biz.aQute.bnd + bnd-maven-plugin + + + diff --git a/batik-extension/pom.xml b/batik-extension/pom.xml index 638bb70b74..15b7f2a52a 100644 --- a/batik-extension/pom.xml +++ b/batik-extension/pom.xml @@ -75,11 +75,6 @@ batik-parser ${project.version} - - ${project.groupId} - batik-shared-resources - ${project.version} - ${project.groupId} batik-svg-dom @@ -100,23 +95,18 @@ - maven-dependency-plugin - ${dependency.version} - - - unpack-shared-resources - prepare-package - - unpack-dependencies - - - ${project.groupId} - batik-shared-resources - **/LICENSE,**/NOTICE - ${project.build.outputDirectory} - - - + biz.aQute.bnd + bnd-maven-plugin + + + diff --git a/batik-extension/src/main/java/org/apache/batik/extension/svg/BatikBridgeExtension.java b/batik-extension/src/main/java/org/apache/batik/extension/svg/BatikBridgeExtension.java index 65dbf4510d..9ea92c84b5 100644 --- a/batik-extension/src/main/java/org/apache/batik/extension/svg/BatikBridgeExtension.java +++ b/batik-extension/src/main/java/org/apache/batik/extension/svg/BatikBridgeExtension.java @@ -18,15 +18,17 @@ Licensed to the Apache Software Foundation (ASF) under one or more */ package org.apache.batik.extension.svg; +import java.util.Arrays; import java.util.Collections; import java.util.Iterator; import java.util.List; -import java.util.Arrays; import org.apache.batik.bridge.BridgeContext; import org.apache.batik.bridge.BridgeExtension; import org.w3c.dom.Element; +import aQute.bnd.annotation.spi.ServiceProvider; + /** * This is a Service interface for classes that want to extend the * functionality of the Bridge, to support new tags in the rendering tree. @@ -34,6 +36,7 @@ Licensed to the Apache Software Foundation (ASF) under one or more * @author Thomas DeWeese * @version $Id$ */ +@ServiceProvider(value = BridgeExtension.class) public class BatikBridgeExtension implements BridgeExtension { /** diff --git a/batik-extension/src/main/java/org/apache/batik/extension/svg/BatikDomExtension.java b/batik-extension/src/main/java/org/apache/batik/extension/svg/BatikDomExtension.java index 352f50489b..ad1a35f909 100644 --- a/batik-extension/src/main/java/org/apache/batik/extension/svg/BatikDomExtension.java +++ b/batik-extension/src/main/java/org/apache/batik/extension/svg/BatikDomExtension.java @@ -22,10 +22,11 @@ Licensed to the Apache Software Foundation (ASF) under one or more import org.apache.batik.dom.AbstractDocument; import org.apache.batik.dom.DomExtension; import org.apache.batik.dom.ExtensibleDOMImplementation; - import org.w3c.dom.Document; import org.w3c.dom.Element; +import aQute.bnd.annotation.spi.ServiceProvider; + /** * This is a Service interface for classes that want to extend the * functionality of the Dom, to support new tags in the rendering tree. @@ -33,6 +34,7 @@ Licensed to the Apache Software Foundation (ASF) under one or more * @author Thomas DeWeese * @version $Id$ */ +@ServiceProvider(value = DomExtension.class) public class BatikDomExtension implements DomExtension, BatikExtConstants { diff --git a/batik-extension/src/main/resources/META-INF/services/org.apache.batik.bridge.BridgeExtension b/batik-extension/src/main/resources/META-INF/services/org.apache.batik.bridge.BridgeExtension deleted file mode 100644 index 51f48e1f57..0000000000 --- a/batik-extension/src/main/resources/META-INF/services/org.apache.batik.bridge.BridgeExtension +++ /dev/null @@ -1,24 +0,0 @@ -# ----------------------------------------------------------------------------- -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# This file registers the example Bridge extension as a service for the -# Bridge context. -# -# $Id$ -# ----------------------------------------------------------------------------- - -org.apache.batik.extension.svg.BatikBridgeExtension diff --git a/batik-extension/src/main/resources/META-INF/services/org.apache.batik.dom.DomExtension b/batik-extension/src/main/resources/META-INF/services/org.apache.batik.dom.DomExtension deleted file mode 100644 index e26bff5ebd..0000000000 --- a/batik-extension/src/main/resources/META-INF/services/org.apache.batik.dom.DomExtension +++ /dev/null @@ -1,24 +0,0 @@ -# ----------------------------------------------------------------------------- -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# This file registers the example DOM extension as a service for the -# SVGOMDocument. -# -# $Id$ -# ----------------------------------------------------------------------------- - -org.apache.batik.extension.svg.BatikDomExtension diff --git a/batik-gui-util/pom.xml b/batik-gui-util/pom.xml index 80202f7df4..29f392cbdf 100644 --- a/batik-gui-util/pom.xml +++ b/batik-gui-util/pom.xml @@ -36,11 +36,6 @@ - - ${project.groupId} - batik-shared-resources - ${project.version} - org.apache.xmlgraphics batik-util @@ -56,23 +51,14 @@ - maven-dependency-plugin - ${dependency.version} - - - unpack-shared-resources - prepare-package - - unpack-dependencies - - - ${project.groupId} - batik-shared-resources - **/LICENSE,**/NOTICE - ${project.build.outputDirectory} - - - + biz.aQute.bnd + bnd-maven-plugin + + + diff --git a/batik-gvt/pom.xml b/batik-gvt/pom.xml index d8785620ad..9112420bc9 100644 --- a/batik-gvt/pom.xml +++ b/batik-gvt/pom.xml @@ -40,11 +40,6 @@ batik-awt-util ${project.version} - - ${project.groupId} - batik-shared-resources - ${project.version} - ${project.groupId} batik-util @@ -55,23 +50,14 @@ - maven-dependency-plugin - ${dependency.version} - - - unpack-shared-resources - prepare-package - - unpack-dependencies - - - ${project.groupId} - batik-shared-resources - **/LICENSE,**/NOTICE - ${project.build.outputDirectory} - - - + biz.aQute.bnd + bnd-maven-plugin + + + diff --git a/batik-i18n/pom.xml b/batik-i18n/pom.xml index 76b6e1f2df..5f19bbafd0 100644 --- a/batik-i18n/pom.xml +++ b/batik-i18n/pom.xml @@ -34,34 +34,17 @@ 1.14.0-SNAPSHOT - - - ${project.groupId} - batik-shared-resources - ${project.version} - - - - maven-dependency-plugin - ${dependency.version} - - - unpack-shared-resources - prepare-package - - unpack-dependencies - - - ${project.groupId} - batik-shared-resources - **/LICENSE,**/NOTICE - ${project.build.outputDirectory} - - - + biz.aQute.bnd + bnd-maven-plugin + + + diff --git a/batik-parser/pom.xml b/batik-parser/pom.xml index b14f70164d..e6d99bd709 100644 --- a/batik-parser/pom.xml +++ b/batik-parser/pom.xml @@ -40,11 +40,6 @@ batik-awt-util ${project.version} - - ${project.groupId} - batik-shared-resources - ${project.version} - ${project.groupId} batik-util @@ -65,23 +60,14 @@ - maven-dependency-plugin - ${dependency.version} - - - unpack-shared-resources - prepare-package - - unpack-dependencies - - - ${project.groupId} - batik-shared-resources - **/LICENSE,**/NOTICE - ${project.build.outputDirectory} - - - + biz.aQute.bnd + bnd-maven-plugin + + + diff --git a/batik-script/pom.xml b/batik-script/pom.xml index 56e625eb50..d5adc26e14 100644 --- a/batik-script/pom.xml +++ b/batik-script/pom.xml @@ -40,11 +40,6 @@ batik-anim ${project.version} - - ${project.groupId} - batik-shared-resources - ${project.version} - ${project.groupId} batik-util @@ -66,6 +61,15 @@ + + biz.aQute.bnd + bnd-maven-plugin + + + + maven-compiler-plugin ${compiler.version} @@ -75,25 +79,6 @@ - - maven-dependency-plugin - ${dependency.version} - - - unpack-shared-resources - prepare-package - - unpack-dependencies - - - ${project.groupId} - batik-shared-resources - **/LICENSE,**/NOTICE - ${project.build.outputDirectory} - - - - diff --git a/batik-script/src/main/java/org/apache/batik/script/jacl/JaclInterpreterFactory.java b/batik-script/src/main/java/org/apache/batik/script/jacl/JaclInterpreterFactory.java index 1486cee92f..dbeda56ab8 100644 --- a/batik-script/src/main/java/org/apache/batik/script/jacl/JaclInterpreterFactory.java +++ b/batik-script/src/main/java/org/apache/batik/script/jacl/JaclInterpreterFactory.java @@ -20,21 +20,28 @@ Licensed to the Apache Software Foundation (ASF) under one or more import java.net.URL; +import org.apache.batik.ext.awt.image.spi.RegistryEntry; import org.apache.batik.script.ImportInfo; import org.apache.batik.script.Interpreter; import org.apache.batik.script.InterpreterFactory; +import org.apache.batik.script.jpython.JPythonInterpreterFactory; + +import aQute.bnd.annotation.spi.ServiceProvider; /** * Allows to create instances of JaclInterpreter class. * @author Christophe Jolif * @version $Id$ */ +@ServiceProvider(value = InterpreterFactory.class, attribute = { "mimeTypes:List='" + + JaclInterpreterFactory.MIMETYPE_TEXT_PYTHON + "'" }) public class JaclInterpreterFactory implements InterpreterFactory { - /** + private static final String MIMETYPE_TEXT_TCL = "text/tcl"; + /** * The MIME types that jacl can handle. */ - public static final String[] JACL_MIMETYPES = { "text/tcl" }; + public static final String[] JACL_MIMETYPES = { MIMETYPE_TEXT_TCL }; /** * Builds a JaclInterpreterFactory. diff --git a/batik-script/src/main/java/org/apache/batik/script/jpython/JPythonInterpreterFactory.java b/batik-script/src/main/java/org/apache/batik/script/jpython/JPythonInterpreterFactory.java index b5ef681917..a1e906e1f4 100644 --- a/batik-script/src/main/java/org/apache/batik/script/jpython/JPythonInterpreterFactory.java +++ b/batik-script/src/main/java/org/apache/batik/script/jpython/JPythonInterpreterFactory.java @@ -24,17 +24,22 @@ Licensed to the Apache Software Foundation (ASF) under one or more import org.apache.batik.script.Interpreter; import org.apache.batik.script.InterpreterFactory; +import aQute.bnd.annotation.spi.ServiceProvider; + /** * Allows to create instances of JPythonInterpreter class. * @author Christophe Jolif * @version $Id$ */ +@ServiceProvider(value = InterpreterFactory.class, attribute = { "mimeTypes:List='" + + JPythonInterpreterFactory.MIMETYPE_TEXT_PYTHON + "'" }) public class JPythonInterpreterFactory implements InterpreterFactory { - /** + protected static final String MIMETYPE_TEXT_PYTHON = "text/python"; + /** * The MIME types that JPython can handle. */ - public static final String[] JPYTHON_MIMETYPES = { "text/python" }; + public static final String[] JPYTHON_MIMETYPES = { MIMETYPE_TEXT_PYTHON }; /** * Builds a JPythonInterpreterFactory. diff --git a/batik-shared-resources/pom.xml b/batik-shared-resources/pom.xml index 2eee4edffc..5d202814e0 100644 --- a/batik-shared-resources/pom.xml +++ b/batik-shared-resources/pom.xml @@ -45,6 +45,16 @@ META-INF + + + biz.aQute.bnd + bnd-maven-plugin + + + + + diff --git a/batik-svg-dom/pom.xml b/batik-svg-dom/pom.xml index 9b41291870..d529ea4064 100644 --- a/batik-svg-dom/pom.xml +++ b/batik-svg-dom/pom.xml @@ -60,11 +60,6 @@ batik-parser ${project.version} - - ${project.groupId} - batik-shared-resources - ${project.version} - ${project.groupId} batik-util @@ -80,23 +75,15 @@ - maven-dependency-plugin - ${dependency.version} - - - unpack-shared-resources - prepare-package - - unpack-dependencies - - - ${project.groupId} - batik-shared-resources - **/LICENSE,**/NOTICE - ${project.build.outputDirectory} - - - + biz.aQute.bnd + bnd-maven-plugin + + + diff --git a/batik-svgbrowser/pom.xml b/batik-svgbrowser/pom.xml index 49813a6106..49040d9822 100644 --- a/batik-svgbrowser/pom.xml +++ b/batik-svgbrowser/pom.xml @@ -55,11 +55,6 @@ batik-gvt ${project.version} - - ${project.groupId} - batik-shared-resources - ${project.version} - ${project.groupId} batik-swing @@ -90,23 +85,13 @@ - maven-dependency-plugin - ${dependency.version} - - - unpack-shared-resources - prepare-package - - unpack-dependencies - - - ${project.groupId} - batik-shared-resources - **/LICENSE,**/NOTICE - ${project.build.outputDirectory} - - - + biz.aQute.bnd + bnd-maven-plugin + + + diff --git a/batik-svgbrowser/src/main/java/org/apache/batik/apps/svgbrowser/SVGInputHandler.java b/batik-svgbrowser/src/main/java/org/apache/batik/apps/svgbrowser/SVGInputHandler.java index 3f03f6b7a8..188948560c 100644 --- a/batik-svgbrowser/src/main/java/org/apache/batik/apps/svgbrowser/SVGInputHandler.java +++ b/batik-svgbrowser/src/main/java/org/apache/batik/apps/svgbrowser/SVGInputHandler.java @@ -29,12 +29,22 @@ Licensed to the Apache Software Foundation (ASF) under one or more * @author Vincent Hardy * @version $Id$ */ +//@ServiceProvider(value=SquiggleInputHandler.class,attribute ={ +// "mimeTypes:List='"+SVGInputHandler.MIME_TYPE_IMAGE_SVG_XML+"'", +// "extensions:List='"+SVGInputHandler.EXTENSION_SVG+","+SVGInputHandler.EXTENSION_SVGZ+"'"}) public class SVGInputHandler implements SquiggleInputHandler { - public static final String[] SVG_MIME_TYPES = - { "image/svg+xml" }; + + public static final String MIME_TYPE_IMAGE_SVG_XML = "image/svg+xml"; + + public static final String EXTENSION_SVGZ = ".svgz"; + + public static final String EXTENSION_SVG = ".svg"; + + public static final String[] SVG_MIME_TYPES = + { MIME_TYPE_IMAGE_SVG_XML }; public static final String[] SVG_FILE_EXTENSIONS = - { ".svg", ".svgz" }; + { EXTENSION_SVG, EXTENSION_SVGZ }; /** * Returns the list of mime types handled by this handler. diff --git a/batik-svgbrowser/src/main/java/org/apache/batik/apps/svgbrowser/XMLInputHandler.java b/batik-svgbrowser/src/main/java/org/apache/batik/apps/svgbrowser/XMLInputHandler.java index 350416cca2..535a7d0e33 100644 --- a/batik-svgbrowser/src/main/java/org/apache/batik/apps/svgbrowser/XMLInputHandler.java +++ b/batik-svgbrowser/src/main/java/org/apache/batik/apps/svgbrowser/XMLInputHandler.java @@ -36,7 +36,6 @@ Licensed to the Apache Software Foundation (ASF) under one or more import org.apache.batik.anim.dom.SAXSVGDocumentFactory; import org.apache.batik.anim.dom.SVGDOMImplementation; import org.apache.batik.dom.util.DOMUtilities; - import org.apache.batik.util.ParsedURL; import org.apache.batik.util.SVGConstants; import org.apache.batik.util.XMLResourceDescriptor; @@ -61,12 +60,22 @@ Licensed to the Apache Software Foundation (ASF) under one or more * @author Vincent Hardy * @version $Id$ */ +//@ServiceProvider(value=SquiggleInputHandler.class,attribute ={ +// "mimeTypes:List='"+XMLInputHandler.MIME_TYPE_IMAGE_XML_XSL_SVG+"'", +// "extensions:List='"+XMLInputHandler.EXTENSION_XML+","+XMLInputHandler.EXTENSION_XSL+"'"}) public class XMLInputHandler implements SquiggleInputHandler { - public static final String[] XVG_MIME_TYPES = - { "image/xml+xsl+svg" }; + + public static final String MIME_TYPE_IMAGE_XML_XSL_SVG = "image/xml+xsl+svg"; + + public static final String EXTENSION_XML = ".xml"; + + public static final String EXTENSION_XSL = ".xsl"; + + public static final String[] XVG_MIME_TYPES = + { MIME_TYPE_IMAGE_XML_XSL_SVG }; public static final String[] XVG_FILE_EXTENSIONS = - { ".xml", ".xsl" }; + { EXTENSION_XML, EXTENSION_XSL }; public static final String ERROR_NO_XML_STYLESHEET_PROCESSING_INSTRUCTION = "XMLInputHandler.error.no.xml.stylesheet.processing.instruction"; diff --git a/batik-svgbrowser/src/main/resources/META-INF/services/org.apache.batik.apps.svgbrowser.SquiggleInputHandler b/batik-svgbrowser/src/main/resources/META-INF/services/org.apache.batik.apps.svgbrowser.SquiggleInputHandler deleted file mode 100644 index 39b230f57b..0000000000 --- a/batik-svgbrowser/src/main/resources/META-INF/services/org.apache.batik.apps.svgbrowser.SquiggleInputHandler +++ /dev/null @@ -1,21 +0,0 @@ -# ----------------------------------------------------------------------------- -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# $Id$ -# ----------------------------------------------------------------------------- - -# org.apache.batik.apps.svgbrowser.XMLInputHandler diff --git a/batik-svggen/pom.xml b/batik-svggen/pom.xml index 833b4934a3..4de84a08ef 100644 --- a/batik-svggen/pom.xml +++ b/batik-svggen/pom.xml @@ -40,11 +40,6 @@ batik-awt-util ${project.version} - - ${project.groupId} - batik-shared-resources - ${project.version} - ${project.groupId} batik-util @@ -55,23 +50,14 @@ - maven-dependency-plugin - ${dependency.version} - - - unpack-shared-resources - prepare-package - - unpack-dependencies - - - ${project.groupId} - batik-shared-resources - **/LICENSE,**/NOTICE - ${project.build.outputDirectory} - - - + biz.aQute.bnd + bnd-maven-plugin + + + diff --git a/batik-svgrasterizer/pom.xml b/batik-svgrasterizer/pom.xml index ce896982e1..954eac2f14 100644 --- a/batik-svgrasterizer/pom.xml +++ b/batik-svgrasterizer/pom.xml @@ -40,11 +40,6 @@ batik-parser ${project.version} - - ${project.groupId} - batik-shared-resources - ${project.version} - ${project.groupId} batik-transcoder @@ -65,23 +60,14 @@ - maven-dependency-plugin - ${dependency.version} - - - unpack-shared-resources - prepare-package - - unpack-dependencies - - - ${project.groupId} - batik-shared-resources - **/LICENSE,**/NOTICE - ${project.build.outputDirectory} - - - + biz.aQute.bnd + bnd-maven-plugin + + + diff --git a/batik-swing/pom.xml b/batik-swing/pom.xml index 62cfc4d5d8..823aaae5c6 100644 --- a/batik-swing/pom.xml +++ b/batik-swing/pom.xml @@ -80,11 +80,6 @@ batik-script ${project.version} - - ${project.groupId} - batik-shared-resources - ${project.version} - ${project.groupId} batik-util @@ -100,23 +95,14 @@ - maven-dependency-plugin - ${dependency.version} - - - unpack-shared-resources - prepare-package - - unpack-dependencies - - - ${project.groupId} - batik-shared-resources - **/LICENSE,**/NOTICE - ${project.build.outputDirectory} - - - + biz.aQute.bnd + bnd-maven-plugin + + + diff --git a/batik-transcoder/pom.xml b/batik-transcoder/pom.xml index b784b30901..50c3103197 100644 --- a/batik-transcoder/pom.xml +++ b/batik-transcoder/pom.xml @@ -60,11 +60,6 @@ batik-gvt ${project.version} - - ${project.groupId} - batik-shared-resources - ${project.version} - org.apache.xmlgraphics batik-svggen @@ -90,23 +85,14 @@ - maven-dependency-plugin - ${dependency.version} - - - unpack-shared-resources - prepare-package - - unpack-dependencies - - - ${project.groupId} - batik-shared-resources - **/LICENSE,**/NOTICE - ${project.build.outputDirectory} - - - + biz.aQute.bnd + bnd-maven-plugin + + + diff --git a/batik-util/pom.xml b/batik-util/pom.xml index 23144d212b..c418bea787 100644 --- a/batik-util/pom.xml +++ b/batik-util/pom.xml @@ -45,11 +45,6 @@ batik-i18n ${project.version} - - ${project.groupId} - batik-shared-resources - ${project.version} - ${project.groupId} batik-test @@ -77,36 +72,16 @@ true - - org.apache.maven.plugins - maven-jar-plugin - ${jar.version} - - - - test-jar - - - - - maven-dependency-plugin - ${dependency.version} - - - unpack-shared-resources - prepare-package - - unpack-dependencies - - - ${project.groupId} - batik-shared-resources - **/LICENSE,**/NOTICE - ${project.build.outputDirectory} - - - + biz.aQute.bnd + bnd-maven-plugin + + + diff --git a/batik-util/src/main/java/org/apache/batik/util/Service.java b/batik-util/src/main/java/org/apache/batik/util/Service.java index 068610578a..32cdb57445 100644 --- a/batik-util/src/main/java/org/apache/batik/util/Service.java +++ b/batik-util/src/main/java/org/apache/batik/util/Service.java @@ -29,6 +29,7 @@ Licensed to the Apache Software Foundation (ASF) under one or more import java.util.HashMap; import java.util.Iterator; import java.util.List; +import java.util.ServiceLoader; /** * This class handles looking up service providers on the class path. @@ -44,9 +45,6 @@ Licensed to the Apache Software Foundation (ASF) under one or more */ public class Service { - // Remember providers we have looked up before. - static HashMap providerMap = new HashMap(); - /** * Returns an iterator where each element should implement the * interface (or subclass the baseclass) described by cls. The @@ -59,104 +57,8 @@ public class Service { * @param cls The class/interface to search for providers of. */ public static synchronized Iterator providers(Class cls) { - String serviceFile = "META-INF/services/"+cls.getName(); - - // System.out.println("File: " + serviceFile); - - List l = (List)providerMap.get(serviceFile); - if (l != null) - return l.iterator(); - - l = new ArrayList(); - providerMap.put(serviceFile, l); - - ClassLoader cl = null; - try { - cl = cls.getClassLoader(); - } catch (SecurityException se) { - // Ooops! can't get his class loader. - } - // Can always request your own class loader. But it might be 'null'. - if (cl == null) cl = Service.class.getClassLoader(); - - // No class loader so we can't find 'serviceFile'. - if (cl == null) return l.iterator(); - - Enumeration e; - try { - e = cl.getResources(serviceFile); - } catch (IOException ioe) { - return l.iterator(); - } - - while (e.hasMoreElements()) { - InputStream is = null; - Reader r = null; - BufferedReader br = null; - try { - URL u = (URL)e.nextElement(); - // System.out.println("URL: " + u); - - is = u.openStream(); - r = new InputStreamReader(is, "UTF-8"); - br = new BufferedReader(r); - - String line = br.readLine(); - while (line != null) { - try { - // First strip any comment... - int idx = line.indexOf('#'); - if (idx != -1) - line = line.substring(0, idx); - - // Trim whitespace. - line = line.trim(); - - // If nothing left then loop around... - if (line.length() == 0) { - line = br.readLine(); - continue; - } - // System.out.println("Line: " + line); - - // Try and load the class - Object obj = cl.loadClass(line).getDeclaredConstructor().newInstance(); - // stick it into our vector... - l.add(obj); - } catch (Exception ex) { - // Just try the next line - } - line = br.readLine(); - } - } catch (Exception ex) { - // Just try the next file... - } catch (LinkageError le) { - // Just try the next file... - } finally { - // close and release all io-resources to avoid leaks - if (is != null) { - try { - is.close(); - } catch (IOException ignored) { - } - is = null; - } - if (r != null) { - try{ - r.close(); - } catch (IOException ignored) { - } - r = null; - } - if (br != null) { - try { - br.close(); - } catch (IOException ignored) { - } - br = null; - } - } - } - return l.iterator(); + + ServiceLoader serviceLoader=ServiceLoader.load(cls); + return serviceLoader.iterator(); } } diff --git a/batik-xml/pom.xml b/batik-xml/pom.xml index 47209d5db2..e3505f178a 100644 --- a/batik-xml/pom.xml +++ b/batik-xml/pom.xml @@ -35,11 +35,6 @@ - - ${project.groupId} - batik-shared-resources - ${project.version} - ${project.groupId} batik-util @@ -50,23 +45,14 @@ - maven-dependency-plugin - ${dependency.version} - - - unpack-shared-resources - prepare-package - - unpack-dependencies - - - ${project.groupId} - batik-shared-resources - **/LICENSE,**/NOTICE - ${project.build.outputDirectory} - - - + biz.aQute.bnd + bnd-maven-plugin + + + diff --git a/pom.xml b/pom.xml index e7712cd74e..7e42fb37a1 100644 --- a/pom.xml +++ b/pom.xml @@ -21,6 +21,7 @@ 1.7 4.11 2.7.0 + 6.2.0 error 2.8 UTF-8 @@ -145,6 +146,31 @@ false + + biz.aQute.bnd + bnd-maven-plugin + ${bnd.version} + true + + + + + + jar + + jar + + + + @@ -200,5 +226,15 @@ ${project.baseUri} + + + + + biz.aQute.bnd + biz.aQute.bnd.annotation + ${bnd.version} + provided + +