1 19 20 package org.netbeans.modules.j2ee.ejbjar; 21 22 import java.util.HashMap ; 23 import org.netbeans.modules.j2ee.api.ejbjar.Car; 24 import org.netbeans.modules.j2ee.api.ejbjar.Ear; 25 import org.netbeans.modules.j2ee.api.ejbjar.EjbJar; 26 import org.netbeans.modules.j2ee.api.ejbjar.EjbProjectConstants; 27 import org.netbeans.modules.j2ee.spi.ejbjar.CarFactory; 28 import org.netbeans.modules.j2ee.spi.ejbjar.EarImplementation; 29 import org.netbeans.modules.j2ee.spi.ejbjar.EarProvider; 30 import org.netbeans.modules.j2ee.spi.ejbjar.EjbJarFactory; 31 import org.openide.filesystems.FileObject; 32 import org.netbeans.modules.web.api.webmodule.WebModule; 33 34 38 public class CustomProviderEar implements EarProvider { 39 40 private HashMap cache = new HashMap (); 41 42 public CustomProviderEar () { 43 } 44 45 public Ear findEar (FileObject file) { 46 if (file.getExt ().equals ("foo")) { 47 Ear em = (Ear) cache.get (file.getParent ()); 48 if (em == null) { 49 em = EjbJarFactory.createEar (new EM (file.getParent (), EjbProjectConstants.J2EE_14_LEVEL)); 50 cache.put (file.getParent (), em); 51 } 52 return em; 53 } 54 if (file.getExt ().equals ("bar")) { 55 Ear em = (Ear) cache.get (file.getParent ()); 56 if (em == null) { 57 em = CarFactory.createEar (new EM (file.getParent (), EjbProjectConstants.J2EE_14_LEVEL)); 58 cache.put (file.getParent (), em); 59 } 60 return em; 61 } 62 return null; 63 } 64 65 private class EM implements EarImplementation { 66 FileObject root; 67 String ver; 68 69 public EM (FileObject root, String ver) { 70 this.root = root; 71 this.ver = ver; 72 } 73 74 public String getJ2eePlatformVersion () { 75 return ver; 76 } 77 78 public FileObject getDeploymentDescriptor () { 79 return root.getFileObject ("conf/application.xml"); 80 } 81 82 public FileObject getMetaInf () { 83 return null; 84 } 85 86 public void addEjbJarModule(EjbJar module) { 87 88 } 89 public void addWebModule(WebModule module) { 90 91 } 92 public void addCarModule(Car module) { 93 94 } 95 } 96 } 97 | Popular Tags |