KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > genimen > djeneric > web > util > DjenericTransformerFactory


1 package com.genimen.djeneric.web.util;
2
3 import javax.xml.transform.TransformerFactory JavaDoc;
4 import javax.xml.transform.TransformerFactoryConfigurationError JavaDoc;
5 import javax.xml.transform.URIResolver JavaDoc;
6
7 public class DjenericTransformerFactory
8 {
9   private static String JavaDoc _factoryClassName = null;
10   private static URIResolver JavaDoc _uriResolver = new DjenericXslUriResolver();
11
12   public static String JavaDoc getFactoryClassName()
13   {
14     return _factoryClassName;
15   }
16
17   public static void setFactoryClassName(String JavaDoc factoryClassName)
18   {
19     _factoryClassName = factoryClassName;
20   }
21
22   public static TransformerFactory JavaDoc newInstance()
23   {
24     try
25     {
26       TransformerFactory JavaDoc tFactory;
27       if (_factoryClassName == null)
28       {
29         tFactory = TransformerFactory.newInstance();
30       }
31       else
32       {
33         Class JavaDoc clazz = Thread.currentThread().getContextClassLoader().loadClass(_factoryClassName);
34         tFactory = (TransformerFactory JavaDoc) clazz.newInstance();
35       }
36       tFactory.setURIResolver(_uriResolver);
37       return tFactory;
38     }
39     catch (Exception JavaDoc x)
40     {
41       throw new TransformerFactoryConfigurationError JavaDoc(x);
42     }
43   }
44
45 }
Popular Tags