1 36 package org.ungoverned.moduleloader; 37 38 import java.net.URL ; 39 40 63 public class DefaultURLPolicy implements URLPolicy 64 { 65 private ModuleURLStreamHandler m_handler = null; 66 67 75 public URL createCodeSourceURL(ModuleManager mgr, Module module) 76 { 77 return null; 78 } 79 80 91 public URL createResourceURL(ModuleManager mgr, Module module, int rsIdx, String name) 92 { 93 if (m_handler == null) 94 { 95 m_handler = new ModuleURLStreamHandler(mgr); 96 } 97 98 if (!name.startsWith("/")) 102 { 103 name = "/" + name; 104 } 105 106 try 107 { 108 return new URL ("module", module.getId(), -1, "/" + rsIdx + name, m_handler); 109 } 110 catch (Exception ex) 111 { 112 System.err.println("DefaultResourceURLPolicy: " + ex); 113 return null; 114 } 115 } 116 } | Popular Tags |