1 /*
2 * Copyright (c) 2005-2007 Creative Sphere Limited.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 *
10 * Creative Sphere - initial API and implementation
11 *
12 */
13 package org.abstracthorizon.extend.server.deployment;
14
15 import java.net.URI;
16 import java.util.Set;
17
18 import org.abstracthorizon.extend.server.support.EnhancedMap;
19
20 /**
21 * This interface defines behaviour of main deployment manager.
22 * It handles module loaders and deployment cycle of modules.
23 *
24 * @author Daniel Sendula
25 */
26 public interface DeploymentManager extends ModuleLoader {
27
28 /** Default name DeploymentManager can be found in a context */
29 String DEPLOYMENT_MANAGER_DEFAULT_NAME = "DeploymentManager";
30
31 /**
32 * Deploys given module.
33 * @param module module
34 */
35 void deploy(ModuleId moduleId, Module module);
36
37 /**
38 * Undeploys given module.
39 * @param module module
40 */
41 void undeploy(Module module);
42
43 /**
44 * Re-deploys given module.
45 * @param module module
46 */
47 void redeploy(Module module);
48
49 /**
50 * Calls {@link Module#create} method.
51 * @param module module whose create method is to be called
52 */
53 void create(Module module);
54
55 /**
56 * Calls {@link Module#start} method.
57 * @param module module whose start method is to be called
58 */
59 void start(Module module);
60
61 /**
62 * Calls {@link Module#stop} method.
63 * @param module module whose stop method is to be called
64 */
65 void stop(Module module);
66
67 /**
68 * Calls {@link Module#destroy} method.
69 * @param module module whose destroy method is to be called
70 */
71 void destroy(Module module);
72
73 /**
74 * This method loads module and deploys it before returning it to the caller.
75 *
76 * @param uri uri of the module as it is going to be passed to {@link ModuleLoader#load(URI)} method and {@link #deploy(URI, Module)} method
77 * @return loaded module or <code>null</code> if module cannot be loaded
78 * TODO check return statement
79 */
80 Module loadAndDeploy(URI uri);
81
82 /**
83 * Returns map of deployed modules.
84 * @return map of deployed modules
85 */
86 EnhancedMap<ModuleId, Module> getDeployedModules();
87
88 /**
89 * Returns set of module loaders
90 * @return module loaders
91 */
92 Set<ModuleLoader> getModuleLoaders();
93
94 /**
95 * Sets module loaders
96 * @param moduleLoaders module loaders
97 */
98 void setModuleLoaders(Set<ModuleLoader> moduleLoaders);
99 }