1 23 24 package com.sun.enterprise.config.clientbeans; 25 26 import org.xml.sax.helpers.DefaultHandler ; 27 import org.xml.sax.SAXParseException ; 28 import org.xml.sax.InputSource ; 29 import org.xml.sax.SAXException ; 30 import java.io.FileInputStream ; 31 import java.io.File ; 32 import java.io.InputStream ; 33 34 import java.util.logging.Logger ; 35 import java.util.logging.Level ; 36 37 import com.sun.enterprise.util.RelativePathResolver; 41 42 public class ClientBeansResolver extends DefaultHandler { 43 44 45 public static final String SUN_ACC_DTD_PATH = 46 "/sun-application-client-container_1_2.dtd"; 47 48 49 53 public InputSource resolveEntity(String publicID, String systemID) 54 throws SAXException { 55 InputSource is = null; 56 try { 57 InputStream i = this.getClass().getResourceAsStream(SUN_ACC_DTD_PATH ); 58 if( i!= null ) { 59 return new InputSource (i); 60 } 61 is = new InputSource ( 62 new FileInputStream ( 63 new File (new java.net.URI ( 64 RelativePathResolver.resolvePath(systemID))))); 65 } catch(Exception e) { 66 throw new SAXException ("Cannot resolve ", e); 67 } 68 return is; 69 } 70 } 71 72 73 74 | Popular Tags |