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.URL; 16 import java.util.Set; 17 18 /** 19 * This interface describes a module that can be loaded and deployed. 20 * 21 * @author Daniel Sendula 22 */ 23 public interface Module { 24 25 /** Undefined module */ 26 int UNDEFINED = 0; 27 28 /** Module that is defined (loaded) */ 29 int DEFINED = 1; 30 31 /** Module that waits of dependencies to be created */ 32 int WAITING_ON_CREATE = 2; 33 34 /** Module that waits of dependencies to be created */ 35 int WAITING_ON_CREATE_TO_START = 3; 36 37 /** Created module */ 38 int CREATED = 4; 39 40 /** Waiting on modules this module depends to start */ 41 int WAITING_ON_START = 5; 42 43 /** Deployed module */ 44 int STARTED = 6; 45 46 /** 47 * Returns module's original location. 48 * @return module's original location 49 */ 50 URL getOriginalLocation(); 51 52 /** 53 * Returns module's working location 54 * @return module's working location 55 */ 56 URL getWorkingLocation(); 57 58 /** 59 * Returns modules class loader. 60 * @return modules class loader or <code>null</code> 61 */ 62 ClassLoader getClassLoader(); 63 64 /** 65 * Returns a set of modules that depend on this module. 66 * @return a set of modules that depend on this module 67 */ 68 Set<Module> getDependOnThis(); 69 70 /** 71 * Returns a set of modules this module depends on. 72 * @return a set of modules this module depends on 73 */ 74 Set<Module> getDependsOn(); 75 76 /** 77 * Sets the moduile's state. 78 * <p>Note: Not to be called directly!</p> 79 * @param state module's state 80 */ 81 void setState(int state); 82 83 /** 84 * Returns module's state 85 * @return module's state 86 */ 87 int getState(); 88 89 /** 90 * Return's module's name. This must not be null. 91 * @return module's name 92 */ 93 ModuleId getModuleId(); 94 95 /** 96 * Creates the module. 97 * <p>Note: Not to be called directly. Use {@link DeploymentManager#create(Module)} method instead.</p> 98 */ 99 void create(); 100 101 /** 102 * Starts the module. 103 * <p>Note: Not to be called directly. Use {@link DeploymentManager#start(Module)} method instead.</p> 104 */ 105 void start(); 106 107 /** 108 * Stops the module. 109 * <p>Note: Not to be called directly. Use {@link DeploymentManager#stop(Module)} method instead.</p> 110 */ 111 void stop(); 112 113 /** 114 * Destroys the module. 115 * <p>Note: Not to be called directly. Use {@link DeploymentManager#destroy(Module)} method instead.</p> 116 */ 117 void destroy(); 118 119 }