1 19 package org.netbeans.modules.j2ee.websphere6.j2ee; 20 21 import java.io.*; 22 import java.net.*; 23 import java.util.*; 24 import java.awt.*; 25 26 import javax.enterprise.deploy.spi.DeploymentManager ; 27 import org.netbeans.api.java.platform.JavaPlatform; 28 import org.openide.*; 29 import org.openide.filesystems.*; 30 import org.openide.util.*; 31 import org.netbeans.spi.project.libraries.*; 32 import org.netbeans.modules.j2ee.deployment.common.api.*; 33 import org.netbeans.modules.j2ee.deployment.devmodules.api.*; 34 import org.netbeans.modules.j2ee.deployment.plugins.api.*; 35 import org.netbeans.modules.j2ee.websphere6.*; 36 37 43 public class WSJ2eePlatformFactory extends J2eePlatformFactory { 44 45 52 public J2eePlatformImpl getJ2eePlatformImpl(DeploymentManager dm) { 53 return new J2eePlatformImplImpl(dm); 54 } 55 56 63 private static class J2eePlatformImplImpl extends J2eePlatformImpl { 64 65 68 private static final String ICON = "org/netbeans/modules/" + "j2ee/websphere6/resources/16x16.gif"; 71 75 WSDeploymentManager dm; 76 77 82 public J2eePlatformImplImpl(DeploymentManager dm) { 83 this.dm = (WSDeploymentManager) dm; 85 } 86 87 95 public boolean isToolSupported(String toolName) { 96 return false; 97 } 98 99 108 public File[] getToolClasspathEntries(String toolName) { 109 return new File[0]; 110 } 111 112 117 public Set getSupportedSpecVersions() { 118 Set result = new HashSet(); 120 121 result.add(J2eeModule.J2EE_14); 123 124 return result; 126 } 127 128 129 public Set getSupportedJavaPlatformVersions() { 130 Set versions = new HashSet(); 131 versions.add("1.4"); versions.add("1.5"); return versions; 134 135 } 136 137 142 public Set getSupportedModuleTypes() { 143 Set result = new HashSet(); 145 146 result.add(J2eeModule.EAR); 148 result.add(J2eeModule.WAR); 149 result.add(J2eeModule.EJB); 150 result.add(J2eeModule.CONN); 151 result.add(J2eeModule.CLIENT); 152 153 return result; 155 } 156 157 164 public java.io.File [] getPlatformRoots() { 165 return new File[] { 166 new File(dm.getInstanceProperties().getProperty( 167 WSDeploymentFactory.SERVER_ROOT_ATTR)) 168 }; 169 } 170 171 179 public LibraryImplementation[] getLibraries() { 180 LibraryImplementation[] libraries = new LibraryImplementation[1]; 182 183 LibraryImplementation library = new J2eeLibraryTypeProvider(). 185 createLibrary(); 186 187 library.setName(NbBundle.getMessage(WSJ2eePlatformFactory.class, 189 "TXT_libraryName")); 191 try { 193 ArrayList list = new ArrayList(); 194 list.add(fileToUrl(new File(dm.getInstanceProperties(). 195 getProperty(WSDeploymentFactory.SERVER_ROOT_ATTR), 196 "/lib/j2ee.jar"))); 198 library.setContent(J2eeLibraryTypeProvider. 199 VOLUME_TYPE_CLASSPATH, list); 200 } catch (MalformedURLException e) { 201 ErrorManager.getDefault().notify(ErrorManager.EXCEPTION, e); 202 } 203 204 libraries[0] = library; 206 207 return libraries; 209 } 210 211 217 public Image getIcon() { 218 return Utilities.loadImage(ICON); 219 } 220 221 227 public String getDisplayName() { 228 return NbBundle.getMessage(WSJ2eePlatformFactory.class, 229 "TXT_platformName"); } 231 232 240 private URL fileToUrl(File file) throws MalformedURLException { 241 URL url = file.toURI().toURL(); 243 244 if (FileUtil.isArchiveFile(url)) { 246 url = FileUtil.getArchiveRoot(url); 247 } 248 249 return url; 251 } 252 253 254 258 259 public JavaPlatform getJavaPlatform() { 260 273 return null; 274 } 275 } 276 } | Popular Tags |