1 package org.apache.tomcat.util.modeler.modules; 2 3 import java.io.File ; 4 import java.io.FileInputStream ; 5 import java.io.IOException ; 6 import java.io.InputStream ; 7 import java.net.URL ; 8 import java.util.List ; 9 10 import javax.management.ObjectName ; 11 12 import org.apache.tomcat.util.modeler.Registry; 13 14 17 public class ModelerSource { 18 protected Object source; 19 protected String location; 20 21 29 public List loadDescriptors( Registry registry, String location, 30 String type, Object source) 31 throws Exception 32 { 33 return null; 35 } 36 37 44 public void updateField( ObjectName oname, String name, 45 Object value ) { 46 } 48 49 public void store() { 50 } 52 53 protected InputStream getInputStream() throws IOException { 54 if( source instanceof URL ) { 55 URL url=(URL )source; 56 location=url.toString(); 57 return url.openStream(); 58 } else if( source instanceof File ) { 59 location=((File )source).getAbsolutePath(); 60 return new FileInputStream ((File )source); 61 } else if( source instanceof String ) { 62 location=(String )source; 63 return new FileInputStream ((String )source); 64 } else if( source instanceof InputStream ) { 65 return (InputStream )source; 66 } 67 return null; 68 } 69 70 } 71 | Popular Tags |