1 19 20 24 25 package org.netbeans.modules.j2ee.sun.ws7.j2ee; 26 27 import java.awt.Image ; 28 import java.beans.PropertyChangeEvent ; 29 import java.beans.PropertyChangeListener ; 30 import java.io.File ; 31 import java.net.MalformedURLException ; 32 import java.net.URL ; 33 import java.util.ArrayList ; 34 import java.util.HashSet ; 35 import java.util.List ; 36 import java.util.Set ; 37 import javax.swing.SwingUtilities ; 38 import org.netbeans.modules.j2ee.deployment.devmodules.api.J2eeModule; 39 import org.netbeans.modules.j2ee.deployment.devmodules.api.J2eePlatform; 40 import org.openide.filesystems.FileUtil; 41 import org.netbeans.modules.j2ee.deployment.common.api.J2eeLibraryTypeProvider; 42 import org.netbeans.modules.j2ee.deployment.plugins.api.J2eePlatformImpl; 43 import org.netbeans.spi.project.libraries.LibraryImplementation; 44 import org.openide.modules.InstalledFileLocator; 45 import org.openide.util.NbBundle; 46 import org.openide.util.Utilities; 47 import org.netbeans.modules.j2ee.deployment.plugins.api.InstanceProperties; 48 import org.netbeans.api.java.platform.JavaPlatform; 49 53 public class WS70J2eePlatformImpl extends J2eePlatformImpl{ 54 private static final Set MODULE_TYPES = new HashSet (); 55 private static final Set SPEC_VERSIONS = new HashSet (); 56 57 58 private static final String WS70_JAR = "lib/pwc.jar"; private static final String JWSDP20_JAR = "lib/webserv-jwsdp.jar"; private static final String JSTL_JAR = "lib/webserv-jstl.jar"; private static final String MAIL_JAR = "lib/mail.jar"; private static final String JAXRPC_API_JAR = "lib/jaxrpc-api.jar"; private static final String JAXRPC_IMPL_JAR = "lib/jaxrpc-impl.jar"; private static final String JAXRPC_SPI_JAR = "lib/jaxrpc-spi.jar"; private static final String ACTIVATION = "lib/activation.jar"; 67 private List libraries = new ArrayList (); 68 69 70 71 static { 72 MODULE_TYPES.add(J2eeModule.WAR); 73 74 SPEC_VERSIONS.add(J2eeModule.J2EE_13); 75 SPEC_VERSIONS.add(J2eeModule.J2EE_14); 76 } 77 78 private File root; 79 private String displayName; 80 81 84 public WS70J2eePlatformImpl(String rootLocation, String displayName) { 85 if(rootLocation!=null){ 86 root = new File (rootLocation); 87 init(root); 88 } 89 this.displayName = displayName; 90 } 91 92 private void init(File location){ 93 try { 94 J2eeLibraryTypeProvider lp = new J2eeLibraryTypeProvider(); 95 lp.createLibrary().setName ("a"); 96 LibraryImplementation lib = lp.createLibrary(); 97 98 lib.setName("webserver70 library"); 100 List l = new ArrayList (); 101 102 l.add(fileToUrl(new File (root, WS70_JAR))); 103 l.add(fileToUrl(new File (root, JWSDP20_JAR))); 104 l.add(fileToUrl(new File (root, MAIL_JAR))); 105 l.add(fileToUrl(new File (root, JSTL_JAR))); 106 l.add(fileToUrl(new File (root, JAXRPC_API_JAR))); 107 l.add(fileToUrl(new File (root, JAXRPC_IMPL_JAR))); 108 l.add(fileToUrl(new File (root, JAXRPC_SPI_JAR))); 109 l.add(fileToUrl(new File (root, ACTIVATION))); 110 111 112 lib.setContent(J2eeLibraryTypeProvider.VOLUME_TYPE_CLASSPATH, l); 113 114 File doc = InstalledFileLocator.getDefault().locate("docs/j2eeri-1_4-doc-api.zip", null, false); if (doc != null) { 116 l = new ArrayList (); 117 l.add(fileToUrl(doc)); 118 lib.setContent(J2eeLibraryTypeProvider.VOLUME_TYPE_JAVADOC, l); 119 } 120 121 libraries.add(lib); 122 123 } catch(Exception e) { 124 e.printStackTrace(); 125 } 126 } 127 134 public Set getSupportedSpecVersions() { 135 return SPEC_VERSIONS; 136 } 137 138 145 public Set getSupportedModuleTypes() { 146 return MODULE_TYPES; 147 } 148 155 public boolean isToolSupported(String toolName) { 156 if(toolName.equals("wscompile")){ 157 return true; 158 }else{ 159 return false; 160 } 161 } 162 163 168 public LibraryImplementation[] getLibraries() { 169 return (LibraryImplementation[])libraries.toArray(new LibraryImplementation[libraries.size()]); 170 } 171 172 public File [] getToolClasspathEntries(String toolName) { 173 return new File [] { 174 new File (root, JWSDP20_JAR), 175 new File (root, JAXRPC_API_JAR), 176 new File (root, JAXRPC_IMPL_JAR), 177 new File (root, JAXRPC_SPI_JAR), 178 new File (root, MAIL_JAR), 179 new File (root, ACTIVATION) 180 181 }; 182 } 183 184 189 public String getDisplayName() { 190 return displayName; 191 } 192 193 198 public Image getIcon() { 199 return Utilities.loadImage("org/netbeans/modules/j2ee/sun/ide/resources/ServerInstanceIcon.gif"); } 201 202 208 public File [] getPlatformRoots() { 209 return new File [] {root}; 210 } 211 212 public Set getSupportedJavaPlatformVersions(){ 213 Set versions = new HashSet (); 214 versions.add("1.4"); versions.add("1.5"); return versions; 217 } 218 219 228 public JavaPlatform getJavaPlatform(){ 229 return null; 230 } 231 private URL fileToUrl(File file) throws MalformedURLException { 232 URL url = file.toURI().toURL(); 233 if (FileUtil.isArchiveFile(url)) { 234 url = FileUtil.getArchiveRoot(url); 235 } 236 return url; 237 } 238 } 239 | Popular Tags |