Skip to main content
summaryrefslogtreecommitdiffstats
blob: 1fb2ce68cb631c143b9b5a0215d31bcf42d27a5d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
/**********************************************************************
 * Copyright (c) 2003 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Common Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/cpl-v10.html
 *
 * Contributors:
 *     IBM Corporation - Initial API and implementation
 **********************************************************************/
package org.eclipse.wst.server.core.model;

import java.util.List;

import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.wst.server.core.IServerState;
import org.eclipse.wst.server.core.ITask;
import org.eclipse.wst.server.core.resources.IModuleResourceDelta;
/**
 * 
 */
public interface IServerDelegate {
	/**
	 * Called when the server is loaded as a model object.
	 */
	public void initialize(IServerState liveServer);

	/**
	 * Called when this server resource has become invalid or no longer
	 * required and is being deregistered or dicarded. This method can
	 * be used to remove listeners, etc.
	 */
	public void dispose();
	
	/**
	 * Returns the publisher that can be used to publish the
	 * given module. If the module should never
	 * be published to the server, it may return null.
	 *
	 * @param parents java.util.List
	 * @param module org.eclipse.wst.server.core.model.IModule
	 * @return org.eclipse.wst.server.core.model.IPublisher
	 */
	public IPublisher getPublisher(List parents, IModule module);

	/**
	 * The server configuration has changed. This method should return
	 * quickly. If any republishing must occur, the relevant in-sync
	 * methods should return a new value. If the server must be restarted,
	 * the isRestartNeeded() method should return true.
	 */
	public void updateConfiguration();

	/**
	 * A module resource has changed. This method should return
	 * quickly. If the server must be restarted to handle the
	 * change of this file, the isRestartNeeded() method should
	 * return true and the event should be fired.
	 *
	 * @param module org.eclipse.wst.server.core.IModule
	 * @param delta org.eclipse.wst.server.core.IModuleResourceDelta
	 */
	public void updateModule(IModule module, IModuleResourceDelta delta);

	/**
	 * Methods called to notify that publishing is about to begin.
	 * This allows the server to open a connection to the server
	 * or get any global information ready.
	 *
	 * <p>This method should not be called directly! Use the
	 * IServerControl to correctly publish to the server.</p>
	 *
	 * @param monitor org.eclipse.core.runtime.IProgressMonitor
	 * @return org.eclipse.core.runtime.IStatus
	 */
	public IStatus publishStart(IProgressMonitor monitor);

	/**
	 * Publish the configuration.
	 * 
	 * @param monitor
	 * @return
	 */
	public IStatus publishConfiguration(IProgressMonitor monitor);

	/**
	 * Methods called to notify that publishing has finished.
	 * The server can close any open connections to the server
	 * and do any cleanup operations.
	 *
	 * <p>This method should not be called directly! Use the
	 * IServerControl to correctly publish to the
	 * server.</p>
	 *
	 * @param monitor org.eclipse.core.runtime.IProgressMonitor
	 * @return org.eclipse.core.runtime.IStatus
	 */
	public IStatus publishStop(IProgressMonitor monitor);
	
	/**
	 * Returns true if this module can be added to this
	 * configuration at the current time, and false otherwise.
	 *
	 * <p>This method may decide based on the type of module
	 * or refuse simply due to reaching a maximum number of
	 * modules or other criteria.</p>
	 *
	 * @param add org.eclipse.wst.server.core.model.IModule[]
	 * @param remove org.eclipse.wst.server.core.model.Module[]
	 * @return boolean
	 */
	public IStatus canModifyModules(IModule[] add, IModule[] remove);

	/**
	 * Returns the modules that are in this configuration.
	 *
	 * @return org.eclipse.wst.server.core.model.IModule[]
	 */
	public IModule[] getModules();
	
	/**
	 * Returns the current state of the given module. See
	 * class header for MODULE_XXX constants.
	 *
	 * @param module org.eclipse.wst.server.core.model.IModule
	 * @return byte
	 */
	public byte getModuleState(IModule module);

	/**
	 * Method called when changes to the modules or module factories
	 * within this configuration occur. Return any necessary commands to repair
	 * or modify the server configuration in response to these changes.
	 * 
	 * @param org.eclipse.wst.server.core.model.IModuleFactoryEvent[]
	 * @param org.eclipse.wst.server.core.model.IModuleEvent[]
	 * @return org.eclipse.wst.server.core.model.ITask[]
	 */
	public ITask[] getRepairCommands(IModuleFactoryEvent[] factoryEvent, IModuleEvent[] moduleEvent);
	
	/**
	 * Returns the child module(s) of this module. If this
	 * module contains other modules, it should list those
	 * modules. If not, it should return an empty list.
	 *
	 * <p>This method should only return the direct children.
	 * To obtain the full module tree, this method may be
	 * recursively called on the children.</p>
	 *
	 * @param module org.eclipse.wst.server.core.model.IModule
	 * @return java.util.List
	 */
	public List getChildModules(IModule module);

	/**
	 * Returns the parent module(s) of this module. When
	 * determining if a given project can run on a server
	 * configuration, this method will be used to find the
	 * actual module(s) that may be run on the server. For
	 * instance, a Web module may return a list of Ear
	 * modules that it is contained in if the server only
	 * supports configuring Ear modules.
	 *
	 * <p>If the module type is not supported, this method
	 * may return null. If the type is normally supported but there
	 * is a configuration problem or missing parent, etc., this
	 * method may fire a CoreException that may then be presented
	 * to the user.</p>
	 *
	 * <p>If it does return valid parent(s), this method should
	 * always return the topmost parent module(s), even if
	 * there are a few levels (a heirarchy) of modules.</p>
	 *
	 * @param module org.eclipse.wst.server.core.model.IModule
	 * @return java.util.List
	 * @throws org.eclipse.core.runtime.CoreException
	 */
	public List getParentModules(IModule module) throws CoreException;
	
	public void setLaunchDefaults(ILaunchConfigurationWorkingCopy workingCopy);
}

Back to the top