blob: faa87898a0989a3eae9838db19237b6d37d58472 (
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
|
/***************************************************************************************************
* Copyright (c) 2005 Eteration A.S. and Gorkem Ercan. All rights reserved. This program and the
* accompanying materials are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors: Gorkem Ercan - initial API and implementation
*
**************************************************************************************************/
package org.eclipse.jst.server.generic.core.internal;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.wst.server.core.IModule;
import org.eclipse.wst.server.core.IModuleArtifact;
import org.eclipse.wst.server.core.IServer;
/**
* The abstract publisher. This is intended to be subclassed by
* clients implementing the genericpublisher extension point.
*
* @author Gorkem Ercan
*/
public abstract class GenericPublisher
{
private IModule[] fModule;
private GenericServerRuntime fServerRuntime;
private GenericServer fServer;
private int fKind;
private int fDeltaKind;
/**
* Intizilazes publisher.
*
* @param module
* @param server
*/
protected void initialize( IModule[] module, IServer server, int kind, int deltaKind )
{
fModule = module;
fServer = (GenericServer)server.loadAdapter(GenericServer.class,null);
fServerRuntime = (GenericServerRuntime)server.getRuntime().loadAdapter(GenericServerRuntime.class,null);
fKind = kind;
fDeltaKind = deltaKind;
}
/**
* Initializes publisher.
* @deprecated
* @param module
* @param server
*/
protected void initialize(IModule[] module, IServer server)
{
fModule = module;
fServer = (GenericServer)server.loadAdapter(GenericServer.class,null);
fServerRuntime = (GenericServerRuntime)server.getRuntime().loadAdapter(GenericServerRuntime.class,null);
}
/**
* Called by the generic server implementation when a module is
* removed form the server instance.
* Subclasses may extend this method to perform their own module removal
*
* @param monitor
* @return status
*/
public abstract IStatus[] unpublish(IProgressMonitor monitor);
/**
* Called by the generic server implementation when a publish module
* event occurs.
* Subclasses may extend this method to perform their own publishing
*
* @param resource
* @param monitor
* @return status
*/
public abstract IStatus[] publish(IModuleArtifact[] resource,
IProgressMonitor monitor);
/**
* Returns the module associated with this publisher instance
* @return module
*/
protected IModule[] getModule() {
return fModule;
}
/**
* Generic server instance
* @return server
*/
protected GenericServer getServer(){
return fServer;
}
/**
* a handle to server definition.
* @return serverdef
*/
protected GenericServerRuntime getServerRuntime() {
return fServerRuntime;
}
protected int getDeltaKind() {
return fDeltaKind;
}
protected int getKind() {
return fKind;
}
}
|