1 19 20 package org.netbeans.modules.j2ee.genericserver; 21 22 import javax.enterprise.deploy.shared.factories.DeploymentFactoryManager ; 23 import javax.enterprise.deploy.spi.DeploymentManager ; 24 import javax.enterprise.deploy.spi.exceptions.DeploymentManagerCreationException ; 25 import javax.enterprise.deploy.spi.factories.DeploymentFactory ; 26 import org.openide.ErrorManager; 27 import org.openide.util.NbBundle; 28 29 33 public class GSDeploymentFactory implements DeploymentFactory { 34 35 public static final String GENERIC_SERVER_PREFIX = "generic"; 37 private static DeploymentFactory instance; 38 39 private static ErrorManager err = ErrorManager.getDefault().getInstance("org.netbeans.modules.j2ee.genericserver"); 41 public static synchronized DeploymentFactory create() { 42 if (instance == null) { 43 if (err.isLoggable(ErrorManager.INFORMATIONAL)) err.log("Creating Generic Server Factory"); instance = new GSDeploymentFactory(); 45 DeploymentFactoryManager.getInstance().registerDeploymentFactory(instance); 46 } 47 return instance; 48 } 49 50 public boolean handlesURI(String str) { 51 return str != null && str.startsWith(GENERIC_SERVER_PREFIX); 52 } 53 54 public DeploymentManager getDeploymentManager(String uri, String uname, String passwd) throws DeploymentManagerCreationException { 55 if (!handlesURI(uri)) { 56 throw new DeploymentManagerCreationException ("Invalid URI:" + uri); } 58 return new GSDeploymentManager(); 59 } 60 61 public DeploymentManager getDisconnectedDeploymentManager(String str) throws DeploymentManagerCreationException { 62 return new GSDeploymentManager(); 63 } 64 65 public String getProductVersion() { 66 return "0.1"; } 68 69 public String getDisplayName() { 70 return NbBundle.getMessage(GSDeploymentFactory.class, "TXT_DisplayName"); } 72 73 } 74 | Popular Tags |