blob: 07fffc2582ac40665aadb1f7b0b5036b61e453e7 (
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
|
/*******************************************************************************
* Copyright (c) 2013 Composent, Inc. and others. 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:
* Composent, Inc. - initial API and implementation
******************************************************************************/
package org.eclipse.ecf.server.generic.app;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.equinox.app.IApplication;
import org.eclipse.equinox.app.IApplicationContext;
/**
* @since 6.0
*/
public class SSLGenericServerApplication extends AbstractSSLGenericServerApplication implements IApplication {
protected final Object appLock = new Object();
protected boolean done = false;
public Object start(IApplicationContext context) throws Exception {
String[] args = getArguments(context);
processArguments(args);
initialize();
if (configURL != null)
System.out.println("SSL Generic server started with config from " + configURL); //$NON-NLS-1$
else
System.out.println("SSL Generic server started with id=" + serverName); //$NON-NLS-1$
waitForDone();
return IApplication.EXIT_OK;
}
public void stop() {
shutdown();
synchronized (appLock) {
done = true;
appLock.notifyAll();
}
}
protected void waitForDone() {
// then just wait here
synchronized (appLock) {
while (!done) {
try {
appLock.wait();
} catch (InterruptedException e) {
// do nothing
}
}
}
}
protected String[] getArguments(IApplicationContext context) {
String[] originalArgs = (String[]) context.getArguments().get("application.args"); //$NON-NLS-1$
if (originalArgs == null)
return new String[0];
final List l = new ArrayList();
for (int i = 0; i < originalArgs.length; i++)
if (!originalArgs[i].equals("-pdelaunch")) //$NON-NLS-1$
l.add(originalArgs[i]);
return (String[]) l.toArray(new String[] {});
}
}
|