1 25 26 package org.webdocwf.util.loader; 27 28 import java.io.File ; 29 import java.io.FileInputStream ; 30 import java.io.FileNotFoundException ; 31 32 import org.xml.sax.EntityResolver ; 33 import org.xml.sax.InputSource ; 34 35 40 public class OctopusEntityResolver implements EntityResolver { 41 42 public OctopusEntityResolver() { 44 } 45 46 public InputSource resolveEntity (String publicId, String systemId ) 47 { 48 if ( true ) { 49 String OCTOPUS_HOME = System.getProperty("OCTOPUS_HOME"); 51 if( OCTOPUS_HOME == null ){ 52 return new InputSource ( getClass().getClassLoader().getResourceAsStream("xml/xmlschema/loaderJob.xsd")); 53 }else{ 54 try { 55 return new InputSource ( new FileInputStream (new File (OCTOPUS_HOME + "/XmlTransform/xml/xmlschema/loaderJob.xsd"))); 56 } catch (Exception e) { 57 try { 58 return new InputSource ( getClass().getClassLoader().getResourceAsStream("xml/xmlschema/loaderJob.xsd")); 59 }catch(Exception ex) { 60 return null; 61 } 62 } 63 } 64 } 65 66 else { 67 return null; 69 } 70 } 71 } 72 | Popular Tags |