blob: debf78496db3b8be1b77b9071f5d1d13ec8703b4 (
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
|
/*******************************************************************************
* Copyright (c) 2015 IBM Corporation 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:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.osgi.tests.container.dummys;
import java.io.File;
import java.util.Map;
import org.eclipse.osgi.service.debug.DebugOptions;
import org.eclipse.osgi.service.debug.DebugTrace;
public class DummyDebugOptions implements DebugOptions {
private final Map<String, String> options;
public DummyDebugOptions(Map<String, String> options) {
this.options = options;
}
@Override
public boolean getBooleanOption(String option, boolean defaultValue) {
String value = options.get(option);
return value == null ? defaultValue : Boolean.parseBoolean(value);
}
@Override
public String getOption(String option) {
return options.get(option);
}
@Override
public String getOption(String option, String defaultValue) {
String value = options.get(option);
return value == null ? defaultValue : value;
}
@Override
public int getIntegerOption(String option, int defaultValue) {
String value = options.get(option);
try {
return Integer.parseInt(value);
} catch (NumberFormatException e) {
return defaultValue;
}
}
@Override
public Map<String, String> getOptions() {
return options;
}
@Override
public void setOption(String option, String value) {
options.put(option, value);
}
@Override
public void setOptions(Map<String, String> options) {
this.options.clear();
this.options.putAll(options);
}
@Override
public void removeOption(String option) {
this.options.remove(option);
}
@Override
public boolean isDebugEnabled() {
return true;
}
@Override
public void setDebugEnabled(boolean value) {
// nothing
}
@Override
public void setFile(File newFile) {
// nothing
}
@Override
public File getFile() {
// nothing
return null;
}
@Override
public DebugTrace newDebugTrace(String bundleSymbolicName) {
// nothing
return null;
}
@Override
public DebugTrace newDebugTrace(String bundleSymbolicName, Class<?> traceEntryClass) {
// nothing
return null;
}
}
|