1 19 20 package org.netbeans.modules.j2ee.sun.ide.j2ee; 21 22 import java.io.File ; 23 import java.util.WeakHashMap ; 24 import org.netbeans.modules.j2ee.deployment.plugins.api.J2eePlatformFactory; 25 import org.netbeans.modules.j2ee.deployment.plugins.api.J2eePlatformImpl; 26 import javax.enterprise.deploy.spi.DeploymentManager ; 27 import org.netbeans.modules.j2ee.deployment.plugins.api.InstanceProperties; 28 import org.netbeans.modules.j2ee.sun.api.SunDeploymentManagerInterface; 29 30 32 public final class PlatformFactory extends J2eePlatformFactory { 33 34 private static final WeakHashMap <InstanceProperties,PlatformImpl> instanceCache = new WeakHashMap <InstanceProperties,PlatformImpl>(); 35 36 37 public PlatformFactory() { 38 } 39 40 public synchronized J2eePlatformImpl getJ2eePlatformImpl(DeploymentManager dm) { 41 DeploymentManagerProperties dmProps = new DeploymentManagerProperties(dm); 43 InstanceProperties ip = dmProps.getInstanceProperties(); 44 File rootDir = ((SunDeploymentManagerInterface)dm).getPlatformRoot(); 45 PlatformImpl platform = instanceCache.get(ip); 46 if (platform == null) { 47 platform = new PlatformImpl(rootDir, dmProps); 48 instanceCache.put(ip, platform); 49 } 50 return platform; 51 } 52 } 53 | Popular Tags |