1 19 20 package org.jahia.services.webapps_deployer; 21 22 23 import org.jahia.data.applications.ApplicationBean; 24 import org.jahia.exceptions.JahiaException; 25 import org.jahia.services.sites.JahiaSite; 26 import org.jahia.utils.JahiaTools; 27 28 import java.io.File ; 29 import java.util.Vector ; 30 31 38 public class JahiaJBossWebAppsDeployerBaseService 39 extends JahiaTomcatWebAppsDeployerBaseService { 40 41 private static JahiaJBossWebAppsDeployerBaseService m_Instance = null; 42 43 46 public static synchronized JahiaTomcatWebAppsDeployerBaseService getInstance () { 47 48 if (m_Instance == null) { 49 m_Instance = new JahiaJBossWebAppsDeployerBaseService (); 50 } 51 return m_Instance; 52 } 53 54 55 56 64 protected boolean deployWarFile (JahiaSite site, String webContext, String filePath) 65 throws JahiaException { 66 Vector webApps = new Vector (); 67 StringBuffer webContextDiskPath = new StringBuffer (m_ServerHomeDiskPath); 68 webContextDiskPath.append (File.separator); 69 webContextDiskPath.append ("deploy"); 70 webContextDiskPath.append (File.separator); 71 webContextDiskPath.append (webContext); 72 webContextDiskPath.append ("_"); 73 webContextDiskPath.append (site.getSiteKey ()); 74 webContextDiskPath.append (".war"); 75 76 StringBuffer webContextBuff = new StringBuffer (webContext); 78 webContextBuff.append ("_"); 79 webContextBuff.append (site.getSiteKey ()); 80 81 webApps = handleWarFile (webContextDiskPath.toString (), filePath); 82 83 86 File f = new File (filePath); 88 registerWebApps (site, webContextBuff.toString (), f.getName (), webApps); 89 90 File warFile = new File (filePath); 92 warFile.delete (); 93 94 103 104 return true; 105 106 } 107 108 109 117 118 public boolean undeploy (ApplicationBean app) throws JahiaException { 119 if (app != null) { 120 121 StringBuffer webContextDiskPath = new StringBuffer (m_ServerHomeDiskPath); 123 webContextDiskPath.append (File.separator); 124 webContextDiskPath.append ("deploy"); 125 webContextDiskPath.append (File.separator); 126 webContextDiskPath.append (app.getContext ()); 127 webContextDiskPath.append (".war"); 128 JahiaTools.deleteFile (new File (webContextDiskPath.toString ())); 129 130 return true; 131 } 132 133 return false; 134 } 135 136 137 protected boolean activateWebApp ( 138 String context, 139 String webAppDiskPath 140 ) throws JahiaException { 141 return true; 142 } 143 144 protected boolean undeployWebApp (String context 145 ) throws JahiaException { 146 return true; 147 } 148 149 protected boolean addManagerUser (String docPath) { 150 return true; 151 } 152 153 public boolean canDeploy () { 154 return true; 155 } 156 } 157 | Popular Tags |