1 28 29 package com.caucho.j2ee.deployclient; 30 31 import javax.enterprise.deploy.spi.DeploymentManager ; 32 import javax.enterprise.deploy.spi.exceptions.DeploymentManagerCreationException ; 33 import javax.enterprise.deploy.spi.factories.DeploymentFactory ; 34 35 38 public class DeploymentFactoryImpl implements DeploymentFactory { 39 42 public boolean handlesURI(String uri) 43 { 44 return uri.startsWith("resin:"); 45 } 46 47 50 public DeploymentManager getDeploymentManager(String uri, 51 String username, 52 String password) 53 throws DeploymentManagerCreationException 54 { 55 try { 56 DeploymentManagerImpl manager = createManager(uri); 57 58 manager.connect(username, password); 59 60 return manager; 61 } catch (Throwable e) { 62 e.printStackTrace(); 63 throw new RuntimeException (e); 64 } 65 } 66 67 70 public DeploymentManager getDisconnectedDeploymentManager(String uri) 71 throws DeploymentManagerCreationException 72 { 73 return createManager(uri); 74 } 75 76 79 private DeploymentManagerImpl createManager(String uri) 80 throws DeploymentManagerCreationException 81 { 82 if (! handlesURI(uri)) 83 throw new DeploymentManagerCreationException ("'" + uri + "' is an unsupported deployment URI."); 84 85 return new DeploymentManagerImpl(uri); 86 } 87 88 91 public String getDisplayName() 92 { 93 return "Resin J2EE DeploymentFactory"; 94 } 95 96 99 public String getProductVersion() 100 { 101 return com.caucho.Version.FULL_VERSION; 102 } 103 } 104 105 | Popular Tags |