1 19 20 package org.netbeans.modules.web.webmodule; 21 22 import java.util.HashMap ; 23 import org.netbeans.modules.web.api.webmodule.*; 24 import org.netbeans.modules.web.spi.webmodule.*; 25 import org.openide.filesystems.FileObject; 26 27 31 public class CustomProvider implements WebModuleProvider { 32 33 private HashMap cache = new HashMap (); 34 35 public CustomProvider () { 36 } 37 38 public WebModule findWebModule (FileObject file) { 39 if (file.getExt ().equals ("foo")) { 40 WebModule wm = (WebModule) cache.get (file.getParent ()); 41 if (wm == null) { 42 wm = WebModuleFactory.createWebModule (new WM (file.getParent (), "/"+file.getParent ().getName (), WebModule.J2EE_14_LEVEL)); 43 cache.put (file.getParent (), wm); 44 } 45 return wm; 46 } 47 return null; 48 } 49 50 private class WM implements WebModuleImplementation { 51 FileObject db; 52 String cp; 53 String ver; 54 55 public WM (FileObject db, String cp, String ver) { 56 this.db = db; 57 this.cp = cp; 58 this.ver = ver; 59 } 60 61 public String getContextPath () { 62 return cp; 63 } 64 65 public FileObject getDocumentBase () { 66 return db; 67 } 68 69 public String getJ2eePlatformVersion () { 70 return ver; 71 } 72 73 public FileObject getDeploymentDescriptor () { 74 return getWebInf ().getFileObject ("web.xml"); 75 } 76 77 public FileObject getWebInf () { 78 return getDocumentBase ().getFileObject ("WEB-INF"); 79 } 80 81 public FileObject[] getJavaSources() { 82 return null; 83 } 84 85 } 86 } 87 | Popular Tags |