1 19 20 package org.netbeans.modules.j2ee.ejbfreeform; 21 22 import java.beans.PropertyChangeListener ; 23 import java.net.MalformedURLException ; 24 import java.net.URL ; 25 import java.util.Collection ; 26 import java.util.Collections ; 27 import java.util.List ; 28 import java.util.Map ; 29 import org.netbeans.api.java.classpath.ClassPath; 30 import org.netbeans.api.java.platform.JavaPlatform; 31 import org.netbeans.api.java.platform.Specification; 32 import org.netbeans.modules.java.platform.JavaPlatformProvider; 33 import org.netbeans.spi.java.classpath.support.ClassPathSupport; 34 import org.openide.filesystems.FileObject; 35 import org.openide.modules.SpecificationVersion; 36 37 41 public final class DummyJavaPlatformProvider implements JavaPlatformProvider { 42 43 private final JavaPlatform jdk14 = new DummyJavaPlatform("1.4"); 44 private final JavaPlatform jdk15 = new DummyJavaPlatform("1.5"); 45 46 47 public DummyJavaPlatformProvider() {} 48 49 public JavaPlatform getDefaultPlatform() { 50 return jdk15; 51 } 52 53 public JavaPlatform[] getInstalledPlatforms() { 54 return new JavaPlatform[] { 55 jdk14, 56 jdk15, 57 }; 58 } 59 60 public void addPropertyChangeListener(PropertyChangeListener listener) {} 61 62 public void removePropertyChangeListener(PropertyChangeListener listener) {} 63 64 private static final class DummyJavaPlatform extends JavaPlatform { 65 66 private final String spec; 67 private ClassPath bootcp; 68 69 public DummyJavaPlatform(String spec) { 70 this.spec = spec; 71 } 72 73 public FileObject findTool(String toolName) { 74 return null; 75 } 76 77 public ClassPath getBootstrapLibraries() { 78 if (bootcp == null) { 79 try { 80 bootcp = ClassPathSupport.createClassPath(new URL [] { 81 new URL ("jar:file:/c:/java/" + spec + "/jre/lib/rt.jar!/"), 84 }); 85 } catch (MalformedURLException e) { 86 throw new AssertionError (e); 87 } 88 } 89 return bootcp; 90 } 91 92 public String getDisplayName() { 93 return "JDK " + spec; 94 } 95 96 public Collection getInstallFolders() { 97 return Collections.EMPTY_SET; 98 } 99 100 public List getJavadocFolders() { 101 return Collections.EMPTY_LIST; 102 } 103 104 public Map getProperties() { 105 return Collections.EMPTY_MAP; 106 } 107 108 public ClassPath getSourceFolders() { 109 return ClassPathSupport.createClassPath(new FileObject[0]); 110 } 111 112 public Specification getSpecification() { 113 return new Specification("j2se", new SpecificationVersion(spec)); 114 } 115 116 public ClassPath getStandardLibraries() { 117 return ClassPathSupport.createClassPath(new FileObject[0]); 118 } 119 120 public String getVendor() { 121 return "test"; 122 } 123 124 } 125 126 } 127 | Popular Tags |