1 23 24 33 34 package com.sun.enterprise.deployment.backend; 35 36 import java.io.IOException ; 37 import java.io.File ; 38 import java.util.logging.Level ; 39 import java.util.Iterator ; 40 import java.util.List ; 41 import java.util.ArrayList ; 42 import com.sun.enterprise.config.ConfigException; 43 import com.sun.enterprise.config.serverbeans.ConnectorModule; 44 import com.sun.enterprise.deployment.Application; 45 import com.sun.enterprise.deployment.archivist.Archivist; 46 import com.sun.enterprise.deployment.ConnectorDescriptor; 47 import com.sun.enterprise.deployment.deploy.shared.AbstractArchive; 48 import com.sun.enterprise.deployment.deploy.shared.FileArchive; 49 import com.sun.enterprise.deployment.RootDeploymentDescriptor; 50 import com.sun.enterprise.instance.BaseManager; 51 import com.sun.enterprise.instance.ConnectorModulesManager; 52 import com.sun.enterprise.instance.InstanceEnvironment; 53 import com.sun.enterprise.instance.ModuleEnvironment; 54 import com.sun.enterprise.util.i18n.StringManager; 55 import com.sun.enterprise.util.io.FileUtils; 56 import com.sun.enterprise.util.StringUtils; 57 import com.sun.enterprise.util.zip.ZipFileException; 58 59 public class ConnectorModuleDeployer extends ModuleDeployer 60 { 61 ConnectorModuleDeployer(DeploymentRequest r) throws IASDeploymentException 62 { 63 super(r); 64 } 65 66 68 protected BaseManager createConfigManager(InstanceEnvironment ienv, ModuleEnvironment menv) 69 throws IASDeploymentException, ConfigException 70 { 71 connModulesMgr = new ConnectorModulesManager(ienv); 72 return connModulesMgr; 73 } 74 75 78 protected List getModuleClasspath(Archivist archivist, 79 AbstractArchive archive) throws IASDeploymentException { 80 81 return new ArrayList (); 82 } 83 84 86 protected void preDeploy() throws IASDeploymentException 87 { 88 assert moduleDir != null; 89 assert StringUtils.ok(moduleName); 90 91 try 92 { 93 if(isRegistered()) { 94 String msg = localStrings.getString( 95 "enterprise.deployment.backend.deploy_error_module_exists"); 96 throw new IASDeploymentException( msg ); 97 } 98 99 liquidateModuleDirAndStubsDirIfTheyHappenToExist(); 103 104 if(request.isArchive()) 105 { 106 J2EEModuleExploder.explode(request.getFileSource().getFile(), moduleDir, moduleName); 107 } 108 xmlDir.mkdirs(); 109 } 110 catch(Exception e) 111 { 112 throw new IASDeploymentException(e.toString(), e); 113 } 114 } 115 116 118 protected void preRedeploy() throws IASDeploymentException, ConfigException 119 { 120 setOldDirs(); 121 122 if(request.isArchive()) 123 { 124 try 125 { 126 J2EEModuleExploder.explode(request.getFileSource().getFile(), moduleDir, moduleName); 127 128 } 129 catch(IOException e) 130 { 131 throw new IASDeploymentException(e.toString(), e); 132 } 133 } 134 135 xmlDir.mkdirs(); 136 } 137 138 140 protected void deploy() throws IASDeploymentException, ConfigException 141 { 142 runVerifier(); 143 144 try { 145 String appDir = 150 request.getDeployedDirectory().getCanonicalPath(); 151 String generatedXMLDir = 152 request.getGeneratedXMLDirectory().getCanonicalPath(); 153 154 FileArchive srcArchive = new FileArchive(); 155 srcArchive.open(appDir); 156 157 FileArchive destArchive = new FileArchive(); 158 destArchive.open(generatedXMLDir); 159 160 Archivist.copyExtraElements(srcArchive, destArchive); 161 } catch (Exception e) { 162 throw new IASDeploymentException(e.getCause()); 163 } 164 } 165 167 private ConnectorModulesManager connModulesMgr = null; 168 private static StringManager localStrings = StringManager.getManager(ConnectorModuleDeployer.class); 169 } 170 171 | Popular Tags |