1 /* 2 * JBoss, Home of Professional Open Source 3 * Copyright 2005, JBoss Inc., and individual contributors as indicated 4 * by the @authors tag. See the copyright.txt in the distribution for a 5 * full listing of individual contributors. 6 * 7 * This is free software; you can redistribute it and/or modify it 8 * under the terms of the GNU Lesser General Public License as 9 * published by the Free Software Foundation; either version 2.1 of 10 * the License, or (at your option) any later version. 11 * 12 * This software is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 * Lesser General Public License for more details. 16 * 17 * You should have received a copy of the GNU Lesser General Public 18 * License along with this software; if not, write to the Free 19 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 20 * 02110-1301 USA, or see the FSF site: http://www.fsf.org. 21 */ 22 package javax.enterprise.deploy.spi; 23 24 import java.io.File; 25 import java.io.InputStream; 26 import java.util.Locale; 27 28 import javax.enterprise.deploy.model.DeployableObject; 29 import javax.enterprise.deploy.shared.DConfigBeanVersionType; 30 import javax.enterprise.deploy.shared.ModuleType; 31 import javax.enterprise.deploy.spi.exceptions.InvalidModuleException; 32 import javax.enterprise.deploy.spi.exceptions.TargetException; 33 import javax.enterprise.deploy.spi.exceptions.DConfigBeanVersionUnsupportedException; 34 import javax.enterprise.deploy.spi.status.ProgressObject; 35 36 /** 37 * The core object for deploying modules to a j2ee environment 38 * 39 * @author <a href="mailto:adrian@jboss.org">Adrian Brock</a> 40 * @version $Revision: 59878 $ 41 */ 42 public interface DeploymentManager 43 { 44 // Constants ----------------------------------------------------- 45 46 // Public -------------------------------------------------------- 47 48 /** 49 * Get the available targets 50 * 51 * @return the available targets 52 * @throws IllegalStateException when the manager is disconnected 53 */ 54 Target[] getTargets() throws IllegalStateException; 55 56 /** 57 * Get the running modules 58 * 59 * @param moduleType the module type 60 * @param targets the targets 61 * @return the target modules 62 * @throws TargetException an invalid target 63 * @throws IllegalStateException when the manager is disconnected 64 */ 65 TargetModuleID[] getRunningModules(ModuleType moduleType, Target[] targets) throws TargetException, IllegalStateException; 66 67 /** 68 * Get the non running modules 69 * 70 * @param moduleType the module type 71 * @param targets the targets 72 * @return the target modules 73 * @throws TargetException an invalid target 74 * @throws IllegalStateException when the manager is disconnected 75 */ 76 TargetModuleID[] getNonRunningModules(ModuleType moduleType, Target[] targets) throws TargetException, IllegalStateException; 77 78 /** 79 * Get the available modules both running and non running 80 * 81 * @param moduleType the module type 82 * @param targets the targets 83 * @return the target modules 84 * @throws TargetException an invalid target 85 * @throws IllegalStateException when the manager is disconnected 86 */ 87 TargetModuleID[] getAvailableModules(ModuleType moduleType, Target[] targets) throws TargetException, IllegalStateException; 88 89 /** 90 * Retrieve server specific configuration for a component 91 * 92 * @param obj the deployable component 93 * @return the configuration 94 * @throws InvalidModuleException when the module does not exist or is not supported 95 */ 96 DeploymentConfiguration createConfiguration(DeployableObject obj) throws InvalidModuleException; 97 98 /** 99 * Validates the configuration, generates all container specific classes and moves the archive 100 * to the targets 101 * 102 * @param targets the targets 103 * @param moduleArchive the module archive 104 * @param deploymentPlan the runtime configuration 105 * @return the progress object 106 * @throws IllegalStateException when the manager is disconnected 107 */ 108 ProgressObject distribute(Target[] targets, File moduleArchive, File deploymentPlan) throws IllegalStateException; 109 110 /** 111 * Validates the configuration, generates all container specific classes and moves the archive 112 * to the targets 113 * 114 * @param targets the targets 115 * @param moduleArchive the module archive 116 * @param deploymentPlan the runtime configuration 117 * @return the progress object 118 * @throws IllegalStateException when the manager is disconnected 119 */ 120 ProgressObject distribute(Target[] targets, InputStream moduleArchive, InputStream deploymentPlan) throws IllegalStateException; 121 122 /** 123 * The distribute method performs three tasks; it validates the deployment configuration 124 * data, generates all container specific classes and interfaces, and moves the fully 125 * baked archive to the designated deployment targets. 126 * @param targets the targets 127 * @param moduleArchive the module archive 128 * @param deploymentPlan the runtime configuration 129 * @return the progress object 130 * @throws IllegalStateException when the manager is disconnected 131 */ 132 public ProgressObject distribute(Target[] targets, ModuleType type, 133 InputStream moduleArchive, InputStream deploymentPlan) 134 throws IllegalStateException; 135 136 /** 137 * Start the modules 138 * 139 * @param moduleIDList the list of modules 140 * @return the progress object 141 * @throws IllegalStateException when the manager is disconnected 142 */ 143 ProgressObject start(TargetModuleID[] moduleIDList) throws IllegalStateException; 144 145 /** 146 * Stop the modules 147 * 148 * @param moduleIDList the list of modules 149 * @return the progress object 150 * @throws IllegalStateException when the manager is disconnected 151 */ 152 ProgressObject stop(TargetModuleID[] moduleIDList) throws IllegalStateException; 153 154 /** 155 * Removes the modules 156 * 157 * @param moduleIDList the list of modules 158 * @return the progress object 159 * @throws IllegalStateException when the manager is disconnected 160 */ 161 ProgressObject undeploy(TargetModuleID[] moduleIDList) throws IllegalStateException; 162 163 /** 164 * Is redeploy supported 165 * 166 * @return true when redeploy is supported, false otherwise 167 */ 168 boolean isRedeploySupported(); 169 170 /** 171 * Redeploys the modules 172 * 173 * @param moduleIDList the list of modules 174 * @return the progress object 175 * @throws IllegalStateException when the manager is disconnected 176 * @throws UnsupportedOperationException when redeploy is not supported 177 */ 178 ProgressObject redeploy(TargetModuleID[] moduleIDList, File moduleArchive, File deploymentPlan) 179 throws UnsupportedOperationException, IllegalStateException; 180 181 /** 182 * Redeploys the modules 183 * 184 * @param moduleIDList the list of modules 185 * @return the progress object 186 * @throws IllegalStateException when the manager is disconnected 187 * @throws UnsupportedOperationException when redeploy is not supported 188 */ 189 ProgressObject redeploy(TargetModuleID[] moduleIDList, InputStream moduleArchive, InputStream deploymentPlan) 190 throws UnsupportedOperationException, IllegalStateException; 191 192 /** 193 * Release the deployment manager 194 */ 195 void release(); 196 197 /** 198 * Get the default locale 199 * 200 * @return the default locale 201 */ 202 Locale getDefaultLocale(); 203 204 /** 205 * Get the current local 206 * 207 * @return the current locale 208 */ 209 Locale getCurrentLocale(); 210 211 /** 212 * Set the locale 213 * 214 * @param locale the new local 215 * @throws UnsupportedOperationException when the locale is not supported 216 */ 217 void setLocale(Locale locale) throws UnsupportedOperationException; 218 219 /** 220 * Get the supported locales 221 * 222 * @return the supported locales 223 */ 224 Locale[] getSupportedLocales(); 225 226 /** 227 * Is the locale supported 228 * 229 * @param locale the locale 230 * @return true when supported, false otherwise 231 */ 232 boolean isLocaleSupported(Locale locale); 233 234 /** 235 * Get the J2EE platform version 236 * 237 * @return the version 238 */ 239 DConfigBeanVersionType getDConfigBeanVersion(); 240 241 /** 242 * Test whether the version is supported 243 * 244 * @param version the version 245 * @return true when supported, false otherwise 246 */ 247 boolean isDConfigBeanVersionSupported(DConfigBeanVersionType version); 248 249 /** 250 * Set the J2EE version 251 * 252 * @param version the version 253 * @throws UnsupportedOperationException when the version is not supported 254 */ 255 void setDConfigBeanVersion(DConfigBeanVersionType version) 256 throws DConfigBeanVersionUnsupportedException; 257 }