|
Lines 42-48
import org.springframework.util.ObjectUtils;
Link Here
|
| 42 |
import java.io.UnsupportedEncodingException; |
42 |
import java.io.UnsupportedEncodingException; |
| 43 |
import java.net.URL; |
43 |
import java.net.URL; |
| 44 |
import java.net.URLDecoder; |
44 |
import java.net.URLDecoder; |
| 45 |
import java.util.*; |
45 |
import java.util.ArrayList; |
|
|
46 |
import java.util.Collections; |
| 47 |
import java.util.Enumeration; |
| 48 |
import java.util.List; |
| 49 |
import java.util.Properties; |
| 50 |
import java.util.Timer; |
| 46 |
|
51 |
|
| 47 |
/** |
52 |
/** |
| 48 |
* Configuration class for the extender. Takes care of locating the extender specific configurations and merging the |
53 |
* Configuration class for the extender. Takes care of locating the extender specific configurations and merging the |
|
Lines 67-72
public class ExtenderConfiguration implements BundleActivator {
Link Here
|
| 67 |
|
72 |
|
| 68 |
private static final String PROPERTIES_NAME = "extenderProperties"; |
73 |
private static final String PROPERTIES_NAME = "extenderProperties"; |
| 69 |
|
74 |
|
|
|
75 |
private static final String SHUTDOWN_ASYNCHRONOUS_KEY = "shutdown.asynchronously"; |
| 76 |
|
| 70 |
private static final String SHUTDOWN_WAIT_KEY = "shutdown.wait.time"; |
77 |
private static final String SHUTDOWN_WAIT_KEY = "shutdown.wait.time"; |
| 71 |
|
78 |
|
| 72 |
private static final String PROCESS_ANNOTATIONS_KEY = "process.annotations"; |
79 |
private static final String PROCESS_ANNOTATIONS_KEY = "process.annotations"; |
|
Lines 91-97
public class ExtenderConfiguration implements BundleActivator {
Link Here
|
| 91 |
// default dependency wait time (in milliseconds) |
98 |
// default dependency wait time (in milliseconds) |
| 92 |
private static final long DEFAULT_DEP_WAIT = ConfigUtils.DIRECTIVE_TIMEOUT_DEFAULT * 1000; |
99 |
private static final long DEFAULT_DEP_WAIT = ConfigUtils.DIRECTIVE_TIMEOUT_DEFAULT * 1000; |
| 93 |
private static final boolean DEFAULT_NS_BUNDLE_STATE = true; |
100 |
private static final boolean DEFAULT_NS_BUNDLE_STATE = true; |
| 94 |
private static final long DEFAULT_SHUTDOWN_WAIT = 10 * 1000; |
101 |
private static final boolean DEFAULT_SHUTDOWN_ASYNCHRONOUS = true; |
|
|
102 |
private static final long DEFAULT_SHUTDOWN_WAIT = 10 * 1000; |
| 103 |
|
| 95 |
private static final boolean DEFAULT_PROCESS_ANNOTATION = false; |
104 |
private static final boolean DEFAULT_PROCESS_ANNOTATION = false; |
| 96 |
|
105 |
|
| 97 |
private ConfigurableOsgiBundleApplicationContext extenderConfiguration; |
106 |
private ConfigurableOsgiBundleApplicationContext extenderConfiguration; |
|
Lines 106-111
public class ExtenderConfiguration implements BundleActivator {
Link Here
|
| 106 |
|
115 |
|
| 107 |
private long shutdownWaitTime, dependencyWaitTime; |
116 |
private long shutdownWaitTime, dependencyWaitTime; |
| 108 |
|
117 |
|
|
|
118 |
private boolean shutdownAsynchronously; |
| 119 |
|
| 109 |
private boolean processAnnotation, nsBundledResolved; |
120 |
private boolean processAnnotation, nsBundledResolved; |
| 110 |
|
121 |
|
| 111 |
private OsgiBundleApplicationContextEventMulticaster eventMulticaster; |
122 |
private OsgiBundleApplicationContextEventMulticaster eventMulticaster; |
|
Lines 128-134
public class ExtenderConfiguration implements BundleActivator {
Link Here
|
| 128 |
// fields reading/writing lock |
139 |
// fields reading/writing lock |
| 129 |
private final Object lock = new Object(); |
140 |
private final Object lock = new Object(); |
| 130 |
|
141 |
|
| 131 |
/** |
142 |
/** |
| 132 |
* Constructs a new <code>ExtenderConfiguration</code> instance. Locates the extender configuration, creates an |
143 |
* Constructs a new <code>ExtenderConfiguration</code> instance. Locates the extender configuration, creates an |
| 133 |
* application context which will returned the extender items. |
144 |
* application context which will returned the extender items. |
| 134 |
* |
145 |
* |
|
Lines 209-215
public class ExtenderConfiguration implements BundleActivator {
Link Here
|
| 209 |
|
220 |
|
| 210 |
synchronized (lock) { |
221 |
synchronized (lock) { |
| 211 |
shutdownWaitTime = getShutdownWaitTime(properties); |
222 |
shutdownWaitTime = getShutdownWaitTime(properties); |
| 212 |
dependencyWaitTime = getDependencyWaitTime(properties); |
223 |
shutdownAsynchronously = getShutdownAsynchronously(properties); |
|
|
224 |
dependencyWaitTime = getDependencyWaitTime(properties); |
| 213 |
processAnnotation = getProcessAnnotations(properties); |
225 |
processAnnotation = getProcessAnnotations(properties); |
| 214 |
} |
226 |
} |
| 215 |
|
227 |
|
|
Lines 302-307
public class ExtenderConfiguration implements BundleActivator {
Link Here
|
| 302 |
private Properties createDefaultProperties() { |
314 |
private Properties createDefaultProperties() { |
| 303 |
Properties properties = new Properties(); |
315 |
Properties properties = new Properties(); |
| 304 |
properties.setProperty(SHUTDOWN_WAIT_KEY, "" + DEFAULT_SHUTDOWN_WAIT); |
316 |
properties.setProperty(SHUTDOWN_WAIT_KEY, "" + DEFAULT_SHUTDOWN_WAIT); |
|
|
317 |
properties.setProperty(SHUTDOWN_ASYNCHRONOUS_KEY, "" + DEFAULT_SHUTDOWN_ASYNCHRONOUS); |
| 305 |
properties.setProperty(PROCESS_ANNOTATIONS_KEY, "" + DEFAULT_PROCESS_ANNOTATION); |
318 |
properties.setProperty(PROCESS_ANNOTATIONS_KEY, "" + DEFAULT_PROCESS_ANNOTATION); |
| 306 |
properties.setProperty(WAIT_FOR_DEPS_TIMEOUT_KEY, "" + DEFAULT_DEP_WAIT); |
319 |
properties.setProperty(WAIT_FOR_DEPS_TIMEOUT_KEY, "" + DEFAULT_DEP_WAIT); |
| 307 |
|
320 |
|
|
Lines 388-393
public class ExtenderConfiguration implements BundleActivator {
Link Here
|
| 388 |
return Long.parseLong(properties.getProperty(SHUTDOWN_WAIT_KEY)); |
401 |
return Long.parseLong(properties.getProperty(SHUTDOWN_WAIT_KEY)); |
| 389 |
} |
402 |
} |
| 390 |
|
403 |
|
|
|
404 |
private boolean getShutdownAsynchronously(Properties properties) { |
| 405 |
return Boolean.valueOf(properties.getProperty(SHUTDOWN_ASYNCHRONOUS_KEY)); |
| 406 |
} |
| 407 |
|
| 391 |
private long getDependencyWaitTime(Properties properties) { |
408 |
private long getDependencyWaitTime(Properties properties) { |
| 392 |
return Long.parseLong(properties.getProperty(WAIT_FOR_DEPS_TIMEOUT_KEY)); |
409 |
return Long.parseLong(properties.getProperty(WAIT_FOR_DEPS_TIMEOUT_KEY)); |
| 393 |
} |
410 |
} |
|
Lines 452-457
public class ExtenderConfiguration implements BundleActivator {
Link Here
|
| 452 |
} |
469 |
} |
| 453 |
} |
470 |
} |
| 454 |
|
471 |
|
|
|
472 |
/** |
| 473 |
* @return whether the application context shutdown during the bundle stop phase shall be |
| 474 |
* performed asynchronously. |
| 475 |
*/ |
| 476 |
public boolean shouldShutdownAsynchronously() { |
| 477 |
synchronized (lock) { |
| 478 |
return this.shutdownAsynchronously; |
| 479 |
} |
| 480 |
} |
| 481 |
|
| 455 |
/** |
482 |
/** |
| 456 |
* Returns the dependencyWaitTime. |
483 |
* Returns the dependencyWaitTime. |
| 457 |
* |
484 |
* |