You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

AbstractBitmapProducer.java 1.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*
  2. * Copyright 2005 The Apache Software Foundation.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. /* $Id$ */
  17. package org.apache.fop.visual;
  18. import javax.xml.transform.Transformer;
  19. import javax.xml.transform.TransformerConfigurationException;
  20. import org.apache.commons.logging.Log;
  21. import org.apache.commons.logging.LogFactory;
  22. /**
  23. * Abstract base class for converters.
  24. */
  25. public abstract class AbstractBitmapProducer implements BitmapProducer {
  26. /** Logger */
  27. protected static Log log = LogFactory.getLog(AbstractBitmapProducer.class);
  28. /**
  29. * Returns a new JAXP Transformer based on information in the ProducerContext.
  30. * @param context context information for the process
  31. * @return a new Transformer instance (identity or set up with a stylesheet)
  32. * @throws TransformerConfigurationException in case creating the Transformer fails.
  33. */
  34. protected Transformer getTransformer(ProducerContext context)
  35. throws TransformerConfigurationException {
  36. if (context.getTemplates() != null) {
  37. return context.getTemplates().newTransformer();
  38. } else {
  39. return context.getTransformerFactory().newTransformer();
  40. }
  41. }
  42. }