1
|
/*
|
2
|
* ========================================================================
|
3
|
* Based on Jetty 6 code from Mort Bay Consulting Pty. Ltd.
|
4
|
* Modified for CDM Server by Andreas Kohlbecker. 2010-10-24
|
5
|
* ========================================================================
|
6
|
* Copyright 2004-2008 Mort Bay Consulting Pty. Ltd.
|
7
|
* ------------------------------------------------------------------------
|
8
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
9
|
* you may not use this file except in compliance with the License.
|
10
|
* You may obtain a copy of the License at
|
11
|
* http://www.apache.org/licenses/LICENSE-2.0
|
12
|
* Unless required by applicable law or agreed to in writing, software
|
13
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
* See the License for the specific language governing permissions and
|
16
|
* limitations under the License.
|
17
|
* ========================================================================
|
18
|
*/
|
19
|
|
20
|
package eu.etaxonomy.cdm.server.win32service;
|
21
|
|
22
|
import org.apache.log4j.Logger;
|
23
|
import org.eclipse.jetty.server.Server;
|
24
|
import org.eclipse.jetty.util.component.AbstractLifeCycle;
|
25
|
|
26
|
|
27
|
/**
|
28
|
* @author a.kohlbecker
|
29
|
* @date 26.10.2010
|
30
|
*
|
31
|
*/
|
32
|
public class Win32Service extends AbstractLifeCycle implements Runnable
|
33
|
{
|
34
|
public static final Logger logger = Logger.getLogger(Win32Service.class);
|
35
|
|
36
|
private Server server;
|
37
|
|
38
|
public void doStart()
|
39
|
{
|
40
|
logger.info("doStart");
|
41
|
CDMServerWrapperListener.setServer(server);
|
42
|
}
|
43
|
|
44
|
public void doStop()
|
45
|
{
|
46
|
logger.info("Listener is stopping CDM Server Instance!!!");
|
47
|
}
|
48
|
|
49
|
public void run()
|
50
|
{
|
51
|
doStop();
|
52
|
|
53
|
}
|
54
|
|
55
|
public void stopServer()
|
56
|
{
|
57
|
try
|
58
|
{
|
59
|
logger.info("Thread Test Stopper!!!");
|
60
|
server.stop();
|
61
|
//WrapperManager.stop(0);
|
62
|
}
|
63
|
catch (Exception e)
|
64
|
{
|
65
|
e.printStackTrace();
|
66
|
}
|
67
|
}
|
68
|
|
69
|
|
70
|
public Server getServer()
|
71
|
{
|
72
|
return server;
|
73
|
}
|
74
|
|
75
|
public void setServer(Server server)
|
76
|
{
|
77
|
this.server = server;
|
78
|
}
|
79
|
|
80
|
|
81
|
|
82
|
|
83
|
|
84
|
|
85
|
|
86
|
}
|